-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(cast): allow comma-separated values for overrides #11553
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also document this somehow in the docs because this is pretty useful to know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed with @grandizzy offline, the test is correctly testing the wrong case (should return 0x000...001
) and I also tested it locally using this
cast call --trace --from "0x89D5C0AF48e9C945F280E0450579DE8c4d92a718" \
"0x5EA1d9A6dDC3A0329378a327746D71A2019eC332" \
--data "0xe75235b8" \
--override-state-diff "0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:0x7817a5f88884c5cb3dfd88434e99bb216a32ad4560cf73fe0fbe518279f8163e:1,0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:4:1,0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8:0,0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:0xb104e0b93118902c651344349b610029d694cfdec91c589c91ebafbcd0289947:0" \
--rpc-url "https://eth.llamarpc.com"
and it doesn't parse it correctly, i.e. not all the state overrides are reflected.
af5ee0e
to
5e2438f
Compare
I updated the test, it didn't use |
5e2438f
to
355881d
Compare
355881d
to
f81ba53
Compare
need to call foundry/crates/cast/src/cmd/call.rs Lines 414 to 417 in bcca6c7
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, a good complex test for this is this:
- Checks if the Safe signer threshold is set to
1
(overrides the storage slot4
to1
, which is the storage slot for thethreshold
and callsgetThreshold()
(0xe75235b8
)):
cast call --trace --from "0x2066901073a33ba2500274704aB04763875cF210" \
"0x5EA1d9A6dDC3A0329378a327746D71A2019eC332" \
--data "0xe75235b8" \
--override-state-diff "0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:0xf0af0268363540b847b4c07f2f9a0401c607c1b11ebca511724a71755dfd4137:1,0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:4:1,0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8:0,0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:0xb104e0b93118902c651344349b610029d694cfdec91c589c91ebafbcd0289947:0" \
--rpc-url "https://eth.llamarpc.com"
and
- Checks if the Safe signer
0x2066901073a33ba2500274704aB04763875cF210
is an owner, i.e. should returntrue
(overrides/sets the specific mapping slot for theowners[signer_address] = address(0x1)
- can be calculate like$(cast keccak $(cast abi-encode "mappingOwnerSlot(address,uint256)" "$signer_address" "2"))
, and callsisOwner(address)
(0x2f54bf6e0000000000000000000000002066901073a33ba2500274704ab04763875cf210
)):
cast call --trace --from "0x2066901073a33ba2500274704aB04763875cF210" \
"0x5EA1d9A6dDC3A0329378a327746D71A2019eC332" \
--data "0x2f54bf6e0000000000000000000000002066901073a33ba2500274704ab04763875cf210" \
--override-state-diff "0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:0xf0af0268363540b847b4c07f2f9a0401c607c1b11ebca511724a71755dfd4137:1,0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:4:1,0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8:0,0x5EA1d9A6dDC3A0329378a327746D71A2019eC332:0xb104e0b93118902c651344349b610029d694cfdec91c589c91ebafbcd0289947:0" \
--rpc-url "https://eth.llamarpc.com"
bdd52d6
to
6af2935
Compare
* fix(cast): allow comma sepparated values for overrides * Fix multiple slots * Tests with traces
* fix(cast): allow comma sepparated values for overrides * Fix multiple slots * Tests with traces
Motivation
cast call
): multiple--override-state-diff
slots not correctly parsed #11551Solution
PR Checklist