From fd37a18347fbd3bba0e33ee829d5a04faccfaecd Mon Sep 17 00:00:00 2001 From: xiyang <161114931+0xdoomxy@users.noreply.github.com> Date: Tue, 2 Apr 2024 10:40:38 +0800 Subject: [PATCH] Improve the application of EIP150 for create2 When EIP150 is enabled, gas constraints on sub contracts are only applied. This fix is to ensure consistency with create and to correctly interpret EIP150 --- core/vm/instructions.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 990bdbf925..3469d1c141 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -628,7 +628,9 @@ func opCreate2(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([] gas = scope.Contract.Gas ) // Apply EIP150 - gas -= gas / 64 + if interpreter.evm.chainRules.IsEIP150 { + gas -= gas / 64 + } scope.Contract.UseGas(gas, interpreter.evm.Config.Tracer, tracing.GasChangeCallContractCreation2) // reuse size int for stackvalue stackvalue := size