core/tracing: add vm context to system call hook

This commit is contained in:
Sina Mahmoodi 2024-08-26 15:45:56 +02:00
parent a223efcf39
commit 8659e68ad5
3 changed files with 4 additions and 4 deletions

View File

@ -183,7 +183,7 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb *state.StateDB) {
if tracer := vmenv.Config.Tracer; tracer != nil {
if tracer.OnSystemCallStart != nil {
tracer.OnSystemCallStart()
tracer.OnSystemCallStart(vmenv.GetVMContext())
}
if tracer.OnSystemCallEnd != nil {
defer tracer.OnSystemCallEnd()
@ -212,7 +212,7 @@ func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb *stat
func ProcessParentBlockHash(prevHash common.Hash, vmenv *vm.EVM, statedb *state.StateDB) {
if tracer := vmenv.Config.Tracer; tracer != nil {
if tracer.OnSystemCallStart != nil {
tracer.OnSystemCallStart()
tracer.OnSystemCallStart(vmenv.GetVMContext())
}
if tracer.OnSystemCallEnd != nil {
defer tracer.OnSystemCallEnd()

View File

@ -142,7 +142,7 @@ type (
//
// Note that system call happens outside normal transaction execution, so the `OnTxStart/OnTxEnd` hooks
// will not be invoked.
OnSystemCallStartHook = func()
OnSystemCallStartHook = func(vm *VMContext)
// OnSystemCallEndHook is called when a system call has finished executing. Today,
// this hook is invoked when the EIP-4788 system call is about to be executed to set the

View File

@ -127,7 +127,7 @@ func (l *jsonLogger) OnOpcode(pc uint64, op byte, gas, cost uint64, scope tracin
l.encoder.Encode(log)
}
func (l *jsonLogger) onSystemCallStart() {
func (l *jsonLogger) onSystemCallStart(_ *tracing.VMContext) {
// Process no events while in system call.
hooks := *l.hooks
*l.hooks = tracing.Hooks{