Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 Implement EIP-7623: Increase calldata cost #7859

Merged
merged 30 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b6f2004
add floor gas cost
tanishqjasoria Oct 1, 2024
a3248c1
transaction validator and gas estimator
tanishqjasoria Oct 1, 2024
96043d2
update
tanishqjasoria Oct 3, 2024
9ca3800
update and add tests
tanishqjasoria Oct 3, 2024
23426bd
add evm tests
tanishqjasoria Oct 3, 2024
6e4af3a
rename
tanishqjasoria Oct 4, 2024
bbfcb28
add token calculations
tanishqjasoria Oct 4, 2024
c7917f3
fix merger issues
tanishqjasoria Oct 7, 2024
786a7ad
small fixes
tanishqjasoria Oct 8, 2024
8bfb98f
another approach
tanishqjasoria Oct 8, 2024
64b146e
small fixes
tanishqjasoria Dec 4, 2024
5f80439
fix taiko processor
tanishqjasoria Dec 4, 2024
3a98449
fix whitespace
tanishqjasoria Dec 4, 2024
580168e
Update src/Nethermind/Nethermind.Evm.Test/Eip2028Tests.cs
tanishqjasoria Dec 5, 2024
a8d2004
address review comments
tanishqjasoria Dec 5, 2024
53315e2
Replace with flags
tanishqjasoria Dec 5, 2024
64fe0c4
Update src/Nethermind/Nethermind.Evm/IntrinsicGasCalculator.cs
tanishqjasoria Dec 10, 2024
31d5a22
format fix
tanishqjasoria Dec 10, 2024
49b4a25
calculate is outside
tanishqjasoria Dec 10, 2024
ec4372e
temp fix
tanishqjasoria Dec 13, 2024
3a31856
fix state tests
tanishqjasoria Dec 17, 2024
a1939eb
use minimal gas as lower bound estimiate
tanishqjasoria Dec 17, 2024
46320a7
fix whitespaces
tanishqjasoria Dec 17, 2024
d834bcf
refactor
tanishqjasoria Dec 18, 2024
54c5f95
Merge branch 'master' into eip7623v2
tanishqjasoria Dec 18, 2024
33538d2
Add GasConsumed and OperationGas to tracer (#7918)
tanishqjasoria Dec 18, 2024
0aac23c
fix tracer
tanishqjasoria Dec 18, 2024
104672c
fix calculation errors
tanishqjasoria Dec 18, 2024
b3d66a5
final fix
tanishqjasoria Dec 18, 2024
f4dd4a7
Merge branch 'master' into eip7623v2
tanishqjasoria Jan 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Nethermind/Nethermind.Consensus/Validators/TxValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,14 @@ public sealed class IntrinsicGasTxValidator : ITxValidator
public static readonly IntrinsicGasTxValidator Instance = new();
private IntrinsicGasTxValidator() { }

public ValidationResult IsWellFormed(Transaction transaction, IReleaseSpec releaseSpec) =>
public ValidationResult IsWellFormed(Transaction transaction, IReleaseSpec releaseSpec)
{
// This is unnecessarily calculated twice - at validation and execution times.
transaction.GasLimit < IntrinsicGasCalculator.Calculate(transaction, releaseSpec)
IntrinsicGas intrinsicGas = IntrinsicGasCalculator.Calculate(transaction, releaseSpec);
return transaction.GasLimit < intrinsicGas.MinimalGas
? TxErrorMessages.IntrinsicGasTooLow
: ValidationResult.Success;
}
}

public sealed class ReleaseSpecTxValidator(Func<IReleaseSpec, bool> validate) : ITxValidator
Expand Down
5 changes: 5 additions & 0 deletions src/Nethermind/Nethermind.Core/Specs/IReleaseSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ public interface IReleaseSpec : IEip1559Spec, IReceiptSpec
/// Taiko Ontake
bool IsOntakeEnabled { get; }

/// <summary>
/// Increase call data cost
/// </summary>
bool IsEip7623Enabled { get; }

/// <summary>
/// Should transactions be validated against chainId.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class ReleaseSpecDecorator(IReleaseSpec spec) : IReleaseSpec
public virtual bool IsOpGraniteEnabled => spec.IsOpGraniteEnabled;
public virtual bool IsOpHoloceneEnabled => spec.IsOpHoloceneEnabled;
public virtual bool IsOntakeEnabled => spec.IsOntakeEnabled;
public virtual bool IsEip7623Enabled => spec.IsEip7623Enabled;
public virtual ulong WithdrawalTimestamp => spec.WithdrawalTimestamp;
public virtual ulong Eip4844TransitionTimestamp => spec.Eip4844TransitionTimestamp;
public virtual bool IsEip158IgnoredAccount(Address address) => spec.IsEip158IgnoredAccount(address);
Expand Down
20 changes: 12 additions & 8 deletions src/Nethermind/Nethermind.Evm.Test/Eip2028Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ private class AfterIstanbul : Eip2028Tests
public void non_zero_transaction_data_cost_should_be_16()
{
Transaction transaction = new Transaction { Data = new byte[] { 1 }, To = Address.Zero };
long cost = IntrinsicGasCalculator.Calculate(transaction, Spec);
cost.Should().Be(GasCostOf.Transaction + GasCostOf.TxDataNonZeroEip2028);
IntrinsicGas cost = IntrinsicGasCalculator.Calculate(transaction, Spec);
cost.Should().Be(new IntrinsicGas(Standard: GasCostOf.Transaction + GasCostOf.TxDataNonZeroEip2028,
FloorGas: 0));
}

[Test]
public void zero_transaction_data_cost_should_be_4()
{
Transaction transaction = new Transaction { Data = new byte[] { 0 }, To = Address.Zero };
long cost = IntrinsicGasCalculator.Calculate(transaction, Spec);
cost.Should().Be(GasCostOf.Transaction + GasCostOf.TxDataZero);
IntrinsicGas cost = IntrinsicGasCalculator.Calculate(transaction, Spec);
cost.Should().Be(new IntrinsicGas(Standard: GasCostOf.Transaction + GasCostOf.TxDataZero,
FloorGas: 0));
}
}

Expand All @@ -45,16 +47,18 @@ private class BeforeIstanbul : Eip2028Tests
public void non_zero_transaction_data_cost_should_be_68()
{
Transaction transaction = new Transaction { Data = new byte[] { 1 }, To = Address.Zero };
long cost = IntrinsicGasCalculator.Calculate(transaction, Spec);
cost.Should().Be(GasCostOf.Transaction + GasCostOf.TxDataNonZero);
IntrinsicGas cost = IntrinsicGasCalculator.Calculate(transaction, Spec);
cost.Should().Be(new IntrinsicGas(Standard: GasCostOf.Transaction + GasCostOf.TxDataNonZero,
FloorGas: 0));
}

[Test]
public void zero_transaction_data_cost_should_be_4()
{
Transaction transaction = new Transaction { Data = new byte[] { 0 }, To = Address.Zero };
long cost = IntrinsicGasCalculator.Calculate(transaction, Spec);
cost.Should().Be(GasCostOf.Transaction + GasCostOf.TxDataZero);
IntrinsicGas cost = IntrinsicGasCalculator.Calculate(transaction, Spec);
cost.Should().Be(new IntrinsicGas(Standard: GasCostOf.Transaction + GasCostOf.TxDataZero,
FloorGas: 0));
}
}
}
Expand Down
34 changes: 34 additions & 0 deletions src/Nethermind/Nethermind.Evm.Test/Eip7623Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using FluentAssertions;
using Nethermind.Core;
using Nethermind.Specs;
using NUnit.Framework;

namespace Nethermind.Evm.Test;

[TestFixture]
public class Eip7623Tests : VirtualMachineTestsBase
{
protected override long BlockNumber => MainnetSpecProvider.ParisBlockNumber;
protected override ulong Timestamp => MainnetSpecProvider.PragueBlockTimestamp;

[Test]
public void non_zero_data_transaction_floor_cost_should_be_40()
{
var transaction = new Transaction { Data = new byte[] { 1 }, To = Address.Zero };
IntrinsicGas cost = IntrinsicGasCalculator.Calculate(transaction, Spec);
cost.Should().Be(new IntrinsicGas(Standard: GasCostOf.Transaction + GasCostOf.TxDataNonZeroEip2028,
FloorGas: GasCostOf.Transaction + GasCostOf.TotalCostFloorPerTokenEip7623 * 4));
}

[Test]
public void zero_data_transaction_floor_cost_should_be_10()
{
var transaction = new Transaction { Data = new byte[] { 0 }, To = Address.Zero };
IntrinsicGas cost = IntrinsicGasCalculator.Calculate(transaction, Spec);
cost.Should().Be(new IntrinsicGas(Standard: GasCostOf.Transaction + GasCostOf.TxDataZero,
FloorGas: GasCostOf.Transaction + GasCostOf.TotalCostFloorPerTokenEip7623));
}
}
11 changes: 7 additions & 4 deletions src/Nethermind/Nethermind.Evm.Test/GasPriceExtractorTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using System.Linq;
using FluentAssertions;
using Nethermind.Core;
Expand Down Expand Up @@ -32,8 +33,9 @@ public void Intrinsic_gas_cost_assumption_is_correct()
Rlp rlp = BuildHeader();

Transaction tx = Build.A.Transaction.WithData(rlp.Bytes).TestObject;
long gasCost = IntrinsicGasCalculator.Calculate(tx, Spec);
gasCost.Should().BeLessThan(21000 + 9600);
IntrinsicGas gasCost = IntrinsicGasCalculator.Calculate(tx, Spec);
gasCost.FloorGas.Should().Be(0);
gasCost.Standard.Should().BeLessThan(21000 + 9600);
}

[Test]
Expand All @@ -42,8 +44,9 @@ public void Keccak_gas_cost_assumption_is_correct()
Rlp rlp = BuildHeader();

Transaction tx = Build.A.Transaction.WithData(rlp.Bytes).TestObject;
long gasCost = IntrinsicGasCalculator.Calculate(tx, Spec);
gasCost.Should().BeLessThan(21000 + 9600);
var gasCost = IntrinsicGasCalculator.Calculate(tx, Spec);
gasCost.FloorGas.Should().Be(0);
gasCost.Standard.Should().BeLessThan(21000 + 9600);

byte[] bytecode =
Prepare.EvmCode
Expand Down
78 changes: 52 additions & 26 deletions src/Nethermind/Nethermind.Evm.Test/IntrinsicGasCalculatorTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using System.Collections.Generic;
using System.IO;
using FluentAssertions;
Expand All @@ -16,6 +17,15 @@

namespace Nethermind.Evm.Test
{

[Flags]
public enum GasOptions
{
None = 0,
AfterRepricing = 1,
FloorCostEnabled = 2,
}

[TestFixture]
public class IntrinsicGasCalculatorTests
{
Expand All @@ -33,18 +43,19 @@ public class IntrinsicGasCalculatorTests
yield return (new List<object> { Address.Zero, (UInt256)1, Address.Zero, (UInt256)1 }, 8600);
}

public static IEnumerable<(byte[] Data, int OldCost, int NewCost)> DataTestCaseSource()
public static IEnumerable<(byte[] Data, int OldCost, int NewCost, int FloorCost)> DataTestCaseSource()
{
yield return (new byte[] { 0 }, 4, 4);
yield return (new byte[] { 1 }, 68, 16);
yield return (new byte[] { 0, 0, 1 }, 76, 24);
yield return (new byte[] { 1, 1, 0 }, 140, 36);
yield return (new byte[] { 0, 0, 1, 1 }, 144, 40);
yield return ([0], 4, 4, 21010);
yield return ([1], 68, 16, 21040);
yield return ([0, 0, 1], 76, 24, 21060);
yield return ([1, 1, 0], 140, 36, 21090);
yield return ([0, 0, 1, 1], 144, 40, 21100);
}
[TestCaseSource(nameof(TestCaseSource))]
public void Intrinsic_cost_is_calculated_properly((Transaction Tx, long Cost, string Description) testCase)
{
IntrinsicGasCalculator.Calculate(testCase.Tx, Berlin.Instance).Should().Be(testCase.Cost);
IntrinsicGas gas = IntrinsicGasCalculator.Calculate(testCase.Tx, Berlin.Instance);
gas.Should().Be(new IntrinsicGas(Standard: testCase.Cost, FloorGas: 0));
}

[TestCaseSource(nameof(AccessTestCaseSource))]
Expand Down Expand Up @@ -74,7 +85,8 @@ void Test(IReleaseSpec spec, bool supportsAccessLists)
}
else
{
IntrinsicGasCalculator.Calculate(tx, spec).Should().Be(21000 + testCase.Cost, spec.Name);
IntrinsicGas gas = IntrinsicGasCalculator.Calculate(tx, spec);
gas.Should().Be(new IntrinsicGas(Standard: 21000 + testCase.Cost, FloorGas: 0), spec.Name);
}
}

Expand All @@ -91,31 +103,45 @@ void Test(IReleaseSpec spec, bool supportsAccessLists)
}

[TestCaseSource(nameof(DataTestCaseSource))]
public void Intrinsic_cost_of_data_is_calculated_properly((byte[] Data, int OldCost, int NewCost) testCase)
public void Intrinsic_cost_of_data_is_calculated_properly((byte[] Data, int OldCost, int NewCost, int FloorCost) testCase)
{
Transaction tx = Build.A.Transaction.SignedAndResolved().WithData(testCase.Data).TestObject;

void Test(IReleaseSpec spec, bool isAfterRepricing)

void Test(IReleaseSpec spec, GasOptions options)
{
IntrinsicGasCalculator.Calculate(tx, spec).Should()
IntrinsicGas gas = IntrinsicGasCalculator.Calculate(tx, spec);

bool isAfterRepricing = options.HasFlag(GasOptions.AfterRepricing);
bool floorCostEnabled = options.HasFlag(GasOptions.FloorCostEnabled);

gas.Standard.Should()
.Be(21000 + (isAfterRepricing ? testCase.NewCost : testCase.OldCost), spec.Name,
testCase.Data.ToHexString());
gas.FloorGas.Should().Be(floorCostEnabled ? testCase.FloorCost : 0);

gas.Should().Be(new IntrinsicGas(
Standard: 21000 + (isAfterRepricing ? testCase.NewCost : testCase.OldCost),
FloorGas: floorCostEnabled ? testCase.FloorCost : 0),
spec.Name, testCase.Data.ToHexString());
}

Test(Homestead.Instance, false);
Test(Frontier.Instance, false);
Test(SpuriousDragon.Instance, false);
Test(TangerineWhistle.Instance, false);
Test(Byzantium.Instance, false);
Test(Constantinople.Instance, false);
Test(ConstantinopleFix.Instance, false);
Test(Istanbul.Instance, true);
Test(MuirGlacier.Instance, true);
Test(Berlin.Instance, true);
Test(GrayGlacier.Instance, true);
Test(Shanghai.Instance, true);
Test(Cancun.Instance, true);
Test(Homestead.Instance, GasOptions.None);
Test(Frontier.Instance, GasOptions.None);
Test(SpuriousDragon.Instance, GasOptions.None);
Test(TangerineWhistle.Instance, GasOptions.None);
Test(Byzantium.Instance, GasOptions.None);
Test(Constantinople.Instance, GasOptions.None);
Test(ConstantinopleFix.Instance, GasOptions.None);
Test(Istanbul.Instance, GasOptions.AfterRepricing);
Test(MuirGlacier.Instance, GasOptions.AfterRepricing);
Test(Berlin.Instance, GasOptions.AfterRepricing);
Test(GrayGlacier.Instance, GasOptions.AfterRepricing);
Test(Shanghai.Instance, GasOptions.AfterRepricing);
Test(Cancun.Instance, GasOptions.AfterRepricing);
Test(Prague.Instance, GasOptions.AfterRepricing | GasOptions.FloorCostEnabled);
}

public static IEnumerable<(AuthorizationTuple[] contractCode, long expectedCost)> AuthorizationListTestCaseSource()
{
yield return (
Expand Down Expand Up @@ -179,8 +205,8 @@ public void Calculate_TxHasAuthorizationList_ReturnsExpectedCostOfTx((Authorizat
.WithAuthorizationCode(testCase.AuthorizationList)
.TestObject;

IntrinsicGasCalculator.Calculate(tx, Prague.Instance)
.Should().Be(GasCostOf.Transaction + (testCase.ExpectedCost));
IntrinsicGas gas = IntrinsicGasCalculator.Calculate(tx, Prague.Instance);
gas.Standard.Should().Be(GasCostOf.Transaction + (testCase.ExpectedCost));
}

[Test]
Expand Down
21 changes: 10 additions & 11 deletions src/Nethermind/Nethermind.Evm.Test/TransactionProcessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public void Can_estimate_with_refund()
Transaction tx = Build.A.Transaction.SignedAndResolved(_ethereumEcdsa, TestItem.PrivateKeyA, _isEip155Enabled).WithCode(initByteCode).WithGasLimit(gasLimit).TestObject;
Block block = Build.A.Block.WithNumber(MainnetSpecProvider.MuirGlacierBlockNumber).WithTransactions(tx).WithGasLimit(2 * gasLimit).TestObject;

long intrinsic = IntrinsicGasCalculator.Calculate(tx, MuirGlacier.Instance);
IntrinsicGas intrinsicGas = IntrinsicGasCalculator.Calculate(tx, MuirGlacier.Instance);

GethLikeTxMemoryTracer gethTracer = new(GethTraceOptions.Default);
_transactionProcessor.CallAndRestore(tx, block.Header, gethTracer);
Expand All @@ -404,7 +404,7 @@ public void Can_estimate_with_refund()
GasEstimator estimator = new(_transactionProcessor, _stateProvider, _specProvider, blocksConfig);

long actualIntrinsic = tx.GasLimit - tracer.IntrinsicGasAt;
actualIntrinsic.Should().Be(intrinsic);
actualIntrinsic.Should().Be(intrinsicGas.Standard);
IReleaseSpec releaseSpec = Berlin.Instance;
tracer.CalculateAdditionalGasRequired(tx, releaseSpec).Should().Be(RefundOf.SSetReversedEip2200 + GasCostOf.CallStipend - GasCostOf.SStoreNetMeteredEip2200 + 1);
tracer.GasSpent.Should().Be(54764L);
Expand Down Expand Up @@ -432,8 +432,7 @@ public void Can_estimate_with_destroy_refund_and_below_intrinsic_pre_berlin()
Block block = Build.A.Block.WithNumber(MainnetSpecProvider.MuirGlacierBlockNumber).WithTransactions(tx).WithGasLimit(2 * gasLimit).TestObject;

IReleaseSpec releaseSpec = MuirGlacier.Instance;
long intrinsic = IntrinsicGasCalculator.Calculate(tx, releaseSpec);

IntrinsicGas intrinsicGas = IntrinsicGasCalculator.Calculate(tx, releaseSpec);
_transactionProcessor.Execute(initTx, block.Header, NullTxTracer.Instance);

EstimateGasTracer tracer = new();
Expand All @@ -446,7 +445,7 @@ public void Can_estimate_with_destroy_refund_and_below_intrinsic_pre_berlin()
GasEstimator estimator = new(_transactionProcessor, _stateProvider, _specProvider, blocksConfig);

long actualIntrinsic = tx.GasLimit - tracer.IntrinsicGasAt;
actualIntrinsic.Should().Be(intrinsic);
actualIntrinsic.Should().Be(intrinsicGas.Standard);
tracer.CalculateAdditionalGasRequired(tx, releaseSpec).Should().Be(24080);
tracer.GasSpent.Should().Be(35228L);
long estimate = estimator.Estimate(tx, block.Header, tracer, 0);
Expand Down Expand Up @@ -498,7 +497,7 @@ public void Can_estimate_with_stipend()
Block block = Build.A.Block.WithNumber(MainnetSpecProvider.MuirGlacierBlockNumber).WithTransactions(tx).WithGasLimit(2 * gasLimit).TestObject;

IReleaseSpec releaseSpec = MuirGlacier.Instance;
long intrinsic = IntrinsicGasCalculator.Calculate(tx, releaseSpec);
IntrinsicGas intrinsicGas = IntrinsicGasCalculator.Calculate(tx, releaseSpec);

GethLikeTxMemoryTracer gethTracer = new(GethTraceOptions.Default);
_transactionProcessor.CallAndRestore(tx, block.Header, gethTracer);
Expand All @@ -511,7 +510,7 @@ public void Can_estimate_with_stipend()
GasEstimator estimator = new(_transactionProcessor, _stateProvider, _specProvider, blocksConfig);

long actualIntrinsic = tx.GasLimit - tracer.IntrinsicGasAt;
actualIntrinsic.Should().Be(intrinsic);
actualIntrinsic.Should().Be(intrinsicGas.Standard);
tracer.CalculateAdditionalGasRequired(tx, releaseSpec).Should().Be(2300);
tracer.GasSpent.Should().Be(85669L);
long estimate = estimator.Estimate(tx, block.Header, tracer, 0);
Expand Down Expand Up @@ -540,7 +539,7 @@ public void Can_estimate_with_stipend_and_refund()
Block block = Build.A.Block.WithNumber(MainnetSpecProvider.MuirGlacierBlockNumber).WithTransactions(tx).WithGasLimit(2 * gasLimit).TestObject;

IReleaseSpec releaseSpec = MuirGlacier.Instance;
long intrinsic = IntrinsicGasCalculator.Calculate(tx, releaseSpec);
IntrinsicGas intrinsicGas = IntrinsicGasCalculator.Calculate(tx, releaseSpec);

GethLikeTxMemoryTracer gethTracer = new(GethTraceOptions.Default);
_transactionProcessor.CallAndRestore(tx, block.Header, gethTracer);
Expand All @@ -553,7 +552,7 @@ public void Can_estimate_with_stipend_and_refund()
GasEstimator estimator = new(_transactionProcessor, _stateProvider, _specProvider, blocksConfig);

long actualIntrinsic = tx.GasLimit - tracer.IntrinsicGasAt;
actualIntrinsic.Should().Be(intrinsic);
actualIntrinsic.Should().Be(intrinsicGas.Standard);
tracer.CalculateAdditionalGasRequired(tx, releaseSpec).Should().Be(RefundOf.SSetReversedEip2200 + GasCostOf.CallStipend);
tracer.GasSpent.Should().Be(87429L);
long estimate = estimator.Estimate(tx, block.Header, tracer, 0);
Expand All @@ -580,7 +579,7 @@ public void Can_estimate_with_single_call()
Block block = Build.A.Block.WithNumber(MainnetSpecProvider.MuirGlacierBlockNumber).WithTransactions(tx).WithGasLimit(2 * gasLimit).TestObject;

IReleaseSpec releaseSpec = Berlin.Instance;
long intrinsic = IntrinsicGasCalculator.Calculate(tx, releaseSpec);
IntrinsicGas intrinsicGas = IntrinsicGasCalculator.Calculate(tx, releaseSpec);

_transactionProcessor.Execute(initTx, block.Header, NullTxTracer.Instance);

Expand All @@ -591,7 +590,7 @@ public void Can_estimate_with_single_call()
GasEstimator estimator = new(_transactionProcessor, _stateProvider, _specProvider, blocksConfig);

long actualIntrinsic = tx.GasLimit - tracer.IntrinsicGasAt;
actualIntrinsic.Should().Be(intrinsic);
actualIntrinsic.Should().Be(intrinsicGas.Standard);
tracer.CalculateAdditionalGasRequired(tx, releaseSpec).Should().Be(1);
tracer.GasSpent.Should().Be(54224L);
long estimate = estimator.Estimate(tx, block.Header, tracer, 0);
Expand Down
4 changes: 4 additions & 0 deletions src/Nethermind/Nethermind.Evm/GasCostOf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,9 @@ public static class GasCostOf
public const long TLoad = WarmStateRead; // eip-1153
public const long TStore = WarmStateRead; // eip-1153
public const long PerAuthBaseCost = 12500; // eip-7702
public const long TotalCostFloorPerTokenEip7623 = 10; // eip-7632

public const long TxDataNonZeroMultiplier = TxDataNonZero / TxDataZero;
public const long TxDataNonZeroMultiplierEip2028 = TxDataNonZeroEip2028 / TxDataZero;
}
}
Loading
Loading