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

chore(anvil): migrate cheatsmanager to alloy #6767

Merged
merged 4 commits into from
Jan 12, 2024

Conversation

Evalir
Copy link
Member

@Evalir Evalir commented Jan 11, 2024

Motivation

Part of #6715.

Solution

Migrates the cheats manager and pushes any conversions straight to the signing step, which will then be removed once signers are migrated. While it doesn't remove many conversions, it makes easier to remove them later with the new signers.

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.

smol nit

crates/anvil/core/src/eth/transaction/mod.rs Outdated Show resolved Hide resolved
@@ -790,7 +794,7 @@ impl TypedTransaction {
/// Returns true if the transaction was impersonated (using the impersonate Signature)
#[cfg(feature = "impersonated-tx")]
pub fn is_impersonated(&self) -> bool {
self.signature() == IMPERSONATED_SIGNATURE
to_alloy_signature(self.signature()) == IMPERSONATED_SIGNATURE
Copy link
Member

Choose a reason for hiding this comment

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

make self.signature() return an alloy signature imo, any reason why we cannot port the typed transaction fields to be alloy?

Copy link
Member Author

@Evalir Evalir Jan 12, 2024

Choose a reason for hiding this comment

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

thought about doing this, but migrating typedtransaction so early would make us migrate most of anvil in one go with a longer running pr—ideally we want to avoid this.

TypedTransaction, along with other base types are getting migrated on this PR: #6778

crates/anvil/src/eth/backend/mem/mod.rs Show resolved Hide resolved
@@ -1,7 +1,8 @@
//! Support for "cheat codes" / bypass functions

use alloy_primitives::Address;
use alloy_rpc_types::Signature;
Copy link
Member

Choose a reason for hiding this comment

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

@DaniPopes are we mixing types here? or should we pull signature into primitives?

Copy link
Member Author

Choose a reason for hiding this comment

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

We do have alloy_primitives::Signature! we'll pull it in once needed when we get into actually moving types that can recover their signer (TypedTransaction, e.g) here #6778. For now we can use this type, as right now we just need an equivalence check

Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

lgtm

@Evalir Evalir merged commit 78b22db into master Jan 12, 2024
19 checks passed
@Evalir Evalir deleted the evalir/migrate-cheatsmanager branch January 12, 2024 19:37
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