web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

Implement tests for EIP-838 errors with local contract deployment

Open Muhammad-Altabba opened this issue 3 years ago • 3 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

Feature Request

As a follow-up to https://github.com/web3/web3.js/issues/4235 implements more tests (and replace the current one). Additionally, some cases need to be handled. According to: https://blog.soliditylang.org/2021/04/21/custom-errors/ there are special selectors: 0x82b42900 which is the ‘selector’ for Unauthorized() and 0x08c379a0 is the ‘selector’ of Error(string).

Use Cases

Deploying a smart contract locally enables better testing. And handling for Unauthorized() and Error(string) would be good as they are special selectors that the user would not need to provide the ABI for.

Implementation Ideas

No response

Feature Examples/References

No response

Are you willing to implement this feature?

  • [X] Yes

Muhammad-Altabba avatar Sep 27 '22 15:09 Muhammad-Altabba

0x82b42900/Unauthorized() is not a special selector. It's just an example of a user-defined error, it's shown in Example section in the article linked.

The two built in selectors are Error(string) and Panic(uint256) as defined in the docs.

frangio avatar Sep 27 '22 16:09 frangio

Thanks @frangio, Oh, sorry, I mixed things up in the description as I just wrot this fast to keep in mind the follow-up work. And this will be revisited thoroughly once I start with it... And I will update the description as well... Thanks again for your hint.

Muhammad-Altabba avatar Sep 27 '22 21:09 Muhammad-Altabba

For some reason, the following was not implemented:

Additionally, some cases need to be handled. According to: https://blog.soliditylang.org/2021/04/21/custom-errors/ there are special selectors: [UPDATED] 0x4e487b71 which is the ‘selector’ for Panic(uint256) and 0x08c379a0 is the ‘selector’ of Error(string).

Muhammad-Altabba avatar Jul 16 '24 12:07 Muhammad-Altabba