-
Notifications
You must be signed in to change notification settings - Fork 21.6k
eth, eth/tracers: process beacon root before transactions #29402
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
Changes from 2 commits
599c461
c9c894c
43b91b3
e1637b3
f7e87d1
c3951c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -376,6 +376,14 @@ func (api *API) traceChain(start, end *types.Block, config *TraceConfig, closed | |
| failed = err | ||
| break | ||
| } | ||
|
|
||
| if beaconRoot := block.BeaconRoot(); beaconRoot != nil { | ||
| context := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil) | ||
| vmenv := vm.NewEVM(context, vm.TxContext{}, statedb, api.backend.ChainConfig(), vm.Config{}) | ||
|
|
||
| core.ProcessBeaconBlockRoot(*block.BeaconRoot(), vmenv, statedb) | ||
| } | ||
|
|
||
| // Clean out any pending release functions of trace state. Note this | ||
| // step must be done after constructing tracing state, because the | ||
| // tracing state of block next depends on the parent state and construction | ||
|
|
@@ -518,6 +526,13 @@ func (api *API) IntermediateRoots(ctx context.Context, hash common.Hash, config | |
| } | ||
| defer release() | ||
|
|
||
| if beaconRoot := block.BeaconRoot(); beaconRoot != nil { | ||
| context := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil) | ||
| vmenv := vm.NewEVM(context, vm.TxContext{}, statedb, api.backend.ChainConfig(), vm.Config{}) | ||
|
|
||
| core.ProcessBeaconBlockRoot(*block.BeaconRoot(), vmenv, statedb) | ||
| } | ||
|
|
||
| var ( | ||
| roots []common.Hash | ||
| signer = types.MakeSigner(api.backend.ChainConfig(), block.Number(), block.Time()) | ||
|
|
@@ -585,6 +600,13 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac | |
| } | ||
| defer release() | ||
|
|
||
| if beaconRoot := block.BeaconRoot(); beaconRoot != nil { | ||
| context := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil) | ||
| vmenv := vm.NewEVM(context, vm.TxContext{}, statedb, api.backend.ChainConfig(), vm.Config{}) | ||
|
|
||
| core.ProcessBeaconBlockRoot(*block.BeaconRoot(), vmenv, statedb) | ||
| } | ||
|
|
||
| // JS tracers have high overhead. In this case run a parallel | ||
| // process that generates states in one thread and traces txes | ||
| // in separate worker threads. | ||
|
|
@@ -728,6 +750,13 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block | |
| } | ||
| defer release() | ||
|
|
||
| if beaconRoot := block.BeaconRoot(); beaconRoot != nil { | ||
| context := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil) | ||
| vmenv := vm.NewEVM(context, vm.TxContext{}, statedb, api.backend.ChainConfig(), vm.Config{}) | ||
|
|
||
| core.ProcessBeaconBlockRoot(*block.BeaconRoot(), vmenv, statedb) | ||
| } | ||
|
|
||
|
||
| // Retrieve the tracing configurations, or use default values | ||
| var ( | ||
| logConfig logger.Config | ||
|
|
@@ -916,6 +945,16 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc | |
| } | ||
| defer release() | ||
|
|
||
| // Apply only when we have used StateAtBlock since `StateAtTransaction` already handles the beacon root | ||
| if config == nil || config.TxIndex == nil { | ||
| if beaconRoot := block.BeaconRoot(); beaconRoot != nil { | ||
| context := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil) | ||
| vmenv := vm.NewEVM(context, vm.TxContext{}, statedb, api.backend.ChainConfig(), vm.Config{}) | ||
|
|
||
| core.ProcessBeaconBlockRoot(*block.BeaconRoot(), vmenv, statedb) | ||
| } | ||
| } | ||
|
|
||
| vmctx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil) | ||
| // Apply the customization rules if required. | ||
| if config != nil { | ||
|
|
||
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.
blockis the parent block here. We should usenext.