rm OnKeccakPreimage

This commit is contained in:
Sina Mahmoodi 2024-03-06 17:08:00 +01:00
parent 73595f0911
commit 1d0101969a
5 changed files with 31 additions and 53 deletions

View file

@ -108,9 +108,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)
@ -164,7 +161,6 @@ type Hooks struct {
OnExit ExitHook OnExit ExitHook
OnOpcode OpcodeHook OnOpcode OpcodeHook
OnFault FaultHook OnFault FaultHook
OnKeccakPreimage KeccakPreimageHook
OnGasChange GasChangeHook OnGasChange GasChangeHook
// Chain events // Chain events
OnBlockchainInit BlockchainInitHook OnBlockchainInit BlockchainInitHook

View file

@ -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
} }

View file

@ -44,7 +44,6 @@ func newNoopTracer(ctx *Context, _ json.RawMessage) (*Tracer, 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,
OnBalanceChange: t.OnBalanceChange, OnBalanceChange: t.OnBalanceChange,
OnNonceChange: t.OnNonceChange, OnNonceChange: t.OnNonceChange,
@ -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) {

View file

@ -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) {
} }

View file

@ -65,7 +65,6 @@ func newMuxTracer(ctx *directory.Context, cfg json.RawMessage) (*directory.Trace
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,
@ -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 {