bug(cheatcodes
): Facing issues with startPrank(address msgSender, bool delegateCall)
setting msg.sender
for ALL subsequent delegatecalls at ANY depth
#9990
Labels
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge Version: 1.0.0-nightly
What version of Foundryup are you on?
No response
What command(s) is the bug in?
The
startPrank
cheatcodevm.startPrank(address msgSender, bool delegateCall)
Operating System
macOS (Apple Silicon)
Describe the bug
Description:
Hi, I recently encountered some unexpected behavior with
startPrank(address msgSender, bool delegateCall)
when delegateCall is set totrue
.The documentation states:
While this behavior matches my observations, I believe it shouldn't apply to all delegate calls at any depth. Shouldn't it instead apply only to top-level delegate calls? AFAICT, this is how prank currently works for regular calls.
I searched for existing issues but didn’t find one that directly addresses this. The closest I found is: #5521.
I'm keen to hear thoughts on whether this is intentional or should be adjusted. Thanks!
Steps To Reproduce:
Below is the code showing the delegateCall bug and then another test case proving
prank
only changesmsg.sender
for top level calls.Logs
testDelegatePrank
:Run the command:
forge test --match-test "testDelegatePrank" -vvv
Logs
testCallPrank
:Run the command:
forge test --match-test "testCallPrank" -vvv
The text was updated successfully, but these errors were encountered: