Skip to content

feat: eliminate sender flag if account #10647

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zjesko
Copy link

@zjesko zjesko commented May 27, 2025

solves #10632

Primary Enhancement

Make --sender optional when --account is specified. Foundry should automatically derive the sender address from the account's private key.

Desired Usage

# Simple case - sender automatically derived from account
forge script script/Deploy.s.sol --rpc-url unichain --account deployer --broadcast

Implementation Logic

  1. When --account is provided without --sender:
  • Load the specified account from the keystore
  • Derive the address from the private key
  • Use that address as the sender for transactions
  • Set msg.sender appropriately in the script context
  1. When both --account and --sender are provided:
  • Validate that the sender address matches the account's derived address
  • Throw a clear error if there's a mismatch
  • This maintains backward compatibility for existing scripts
  1. When only --sender is provided (current behavior):
  • Continue to work as before for raw private key workflows
  • Maintain full backward compatibility

@zjesko
Copy link
Author

zjesko commented May 27, 2025

solves #10632

please have a look @zerosnacks @grandizzy @mattsse

@mshakeg
Copy link

mshakeg commented May 27, 2025

nice! lgtm

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

Successfully merging this pull request may close these issues.

2 participants