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(evm/cheatcodes): Use alloy-signer, rm ethers-signers/ethers-core #6911

Merged
merged 5 commits into from
Jan 26, 2024

Conversation

Evalir
Copy link
Member

@Evalir Evalir commented Jan 26, 2024

Motivation

We were still using ethers for signers on cheatcodes.

Solution

Replaces ethers-signers with alloy signers, and removes the now unused ethers deps from cheatcodes.

This isolates signers on forge script/cast, in which we're still converting to ethers signers.

@Evalir Evalir marked this pull request as ready for review January 26, 2024 18:18
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.

pending @DaniPopes

Comment on lines +158 to +162
// The `ecrecover` precompile does not use EIP-155. No chain ID is needed.
let wallet = parse_wallet(private_key)?;

// The `ecrecover` precompile does not use EIP-155
let sig = wallet.sign_hash(digest.to_ethers())?;
let recovered = sig.recover(digest.to_ethers())?.to_alloy();
let sig = wallet.sign_hash_sync(*digest)?;
let recovered = sig.recover_address_from_prehash(digest)?;
Copy link
Member

Choose a reason for hiding this comment

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

so the previous impl also didn't require the chain id?

Copy link
Member Author

Choose a reason for hiding this comment

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

correct

Cargo.toml Outdated Show resolved Hide resolved
Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
"alloy-sol-types",
"base64 0.21.7",
"const-hex",
"ethers-core",
"ethers-signers",
Copy link
Member

Choose a reason for hiding this comment

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

very nice

Copy link
Member Author

Choose a reason for hiding this comment

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

simply lovely

@Evalir Evalir merged commit deb3116 into master Jan 26, 2024
20 checks passed
@Evalir Evalir deleted the evalir/use-alloy-signers-evm branch January 26, 2024 19:51
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.

3 participants