-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[pallet-revive] Execution tracer #9722
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
Merged
Merged
Changes from 77 commits
Commits
Show all changes
86 commits
Select commit
Hold shift + click to select a range
23feffa
Fix tracing collect
pgherveou b565491
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] 9237ec2
Update substrate/frame/revive/src/evm/tracing/prestate_tracing.rs
pgherveou babb6be
[pallet-revive] fix GAS_PRICE (#9679)
pgherveou 63903fb
add logger
pgherveou eea1a2b
wip
pgherveou 5a67cee
wip
pgherveou 52ad1e3
fix
pgherveou ebe0401
nit
pgherveou 1785e8e
fix
pgherveou a1f734f
fix
pgherveou a459aa6
wip
pgherveou c206d14
wip
pgherveou ccf3025
fixes
pgherveou 45d0c4c
fixes
pgherveou 3a8d20c
wip
pgherveou 15fa3a3
wip
pgherveou 4df7eae
wip
pgherveou 049c17d
fix
pgherveou 813e2f9
nit
pgherveou ab31e6f
fix
pgherveou b557153
wip
pgherveou 1a34ea6
wip
pgherveou cb9f79e
wip
pgherveou 7972e46
wip
pgherveou 8aca032
wip
pgherveou b766747
wip
pgherveou 88d93d2
wip
pgherveou 4356b6f
wip
pgherveou 77ae1d2
wip
pgherveou 9d85225
fixes
pgherveou dc62dd2
wip
pgherveou ff2884b
wip
pgherveou 1108f51
Merge branch 'pg/revm-refactor' into pg/structlogger
pgherveou c7c3819
wip
pgherveou 809c7f7
wip
pgherveou a507aa6
wip
pgherveou ed825fd
Merge branch 'pg/revm-refactor' into pg/structlogger-with-refactor
pgherveou 5f08ae8
fix tests
pgherveou b7726d3
Merge branch 'master' into pg/structlogger-with-refactor
pgherveou 57a5c60
fix
pgherveou cd96cd6
rm comment
pgherveou b2d8cee
Merge branch 'master' into pg/structlogger
pgherveou 45d876c
fixes
pgherveou e7febda
fix for evm-test-suite
pgherveou a950637
wip
pgherveou 3cdb2c4
wip
pgherveou ed70925
wip
pgherveou ab335f9
wip
pgherveou 1bc241c
wip
pgherveou 836421c
wip
pgherveou 18bfd5b
Merge branch 'master' into pg/structlogger
pgherveou 0b7972f
wip
pgherveou 53738e6
fix
pgherveou 82f5a85
wip
pgherveou bdeb769
simplify
pgherveou ea5401c
smaller diff
pgherveou 5ee255c
fix
pgherveou 4a26e0a
fix silly comments
pgherveou e02e167
Simplify
pgherveou 3506246
add doc
pgherveou 51bb523
tweak
pgherveou b1571d6
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] 3828cd0
Update from github-actions[bot] running command 'fmt'
github-actions[bot] 86f00cf
fix
pgherveou 0428a8a
fix PR doc
pgherveou 3f8c066
rm diff
pgherveou 8dbd983
fix
pgherveou 5193cc8
simplify
pgherveou e7a7895
fix
pgherveou e8c0107
fix
pgherveou 2730f59
increase limit in dev
pgherveou febe87d
Merge branch 'master' into pg/structlogger
pgherveou 2a19058
fix tests
pgherveou f5b27bf
Merge branch 'master' into pg/structlogger
pgherveou a775d15
Merge branch 'master' into pg/structlogger
pgherveou 02e8e79
update pr doc
pgherveou 231b7b3
Merge branch 'master' into pg/structlogger
pgherveou 4fe1445
add syscall details
pgherveou 68425ab
fixes
pgherveou c29362d
formatting
pgherveou 5e784ba
fixes
pgherveou 9060ba5
fix fmt
pgherveou 891b004
Merge branch 'master' into pg/structlogger
pgherveou 7da932c
update rpc test to fix CI?
pgherveou 9ecca66
fmt
pgherveou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| title: '[pallet-revive] opcode tracer' | ||
| doc: | ||
| - audience: Runtime Dev | ||
| description: | | ||
| This PR introduces a **Geth-compatible execution tracer** ([StructLogger](https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers#struct-opcode-logger)) for pallet-revive | ||
|
|
||
| The tracer can be used to capture both EVM opcode and PVM syscall. | ||
| It can be used with the same RPC endpoint as Geth StructLogger. | ||
|
|
||
|
|
||
| Since it can be quite resource intensive, It can only be queried from the node when the **DebugSettings** are enabled (This is turned on now by default in the dev-node) | ||
|
|
||
| Tested in https://github.com/paritytech/evm-test-suite/pull/138 | ||
|
|
||
|
|
||
| example: | ||
|
|
||
| ```sh | ||
| ❯ cast rpc debug_traceTransaction "<TX_HASH>" | jq | ||
|
|
||
| # or with options | ||
| # See list of options https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers#struct-opcode-logger | ||
|
|
||
| ❯ cast rpc debug_traceTransaction "<TX_HASH>", { "tracer": { "enableMemory": true } } | jq | ||
| ``` | ||
|
|
||
| The response includes additional fields compared to the original Geth debug RPC endpoints: | ||
|
|
||
| For the trace: | ||
| - `weight_consumed`: same as gas but expressed in Weight | ||
| - `base_call_weight`: the base cost of the transaction | ||
|
|
||
| For each step: | ||
| - `weight_cost`: same as gas_cost but expressed in Weight | ||
|
|
||
| For an EVM execution, the output will look like this | ||
|
|
||
| ```json | ||
| { | ||
| "gas": 4208049, | ||
| "weight_consumed": { "ref_time": 126241470000, "proof_size": 4208 }, | ||
| "base_call_weight": { "ref_time": 9000000000, "proof_size": 3000 }, | ||
| "failed": false, | ||
| "returnValue": "0x", | ||
| "structLogs": [ | ||
| { | ||
| "gas": 4109533, | ||
| "gasCost": 3, | ||
| "weight_cost": { "ref_time": 90000, "proof_size": 0 }, | ||
| "depth": 1, | ||
| "pc": 0, | ||
| "op": "PUSH1", | ||
| "stack": [] | ||
| }, | ||
| { | ||
| "gas": 4109530, | ||
| "gasCost": 3, | ||
| "weight_cost": { "ref_time": 90000, "proof_size": 0 }, | ||
| "depth": 1, | ||
| "pc": 2, | ||
| "op": "PUSH1", | ||
| "stack": [ | ||
| "0x80" | ||
| ] | ||
| }, | ||
| { | ||
| "gas": 4109527, | ||
| "gasCost": 3, | ||
| "weight_cost": { "ref_time": 90000, "proof_size": 0 }, | ||
| "depth": 1, | ||
| "pc": 4, | ||
| "op": "MSTORE", | ||
| "stack": [ | ||
| "0x80", | ||
| "0x40" | ||
| ] | ||
| }] | ||
| } | ||
| ``` | ||
|
|
||
| For a PVM execution the response will look like this | ||
|
|
||
| ```json | ||
| { | ||
| "gas": 97945, | ||
| "weight_consumed": { "ref_time": 2938350000, "proof_size": 97 }, | ||
| "base_call_weight": { "ref_time": 9000000000, "proof_size": 3000 }, | ||
| "failed": false, | ||
| "returnValue": "0x", | ||
| "structLogs": [ | ||
| { | ||
| "gas": 97108, | ||
| "gasCost": 131, | ||
| "weight_cost": { "ref_time": 3930000, "proof_size": 0 }, | ||
| "depth": 1, | ||
| "op": "call_data_size" | ||
| }, | ||
| { | ||
| "gas": 96977, | ||
| "gasCost": 20, | ||
| "weight_cost": { "ref_time": 600000, "proof_size": 0 }, | ||
| "depth": 1, | ||
| "op": "call_data_load" | ||
| }, | ||
| { | ||
| "gas": 96957, | ||
| "gasCost": 7, | ||
| "weight_cost": { "ref_time": 210000, "proof_size": 0 }, | ||
| "depth": 1, | ||
| "op": "value_transferred" | ||
| }] | ||
| } | ||
| ``` | ||
| crates: | ||
| - name: pallet-revive | ||
| bump: patch | ||
| - name: pallet-revive-eth-rpc | ||
| bump: patch | ||
| - name: pallet-revive-proc-macro | ||
| bump: patch | ||
| - name: revive-dev-runtime | ||
| bump: patch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.