From a7be867a7855dec0ef3e9e7e28483e7c4669af1f Mon Sep 17 00:00:00 2001 From: Demuirgos Date: Tue, 11 Jul 2023 00:20:51 +0100 Subject: [PATCH] - made precompile address static --- .../Nethermind.Evm.Test/Eip1052Tests.cs | 4 +- .../Nethermind.Evm.Test/Eip1108Tests.cs | 12 ++--- .../Nethermind.Evm.Test/Eip152Tests.cs | 4 +- .../Tracing/ParityLikeTxTracerTests.cs | 12 ++--- .../Precompiles/Blake2FPrecompile.cs | 2 +- .../Precompiles/Bls/G1AddPrecompile.cs | 2 +- .../Precompiles/Bls/G1MulPrecompile.cs | 2 +- .../Precompiles/Bls/G1MultiExpPrecompile.cs | 2 +- .../Precompiles/Bls/G2AddPrecompile.cs | 2 +- .../Precompiles/Bls/G2MulPrecompile.cs | 2 +- .../Precompiles/Bls/G2MultiExpPrecompile.cs | 2 +- .../Precompiles/Bls/MapToG1Precompile.cs | 2 +- .../Precompiles/Bls/MapToG2Precompile.cs | 2 +- .../Precompiles/Bls/PairingPrecompile.cs | 2 +- .../Precompiles/EcRecoverPrecompile.cs | 2 +- .../Nethermind.Evm/Precompiles/IPrecompile.cs | 2 +- .../Precompiles/IdentityPrecompile.cs | 2 +- .../Precompiles/ModExpPrecompile.cs | 2 +- .../Precompiles/ModExpPrecompilePreEip2565.cs | 2 +- .../Precompiles/PointEvaluationPrecompile.cs | 2 +- .../Precompiles/Ripemd160Precompile.cs | 2 +- .../Precompiles/Sha256Precompile.cs | 2 +- .../Precompiles/Snarks/Bn254AddPrecompile.cs | 2 +- .../Precompiles/Snarks/Bn254MulPrecompile.cs | 2 +- .../Snarks/Bn254PairingPrecompile.cs | 2 +- .../Nethermind.Evm/VirtualMachine.cs | 46 +++++++++---------- 26 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/Nethermind/Nethermind.Evm.Test/Eip1052Tests.cs b/src/Nethermind/Nethermind.Evm.Test/Eip1052Tests.cs index 4809e0c68ee..5e139482a7d 100644 --- a/src/Nethermind/Nethermind.Evm.Test/Eip1052Tests.cs +++ b/src/Nethermind/Nethermind.Evm.Test/Eip1052Tests.cs @@ -60,7 +60,7 @@ public void Non_existing_account_returns_0() [Test] public void Non_existing_precompile_returns_0() { - Address precompileAddress = Sha256Precompile.Instance.Address; + Address precompileAddress = Sha256Precompile.Address; Assert.True(precompileAddress.IsPrecompile(Spec)); byte[] code = Prepare.EvmCode @@ -77,7 +77,7 @@ public void Non_existing_precompile_returns_0() [Test] public void Existing_precompile_returns_empty_data_hash() { - Address precompileAddress = Sha256Precompile.Instance.Address; + Address precompileAddress = Sha256Precompile.Address; Assert.True(precompileAddress.IsPrecompile(Spec)); TestState.CreateAccount(precompileAddress, 1.Wei()); diff --git a/src/Nethermind/Nethermind.Evm.Test/Eip1108Tests.cs b/src/Nethermind/Nethermind.Evm.Test/Eip1108Tests.cs index 0d299bb7c8e..909e3ea32c9 100644 --- a/src/Nethermind/Nethermind.Evm.Test/Eip1108Tests.cs +++ b/src/Nethermind/Nethermind.Evm.Test/Eip1108Tests.cs @@ -24,7 +24,7 @@ public void Test_add_before_istanbul() { _blockNumberAdjustment = -1; byte[] code = Prepare.EvmCode - .CallWithInput(Bn254AddPrecompile.Instance.Address, 1000L, new byte[128]) + .CallWithInput(Bn254AddPrecompile.Address, 1000L, new byte[128]) .Done; TestAllTracerWithOutput result = Execute(code); Assert.That(result.StatusCode, Is.EqualTo(StatusCode.Success)); @@ -35,7 +35,7 @@ public void Test_add_before_istanbul() public void Test_add_after_istanbul() { byte[] code = Prepare.EvmCode - .CallWithInput(Bn254AddPrecompile.Instance.Address, 1000L, new byte[128]) + .CallWithInput(Bn254AddPrecompile.Address, 1000L, new byte[128]) .Done; TestAllTracerWithOutput result = Execute(code); Assert.That(result.StatusCode, Is.EqualTo(StatusCode.Success)); @@ -47,7 +47,7 @@ public void Test_mul_before_istanbul() { _blockNumberAdjustment = -1; byte[] code = Prepare.EvmCode - .CallWithInput(Bn254MulPrecompile.Instance.Address, 50000L, new byte[128]) + .CallWithInput(Bn254MulPrecompile.Address, 50000L, new byte[128]) .Done; TestAllTracerWithOutput result = Execute(code); Assert.That(result.StatusCode, Is.EqualTo(StatusCode.Success)); @@ -58,7 +58,7 @@ public void Test_mul_before_istanbul() public void Test_mul_after_istanbul() { byte[] code = Prepare.EvmCode - .CallWithInput(Bn254MulPrecompile.Instance.Address, 10000L, new byte[128]) + .CallWithInput(Bn254MulPrecompile.Address, 10000L, new byte[128]) .Done; TestAllTracerWithOutput result = Execute(code); Assert.That(result.StatusCode, Is.EqualTo(StatusCode.Success)); @@ -70,7 +70,7 @@ public void Test_pairing_before_istanbul() { _blockNumberAdjustment = -1; byte[] code = Prepare.EvmCode - .CallWithInput(Bn254PairingPrecompile.Instance.Address, 200000L, new byte[192]) + .CallWithInput(Bn254PairingPrecompile.Address, 200000L, new byte[192]) .Done; TestAllTracerWithOutput result = Execute(BlockNumber, 1000000L, code); Assert.That(result.StatusCode, Is.EqualTo(StatusCode.Success)); @@ -81,7 +81,7 @@ public void Test_pairing_before_istanbul() public void Test_pairing_after_istanbul() { byte[] code = Prepare.EvmCode - .CallWithInput(Bn254PairingPrecompile.Instance.Address, 200000L, new byte[192]) + .CallWithInput(Bn254PairingPrecompile.Address, 200000L, new byte[192]) .Done; TestAllTracerWithOutput result = Execute(BlockNumber, 1000000L, code); Assert.That(result.StatusCode, Is.EqualTo(StatusCode.Success)); diff --git a/src/Nethermind/Nethermind.Evm.Test/Eip152Tests.cs b/src/Nethermind/Nethermind.Evm.Test/Eip152Tests.cs index 067f3c348dc..78d8e701494 100644 --- a/src/Nethermind/Nethermind.Evm.Test/Eip152Tests.cs +++ b/src/Nethermind/Nethermind.Evm.Test/Eip152Tests.cs @@ -25,7 +25,7 @@ public void TearDown() public void before_istanbul() { _blockNumberAdjustment = -1; - Address precompileAddress = Blake2FPrecompile.Instance.Address; + Address precompileAddress = Blake2FPrecompile.Address; Assert.False(precompileAddress.IsPrecompile(Spec)); } @@ -33,7 +33,7 @@ public void before_istanbul() public void after_istanbul() { byte[] code = Prepare.EvmCode - .CallWithInput(Blake2FPrecompile.Instance.Address, 1000L, new byte[InputLength]) + .CallWithInput(Blake2FPrecompile.Address, 1000L, new byte[InputLength]) .Done; TestAllTracerWithOutput result = Execute(code); Assert.That(result.StatusCode, Is.EqualTo(StatusCode.Success)); diff --git a/src/Nethermind/Nethermind.Evm.Test/Tracing/ParityLikeTxTracerTests.cs b/src/Nethermind/Nethermind.Evm.Test/Tracing/ParityLikeTxTracerTests.cs index c4cc04974c4..3732eee4129 100644 --- a/src/Nethermind/Nethermind.Evm.Test/Tracing/ParityLikeTxTracerTests.cs +++ b/src/Nethermind/Nethermind.Evm.Test/Tracing/ParityLikeTxTracerTests.cs @@ -570,7 +570,7 @@ public void Can_trace_static_calls() public void Can_trace_precompile_calls() { byte[] code = Prepare.EvmCode - .Call(IdentityPrecompile.Instance.Address, 50000) + .Call(IdentityPrecompile.Address, 50000) .Op(Instruction.STOP) .Done; @@ -584,15 +584,15 @@ public void Can_trace_precompile_calls() }; Assert.That(trace.Action.Subtraces[0].CallType, Is.EqualTo("call"), "[0] type"); - Assert.That(trace.Action.Subtraces[0].To, Is.EqualTo(IdentityPrecompile.Instance.Address), "[0] to"); + Assert.That(trace.Action.Subtraces[0].To, Is.EqualTo(IdentityPrecompile.Address), "[0] to"); } [Test] public void Can_ignore_precompile_calls_in_contract() { byte[] deployedCode = Prepare.EvmCode - .Call(IdentityPrecompile.Instance.Address, 50000) - .CallWithValue(IdentityPrecompile.Instance.Address, 50000, 1.Ether()) + .Call(IdentityPrecompile.Address, 50000) + .CallWithValue(IdentityPrecompile.Address, 50000, 1.Ether()) .Op(Instruction.STOP) .Done; @@ -600,7 +600,7 @@ public void Can_ignore_precompile_calls_in_contract() TestState.InsertCode(TestItem.AddressC, deployedCode, Spec); byte[] code = Prepare.EvmCode - .Call(IdentityPrecompile.Instance.Address, 50000) + .Call(IdentityPrecompile.Address, 50000) .Call(TestItem.AddressC, 40000) .Op(Instruction.STOP) .Done; @@ -614,7 +614,7 @@ public void Can_ignore_precompile_calls_in_contract() // Precompile call Assert.That(trace.Action.Subtraces[0].Subtraces.Count, Is.EqualTo(0), "[0] subtraces"); Assert.That(trace.Action.Subtraces[0].CallType, Is.EqualTo("call"), "[0] type"); - Assert.That(trace.Action.Subtraces[0].To, Is.EqualTo(IdentityPrecompile.Instance.Address), "[0] to"); + Assert.That(trace.Action.Subtraces[0].To, Is.EqualTo(IdentityPrecompile.Address), "[0] to"); // AddressC call - only one call Assert.That(trace.Action.Subtraces[1].Subtraces.Count, Is.EqualTo(2), "[1] subtraces"); diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Blake2FPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Blake2FPrecompile.cs index 985eeafd6b3..f0d37413475 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Blake2FPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Blake2FPrecompile.cs @@ -17,7 +17,7 @@ public class Blake2FPrecompile : IPrecompile public static readonly IPrecompile Instance = new Blake2FPrecompile(); - public Address Address { get; } = Address.FromNumber(9); + public static Address Address { get; } = Address.FromNumber(9); public long BaseGasCost(IReleaseSpec releaseSpec) => 0; diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1AddPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1AddPrecompile.cs index dfbc6a8ab6d..e3bc46d020d 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1AddPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1AddPrecompile.cs @@ -19,7 +19,7 @@ private G1AddPrecompile() { } - public Address Address { get; } = Address.FromNumber(0x0c); + public static Address Address { get; } = Address.FromNumber(0x0c); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1MulPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1MulPrecompile.cs index c0ca03db733..bcf58d628ed 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1MulPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1MulPrecompile.cs @@ -19,7 +19,7 @@ private G1MulPrecompile() { } - public Address Address { get; } = Address.FromNumber(0x0d); + public static Address Address { get; } = Address.FromNumber(0x0d); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1MultiExpPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1MultiExpPrecompile.cs index ebfed64983d..337a27876fc 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1MultiExpPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G1MultiExpPrecompile.cs @@ -19,7 +19,7 @@ private G1MultiExpPrecompile() { } - public Address Address { get; } = Address.FromNumber(0x0e); + public static Address Address { get; } = Address.FromNumber(0x0e); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2AddPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2AddPrecompile.cs index 4e12989fcf6..387b15b7cb2 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2AddPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2AddPrecompile.cs @@ -19,7 +19,7 @@ private G2AddPrecompile() { } - public Address Address { get; } = Address.FromNumber(0x0f); + public static Address Address { get; } = Address.FromNumber(0x0f); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2MulPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2MulPrecompile.cs index 9e8334659be..e8bcb212b90 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2MulPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2MulPrecompile.cs @@ -19,7 +19,7 @@ private G2MulPrecompile() { } - public Address Address { get; } = Address.FromNumber(0x10); + public static Address Address { get; } = Address.FromNumber(0x10); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2MultiExpPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2MultiExpPrecompile.cs index 1fc34ff4b7a..8092a7923fe 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2MultiExpPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/G2MultiExpPrecompile.cs @@ -19,7 +19,7 @@ private G2MultiExpPrecompile() { } - public Address Address { get; } = Address.FromNumber(0x11); + public static Address Address { get; } = Address.FromNumber(0x11); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/MapToG1Precompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/MapToG1Precompile.cs index ad3c05001e6..e15d5fb320a 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/MapToG1Precompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/MapToG1Precompile.cs @@ -19,7 +19,7 @@ private MapToG1Precompile() { } - public Address Address { get; } = Address.FromNumber(0x13); + public static Address Address { get; } = Address.FromNumber(0x13); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/MapToG2Precompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/MapToG2Precompile.cs index 790ce8bdc37..b0fa9e16ad9 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/MapToG2Precompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/MapToG2Precompile.cs @@ -19,7 +19,7 @@ private MapToG2Precompile() { } - public Address Address { get; } = Address.FromNumber(0x14); + public static Address Address { get; } = Address.FromNumber(0x14); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/PairingPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/PairingPrecompile.cs index ee3d83588a0..0d7e5144efa 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/PairingPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/PairingPrecompile.cs @@ -17,7 +17,7 @@ public class PairingPrecompile : IPrecompile private PairingPrecompile() { } - public Address Address { get; } = Address.FromNumber(0x12); + public static Address Address { get; } = Address.FromNumber(0x12); public static IPrecompile Instance = new PairingPrecompile(); diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/EcRecoverPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/EcRecoverPrecompile.cs index c633aa52998..831bdef83b3 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/EcRecoverPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/EcRecoverPrecompile.cs @@ -19,7 +19,7 @@ private EcRecoverPrecompile() { } - public Address Address { get; } = Address.FromNumber(1); + public static Address Address { get; } = Address.FromNumber(1); public long DataGasCost(in ReadOnlyMemory inputData, IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/IPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/IPrecompile.cs index 90229ea43e9..1d80239ebdf 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/IPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/IPrecompile.cs @@ -9,7 +9,7 @@ namespace Nethermind.Evm.Precompiles { public interface IPrecompile { - Address Address { get; } + static Address Address { get; } long BaseGasCost(IReleaseSpec releaseSpec); diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/IdentityPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/IdentityPrecompile.cs index 8f3f624e4d4..a760f842d71 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/IdentityPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/IdentityPrecompile.cs @@ -15,7 +15,7 @@ private IdentityPrecompile() { } - public Address Address { get; } = Address.FromNumber(4); + public static Address Address { get; } = Address.FromNumber(4); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/ModExpPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/ModExpPrecompile.cs index b6372c15e57..f45048107d2 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/ModExpPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/ModExpPrecompile.cs @@ -23,7 +23,7 @@ private ModExpPrecompile() { } - public Address Address { get; } = Address.FromNumber(5); + public static Address Address { get; } = Address.FromNumber(5); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/ModExpPrecompilePreEip2565.cs b/src/Nethermind/Nethermind.Evm/Precompiles/ModExpPrecompilePreEip2565.cs index 1f5c23d3e36..a2bee188147 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/ModExpPrecompilePreEip2565.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/ModExpPrecompilePreEip2565.cs @@ -22,7 +22,7 @@ private ModExpPrecompilePreEip2565() { } - public Address Address { get; } = Address.FromNumber(5); + public static Address Address { get; } = Address.FromNumber(5); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/PointEvaluationPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/PointEvaluationPrecompile.cs index 7a25a6c47cf..60734490d18 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/PointEvaluationPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/PointEvaluationPrecompile.cs @@ -20,7 +20,7 @@ public class PointEvaluationPrecompile : IPrecompile .Concat(KzgPolynomialCommitments.BlsModulus.ToBigEndian()) .ToArray(); - public Address Address { get; } = Address.FromNumber(0x0a); + public static Address Address { get; } = Address.FromNumber(0x0a); public long BaseGasCost(IReleaseSpec releaseSpec) => 50000L; diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Ripemd160Precompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Ripemd160Precompile.cs index fced018d33a..8c357d917d1 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Ripemd160Precompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Ripemd160Precompile.cs @@ -23,7 +23,7 @@ private Ripemd160Precompile() // _ripemd.Initialize(); } - public Address Address { get; } = Address.FromNumber(3); + public static Address Address { get; } = Address.FromNumber(3); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Sha256Precompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Sha256Precompile.cs index fefba43a16e..fdb5dacf80b 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Sha256Precompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Sha256Precompile.cs @@ -30,7 +30,7 @@ private static void InitIfNeeded() } } - public Address Address { get; } = Address.FromNumber(2); + public static Address Address { get; } = Address.FromNumber(2); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254AddPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254AddPrecompile.cs index 3b0e64f6e89..4ce9259c3d8 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254AddPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254AddPrecompile.cs @@ -15,7 +15,7 @@ public class Bn254AddPrecompile : IPrecompile { public static IPrecompile Instance = new Bn254AddPrecompile(); - public Address Address { get; } = Address.FromNumber(6); + public static Address Address { get; } = Address.FromNumber(6); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254MulPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254MulPrecompile.cs index b14becb7039..64659eb0bbb 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254MulPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254MulPrecompile.cs @@ -15,7 +15,7 @@ public class Bn254MulPrecompile : IPrecompile { public static IPrecompile Instance = new Bn254MulPrecompile(); - public Address Address { get; } = Address.FromNumber(7); + public static Address Address { get; } = Address.FromNumber(7); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254PairingPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254PairingPrecompile.cs index a46bc55e061..8cff25969d4 100644 --- a/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254PairingPrecompile.cs +++ b/src/Nethermind/Nethermind.Evm/Precompiles/Snarks/Bn254PairingPrecompile.cs @@ -17,7 +17,7 @@ public class Bn254PairingPrecompile : IPrecompile public static IPrecompile Instance = new Bn254PairingPrecompile(); - public Address Address { get; } = Address.FromNumber(8); + public static Address Address { get; } = Address.FromNumber(8); public long BaseGasCost(IReleaseSpec releaseSpec) { diff --git a/src/Nethermind/Nethermind.Evm/VirtualMachine.cs b/src/Nethermind/Nethermind.Evm/VirtualMachine.cs index 9d70bd19e73..72099ed756a 100644 --- a/src/Nethermind/Nethermind.Evm/VirtualMachine.cs +++ b/src/Nethermind/Nethermind.Evm/VirtualMachine.cs @@ -519,29 +519,29 @@ private void InitializePrecompiledContracts() { _precompiles = new Dictionary { - [EcRecoverPrecompile.Instance.Address] = new(EcRecoverPrecompile.Instance), - [Sha256Precompile.Instance.Address] = new(Sha256Precompile.Instance), - [Ripemd160Precompile.Instance.Address] = new(Ripemd160Precompile.Instance), - [IdentityPrecompile.Instance.Address] = new(IdentityPrecompile.Instance), - - [Bn254AddPrecompile.Instance.Address] = new(Bn254AddPrecompile.Instance), - [Bn254MulPrecompile.Instance.Address] = new(Bn254MulPrecompile.Instance), - [Bn254PairingPrecompile.Instance.Address] = new(Bn254PairingPrecompile.Instance), - [ModExpPrecompile.Instance.Address] = new(ModExpPrecompile.Instance), - - [Blake2FPrecompile.Instance.Address] = new(Blake2FPrecompile.Instance), - - [G1AddPrecompile.Instance.Address] = new(G1AddPrecompile.Instance), - [G1MulPrecompile.Instance.Address] = new(G1MulPrecompile.Instance), - [G1MultiExpPrecompile.Instance.Address] = new(G1MultiExpPrecompile.Instance), - [G2AddPrecompile.Instance.Address] = new(G2AddPrecompile.Instance), - [G2MulPrecompile.Instance.Address] = new(G2MulPrecompile.Instance), - [G2MultiExpPrecompile.Instance.Address] = new(G2MultiExpPrecompile.Instance), - [PairingPrecompile.Instance.Address] = new(PairingPrecompile.Instance), - [MapToG1Precompile.Instance.Address] = new(MapToG1Precompile.Instance), - [MapToG2Precompile.Instance.Address] = new(MapToG2Precompile.Instance), - - [PointEvaluationPrecompile.Instance.Address] = new(PointEvaluationPrecompile.Instance), + [EcRecoverPrecompile.Address] = new(EcRecoverPrecompile.Instance), + [Sha256Precompile.Address] = new(Sha256Precompile.Instance), + [Ripemd160Precompile.Address] = new(Ripemd160Precompile.Instance), + [IdentityPrecompile.Address] = new(IdentityPrecompile.Instance), + + [Bn254AddPrecompile.Address] = new(Bn254AddPrecompile.Instance), + [Bn254MulPrecompile.Address] = new(Bn254MulPrecompile.Instance), + [Bn254PairingPrecompile.Address] = new(Bn254PairingPrecompile.Instance), + [ModExpPrecompile.Address] = new(ModExpPrecompile.Instance), + + [Blake2FPrecompile.Address] = new(Blake2FPrecompile.Instance), + + [G1AddPrecompile.Address] = new(G1AddPrecompile.Instance), + [G1MulPrecompile.Address] = new(G1MulPrecompile.Instance), + [G1MultiExpPrecompile.Address] = new(G1MultiExpPrecompile.Instance), + [G2AddPrecompile.Address] = new(G2AddPrecompile.Instance), + [G2MulPrecompile.Address] = new(G2MulPrecompile.Instance), + [G2MultiExpPrecompile.Address] = new(G2MultiExpPrecompile.Instance), + [PairingPrecompile.Address] = new(PairingPrecompile.Instance), + [MapToG1Precompile.Address] = new(MapToG1Precompile.Instance), + [MapToG2Precompile.Address] = new(MapToG2Precompile.Instance), + + [PointEvaluationPrecompile.Address] = new(PointEvaluationPrecompile.Instance), }; }