-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: set script evm sender from all wallet signers #7538
base: master
Are you sure you want to change the base?
Conversation
This is something I was thinking of adding as well, however, this approach has a downside: with this change, users will be required to unlock wallets/keystores right after starting the script which might be annoying, especially for users who were using only |
Ah yes thanks for the comment! What about adding an |
@tchardin yeah, that could work, but would probably only change UX for users of hw-wallets |
tbh I don't really like the current state of script "sender". It's not really safe to use as for different script parameters it can have different values When no or multiple wallets are added it's set to default foundry sender. That way, script behavior might be dependent on the exact signer type used which is not great. What if we changed its semantics and resolved on the level of
That way, we don't change UX for scripts which weren't using |
Sounds good @klkvr, I adjusted the PR to reflect this logic which does feel nicer. The signers may be unlocked only when the runner is created as it must have the sender address by the time CALLER is resolved. |
that sounds good! |
self.evm_opts.sender = *address; | ||
} | ||
if signers.len() > 1 { | ||
eyre::bail!("multiple signers found, please provide a --sender address."); |
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.
cc @tchardin
Looks like requires some additional changes due to failing tests including:
- forge::cli script::can_broadcast_script_skipping_simulation
- forge::cli script::can_deploy_library_create2_different_sender
Motivation
forge script
sets the evm sender by loading the address from the private key. In the case where users are connecting other type of signers the sender is not set which breaks execution of some scripts. (Tested against OP stack deploy script)Solution
This solution checks that we've loaded a single address across ALL the signers and sets it in the script preprocess.