Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
if config.IsPrague(block.Number(), block.Time()) || config.IsVerkle(block.Number(), block.Time()) {
ProcessParentBlockHash(block.ParentHash(), evm)
}
if hooks := cfg.Tracer; hooks != nil && hooks.OnPreTxExecutionDone != nil {
hooks.OnPreTxExecutionDone()
}

// Iterate over and process the individual transactions
for i, tx := range block.Transactions() {
Expand Down Expand Up @@ -129,6 +132,10 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
p.chain.Engine().Finalize(p.chain, header, tracingStateDB, block.Body())

if hooks := cfg.Tracer; hooks != nil && hooks.OnBlockFinalization != nil {
hooks.OnBlockFinalization()
}

return &ProcessResult{
Receipts: receipts,
Requests: requests,
Expand Down
11 changes: 11 additions & 0 deletions core/tracing/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ type (
// beacon block root.
OnSystemCallEndHook = func()

// OnPreTxExecutionDoneHook is called immediately prior to executing the first
// transaction in the block.
OnPreTxExecutionDoneHook func()

// OnBlockFinalizationHook is called immediately after block rewards are applied
OnBlockFinalizationHook func()

/*
- State events -
*/
Expand Down Expand Up @@ -209,6 +216,10 @@ type Hooks struct {
OnSystemCallStart OnSystemCallStartHook
OnSystemCallStartV2 OnSystemCallStartHookV2
OnSystemCallEnd OnSystemCallEndHook

OnPreTxExecutionDone OnPreTxExecutionDoneHook
OnBlockFinalization OnBlockFinalizationHook

// State events
OnBalanceChange BalanceChangeHook
OnNonceChange NonceChangeHook
Expand Down
Loading