-
Notifications
You must be signed in to change notification settings - Fork 717
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
scripts: deployer of script contract is not msg.sender #1435
Comments
That would be rad, been struggling with this for months, I can't test scripts that deploy contracts which implement stuff like Ownable which uses |
I'm lacking some insights here. |
EOAs can't directly use CREATE2, although they can call a contract that does a CREATE2. When a CREATE2 is in a forge script, the transaction is actually a call to this create2 deployer contract. If one want to precompute the address of a new contract, this is the sender that must be used. Btw, there is a cheatcode for this On a side note, I think that this behaviour from forge script is a bit dangerous because it's unclear what happens under the hood. I find that using a cheatcode would be safer (like |
we're going to document this and make sure behavior is well explained |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (34d279a 2022-12-08T07:48:46.429075528Z)
What command(s) is the bug in?
forge script
Operating System
Linux
Describe the bug
The deployer of the Script contract is not
msg.sender
which means a user that usesmsg.sender
in the constructor will cause unexpected results. This bit me as I spent an hour trying to predict the Create2 address of my deployed contract (so I could store it in the script storage and check if it exists before I deploy).I would suggest that the deployer of the script contract should be influenced by the
--sender
flag unless doing so is infeasible/would break other workflows?The text was updated successfully, but these errors were encountered: