From 24349e5141200fc69ba67ba0aa7300b04661d3c7 Mon Sep 17 00:00:00 2001 From: Damian Orzechowski Date: Fri, 20 Mar 2026 11:03:33 +0100 Subject: [PATCH 1/8] Reinstate removed `IGasPolicy` methods and apply for eip-8037 --- .../GasPolicy/EthereumGasPolicy.cs | 17 +++++++++++++++-- .../Nethermind.Evm/GasPolicy/IGasPolicy.cs | 12 +++++++++++- .../Instructions/EvmInstructions.Call.cs | 6 +----- .../Instructions/EvmInstructions.ControlFlow.cs | 6 +----- .../Instructions/EvmInstructions.Storage.cs | 4 ++-- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs index 3bc803f9e729..7905608a491c 100644 --- a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs +++ b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs @@ -196,6 +196,12 @@ public static bool UpdateGas(ref EthereumGasPolicy gas, return true; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool ConsumeStorageWrite(ref EthereumGasPolicy gas, bool isSlotCreation, long cost, IReleaseSpec spec) + { + return UpdateGas(ref gas, cost); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void UpdateGasUp(ref EthereumGasPolicy gas, long refund) @@ -230,8 +236,15 @@ public static bool ConsumeCallValueTransfer(ref EthereumGasPolicy gas) => UpdateGas(ref gas, GasCostOf.CallValue); [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool ConsumeNewAccountCreation(ref EthereumGasPolicy gas) - => ConsumeStateGas(ref gas, GasCostOf.NewAccountState); + public static bool ConsumeNewAccountCreation(ref EthereumGasPolicy gas) where TEip8037 : struct, IFlag + { + return TEip8037.IsActive switch + { + true => ConsumeStateGas(ref gas, GasCostOf.NewAccountState), + false => UpdateGas(ref gas, GasCostOf.NewAccount) + }; + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool ConsumeLogEmission(ref EthereumGasPolicy gas, long topicCount, long dataSize) diff --git a/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs b/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs index 64daecbc1a64..9beea92eb077 100644 --- a/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs +++ b/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs @@ -226,6 +226,16 @@ static virtual bool TryConsumeStateAndRegularGas(ref TSelf gas, long stateGasCos /// The gas amount to refund. static abstract void UpdateGasUp(ref TSelf gas, long refund); + /// + /// Charges gas for SSTORE write operation (after cold/warm access cost). + /// Cost is calculated internally based on whether it's a slot creation or update. + /// + /// The gas state to update. + /// True if creating a new slot (original was zero). + /// The release specification for determining reset cost. + /// True if sufficient gas available + static abstract bool ConsumeStorageWrite(ref TSelf gas, bool isSlotCreation, long cost, IReleaseSpec spec); + /// /// Refunds state gas back to the state reservoir. /// Pre-EIP-8037 fallback refunds into regular gas. @@ -262,7 +272,7 @@ static virtual long ApplyCodeInsertRefunds(ref TSelf gas, int codeInsertRefunds, /// /// The gas state to update. /// True if sufficient gas available - static abstract bool ConsumeNewAccountCreation(ref TSelf gas); + static abstract bool ConsumeNewAccountCreation(ref TSelf gas) where TEip8037 : struct, IFlag; /// /// Charges gas for LOG emission with topic and data costs. diff --git a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Call.cs b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Call.cs index 974f7984139c..7d48f3a42df0 100644 --- a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Call.cs +++ b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Call.cs @@ -185,11 +185,7 @@ public static EvmExceptionType InstructionCall transferValue != 0 && state.IsDeadAccount(target), }; - bool newAccountOutOfGas = chargesNewAccount && !(TEip8037.IsActive switch - { - true => TGasPolicy.ConsumeNewAccountCreation(ref gas), - false => TGasPolicy.UpdateGas(ref gas, GasCostOf.NewAccount), - }); + bool newAccountOutOfGas = chargesNewAccount && !TGasPolicy.ConsumeNewAccountCreation(ref gas); if (newAccountOutOfGas) goto OutOfGas; diff --git a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.ControlFlow.cs b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.ControlFlow.cs index 1c27b19a9b55..2bb3bb6350b1 100644 --- a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.ControlFlow.cs +++ b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.ControlFlow.cs @@ -246,11 +246,7 @@ private static EvmExceptionType InstructionSelfDestruct !inheritorAccountExists && spec.UseShanghaiDDosProtection, }; - bool outOfGas = chargesNewAccount && !(TEip8037.IsActive switch - { - true => TGasPolicy.ConsumeNewAccountCreation(ref gas), - false => TGasPolicy.UpdateGas(ref gas, GasCostOf.NewAccount), - }); + bool outOfGas = chargesNewAccount && !(TGasPolicy.ConsumeNewAccountCreation(ref gas)); if (outOfGas) goto OutOfGas; diff --git a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs index cb6e5107640c..55d7f59f92df 100644 --- a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs +++ b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs @@ -508,14 +508,14 @@ internal static EvmExceptionType InstructionSStoreMetered !TGasPolicy.ConsumeStateGas(ref gas, GasCostOf.SSetState) || !TGasPolicy.UpdateGas(ref gas, GasCostOf.SSetRegular), - false => !TGasPolicy.UpdateGas(ref gas, GasCostOf.SSet), + false => !TGasPolicy.ConsumeStorageWrite(ref gas, true, GasCostOf.SSet, spec), }; if (ssetOutOfGas) goto OutOfGas; } else { - if (!TGasPolicy.UpdateGas(ref gas, spec.GasCosts.SStoreResetCost)) + if (!TGasPolicy.ConsumeStorageWrite(ref gas, false, spec.GasCosts.SStoreResetCost, spec)) goto OutOfGas; if (newIsZero) From 3a82eee6a1b9e3eb2518f2b8be006babc371502f Mon Sep 17 00:00:00 2001 From: Damian Orzechowski Date: Fri, 20 Mar 2026 11:26:55 +0100 Subject: [PATCH 2/8] Simplify ConsumeStorageWrite --- .../Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs | 9 ++++++--- src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs | 2 +- .../Instructions/EvmInstructions.Storage.cs | 9 ++------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs index 7905608a491c..5f389a5b31b5 100644 --- a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs +++ b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs @@ -197,9 +197,13 @@ public static bool UpdateGas(ref EthereumGasPolicy gas, } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool ConsumeStorageWrite(ref EthereumGasPolicy gas, bool isSlotCreation, long cost, IReleaseSpec spec) + public static bool ConsumeStorageWrite(ref EthereumGasPolicy gas, bool isSlotCreation, IReleaseSpec spec) where TEip8037 : struct, IFlag { - return UpdateGas(ref gas, cost); + return TEip8037.IsActive switch + { + true => ConsumeStateGas(ref gas, GasCostOf.SSetState) && UpdateGas(ref gas, GasCostOf.SSetRegular), + false => isSlotCreation ? UpdateGas(ref gas, GasCostOf.SSet) : UpdateGas(ref gas, spec.GasCosts.SStoreResetCost) + }; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -244,7 +248,6 @@ public static bool ConsumeNewAccountCreation(ref EthereumGasPolicy gas false => UpdateGas(ref gas, GasCostOf.NewAccount) }; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool ConsumeLogEmission(ref EthereumGasPolicy gas, long topicCount, long dataSize) diff --git a/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs b/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs index 9beea92eb077..4f2559fc1f4c 100644 --- a/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs +++ b/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs @@ -234,7 +234,7 @@ static virtual bool TryConsumeStateAndRegularGas(ref TSelf gas, long stateGasCos /// True if creating a new slot (original was zero). /// The release specification for determining reset cost. /// True if sufficient gas available - static abstract bool ConsumeStorageWrite(ref TSelf gas, bool isSlotCreation, long cost, IReleaseSpec spec); + static abstract bool ConsumeStorageWrite(ref TSelf gas, bool isSlotCreation, IReleaseSpec spec) where TEip8037 : struct, IFlag; /// /// Refunds state gas back to the state reservoir. diff --git a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs index 55d7f59f92df..ffb55cf6933e 100644 --- a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs +++ b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs @@ -505,17 +505,12 @@ internal static EvmExceptionType InstructionSStoreMetered !TGasPolicy.ConsumeStateGas(ref gas, GasCostOf.SSetState) || !TGasPolicy.UpdateGas(ref gas, GasCostOf.SSetRegular), - false => !TGasPolicy.ConsumeStorageWrite(ref gas, true, GasCostOf.SSet, spec), - }; - + bool ssetOutOfGas = !TGasPolicy.ConsumeStorageWrite(ref gas, true, spec); if (ssetOutOfGas) goto OutOfGas; } else { - if (!TGasPolicy.ConsumeStorageWrite(ref gas, false, spec.GasCosts.SStoreResetCost, spec)) + if (!TGasPolicy.ConsumeStorageWrite(ref gas, false, spec)) goto OutOfGas; if (newIsZero) From fc425f4ff0c787e178cd850c343de97570e9716f Mon Sep 17 00:00:00 2001 From: Damian Orzechowski Date: Fri, 20 Mar 2026 14:33:50 +0100 Subject: [PATCH 3/8] Fix ConsumeStorageWrite --- .../Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs index 5f389a5b31b5..6de6ecd5f2c5 100644 --- a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs +++ b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs @@ -197,12 +197,14 @@ public static bool UpdateGas(ref EthereumGasPolicy gas, } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool ConsumeStorageWrite(ref EthereumGasPolicy gas, bool isSlotCreation, IReleaseSpec spec) where TEip8037 : struct, IFlag + public static bool ConsumeStorageWrite(ref EthereumGasPolicy gas, bool isSlotCreation, IReleaseSpec spec) + where TEip8037 : struct, IFlag { + if (!isSlotCreation) return UpdateGas(ref gas, spec.GasCosts.SStoreResetCost); return TEip8037.IsActive switch { true => ConsumeStateGas(ref gas, GasCostOf.SSetState) && UpdateGas(ref gas, GasCostOf.SSetRegular), - false => isSlotCreation ? UpdateGas(ref gas, GasCostOf.SSet) : UpdateGas(ref gas, spec.GasCosts.SStoreResetCost) + false => UpdateGas(ref gas, GasCostOf.SSet) }; } From 9f08daa1765bfc54eb3cdcfa52f73706094703ce Mon Sep 17 00:00:00 2001 From: Damian Orzechowski Date: Fri, 20 Mar 2026 15:23:43 +0100 Subject: [PATCH 4/8] Refactor ConsumeStorageWrite --- .../Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs | 7 ++++--- src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs | 4 +++- .../Nethermind.Evm/Instructions/EvmInstructions.Storage.cs | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs index 6de6ecd5f2c5..0c2991feff63 100644 --- a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs +++ b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs @@ -197,10 +197,11 @@ public static bool UpdateGas(ref EthereumGasPolicy gas, } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool ConsumeStorageWrite(ref EthereumGasPolicy gas, bool isSlotCreation, IReleaseSpec spec) + public static bool ConsumeStorageWrite(ref EthereumGasPolicy gas, IReleaseSpec spec) where TEip8037 : struct, IFlag + where TIsSlotCreation : struct, IFlag { - if (!isSlotCreation) return UpdateGas(ref gas, spec.GasCosts.SStoreResetCost); + if (!TIsSlotCreation.IsActive) return UpdateGas(ref gas, spec.GasCosts.SStoreResetCost); return TEip8037.IsActive switch { true => ConsumeStateGas(ref gas, GasCostOf.SSetState) && UpdateGas(ref gas, GasCostOf.SSetRegular), @@ -250,7 +251,7 @@ public static bool ConsumeNewAccountCreation(ref EthereumGasPolicy gas false => UpdateGas(ref gas, GasCostOf.NewAccount) }; } - + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool ConsumeLogEmission(ref EthereumGasPolicy gas, long topicCount, long dataSize) { diff --git a/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs b/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs index 4f2559fc1f4c..28f510d555c4 100644 --- a/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs +++ b/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs @@ -234,7 +234,9 @@ static virtual bool TryConsumeStateAndRegularGas(ref TSelf gas, long stateGasCos /// True if creating a new slot (original was zero). /// The release specification for determining reset cost. /// True if sufficient gas available - static abstract bool ConsumeStorageWrite(ref TSelf gas, bool isSlotCreation, IReleaseSpec spec) where TEip8037 : struct, IFlag; + static abstract bool ConsumeStorageWrite(ref TSelf gas, IReleaseSpec spec) + where TEip8037 : struct, IFlag + where TIsSlotCreation : struct, IFlag; /// /// Refunds state gas back to the state reservoir. diff --git a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs index ffb55cf6933e..bfc66f0abaf5 100644 --- a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs +++ b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Storage.cs @@ -505,12 +505,12 @@ internal static EvmExceptionType InstructionSStoreMetered(ref gas, true, spec); + bool ssetOutOfGas = !TGasPolicy.ConsumeStorageWrite(ref gas, spec); if (ssetOutOfGas) goto OutOfGas; } else { - if (!TGasPolicy.ConsumeStorageWrite(ref gas, false, spec)) + if (!TGasPolicy.ConsumeStorageWrite(ref gas, spec)) goto OutOfGas; if (newIsZero) From 0d9ef71ef033fa7b2b6adbba71f2666f29419206 Mon Sep 17 00:00:00 2001 From: Damian Orzechowski Date: Fri, 20 Mar 2026 15:30:17 +0100 Subject: [PATCH 5/8] Fix whitespace --- src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs index 0c2991feff63..dbc0d601b20f 100644 --- a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs +++ b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs @@ -251,7 +251,7 @@ public static bool ConsumeNewAccountCreation(ref EthereumGasPolicy gas false => UpdateGas(ref gas, GasCostOf.NewAccount) }; } - + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool ConsumeLogEmission(ref EthereumGasPolicy gas, long topicCount, long dataSize) { From d08decc21d4129697af6ba61f6161c543ebab128 Mon Sep 17 00:00:00 2001 From: "lukasz.rozmej" Date: Fri, 20 Mar 2026 16:45:31 +0100 Subject: [PATCH 6/8] bit more readable --- .../Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs index dbc0d601b20f..0562e3180111 100644 --- a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs +++ b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs @@ -199,15 +199,13 @@ public static bool UpdateGas(ref EthereumGasPolicy gas, [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool ConsumeStorageWrite(ref EthereumGasPolicy gas, IReleaseSpec spec) where TEip8037 : struct, IFlag - where TIsSlotCreation : struct, IFlag - { - if (!TIsSlotCreation.IsActive) return UpdateGas(ref gas, spec.GasCosts.SStoreResetCost); - return TEip8037.IsActive switch + where TIsSlotCreation : struct, IFlag => + (isSlotCreation: TIsSlotCreation.IsActive, isEip8037: TEip8037.IsActive) switch { - true => ConsumeStateGas(ref gas, GasCostOf.SSetState) && UpdateGas(ref gas, GasCostOf.SSetRegular), - false => UpdateGas(ref gas, GasCostOf.SSet) + (isSlotCreation: true, isEip8037: true) => ConsumeStateGas(ref gas, GasCostOf.SSetState) && UpdateGas(ref gas, GasCostOf.SSetRegular), + (isSlotCreation: true, isEip8037: false) => UpdateGas(ref gas, GasCostOf.SSet), + (isSlotCreation: false, _) => UpdateGas(ref gas, spec.GasCosts.SStoreResetCost) }; - } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void UpdateGasUp(ref EthereumGasPolicy gas, From d86e977be8e387acd04caa7d2e3d5c469467fc9c Mon Sep 17 00:00:00 2001 From: "lukasz.rozmej" Date: Sat, 21 Mar 2026 12:40:17 +0100 Subject: [PATCH 7/8] Revert "bit more readable" This reverts commit d08decc21d4129697af6ba61f6161c543ebab128. --- .../Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs index 0562e3180111..dbc0d601b20f 100644 --- a/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs +++ b/src/Nethermind/Nethermind.Evm/GasPolicy/EthereumGasPolicy.cs @@ -199,13 +199,15 @@ public static bool UpdateGas(ref EthereumGasPolicy gas, [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool ConsumeStorageWrite(ref EthereumGasPolicy gas, IReleaseSpec spec) where TEip8037 : struct, IFlag - where TIsSlotCreation : struct, IFlag => - (isSlotCreation: TIsSlotCreation.IsActive, isEip8037: TEip8037.IsActive) switch + where TIsSlotCreation : struct, IFlag + { + if (!TIsSlotCreation.IsActive) return UpdateGas(ref gas, spec.GasCosts.SStoreResetCost); + return TEip8037.IsActive switch { - (isSlotCreation: true, isEip8037: true) => ConsumeStateGas(ref gas, GasCostOf.SSetState) && UpdateGas(ref gas, GasCostOf.SSetRegular), - (isSlotCreation: true, isEip8037: false) => UpdateGas(ref gas, GasCostOf.SSet), - (isSlotCreation: false, _) => UpdateGas(ref gas, spec.GasCosts.SStoreResetCost) + true => ConsumeStateGas(ref gas, GasCostOf.SSetState) && UpdateGas(ref gas, GasCostOf.SSetRegular), + false => UpdateGas(ref gas, GasCostOf.SSet) }; + } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void UpdateGasUp(ref EthereumGasPolicy gas, From 6f20d8c2d258b8f12a8b31df1b96418caf872422 Mon Sep 17 00:00:00 2001 From: Damian Orzechowski Date: Tue, 24 Mar 2026 12:05:22 +0100 Subject: [PATCH 8/8] Remove duplicated code --- src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs b/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs index 28f510d555c4..a2fcfb32598e 100644 --- a/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs +++ b/src/Nethermind/Nethermind.Evm/GasPolicy/IGasPolicy.cs @@ -215,9 +215,7 @@ static virtual bool ConsumeStateGas(ref TSelf gas, long stateGasCost) => /// State gas component. /// Regular gas component. /// true if both deductions succeeded; otherwise, false. - static virtual bool TryConsumeStateAndRegularGas(ref TSelf gas, long stateGasCost, long regularGasCost) => - (regularGasCost <= 0 || TSelf.UpdateGas(ref gas, regularGasCost)) && - (stateGasCost <= 0 || TSelf.ConsumeStateGas(ref gas, stateGasCost)); + static abstract bool TryConsumeStateAndRegularGas(ref TSelf gas, long stateGasCost, long regularGasCost); /// /// Refunds gas by adding the specified amount back to the available gas.