7

It should not be hard to find collision. There is only 4 294 967 296 possible signatures.

  • Here's a collision: contract a {int public gsf;int public tgeo;} it won't compile – William Entriken Jan 31 '18 at 1:51
6

The function signatures need to be unique only within a contract. The Solidity compiler will detect and prevent collisions if they are not unique in this case. If you have fewer than 2^16 functions in your contract, collisions are unlikely to happen by chance.

There was a Reddit thread about this recently, but it seems a bit contrived to me and not a problem in practice.

  • Having two identical function hash in the same contract means two functions with the same signature and that is impossible and compiler would detect it. – Nicolas Massart Aug 5 '17 at 20:35
1

If two functions have exact same signature in within your contract, the program will not run as during function call, the flow would be confused in which function it has to go. Function overloading is possible but the signature of each function should be unique within the contract. Different contracts can have same function signature. Refer this for function signatures.

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.