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

feat: use foundry-cheatcodes implementations #6131

Merged
merged 65 commits into from
Oct 31, 2023

Conversation

DaniPopes
Copy link
Member

@DaniPopes DaniPopes commented Oct 26, 2023

Motivation

Unblocks all other cheatcode PRs.

Follow-up to #5998, #6128.

This PR deprecates foundry-abi, which will require another follow up to remove completely since it's still used for some trace and log decoding.

Solution

Replace old Ethers cheatcodes with new Alloy cheatcodes.

Breaking changes

  • parse* and env*:
    • bool values are now parsed as strictly true|false instead of [tT]rue|[fF]alse
    • bytes32 values are not padded anymore when encountering less than 32 hex bytes, e.g. 0x0102 won't be padded to 0x0102000000000000000000000000000000000000000000000000000000000000 and instead fail parsing with "invalid string length"
    • Signed integers (not unsigned) don't fail parsing on non-prefixed hex anymore, e.g. ffff parses when it should fail because of missing 0x prefix. This is tracked here: [Bug] Signed::from_str should have the same behavior as Uint alloy-rs/core#387
  • Reverts are now always encoded using the custom error CheatcodeError(string), instead of either the default Solidity revert (Error(string)) or an arbitrary signature (CheatCodeError)
  • Error message strings in general have been changed to be more consistent and less confusing. This breaks tests that check for exact matches on cheatcode error messages, which is not recommended anyway because they may change at any moment.

@DaniPopes DaniPopes requested review from mattsse and Evalir October 26, 2023 21:29
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lfg!!!

one suggestion, otherwise lgtm, pending tests

crates/evm/core/src/backend/error.rs Show resolved Hide resolved
crates/evm/core/src/backend/fuzz.rs Show resolved Hide resolved
Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

This is so much better—I think once tests pass we're good to go!

@refcell
Copy link
Contributor

refcell commented Oct 31, 2023

🔥

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.

4 participants