Skip to content

Conversation

abhi3700
Copy link
Contributor

@abhi3700 abhi3700 commented Jul 9, 2025

Motivation

When running the original example, it failed.

Then found this info from Telegram chat.

Due to recent changes introduced in EIP-7702, the default Anvil mnemonic is no longer suitable for signature-based testing. This causes issues when using Anvil accounts for EIP-712 or other signing workflows, as the ephemeral keys do not behave consistently.

Solution

Replaced the previous usage of Anvil::new().fork().try_spawn()? with a custom mnemonic-based Anvil instance. This ensures deterministic and reusable private keys for consistent behavior in signing and transaction testing.

Added inline documentation explaining the rationale, along with the command to generate such mnemonic-based forks via CLI.

PR Checklist

  • Added Documentation

EIP-7702 prevents use of default Anvil accounts for signing-related tests.
Replaced default '.fork().try_spawn()' with custom mnemonic-based fork
to ensure compatibility with signature workflows.
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.

sigh, yeah we need to do this now -.-

@github-project-automation github-project-automation bot moved this to Reviewed in Alloy Jul 9, 2025
@mattsse mattsse merged commit d44dfa3 into alloy-rs:main Jul 9, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this from Reviewed to Done in Alloy Jul 9, 2025
@zerosnacks
Copy link
Member

zerosnacks commented Jul 9, 2025

Rather than hardcode a mnemonic we should ideally just rely on a random one when running the example considering we always access it using the keys() already

If we publish a mnemonic Github bots will pick this up and will likely deploy forwarding contracts on these too

@abhi3700 abhi3700 deleted the fix/eip7702-anvil-mnemonic branch July 9, 2025 16:29
@abhi3700
Copy link
Contributor Author

abhi3700 commented Jul 9, 2025

Rather than hardcode a mnemonic we should ideally just rely on a random one when running the example considering we always access it using the keys() already

If we publish a mnemonic Github bots will pick this up and will likely deploy forwarding contracts on these too

Fixed in this PR: #230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants