-
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
bug(forge): msg.sender set using startPrank in another contract is wrong #5521
Comments
Right, this is actually not necessarily a bug, but rather a footgun—the msg.sender is being reset to
|
Fwiw, I found this when I used |
msg.sender
set using startPrank
in another contract is wrongstack
system so pranks can be restored at earlier call depths
Turning this into a feature request of adding a |
stack
system so pranks can be restored at earlier call depths
As discussed internally we're looking to make this consistent with starting a new prank at the same depth (that is to error that a prank is already started) |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (ca67d15 2023-08-01T22:03:12.511500000Z)
What command(s) is the bug in?
forge test
Operating System
macOS (Intel)
Describe the bug
msg.sender
set usingstartPrank
in another contract is wrongThe bug reported in #5515 was fixed in #5520 (thanks for the quick fix), but this is not a complete fix.
Using
startPrank
instead of the bannedprank
still has the bug.The following test
outputs
In
Contract::f()
,VM::startPrank(player: [0x44E97aF4418b7a17AABD8090bEA0A471a366305C])
is execute, but the nextmsg.sender
isContractTest
, notplayer
.Full source: https://github.com/minaminao/foundry-bug-reports/tree/main/2023-08-broken-prank-2
The text was updated successfully, but these errors were encountered: