mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-15 08:23:46 +00:00
rm OnKeccakPreimage
# Conflicts: # core/tracing/hooks.go
This commit is contained in:
parent
7190602bd2
commit
5c6fb316b7
5 changed files with 31 additions and 55 deletions
|
|
@ -116,9 +116,6 @@ type (
|
||||||
// FaultHook is invoked when an error occurs during the execution of an opcode.
|
// FaultHook is invoked when an error occurs during the execution of an opcode.
|
||||||
FaultHook = func(pc uint64, op OpCode, gas, cost uint64, scope OpContext, depth int, err error)
|
FaultHook = func(pc uint64, op OpCode, gas, cost uint64, scope OpContext, depth int, err error)
|
||||||
|
|
||||||
// KeccakPreimageHook is invoked on the KECCAK256 opcode to provide the preimage for the hash.
|
|
||||||
KeccakPreimageHook = func(hash common.Hash, data []byte)
|
|
||||||
|
|
||||||
// GasChangeHook is invoked when the gas changes.
|
// GasChangeHook is invoked when the gas changes.
|
||||||
GasChangeHook = func(old, new uint64, reason GasChangeReason)
|
GasChangeHook = func(old, new uint64, reason GasChangeReason)
|
||||||
|
|
||||||
|
|
@ -166,16 +163,13 @@ type (
|
||||||
|
|
||||||
type Hooks struct {
|
type Hooks struct {
|
||||||
// VM events
|
// VM events
|
||||||
OnTxStart TxStartHook
|
OnTxStart TxStartHook
|
||||||
OnTxEnd TxEndHook
|
OnTxEnd TxEndHook
|
||||||
OnStart StartHook
|
OnEnter EnterHook
|
||||||
OnEnd EndHook
|
OnExit ExitHook
|
||||||
OnEnter EnterHook
|
OnOpcode OpcodeHook
|
||||||
OnExit ExitHook
|
OnFault FaultHook
|
||||||
OnOpcode OpcodeHook
|
OnGasChange GasChangeHook
|
||||||
OnFault FaultHook
|
|
||||||
OnKeccakPreimage KeccakPreimageHook
|
|
||||||
OnGasChange GasChangeHook
|
|
||||||
// Chain events
|
// Chain events
|
||||||
OnBlockchainInit BlockchainInitHook
|
OnBlockchainInit BlockchainInitHook
|
||||||
OnBlockStart BlockStartHook
|
OnBlockStart BlockStartHook
|
||||||
|
|
|
||||||
|
|
@ -248,9 +248,6 @@ func opKeccak256(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) (
|
||||||
if evm.Config.EnablePreimageRecording {
|
if evm.Config.EnablePreimageRecording {
|
||||||
evm.StateDB.AddPreimage(interpreter.hasherBuf, data)
|
evm.StateDB.AddPreimage(interpreter.hasherBuf, data)
|
||||||
}
|
}
|
||||||
if interpreter.evm.Config.Tracer != nil && interpreter.evm.Config.Tracer.OnKeccakPreimage != nil {
|
|
||||||
interpreter.evm.Config.Tracer.OnKeccakPreimage(common.BytesToHash(interpreter.hasherBuf[:]), data)
|
|
||||||
}
|
|
||||||
size.SetBytes(interpreter.hasherBuf[:])
|
size.SetBytes(interpreter.hasherBuf[:])
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,19 +38,18 @@ func newNoopTracer(ctx *Context, _ json.RawMessage) (*Tracer, error) {
|
||||||
t := &NoopTracer{}
|
t := &NoopTracer{}
|
||||||
return &Tracer{
|
return &Tracer{
|
||||||
Hooks: &tracing.Hooks{
|
Hooks: &tracing.Hooks{
|
||||||
OnTxStart: t.OnTxStart,
|
OnTxStart: t.OnTxStart,
|
||||||
OnTxEnd: t.OnTxEnd,
|
OnTxEnd: t.OnTxEnd,
|
||||||
OnEnter: t.OnEnter,
|
OnEnter: t.OnEnter,
|
||||||
OnExit: t.OnExit,
|
OnExit: t.OnExit,
|
||||||
OnOpcode: t.OnOpcode,
|
OnOpcode: t.OnOpcode,
|
||||||
OnFault: t.OnFault,
|
OnFault: t.OnFault,
|
||||||
OnKeccakPreimage: t.OnKeccakPreimage,
|
OnGasChange: t.OnGasChange,
|
||||||
OnGasChange: t.OnGasChange,
|
OnBalanceChange: t.OnBalanceChange,
|
||||||
OnBalanceChange: t.OnBalanceChange,
|
OnNonceChange: t.OnNonceChange,
|
||||||
OnNonceChange: t.OnNonceChange,
|
OnCodeChange: t.OnCodeChange,
|
||||||
OnCodeChange: t.OnCodeChange,
|
OnStorageChange: t.OnStorageChange,
|
||||||
OnStorageChange: t.OnStorageChange,
|
OnLog: t.OnLog,
|
||||||
OnLog: t.OnLog,
|
|
||||||
},
|
},
|
||||||
GetResult: t.GetResult,
|
GetResult: t.GetResult,
|
||||||
Stop: t.Stop,
|
Stop: t.Stop,
|
||||||
|
|
@ -63,8 +62,6 @@ func (t *NoopTracer) OnOpcode(pc uint64, op tracing.OpCode, gas, cost uint64, sc
|
||||||
func (t *NoopTracer) OnFault(pc uint64, op tracing.OpCode, gas, cost uint64, _ tracing.OpContext, depth int, err error) {
|
func (t *NoopTracer) OnFault(pc uint64, op tracing.OpCode, gas, cost uint64, _ tracing.OpContext, depth int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *NoopTracer) OnKeccakPreimage(hash common.Hash, data []byte) {}
|
|
||||||
|
|
||||||
func (t *NoopTracer) OnGasChange(old, new uint64, reason tracing.GasChangeReason) {}
|
func (t *NoopTracer) OnGasChange(old, new uint64, reason tracing.GasChangeReason) {}
|
||||||
|
|
||||||
func (t *NoopTracer) OnEnter(depth int, typ tracing.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
|
func (t *NoopTracer) OnEnter(depth int, typ tracing.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ func newNoopTracer(_ json.RawMessage) (*tracing.Hooks, error) {
|
||||||
OnExit: t.OnExit,
|
OnExit: t.OnExit,
|
||||||
OnOpcode: t.OnOpcode,
|
OnOpcode: t.OnOpcode,
|
||||||
OnFault: t.OnFault,
|
OnFault: t.OnFault,
|
||||||
OnKeccakPreimage: t.OnKeccakPreimage,
|
|
||||||
OnGasChange: t.OnGasChange,
|
OnGasChange: t.OnGasChange,
|
||||||
OnBlockchainInit: t.OnBlockchainInit,
|
OnBlockchainInit: t.OnBlockchainInit,
|
||||||
OnBlockStart: t.OnBlockStart,
|
OnBlockStart: t.OnBlockStart,
|
||||||
|
|
@ -51,8 +50,6 @@ func (t *noop) OnOpcode(pc uint64, op tracing.OpCode, gas, cost uint64, scope tr
|
||||||
func (t *noop) OnFault(pc uint64, op tracing.OpCode, gas, cost uint64, _ tracing.OpContext, depth int, err error) {
|
func (t *noop) OnFault(pc uint64, op tracing.OpCode, gas, cost uint64, _ tracing.OpContext, depth int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *noop) OnKeccakPreimage(hash common.Hash, data []byte) {}
|
|
||||||
|
|
||||||
func (t *noop) OnEnter(depth int, typ tracing.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
|
func (t *noop) OnEnter(depth int, typ tracing.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,19 +59,18 @@ func newMuxTracer(ctx *directory.Context, cfg json.RawMessage) (*directory.Trace
|
||||||
t := &muxTracer{names: names, tracers: objects}
|
t := &muxTracer{names: names, tracers: objects}
|
||||||
return &directory.Tracer{
|
return &directory.Tracer{
|
||||||
Hooks: &tracing.Hooks{
|
Hooks: &tracing.Hooks{
|
||||||
OnTxStart: t.OnTxStart,
|
OnTxStart: t.OnTxStart,
|
||||||
OnTxEnd: t.OnTxEnd,
|
OnTxEnd: t.OnTxEnd,
|
||||||
OnEnter: t.OnEnter,
|
OnEnter: t.OnEnter,
|
||||||
OnExit: t.OnExit,
|
OnExit: t.OnExit,
|
||||||
OnOpcode: t.OnOpcode,
|
OnOpcode: t.OnOpcode,
|
||||||
OnFault: t.OnFault,
|
OnFault: t.OnFault,
|
||||||
OnKeccakPreimage: t.OnKeccakPreimage,
|
OnGasChange: t.OnGasChange,
|
||||||
OnGasChange: t.OnGasChange,
|
OnBalanceChange: t.OnBalanceChange,
|
||||||
OnBalanceChange: t.OnBalanceChange,
|
OnNonceChange: t.OnNonceChange,
|
||||||
OnNonceChange: t.OnNonceChange,
|
OnCodeChange: t.OnCodeChange,
|
||||||
OnCodeChange: t.OnCodeChange,
|
OnStorageChange: t.OnStorageChange,
|
||||||
OnStorageChange: t.OnStorageChange,
|
OnLog: t.OnLog,
|
||||||
OnLog: t.OnLog,
|
|
||||||
},
|
},
|
||||||
GetResult: t.GetResult,
|
GetResult: t.GetResult,
|
||||||
Stop: t.Stop,
|
Stop: t.Stop,
|
||||||
|
|
@ -94,14 +93,6 @@ func (t *muxTracer) OnFault(pc uint64, op tracing.OpCode, gas, cost uint64, scop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *muxTracer) OnKeccakPreimage(hash common.Hash, data []byte) {
|
|
||||||
for _, t := range t.tracers {
|
|
||||||
if t.OnKeccakPreimage != nil {
|
|
||||||
t.OnKeccakPreimage(hash, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *muxTracer) OnGasChange(old, new uint64, reason tracing.GasChangeReason) {
|
func (t *muxTracer) OnGasChange(old, new uint64, reason tracing.GasChangeReason) {
|
||||||
for _, t := range t.tracers {
|
for _, t := range t.tracers {
|
||||||
if t.OnGasChange != nil {
|
if t.OnGasChange != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue