Behavior of ERC165Checker when less than 30k gas available
See original GitHub issueEIP-165 stipulate that supportsInterface
can use up to 30,000 gas.
But as you can see in openzeppelin implementation here, the call is executed without making sure 30,000 gas is indeed given to the call. Remember, the gas provided as part of the STATIC_CALL is just a maximum.
And because of EIP-150 behaviour, it is possible for supportsInterface
to get less gas than required for it to complete (and thus throw which is interpreted wrongly as non-implementation) while the rest of the transaction continue and complete.
I described the issue in more details here as the issue is also present in the example implementation described at EIP-165.
Various solution are presented here but the best option is EIP-1930 which also solve issue present in other use cases like meta-transactions.
Also find some test case regarding EIP-165 here
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (14 by maintainers)
…but the whole point of this is what happens when less than 30k are sent? And a post-check will not know how much was actually sent.
What is the intent behind this? What should a contract do if it has less than 30k gas available to make the call?
30k will be sent if they are available: the only way for the implementer to quit early is if the transaction doesn’t have enough gas, in which case the caller will revert with an out of gas error.