-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
R#eceipt decoder
- Loading branch information
Showing
28 changed files
with
1,395 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
global using NUnit.Framework; |
68 changes: 68 additions & 0 deletions
68
src/Nethermind/Nethermind.Era.Test/Nethermind.Era1.Test.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.msbuild"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
<PackageReference Include="NSubstitute" /> | ||
<PackageReference Include="NUnit" /> | ||
<PackageReference Include="NUnit.Analyzers"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="NUnit3TestAdapter" /> | ||
<PackageReference Include="Snappier" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Nethermind.History.Era1\Nethermind.Era1.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="data\checksums.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="data\mainnet-00000-096013b1.era1"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="data\mainnet-00001-440820aa.era1"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="data\mainnet-00002-f324ec16.era1"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="data\mainnet-00003-627b9dce.era1"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="data\mainnet-00004-08ecec94.era1"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="data\mainnet-00005-e2d2b70f.era1"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="data\mainnet-00006-286c2ca5.era1"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="data\mainnet-00007-c9075184.era1"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="data\mainnet-00008-bfd52f39.era1"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="data\raw"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using Nethermind.Core; | ||
using Nethermind.Era1; | ||
using Nethermind.Serialization.Rlp; | ||
using NUnit.Framework.Constraints; | ||
using Snappier; | ||
namespace Nethermind.Era.Test; | ||
|
||
public class Tests | ||
{ | ||
[SetUp] | ||
public void Setup() | ||
{ | ||
} | ||
|
||
[Test] | ||
public async Task Test1() | ||
{ | ||
var ms = new MemoryStream(); | ||
var sut = await E2Store.FromStream(ms); | ||
|
||
sut.WriteEntry(E2Store.TypeVersion, Array.Empty<byte>()); | ||
} | ||
|
||
[Test] | ||
public async Task TestHistoryImport() | ||
{ | ||
var sut = await EraIterator.Create("data/mainnet-00000-096013b1.era1"); | ||
|
||
await foreach ((Block b, TxReceipt[] r) in sut) | ||
{ | ||
} | ||
} | ||
|
||
[Test] | ||
public async Task TestE2Store() | ||
{ | ||
var sut = await E2Store.FromStream(File.OpenRead("data/mainnet-00000-096013b1.era1")); | ||
|
||
var testData = Convert.FromHexString("FF060000734E6150705900B00000FCED3AFBFB0310F901F8A0007A010088A01DCC4DE8DEC75D7AAB85B567B6CCD41AD312451B948A7413F0A142FD40D4934794004A4200F043A09F88BE00EEE1114EDFD9372F52560AAB3980A142EFE8B5B39A09644075084275A056E81F171BCC55A6FF8345E692C0F86E5B48E01B996CADC001622FB5E363B421A0567A210004B9014A7800FE0100FE0100FE0100B601002C83020000808347E7C480808082C90134880000000000000000843B9ACA00"); | ||
|
||
var compressedHeaders = await sut.FindAll(E2Store.TypeCompressedHeader); | ||
|
||
foreach (var cb in compressedHeaders) | ||
{ | ||
try | ||
{ | ||
void Test() | ||
{ | ||
var output = new byte[1000]; | ||
var decompressionStream = new SnappyStream(cb.ValueAsStream(), System.IO.Compression.CompressionMode.Decompress); | ||
var x = decompressionStream.Read(output, 0, output.Length); | ||
var s = new Span<byte>(output, 0, x); | ||
var decoded = Rlp.Decode<BlockHeader>(s); | ||
|
||
} | ||
Test(); | ||
|
||
} | ||
catch (InvalidDataException) | ||
{ | ||
continue; | ||
} | ||
|
||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
0x4c098bf3d1e599a2657ca2856811d885afd2ff3417f073348a0b3ba0989d0a23 | ||
0xeb76936ffb61580f077d6c5145575dc1326b1f21aed8ddd04430c9c726ad823f | ||
0x67a1a249dd63ac7fab0292a27c210597cb053afb87d859f70d8470958f50910b | ||
0x2d96d98253775ba8ea505622634a31b44fc7333e564f9c1f40beba44864cb170 | ||
0x5f58d700d9374e61283c7f2b463130e11347da23c4682e69972605a2ca637fe0 | ||
0x86390cdd139909397b7003aef2ad1863f65cfe2626aeb105ef1cb24e06c37d69 | ||
0xe82aec7edfdb310a1259c251af5ae3697194aa30537bd825d97970525a6a4dd0 | ||
0x1d20d98da322db6ff5caaa699ffaf1fe5b3ef8e9cd9188d44500633e0814ed9c | ||
0x8fce912ffcdda36a0408cf2bf0777f576624f8b4e1547f2dd59656c0d29dde06 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+577 Bytes
src/Nethermind/Nethermind.Era.Test/data/mainnet-00008-bfd52f39.era1
Binary file not shown.
Binary file not shown.
Oops, something went wrong.