This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
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.
feature: contract revert trait #2182
feature: contract revert trait #2182
Changes from all commits
7b7711a
c322520
aad4db9
2cb8f33
e4d9271
0f41b5c
dba0267
03e8f1f
6654597
1fc4cd9
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.
Shouldn't this be below the
if let Ok
in the macro below? So that we only decode as string as a fallback vs prioritizing it?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.
This implementation has never been safe for users to access directly, as it does not include selector information, and ABI encoded types are incredibly ambiguous. It has always thrown bad false positives.
My belief is that strings will be more common than other error types, even for contracts that do not revert, so putting a string in the first attempt results in the fewest decode attempts
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.
is this only derived for enums?
because this clashes with
EthError
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, this trait is only for unifying multiple potential ethereum errors into 1 type. Basically this should be thought of as "the errors associated with a specific contract's ABI".
I thought about breaking out a super-trait that had the shared methods on it, and decided that it was too complex for users
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.
i also thought about modifying AbiDecode to include
decode_with_selector(selector: Selector, bytes: &[u8])
but didn't want to get into lower level changesThere 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.
you can also consult the docstring, btw