Skip to content

Commit

Permalink
Update precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
flcl42 committed Jun 23, 2023
1 parent 3f8de70 commit 7e4d348
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.Core.Test/AddressTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void Of_contract(long nonce, string expectedAddress)

[TestCaseSource(nameof(PointEvaluationPrecompileTestCases))]
public bool Is_PointEvaluationPrecompile_properly_activated(IReleaseSpec spec) =>
Address.FromNumber(0x14).IsPrecompile(spec);
Address.FromNumber(0x0a).IsPrecompile(spec);

public static IEnumerable PointEvaluationPrecompileTestCases
{
Expand Down
38 changes: 19 additions & 19 deletions src/Nethermind/Nethermind.Evm/Precompiles/AddressExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ public static bool IsPrecompile(this Address address, IReleaseSpec releaseSpec)
int precompileCode = address[19];
return precompileCode switch
{
1 => true,
2 => true,
3 => true,
4 => true,
5 => releaseSpec.ModExpEnabled,
6 => releaseSpec.Bn128Enabled,
7 => releaseSpec.Bn128Enabled,
8 => releaseSpec.Bn128Enabled,
9 => releaseSpec.BlakeEnabled,
10 => releaseSpec.Bls381Enabled,
11 => releaseSpec.Bls381Enabled,
12 => releaseSpec.Bls381Enabled,
13 => releaseSpec.Bls381Enabled,
14 => releaseSpec.Bls381Enabled,
15 => releaseSpec.Bls381Enabled,
16 => releaseSpec.Bls381Enabled,
17 => releaseSpec.Bls381Enabled,
18 => releaseSpec.Bls381Enabled,
20 => releaseSpec.IsEip4844Enabled,
0x01 => true,
0x02 => true,
0x03 => true,
0x04 => true,
0x05 => releaseSpec.ModExpEnabled,
0x06 => releaseSpec.Bn128Enabled,
0x07 => releaseSpec.Bn128Enabled,
0x08 => releaseSpec.Bn128Enabled,
0x09 => releaseSpec.BlakeEnabled,
0x0a => releaseSpec.IsEip4844Enabled,
0x0c => releaseSpec.Bls381Enabled,
0x0d => releaseSpec.Bls381Enabled,
0x0e => releaseSpec.Bls381Enabled,
0x0f => releaseSpec.Bls381Enabled,
0x10 => releaseSpec.Bls381Enabled,
0x11 => releaseSpec.Bls381Enabled,
0x12 => releaseSpec.Bls381Enabled,
0x13 => releaseSpec.Bls381Enabled,
0x14 => releaseSpec.Bls381Enabled,
_ => false
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private G1AddPrecompile()
{
}

public Address Address { get; } = Address.FromNumber(10);
public Address Address { get; } = Address.FromNumber(0x0c);

public long BaseGasCost(IReleaseSpec releaseSpec)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private G1MulPrecompile()
{
}

public Address Address { get; } = Address.FromNumber(11);
public Address Address { get; } = Address.FromNumber(0x0d);

public long BaseGasCost(IReleaseSpec releaseSpec)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private G1MultiExpPrecompile()
{
}

public Address Address { get; } = Address.FromNumber(12);
public Address Address { get; } = Address.FromNumber(0x0e);

public long BaseGasCost(IReleaseSpec releaseSpec)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private G2AddPrecompile()
{
}

public Address Address { get; } = Address.FromNumber(13);
public Address Address { get; } = Address.FromNumber(0x0f);

public long BaseGasCost(IReleaseSpec releaseSpec)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private G2MulPrecompile()
{
}

public Address Address { get; } = Address.FromNumber(14);
public Address Address { get; } = Address.FromNumber(0x10);

public long BaseGasCost(IReleaseSpec releaseSpec)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private G2MultiExpPrecompile()
{
}

public Address Address { get; } = Address.FromNumber(15);
public Address Address { get; } = Address.FromNumber(0x11);

public long BaseGasCost(IReleaseSpec releaseSpec)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private MapToG1Precompile()
{
}

public Address Address { get; } = Address.FromNumber(17);
public Address Address { get; } = Address.FromNumber(0x13);

public long BaseGasCost(IReleaseSpec releaseSpec)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private MapToG2Precompile()
{
}

public Address Address { get; } = Address.FromNumber(18);
public Address Address { get; } = Address.FromNumber(0x14);

public long BaseGasCost(IReleaseSpec releaseSpec)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class PairingPrecompile : IPrecompile

private PairingPrecompile() { }

public Address Address { get; } = Address.FromNumber(16);
public Address Address { get; } = Address.FromNumber(0x12);

public static IPrecompile Instance = new PairingPrecompile();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class PointEvaluationPrecompile : IPrecompile
.Concat(KzgPolynomialCommitments.BlsModulus.ToBigEndian())
.ToArray();

public Address Address { get; } = Address.FromNumber(0x14);
public Address Address { get; } = Address.FromNumber(0x0a);

public long BaseGasCost(IReleaseSpec releaseSpec) => 50000L;

Expand Down

0 comments on commit 7e4d348

Please sign in to comment.