From cd9fdd788f58a38744c6e0c4e405919cd4a5227a Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Mon, 4 Mar 2024 10:27:49 +1000 Subject: [PATCH] Pass the original precompile to the override function. Will allow the override to optionally delegate some functions to the original precompile instead of having to fully replace it. --- core/vm/evm.go | 2 +- core/vm/interpreter.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/vm/evm.go b/core/vm/evm.go index 1ec4e2e5e4..20147d33ae 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -58,7 +58,7 @@ func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) { p, ok := precompiles[addr] // Restrict overrides to known precompiles if ok && evm.chainConfig.IsOptimism() && evm.Config.OptimismPrecompileOverrides != nil { - override, ok := evm.Config.OptimismPrecompileOverrides(evm.chainRules, addr) + override, ok := evm.Config.OptimismPrecompileOverrides(evm.chainRules, p, addr) if ok { return override, ok } diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 25d97e2a08..dc5d5fbecc 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -25,7 +25,7 @@ import ( ) // PrecompileOverrides is a function that can be used to override the default precompiled contracts -type PrecompileOverrides func(params.Rules, common.Address) (PrecompiledContract, bool) +type PrecompileOverrides func(params.Rules, PrecompiledContract, common.Address) (PrecompiledContract, bool) // Config are the configuration options for the Interpreter type Config struct {