3

What happens if I craft an EVM binary such that the ABI sees two matching method IDs, and try to deploy the contract? Is it a valid transaction?

3

Function selectors are a Solidity concept. The code it emits basically does a switch statement and jumps to the right function.

If you have a collision of function selectors, the Solidity compiler raises an error. If you skip the Solidity compiler and write your own bytecode that makes use of function selectors, you'll just have to decide what to do yourself. (You can make the code do whatever you want.)

The rest of the system does not care about function selectors or how your contract behaves in those cases.

  • So method resolution is done by the contract code? Not the EMV? – azavalla Apr 19 '18 at 17:10
  • That's correct. – smarx Apr 19 '18 at 17:11

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.