-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solidity 0.8.4 Custom Errors #2839
Comments
Hello @dmihal This is definitely on our roadmap! Since you are interested by this change, I have a few questions for you.
|
Thanks @Amxx!
|
We really want to do this but strictly want Truffle/Web3.js to support custom errors before we change to them. Otherwise, the change would be a downgrade in Dev Experience for that subset of users. 🙁 |
Casting my support for this as well. Custom errors are a game-changer for Solidity development. It would be fantastic if OpenZeppelin supported them! For reference, here are a couple of projects I built or contributed to that use 100% only custom errors:
We do, both in development and in production. In development, out frontend devs find it useful when there is a revert reason or custom error when something goes awry. In production, we filter the error we get from the JSON-RPC provider, and if it's not a bespoke error like the user not signing the tx, we display it in the frontend.
Ethers.js
100% custom errors. |
This might one of those nasty catch-22 situations. Truffle/ Web3.js might also be waiting after the most popular smart contract libraries (cough cough OpenZeppelin) to add support for custom errors before they do it. Should someone who knows the main contributors behind Truffle/ Web3.js tag them in this discussion? |
Web3.js is part of ChainSafe now, I'll tag @spacesailor24 & @GregTheGreek to see if they have any thoughts |
We're trying to get our TypeScript rewrite finished (we're just about there) and thus have put a feature freeze on 1.x until it's done. |
There's now an EIP (6093) for standard custom errors. |
Fixes OpenZeppelin#2839 Add feature custom error to ERC20 Testing is raising errors for multicall, ERC777 and ERC 4626 because I have not added the feature to them yet, and they are using ERC20 behavior. Wanted to make sure the design decisions I made for the feature and testing are OK so I can move forward to the other contracts - [ X ] Tests - [ ] Documentation - [ ] Changeset entry (run `npx changeset add`)
Fixed in #4261. |
Prettt cool. Will this be released in V4.x, or is it slated for V5? |
5.0 (see the Milestone), since it is a breaking change on the ABI of basically all contracts. |
Awesome change, will this be done for OpenZeppelin/openzeppelin-contracts-upgradeable? |
Solidity 0.8.4 introduced "custom errors", which are named errors that can be thrown similar to how events are emitted.
These bring many benefits: primarily the gas savings of not needing to embed revert strings in the bytecode, as well as the ability to include data in the error.
More details:
https://blog.soliditylang.org/2021/04/21/custom-errors/
I would love to see these errors added to OZ contracts.
The text was updated successfully, but these errors were encountered: