-
Notifications
You must be signed in to change notification settings - Fork 79
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
Write storage change in trace #213
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.
mind taking a look at this @klkvr ?
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.
After rebasing on main:
- gate it under a config option for this in
TraceWriterConfig
+ add helper method inTraceWriter
itself - update
fn assert_traces
to accept another bool and follow the implementation ofwrite_bytecodes
in it - update the output files with
SNAPSHOTS=overwrite cargo test
Hi everyone, just checking if there are any updates on this PR? |
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.
makes sense to me |
This PR writes the storage change in the trace. Example output when using cast run from [the PR](foundry-rs/foundry#9013): ``` ❯ cargo run --bin cast run 0xefc789b63631b255aeb6f97d948c9eac14bae4b7f021122fe24c7c6e4f34667f -r https://eth.llamarpc.com -q --decode-internal --with-state-changes Compiling: TransparentUpgradeableProxy 0x6bE457e04092B28865E0cBa84E3b2CFa0f871E67 Compiling: TransparentUpgradeableProxy 0x7a7f0b3c23C23a31cFcb0c44709be70d4D545c6e Compiling: TransparentUpgradeableProxy 0xD523794C879D9eC028960a231F866758e405bE34 Compiling: Pool 0xDEbbf61098642C7c06fAd1E116C1a00e50405D0d Traces: [247473] TransparentUpgradeableProxy::stake{value: 1949677189193480698}(1) ├─ [2232] TransparentUpgradeableProxy::_beforeFallback() │ ├─ [2150] ERC1967Upgrade::_getAdmin() │ │ └─ ← 0xD491302a6621128f4b5a6A49ce6657230732b0cb │ └─ ← ├─ [2196] ERC1967Proxy::_implementation() │ └─ ← 0xDEbbf61098642C7c06fAd1E116C1a00e50405D0d ├─ [240157] Pool::stake{value: 1949677189193480698}(1) [delegatecall] │ ├─ [213932] Pool::_stake(0x93386C72aa57082820Ad6Aa29998B820971a8d61, 1949677189193480698 [1.949e18]) │ │ ├─ [228681] TransparentUpgradeableProxy::deposit(0x93386C72aa57082820Ad6Aa29998B820971a8d61, 1949677189193480698 [1.949e18]) │ │ │ ├─ [2232] TransparentUpgradeableProxy::_beforeFallback() │ │ │ │ ├─ [2150] ERC1967Upgrade::_getAdmin() │ │ │ │ │ └─ ← 0xD491302a6621128f4b5a6A49ce6657230732b0cb │ │ │ │ └─ ← │ │ │ ├─ [2196] ERC1967Proxy::_implementation() │ │ │ │ └─ ← 0x1a5b89b2ef0028A059EAD7D9E648B533f87c8558 │ │ │ ├─ [221356] 0x1a5b89b2ef0028A059EAD7D9E648B533f87c8558::deposit(0x93386C72aa57082820Ad6Aa29998B820971a8d61, 1949677189193480698 [1.949e18]) [delegatecall] │ │ │ │ ├─ emit Update(: 1305166715630598691 [1.305e18], : 17341785000000000 [1.734e16], : 1926865000000000 [1.926e15]) │ │ │ │ ├─ [22215] TransparentUpgradeableProxy::reStake(17341785000000000 [1.734e16], 0) │ │ │ │ │ ├─ [2232] TransparentUpgradeableProxy::_beforeFallback() │ │ │ │ │ │ ├─ [2150] ERC1967Upgrade::_getAdmin() │ │ │ │ │ │ │ └─ ← 0xD491302a6621128f4b5a6A49ce6657230732b0cb │ │ │ │ │ │ └─ ← │ │ │ │ │ ├─ [2196] ERC1967Proxy::_implementation() │ │ │ │ │ │ └─ ← 0xbE3366a14D0c87094DEB6DFbA667299b4EaC489d │ │ │ │ │ ├─ [14896] 0xbE3366a14D0c87094DEB6DFbA667299b4EaC489d::reStake(17341785000000000 [1.734e16], 0) [delegatecall] │ │ │ │ │ │ ├─ [3266] TransparentUpgradeableProxy::restake{value: 17341785000000000}(0) │ │ │ │ │ │ │ ├─ [232] TransparentUpgradeableProxy::_beforeFallback() │ │ │ │ │ │ │ │ ├─ [150] ERC1967Upgrade::_getAdmin() │ │ │ │ │ │ │ │ │ └─ ← 0xD491302a6621128f4b5a6A49ce6657230732b0cb │ │ │ │ │ │ │ │ └─ ← │ │ │ │ │ │ │ ├─ [196] ERC1967Proxy::_implementation() │ │ │ │ │ │ │ │ └─ ← 0xDEbbf61098642C7c06fAd1E116C1a00e50405D0d │ │ │ │ │ │ │ ├─ [2450] Pool::restake{value: 17341785000000000}(0) [delegatecall] │ │ │ │ │ │ │ │ └─ ← [Stop] │ │ │ │ │ │ │ └─ ← [Return] │ │ │ │ │ │ └─ ← [Stop] │ │ │ │ │ └─ ← [Return] │ │ │ │ ├─ emit topic 0: 0xb0ec6c271a891e04f03d43bf454839acfbf574e269cb5599c1f70b9257cf9cd7 │ │ │ │ │ data: 0x000000000000000000000000000000000000000000000000003d9c42f6b23a00 │ │ │ │ ├─ emit topic 0: 0xc8724ec5e59eea00f3f35419c3139ead03ff07766e7e9cf00a62381692aac8c7 │ │ │ │ │ topic 1: 0x00000000000000000000000093386c72aa57082820ad6aa29998b820971a8d61 │ │ │ │ │ data: 0x0000000000000000000000000000000000000000000000001b0ea512e08f39fa │ │ │ │ ├─ storage write 0x7a7f0b3c23C23a31cFcb0c44709be70d4D545c6e [0x501d093c0316d001addb7dc8913312112ff29225e2343de5aed242436c83ecaf]: │ │ │ │ │ 0x0000000000000000000000000000000000000000000000000000000000000000 → 0x0000000000000000000000000000000000000000000000001b0ea512e08f39fa ... │ │ │ │ │ 0x0000000000000000000000000000000000000000000000000000000000000003 → 0x0000000000000000000000000000000000000000000000000000000000000004 │ │ │ │ ├─ storage write 0x7a7f0b3c23C23a31cFcb0c44709be70d4D545c6e [0xb4c87350b3618bf3b0453372aae234908cc3b6cf61d458f195edd9160dac1f7f]: │ │ │ │ │ 0x000000000000000000000000000000000000000000000000ce8cbfb644313c26 → 0x000000000000000000000000000000000000000000000000e9d9010c1b72b020 │ │ │ │ └─ ← [Return] 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 │ │ │ └─ ← [Return] 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 │ │ └─ ← │ ├─ emit StakeAdded(staker: 0x93386C72aa57082820Ad6Aa29998B820971a8d61, value: 1949677189193480698 [1.949e18], source: 1) │ └─ ← [Stop] └─ ← [Return] Transaction successfully executed. Gas used: 248777 ``` --------- Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
This PR writes the storage change in the trace. Example output when using cast run from the PR: