Skip to content
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

test: move decode_revert_reason to alloy and add tests #308

Merged

Conversation

alessandromazza98
Copy link
Contributor

Related to paradigmxyz/reth#4789

I moved decode_revert_reason function here and also add tests:

  1. first test is for properly decoding a solidity revert reason
  2. second one is properly decoding a random revert reason (should fit for vyper revert reasons)
  3. last one to test that too short reason fail since out.len() < Selector::len_bytes()

Actually the last test makes me wonder if it is ok to put that if sentence in the first line of the function as it could happen that a vyper revert reason is actually shorter than 4 bytes but still valid.

Let me know WDYT.

Also, before I can delete this function from Reth, this PR needs to be merged. Otherwise in Reth there are errors because decode_revert_reason does not have any definition.

crates/sol-types/src/types/error.rs Outdated Show resolved Hide resolved
crates/sol-types/src/types/error.rs Outdated Show resolved Hide resolved
@alessandromazza98
Copy link
Contributor Author

Sorry for lots of commits. I can squash them if it's needed. Should be ok now.

Copy link
Member

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, they get squashed on merge

@DaniPopes DaniPopes merged commit e79fe57 into alloy-rs:main Sep 26, 2023
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants