Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
generate keccak256 mappings from sol errors #1522
generate keccak256 mappings from sol errors #1522
Changes from 6 commits
d641ad5
29c672b
0abef89
4a7b4ee
f1daff9
9b7088d
f9759d0
71a6625
13136f4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's probably gonna have different hash if address is replaced with specific value, did you also check the case? would it be still recognizable with this hash value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a suggestion, but how about making a yarn command taking hash and return decoded custom error using related library?
i found this kind of answer in stackoverflow
https://ethereum.stackexchange.com/a/153295
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regarding, hash correctness, i found the following piece:
In Solidity, the error signature is generated from its name and the types of its parameters. The parameter names are not included in the signature. This is similar to how function signatures are generated in Solidity.
The signature is then hashed using the Keccak256 algorithm to produce a 4-byte identifier. This identifier is what's used in the bytecode to represent the error.
so as long as the error definitions dont change the encoding/hash won't change. And if the error def changes, we can always generate updated hashes by running this script. Pls let me know if I misunderstood your point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awh I see, think I misunderstood how hashes were generated. thank you for the explanation.
still, it'd be nice to have if we can parse the data together if there's a parameter in the error 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes that'd be great! I'm currently testing out the library that you suggested,
ethers-decode-error
, from vrf-consumer script but I keep running into errors when I try to initialize the decoder (it's failing to parse the passed abi) or cannot parse the error if no abi is passed. Maybe we can take a quick look together on Monday :)