5

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?

azavalla
  • 83
  • 5
  • Related: https://ethereum.stackexchange.com/questions/7602/how-does-the-evm-find-the-entry-of-a-called-function – eth Apr 20 '18 at 08:45

1 Answers1

5

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.

user19510
  • 27,999
  • 2
  • 30
  • 48