-
Notifications
You must be signed in to change notification settings - Fork 337
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
debug_traceTransaction
RPC method support
#196
Conversation
# Conflicts: # Cargo.lock # Cargo.toml # node/rpc/Cargo.toml # node/standalone/Cargo.lock
# Conflicts: # Cargo.lock # Cargo.toml # node/rpc/Cargo.toml # node/rpc/src/lib.rs # node/standalone/Cargo.lock # runtime/Cargo.toml # runtime/src/lib.rs
Looks good so far. Do you plan to support higher level stepping (e.g. |
# Conflicts: # Cargo.lock # Cargo.toml # client/rpc-core/txpool/Cargo.toml # client/rpc/txpool/Cargo.toml # node/Cargo.toml # node/rpc/Cargo.toml # node/src/rpc.rs # node/src/service.rs # node/standalone/Cargo.lock # node/standalone/Cargo.toml # node/standalone/src/command.rs # node/standalone/src/service.rs # primitives/rpc/txpool/Cargo.toml # runtime/Cargo.toml # runtime/account/Cargo.toml # runtime/precompiles/Cargo.toml # runtime/precompiles/src/lib.rs # runtime/src/lib.rs
@notlesh As I mention to @nanocryk, and because I don't know the status of our frontier branch Solution is as simple as pinning the same Sadly is not part of any release yet, but should be sufficient to get going. |
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.
Here's some stuff that stood out to me when giving the code a look. I'm far from an expert on this work.
Thanks for taking some time to look at this! I pushed some corrections, please let me 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.
Looks good as far as I can tell. Thanks for the docs and addressing my thoughts.
This PR adds optional replaying and tracing capabilities for Ethereum transactions through
debug_traceTransaction
, and provides support for Blockscout tracer.The components included are:
pallet-evm
Runner extension.RPC
Single method is included in this PR -
debug_traceTransaction
. It accepts an Ethereum transaction hash and an optional tracer property. It can be enabled by running the node with--ethapi debug
.Originally in Geth, this property's value is evaluated as a Javascript expression in Go and used to format the tracing output. We don't support this and instead we use it to identify if Blockscout tracing is part of the request - a.k.a. instead evaluating the JS expression we execute a stepping routine that will provide an output that satisfies Blockscout's requirements.
Runtime API
Interfaces the RPC with the Runtime, sets the required intermediate state and calls the
Runner
extension for eithercreate
orcall
transactions.The intermediate state is calculated by applying all previous extrinsics - substrate or ethereum specific - that happened prior to the targeted transaction in that block, using the parent block as the initial state.
Runner extension
Additional methods to interface RPC requests with our executor wrapper.
EVM stack executor wrapper
Wraps an EVM's
StackExecutor
in a customHandlerT
implementor calledTraceExecutorWrapper
. It replaces the normalevm::runtime
opcode recursive execution with opcode stepping. This allows us to capture the state between each step's execution and format a response.Included in this PR there are two possible responses:
depth
,gas
,gasCost
,memory
,op
,pc
,stack
andstorage
properties:Is there something left for follow-up PRs?
What alternative implementations were considered?
execute_block
insteadapply_extrinsics
. The result is the same in both cases, I decided to go with the latter.What value does it bring to the blockchain users?
The ability of replaying transactions and tracing intermediate state enables detailed indexing of the network.
Checklist