mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
core/tracing: extends tracing.Hooks with OnSystemCallStartV2
This commit is contained in:
parent
e3d61e6db0
commit
465577d823
2 changed files with 22 additions and 12 deletions
|
|
@ -221,7 +221,9 @@ func ApplyTransaction(config *params.ChainConfig, evm *vm.EVM, gp *GasPool, stat
|
||||||
// contract. This method is exported to be used in tests.
|
// contract. This method is exported to be used in tests.
|
||||||
func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb vm.StateDB) {
|
func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb vm.StateDB) {
|
||||||
if tracer := vmenv.Config.Tracer; tracer != nil {
|
if tracer := vmenv.Config.Tracer; tracer != nil {
|
||||||
if tracer.OnSystemCallStart != nil {
|
if tracer.OnSystemCallStartV2 != nil {
|
||||||
|
tracer.OnSystemCallStartV2(vmenv.GetVMContext())
|
||||||
|
} else if tracer.OnSystemCallStart != nil {
|
||||||
tracer.OnSystemCallStart()
|
tracer.OnSystemCallStart()
|
||||||
}
|
}
|
||||||
if tracer.OnSystemCallEnd != nil {
|
if tracer.OnSystemCallEnd != nil {
|
||||||
|
|
@ -247,7 +249,9 @@ func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb vm.St
|
||||||
// as per EIP-2935.
|
// as per EIP-2935.
|
||||||
func ProcessParentBlockHash(prevHash common.Hash, vmenv *vm.EVM, statedb vm.StateDB) {
|
func ProcessParentBlockHash(prevHash common.Hash, vmenv *vm.EVM, statedb vm.StateDB) {
|
||||||
if tracer := vmenv.Config.Tracer; tracer != nil {
|
if tracer := vmenv.Config.Tracer; tracer != nil {
|
||||||
if tracer.OnSystemCallStart != nil {
|
if tracer.OnSystemCallStartV2 != nil {
|
||||||
|
tracer.OnSystemCallStartV2(vmenv.GetVMContext())
|
||||||
|
} else if tracer.OnSystemCallStart != nil {
|
||||||
tracer.OnSystemCallStart()
|
tracer.OnSystemCallStart()
|
||||||
}
|
}
|
||||||
if tracer.OnSystemCallEnd != nil {
|
if tracer.OnSystemCallEnd != nil {
|
||||||
|
|
@ -283,14 +287,15 @@ func ProcessConsolidationQueue(vmenv *vm.EVM, statedb vm.StateDB) []byte {
|
||||||
|
|
||||||
func processRequestsSystemCall(vmenv *vm.EVM, statedb vm.StateDB, requestType byte, addr common.Address) []byte {
|
func processRequestsSystemCall(vmenv *vm.EVM, statedb vm.StateDB, requestType byte, addr common.Address) []byte {
|
||||||
if tracer := vmenv.Config.Tracer; tracer != nil {
|
if tracer := vmenv.Config.Tracer; tracer != nil {
|
||||||
if tracer.OnSystemCallStart != nil {
|
if tracer.OnSystemCallStartV2 != nil {
|
||||||
|
tracer.OnSystemCallStartV2(vmenv.GetVMContext())
|
||||||
|
} else if tracer.OnSystemCallStart != nil {
|
||||||
tracer.OnSystemCallStart()
|
tracer.OnSystemCallStart()
|
||||||
}
|
}
|
||||||
if tracer.OnSystemCallEnd != nil {
|
if tracer.OnSystemCallEnd != nil {
|
||||||
defer tracer.OnSystemCallEnd()
|
defer tracer.OnSystemCallEnd()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := &Message{
|
msg := &Message{
|
||||||
From: params.SystemAddress,
|
From: params.SystemAddress,
|
||||||
GasLimit: 30_000_000,
|
GasLimit: 30_000_000,
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,10 @@ type (
|
||||||
// will not be invoked.
|
// will not be invoked.
|
||||||
OnSystemCallStartHook = func()
|
OnSystemCallStartHook = func()
|
||||||
|
|
||||||
|
// OnSystemCallStartHookV2 is called when a system call is about to be executed. Refer
|
||||||
|
// to `OnSystemCallStartHook` for more information.
|
||||||
|
OnSystemCallStartHookV2 = 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
|
||||||
// beacon block root.
|
// beacon block root.
|
||||||
|
|
@ -180,14 +184,15 @@ type Hooks struct {
|
||||||
OnFault FaultHook
|
OnFault FaultHook
|
||||||
OnGasChange GasChangeHook
|
OnGasChange GasChangeHook
|
||||||
// Chain events
|
// Chain events
|
||||||
OnBlockchainInit BlockchainInitHook
|
OnBlockchainInit BlockchainInitHook
|
||||||
OnClose CloseHook
|
OnClose CloseHook
|
||||||
OnBlockStart BlockStartHook
|
OnBlockStart BlockStartHook
|
||||||
OnBlockEnd BlockEndHook
|
OnBlockEnd BlockEndHook
|
||||||
OnSkippedBlock SkippedBlockHook
|
OnSkippedBlock SkippedBlockHook
|
||||||
OnGenesisBlock GenesisBlockHook
|
OnGenesisBlock GenesisBlockHook
|
||||||
OnSystemCallStart OnSystemCallStartHook
|
OnSystemCallStart OnSystemCallStartHook
|
||||||
OnSystemCallEnd OnSystemCallEndHook
|
OnSystemCallStartV2 OnSystemCallStartHookV2
|
||||||
|
OnSystemCallEnd OnSystemCallEndHook
|
||||||
// State events
|
// State events
|
||||||
OnBalanceChange BalanceChangeHook
|
OnBalanceChange BalanceChangeHook
|
||||||
OnNonceChange NonceChangeHook
|
OnNonceChange NonceChangeHook
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue