Normally, If a smart contract is not affected by the Zerofunctionselector bug, then at the end of the code which makes jump to the target function lies a 0xfe opcode (which result in the smart contract execution to throw).

But if the opcode is not present, then, the first function in the opcode is executed even if it wasn’t declared payable.

How to get actual contract opcode from a deployed address ? How to map those opcodes to source code lines of the contract ?
And can the Zerofunctionselector bug results in private or constructor function to be executed ?


how to know which function is executed by default from source code?

You can find a good explanation here:

If a function has a selector consisting only of zeros, is payable and part of a contract that does not have a fallback function and at most five external functions in total, this function is called instead of the fallback function if Ether is sent to the contract without data.

  • ʏᴇꜱ I ᴋɴᴏᴡ. ʏᴏᴜ ᴅɪᴅ ɴᴏᴛ ᴜɴᴅᴇʀꜱᴛᴏᴏᴅ ᴍʏ ᴁᴜᴇꜱᴛɪᴏɴ : ᴡʜᴀᴛ I ᴡᴀɴᴛ ɪꜱ ᴛʜᴇ ꜰᴜɴᴄᴛɪᴏɴ ɴᴀᴍᴇ ᴀꜱ ᴡʀɪᴛᴛᴇɴ ɪɴ ᴛʜᴇ ꜱᴏᴜʀᴄᴇ ᴄᴏᴅᴇ ! THIS IS THE COMPILER WHICH DECIDE THIS. May 27 '18 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.