-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(anvil): Anvil --unlocked
for auto-impersonation on instance creation
#5335
Conversation
anvil/src/cmd.rs
Outdated
|
||
/// Enable autoImpersonate on startup | ||
#[clap(long, short, visible_alias = "unlocked")] | ||
pub unlocked: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--unlocked already has a slightly different meaning in cast,
perhaps we rename this to --auto-impersonate
instead?
Question, would the call to the |
we can either call the rpc handler after creating the EthApi type: Lines 148 to 159 in c78a811
Lines 1382 to 1389 in c78a811
or directly on the backend foundry/anvil/src/eth/backend/mem/mod.rs Lines 318 to 322 in c78a811
these are actually infallible and I think we should remove the result, at least for the backend function so lets do:
|
Thanks! This was very helpful. I've tested this locally through |
--unlocked
for auto-impersonation on instance creation--unlocked
for auto-impersonation on instance creation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, one nit
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Motivation
It should be possible to auto-impersonate accounts upon the initial spawning of Anvil instances.
Solution
This PR introduces an
--auto-impersonate
flag which enables auto impersonation of accounts when the anvil instance is created. This helps avoid the need to usecurl
orcast rpc
to setanvil_autoImpersonateAccount
to true when the Anvil instance is spawned. Resolves #5334