Content
@
https://ethereum.org
0 reply
0 recast
0 reaction
Samuel ツ
@samuellhuber.eth
Does any Foundry Chad know why msg.sender sometimes is the DefaultSender and sometimes the default anvil address when not passing a private key or using cast wallet? Would have saved me 2 days to just use cast wallet for all transactions instead of figuring out the defaults when testing. Would love for that to be in the foundry docs and never see raw commands without --account or the default accounts private key as --private-key
2 replies
0 recast
11 reactions
Marissa
@marissaposner
forge script and cast have different defaults for who sends a transaction if you don’t explicitly specify a sender. If you don't set --private-key or use cast wallet, cast defaults to the first Anvil account, while forge script often uses a placeholder called DefaultSender unless you manually prank a sender. That mismatch can cause msg.sender to behave unexpectedly, especially in scripts.
1 reply
0 recast
1 reaction
Apex777
@apex777.eth
When testing just Prank as the default wallet when you have a msg.sender check. Your script can handle wallets. You don’t need to input them into the CLI.
1 reply
0 recast
0 reaction