-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
perf(evm): only store storage slot diffs and reconstruct full storage on request #3198
Conversation
a2f4a7a
to
fc40e25
Compare
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.
this looks great.
populating the storage
via geth_trace
is a great solution here.
this will make the it correct and will also mem consumption a lot
evm/src/executor/inspector/tracer.rs
Outdated
.last() | ||
.expect("not enough contract journal entries") | ||
.last() | ||
.expect("not enough call journal entries"); |
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.
this should always work since, revm initializes this with vec![vec![]] and has an entry at this point
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.
let's add as comment in the code?
/// Change of the contract state after step execution (effect of the SLOAD/SSTORE instructions) | ||
pub state_diff: Option<(U256, U256)>, |
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.
nice
a1ba35b
to
6e5a613
Compare
There are still some bugs in |
@mattsse not sure if it's fine to pin |
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.
it's OK to use the pinned revm and we can wait for new release np
evm/src/executor/inspector/tracer.rs
Outdated
.last() | ||
.expect("not enough contract journal entries") | ||
.last() | ||
.expect("not enough call journal entries"); |
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.
let's add as comment in the code?
ab9567d
to
6098f45
Compare
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.
awesome
agree, merging since this is already a big improvement |
… on request (foundry-rs#3198) * fix: breaking changes geth trace data * fix: only clone contract state * a bit more fixes n improvements * revertme: bump revm to git * track diffs, reconstruct the storage on request * add comments * omit gas refund if it's 0 (go has omitempty on this field) * add comment regarding gas cost calculation & fix storage emptiness * show storage in response only on SLOAD/SSTORE * reorganize Inspector impl for Tracer * improve unwrap comment Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Motivation
continued work on top of #3187
relevant piece of geth code: https://github.com/ethereum/go-ethereum/blob/366d2169fbc0e0f803b68c042b77b6b480836dbc/eth/tracers/logger/logger.go#L181-L206
Demo
Deposit WETH and debug this transaction
Check
SLOAD
instruction and storage slots associated with it (before, during, after)Check
SSTORE
instruction and storage slots associated with it (before, during, after)