core/tracing: add vm context to system call hook
This commit is contained in:
parent
a223efcf39
commit
8659e68ad5
|
@ -183,7 +183,7 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
|
||||||
func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb *state.StateDB) {
|
func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb *state.StateDB) {
|
||||||
if tracer := vmenv.Config.Tracer; tracer != nil {
|
if tracer := vmenv.Config.Tracer; tracer != nil {
|
||||||
if tracer.OnSystemCallStart != nil {
|
if tracer.OnSystemCallStart != nil {
|
||||||
tracer.OnSystemCallStart()
|
tracer.OnSystemCallStart(vmenv.GetVMContext())
|
||||||
}
|
}
|
||||||
if tracer.OnSystemCallEnd != nil {
|
if tracer.OnSystemCallEnd != nil {
|
||||||
defer tracer.OnSystemCallEnd()
|
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) {
|
func ProcessParentBlockHash(prevHash common.Hash, vmenv *vm.EVM, statedb *state.StateDB) {
|
||||||
if tracer := vmenv.Config.Tracer; tracer != nil {
|
if tracer := vmenv.Config.Tracer; tracer != nil {
|
||||||
if tracer.OnSystemCallStart != nil {
|
if tracer.OnSystemCallStart != nil {
|
||||||
tracer.OnSystemCallStart()
|
tracer.OnSystemCallStart(vmenv.GetVMContext())
|
||||||
}
|
}
|
||||||
if tracer.OnSystemCallEnd != nil {
|
if tracer.OnSystemCallEnd != nil {
|
||||||
defer tracer.OnSystemCallEnd()
|
defer tracer.OnSystemCallEnd()
|
||||||
|
|
|
@ -142,7 +142,7 @@ type (
|
||||||
//
|
//
|
||||||
// Note that system call happens outside normal transaction execution, so the `OnTxStart/OnTxEnd` hooks
|
// Note that system call happens outside normal transaction execution, so the `OnTxStart/OnTxEnd` hooks
|
||||||
// will not be invoked.
|
// will not be invoked.
|
||||||
OnSystemCallStartHook = func()
|
OnSystemCallStartHook = func(vm *VMContext)
|
||||||
|
|
||||||
// OnSystemCallEndHook is called when a system call has finished executing. Today,
|
// 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
|
// this hook is invoked when the EIP-4788 system call is about to be executed to set the
|
||||||
|
|
|
@ -127,7 +127,7 @@ func (l *jsonLogger) OnOpcode(pc uint64, op byte, gas, cost uint64, scope tracin
|
||||||
l.encoder.Encode(log)
|
l.encoder.Encode(log)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *jsonLogger) onSystemCallStart() {
|
func (l *jsonLogger) onSystemCallStart(_ *tracing.VMContext) {
|
||||||
// Process no events while in system call.
|
// Process no events while in system call.
|
||||||
hooks := *l.hooks
|
hooks := *l.hooks
|
||||||
*l.hooks = tracing.Hooks{
|
*l.hooks = tracing.Hooks{
|
||||||
|
|
Loading…
Reference in New Issue