Skip to content

Commit

Permalink
Blake2Fast submodule #816
Browse files Browse the repository at this point in the history
  • Loading branch information
spetz committed Aug 23, 2019
1 parent 12f6ec1 commit 198f962
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
path = src/rocksdb-sharp
url = https://github.com/NethermindEth/rocksdb-sharp.git
branch = master
[submodule "src/Blake2Fast"]
path = src/Blake2Fast
url = git@github.com:saucecontrol/Blake2Fast.git
1 change: 1 addition & 0 deletions src/Blake2Fast
Submodule Blake2Fast added at 603a7b
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.Evm/Nethermind.Evm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<LangVersion>7.2</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Blake2Fast\src\Blake2Fast\Blake2Fast.csproj" />
<ProjectReference Include="..\..\Dirichlet\Nethermind.Dirichlet.Numerics\Nethermind.Dirichlet.Numerics.csproj" />
<ProjectReference Include="..\Nethermind.Core\Nethermind.Core.csproj" />
<ProjectReference Include="..\Nethermind.Store\Nethermind.Store.csproj">
Expand All @@ -13,7 +14,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="1.2.2" />
<PackageReference Include="SauceControl.Blake2Fast" Version="1.0.0" />
<PackageReference Include="System.Buffers" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
*/

using Nethermind.Core;
using Nethermind.Core.Crypto.ZkSnarks;
using Nethermind.Core.Extensions;
using Nethermind.Core.Specs;
using SauceControl.Blake2Fast;

Expand All @@ -27,7 +25,7 @@ namespace Nethermind.Evm.Precompiles
public class Blake2BPrecompiledContract : IPrecompiledContract
{
public static readonly IPrecompiledContract Instance = new Blake2BPrecompiledContract();

public Address Address { get; } = Address.FromNumber(9);

public long BaseGasCost(IReleaseSpec releaseSpec) => 0;
Expand All @@ -37,8 +35,13 @@ public class Blake2BPrecompiledContract : IPrecompiledContract
public (byte[], bool) Run(byte[] inputData)
{
Metrics.Blake2BPrecompile++;
var context = default(Blake2bContext);
//TODO: compression function
// context.Init(digestLength, key);
// context.compress();
var result = context.Finish();

return (inputData, true);
return (result, true);
}
}
}
9 changes: 9 additions & 0 deletions src/Nethermind/Nethermind.sln
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nethermind.DataMarketplace.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nethermind.Runner.Test", "Nethermind.Runner.Test\Nethermind.Runner.Test.csproj", "{47B19E0D-5DED-436D-9BFB-17EF887634D3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cryptography", "Cryptography", "{B5079215-2D69-4345-8B57-0057F3806D32}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blake2Fast", "..\Blake2Fast\src\Blake2Fast\Blake2Fast.csproj", "{28A17F0D-B148-4185-9DE5-74DD5A2589F3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -450,6 +454,10 @@ Global
{47B19E0D-5DED-436D-9BFB-17EF887634D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47B19E0D-5DED-436D-9BFB-17EF887634D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47B19E0D-5DED-436D-9BFB-17EF887634D3}.Release|Any CPU.Build.0 = Release|Any CPU
{28A17F0D-B148-4185-9DE5-74DD5A2589F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28A17F0D-B148-4185-9DE5-74DD5A2589F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28A17F0D-B148-4185-9DE5-74DD5A2589F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28A17F0D-B148-4185-9DE5-74DD5A2589F3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -499,6 +507,7 @@ Global
{6708432B-C547-44B0-ADCB-8396B916B26F} = {568F4A96-2AA2-4B80-A58A-36950E13A242}
{5A0D6198-E28A-4B19-AA61-9F983B6031D3} = {568F4A96-2AA2-4B80-A58A-36950E13A242}
{47B19E0D-5DED-436D-9BFB-17EF887634D3} = {1564814A-27F8-40A3-943E-8E950D5EE17D}
{28A17F0D-B148-4185-9DE5-74DD5A2589F3} = {B5079215-2D69-4345-8B57-0057F3806D32}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {092CA5E3-6180-4ED7-A3CB-9B57FAC2AA85}
Expand Down

0 comments on commit 198f962

Please sign in to comment.