Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Add submodule to Math.Gmp.Native

* Change implementation of ModExp

* Add randomized test to ModExp

* fix Math.Gmp.Native submodule

* fix benchmarks

* Move benchmarks to RuntimeMoniker.NetCoreApp50)

* fix test pipelines with submodule

* Update module

* Update libs

* update arm64

* fix

* Set ModExpPrecompile2565.cs as a default implementation - ModExpPrecompile.cs

* Set ModExpPrecompile2565.cs as a default implementation - ModExpPrecompile.cs

* Use older ModExpPrecompile implementation in case of older spec

* Use an older ModExpPrecompile.Run implementation in case of an older spec

* Rename ModExpPrecompilePreEip2565 precompile. Always use faster precompile for actual excecution.

* Add MathGmp.Native tests

* Fix expLength too big issue

* avoid allocation

* updating MathGmp sub, arm64 libs - shamatar/secp256k1, osx-arm64 support (NethermindEth#2945)

* Updating Fast Sync config files (NethermindEth#2942)

Co-authored-by: matilote <matilote@users.noreply.github.com>

* Berlin guards (NethermindEth#2940)

* Add guard against wrong TxTypes

* Add TxPool Eip2930 guard

* Remove eip2718Transition as it makes no sense for it to be configurable. Use eip2930Transition instead

* Review fixes

* Add ModExp precompile benchmark

Co-authored-by: lukasz.rozmej <lukasz.rozmej@gmail.com>
Co-authored-by: Mateusz Jędrzejewski <33068017+matilote@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: matilote <matilote@users.noreply.github.com>
  • Loading branch information
5 people authored Apr 2, 2021
1 parent 44a4233 commit 541dba5
Show file tree
Hide file tree
Showing 84 changed files with 522 additions and 403 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/cc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
if: github.repository_owner == 'NethermindEth'
name: Nethermind Tests CC
env:
EXCLUDE_TEST_PROJECTS: '/p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[Nethermind.HashLib]*%2c[Nethermind.Core.Test]*%2c[Nethermind.Blockchain.Test]*%2c[Nethermind.DataMarketplace.Test]*%2c[Ethereum.Test.Base]*%2c[Nethermind.JsonRpc.Test]*%2c[Nethermind.Config.Test]*"'
EXCLUDE_TEST_PROJECTS: '/p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[Nethermind.HashLib]*%2c[*Test*]*"'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.3
- name: Unshallow fetching
run: git fetch --unshallow --progress --prune origin +refs/heads/*:refs/remotes/origin/*
- name: Updating submodules
run: git submodule update --init src/int256 src/rocksdb-sharp src/Dirichlet
run: git submodule update --init src/int256 src/rocksdb-sharp src/Dirichlet src/Math.Gmp.Native
- name: Installing Linux packages
run: |
sudo apt-get update
Expand Down Expand Up @@ -140,6 +140,9 @@ jobs:
- name: Nethermind.DataMarketplace.WebSockets.Test
run: |
dotnet test -c Release $EXCLUDE_TEST_PROJECTS src/Nethermind/Nethermind.DataMarketplace.WebSockets.Test
- name: MathGmp.Native
run: |
dotnet test -c Release $EXCLUDE_TEST_PROJECTS src/Math.Gmp.Native/MathGmp.Native.UnitTests
- name: Upload Codecov Report
uses: actions/upload-artifact@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
fetch-depth: 2
- name: Updating submodules
run: git submodule update --init src/int256 src/rocksdb-sharp src/Dirichlet src/tests
run: git submodule update --init src/int256 src/rocksdb-sharp src/Dirichlet src/tests src/Math.Gmp.Native
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/no-cc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v2.3.3
- name: Updating submodules
run: git submodule update --init src/rocksdb-sharp src/int256 src/Dirichlet
run: git submodule update --init src/rocksdb-sharp src/int256 src/Dirichlet src/Math.Gmp.Native
- name: Installing Linux packages
if: matrix.os == 'ubuntu-latest'
run: |
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
steps:
- uses: actions/checkout@v2.3.3
- name: Updating submodules
run: git submodule update --init src/rocksdb-sharp src/int256 src/Dirichlet
run: git submodule update --init src/rocksdb-sharp src/int256 src/Dirichlet src/Math.Gmp.Native
- name: Installing Linux packages
if: matrix.os == 'ubuntu-latest'
run: |
Expand Down Expand Up @@ -92,6 +92,9 @@ jobs:
- name: Nethermind.Logging.NLog.Test
run: |
dotnet test -c Release src/Nethermind/Nethermind.Logging.NLog.Test
- name: MathGmp.Native
run: |
dotnet test -c Release src/Math.Gmp.Native/MathGmp.Native.UnitTests
neth-tests3:
name: Nethermind Tests 3
runs-on: ${{ matrix.os }}
Expand All @@ -101,7 +104,7 @@ jobs:
steps:
- uses: actions/checkout@v2.3.3
- name: Updating submodules
run: git submodule update --init src/rocksdb-sharp src/int256 src/Dirichlet
run: git submodule update --init src/rocksdb-sharp src/int256 src/Dirichlet src/Math.Gmp.Native
- name: Installing Linux packages
if: matrix.os == 'ubuntu-latest'
run: |
Expand Down Expand Up @@ -143,7 +146,7 @@ jobs:
steps:
- uses: actions/checkout@v2.3.3
- name: Updating submodules
run: git submodule update --init src/rocksdb-sharp src/int256
run: git submodule update --init src/rocksdb-sharp src/int256 src/Math.Gmp.Native
- name: Installing Linux packages
if: matrix.os == 'ubuntu-latest'
run: |
Expand Down Expand Up @@ -176,7 +179,7 @@ jobs:
steps:
- uses: actions/checkout@v2.3.3
- name: Updating submodules
run: git submodule update --init src/rocksdb-sharp src/int256 src/Dirichlet
run: git submodule update --init src/rocksdb-sharp src/int256 src/Dirichlet src/Math.Gmp.Native
- name: Installing Linux packages
if: matrix.os == 'ubuntu-latest'
run: |
Expand Down Expand Up @@ -221,7 +224,7 @@ jobs:
steps:
- uses: actions/checkout@v2.3.3
- name: Updating submodules
run: git submodule update --init src/rocksdb-sharp src/int256 src/Dirichlet
run: git submodule update --init src/rocksdb-sharp src/int256 src/Dirichlet src/Math.Gmp.Native
- name: Installing Linux packages
if: matrix.os == 'ubuntu-latest'
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vault-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Clone docker-compose
run: git submodule update --init src/Dirichlet src/int256 src/rocksdb-sharp
run: git submodule update --init src/Dirichlet src/int256 src/rocksdb-sharp src/Math.Gmp.Native
- name: Installing Linux packages
run: |
sudo apt-get update
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@
[submodule "src/int256"]
path = src/int256
url = https://github.com/NethermindEth/int256.git
[submodule "src/Math.Gmp.Native"]
path = src/Math.Gmp.Native
url = https://github.com/NethermindEth/Math.Gmp.Native.git
branch = master
1 change: 1 addition & 0 deletions src/Math.Gmp.Native
Submodule Math.Gmp.Native added at 7589e1
7 changes: 7 additions & 0 deletions src/Nethermind/Benchmarks.sln
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nethermind.Consensus.Ethash
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nethermind.EthStats", "Nethermind.EthStats\Nethermind.EthStats.csproj", "{E55A12C1-578E-4B4D-B679-7DF47893D0F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MathGmp.Native", "..\Math.Gmp.Native\MathGmp.Native\MathGmp.Native.csproj", "{D4589F63-8AA4-4ED9-8A03-2556F697642A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -188,6 +190,10 @@ Global
{E55A12C1-578E-4B4D-B679-7DF47893D0F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E55A12C1-578E-4B4D-B679-7DF47893D0F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E55A12C1-578E-4B4D-B679-7DF47893D0F5}.Release|Any CPU.Build.0 = Release|Any CPU
{D4589F63-8AA4-4ED9-8A03-2556F697642A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D4589F63-8AA4-4ED9-8A03-2556F697642A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4589F63-8AA4-4ED9-8A03-2556F697642A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4589F63-8AA4-4ED9-8A03-2556F697642A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0F53A016-3141-4384-A81F-6444AD116E39} = {57CE427C-455B-47A9-85D6-CEF379DC00F6}
Expand All @@ -214,5 +220,6 @@ Global
{04E3BCD3-F131-4877-84B2-301BD414709F} = {57CE427C-455B-47A9-85D6-CEF379DC00F6}
{DDCC523C-E476-4799-824F-809AAA5D5B4E} = {57CE427C-455B-47A9-85D6-CEF379DC00F6}
{E55A12C1-578E-4B4D-B679-7DF47893D0F5} = {57CE427C-455B-47A9-85D6-CEF379DC00F6}
{D4589F63-8AA4-4ED9-8A03-2556F697642A} = {57CE427C-455B-47A9-85D6-CEF379DC00F6}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
namespace Nethermind.Benchmarks.Core
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class ByteArrayToHexBenchmarks
{
private byte[] array = Bytes.FromHexString("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef");
Expand All @@ -45,4 +45,4 @@ public string HexMateA()
return Convert.ToHexString(array, HexFormattingOptions.Lowercase);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace Nethermind.Benchmarks.Core
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class BytesCompareBenchmarks
{
private byte[] _a;
Expand Down Expand Up @@ -63,4 +63,4 @@ public bool Current()
return Bytes.AreEqual(_a, _b);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace Nethermind.Benchmarks.Core
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class BytesIsZeroBenchmarks
{
private byte[] _a;
Expand Down Expand Up @@ -59,4 +59,4 @@ public bool Current()
return _a.IsZero();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace Nethermind.Benchmarks.Core
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class BytesPadBenchmarks
{
private byte[] _a;
Expand Down Expand Up @@ -57,4 +57,4 @@ public void Setup()
return (_a.PadLeft(32), _a.PadRight(32));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
namespace Nethermind.Benchmarks.Core
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class BytesReverseBenchmarks
{
private byte[] _a;
Expand Down Expand Up @@ -97,4 +97,4 @@ public void Avx2Version()
}
}
}
}
}
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.Benchmark/Core/FromHexBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace Nethermind.Benchmarks.Core
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class FromHexBenchmarks
{
private string array = Bytes.FromHexString("0123456789abcdef").ToHexString();
Expand All @@ -44,4 +44,4 @@ public byte[] Improved()
return Bytes.FromHexStringOld(array);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Nethermind.Benchmarks.Core
{
[MemoryDiagnoser]
[DisassemblyDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class Keccak256Benchmarks
{
private static HashLib.Crypto.SHA3.Keccak256 _hash = HashFactory.Crypto.SHA3.CreateKeccak256();
Expand Down Expand Up @@ -80,4 +80,4 @@ public byte[] HashLib()
return _hash.ComputeBytes(_a).GetBytes();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace Nethermind.Benchmarks.Core
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class Keccak512Benchmarks
{
private static HashLib.Crypto.SHA3.Keccak512 _hash = HashFactory.Crypto.SHA3.CreateKeccak512();
Expand Down Expand Up @@ -67,4 +67,4 @@ public byte[] HashLib()
return _hash.ComputeBytes(_a).GetBytes();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace Nethermind.Benchmarks.Evm
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class BitwiseAndBenchmark
{
[GlobalSetup]
Expand Down Expand Up @@ -60,4 +60,4 @@ public void Improved()
Vector.BitwiseAnd(aVec, bVec).CopyTo(c);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace Nethermind.Benchmarks.Evm
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class BitwiseNotBenchmark
{
[GlobalSetup]
Expand Down Expand Up @@ -62,4 +62,4 @@ public void Improved()
Vector.Xor(aVec, new Vector<byte>(BytesMax32)).CopyTo(c);
}
}
}
}
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.Benchmark/Evm/BitwiseOrBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace Nethermind.Benchmarks.Evm
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class BitwiseOrBenchmark
{
[GlobalSetup]
Expand Down Expand Up @@ -58,4 +58,4 @@ public void Improved()
Vector.BitwiseOr(aVec, bVec).CopyTo(c);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace Nethermind.Benchmarks.Evm
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class BitwiseXorBenchmark
{
[GlobalSetup]
Expand Down Expand Up @@ -58,4 +58,4 @@ public void Improved()
Vector.Xor(aVec, bVec).CopyTo(c);
}
}
}
}
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.Benchmark/Evm/Blake2Benchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Nethermind.Benchmarks.Evm
{
[MemoryDiagnoser]
[DisassemblyDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class Blake2Benchmark
{
private Blake2Compression _blake2Compression = new Blake2Compression();
Expand Down Expand Up @@ -59,4 +59,4 @@ public Span<byte> Improved()
return result;
}
}
}
}
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.Benchmark/Evm/EcRecoverBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace Nethermind.Benchmarks.Evm
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class EcRecoverBenchmark
{
[GlobalSetup]
Expand All @@ -41,4 +41,4 @@ public bool Current()
throw new NotImplementedException();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace Nethermind.Benchmarks.Evm
{
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
[SimpleJob(RuntimeMoniker.NetCoreApp50)]
public class IntrinsicGasCalculatorBenchmark
{
[GlobalSetup]
Expand All @@ -41,4 +41,4 @@ public bool Current()
throw new NotImplementedException();
}
}
}
}
Loading

0 comments on commit 541dba5

Please sign in to comment.