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?
1 Answer
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?– azavallaCommented Apr 19, 2018 at 17:10
-