Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
4e49901
sketch
marcindsobczak Apr 16, 2024
eb20e15
draft
marcindsobczak Apr 16, 2024
53b7a71
modify holesky genesis
marcindsobczak Apr 18, 2024
72e6cfd
modify test blockchain logic
marcindsobczak Apr 18, 2024
5229077
another part of impl
marcindsobczak Apr 18, 2024
348020a
adjust TestBlockchain
marcindsobczak Apr 23, 2024
fcbeb1a
fix
marcindsobczak Apr 24, 2024
808fa0b
clean
marcindsobczak Apr 24, 2024
48eb08d
add automated withdrawals
marcindsobczak Apr 24, 2024
3cd6edd
add simple txs, await block processing
marcindsobczak Apr 24, 2024
a2d835a
clean
marcindsobczak Apr 16, 2024
b8ee632
clean
marcindsobczak Apr 24, 2024
a9a6c10
add configurable test cases and gas limit options
marcindsobczak Apr 25, 2024
4fc4e24
better namings
marcindsobczak Apr 25, 2024
3465a75
draft keccak256
marcindsobczak Apr 29, 2024
58507cd
Merge remote-tracking branch 'origin/master' into feature/requests_ge…
marcindsobczak Apr 29, 2024
deafcc8
keccak up
marcindsobczak May 1, 2024
2bc327c
updates
marcindsobczak May 3, 2024
51e588b
Merge branch 'master' into feature/requests_generator_v2
MarekM25 May 3, 2024
e53322e
moved chainspec to program args
MarekM25 May 3, 2024
9de9458
test cases to arguments
MarekM25 May 3, 2024
f66e2b4
reverted holesky changes, create dedicated chainspec
MarekM25 May 3, 2024
66b9461
added test case attribute
MarekM25 May 3, 2024
4074f15
cleanup
MarekM25 May 3, 2024
5c31be9
metadata generator
MarekM25 May 3, 2024
a1217b5
gasLimits to enum
MarekM25 May 3, 2024
7ebcb3a
add metadata
MarekM25 May 3, 2024
3573958
started working on precompile
MarekM25 May 5, 2024
d4bc0dc
contract deployment logic
marcindsobczak May 7, 2024
75c04d8
Merge branch 'feature/requests_generator_v2' of https://github.com/Ne…
marcindsobczak May 7, 2024
0c679c6
quick fix
marcindsobczak May 7, 2024
8abc242
clean
marcindsobczak May 7, 2024
0d25cc3
refactors
marcindsobczak May 7, 2024
edac8a4
finished keccak256
marcindsobczak May 7, 2024
2581028
skip processing last generated block
marcindsobczak May 7, 2024
03f6dc6
refactoring + new test cases
marcindsobczak May 8, 2024
f7331be
more refactors&cleanup
marcindsobczak May 8, 2024
61ca3e5
refactor
marcindsobczak May 8, 2024
e360c9c
fix
marcindsobczak May 8, 2024
e386821
add CallerPop
marcindsobczak May 8, 2024
e8e7046
fix Push0 test case
marcindsobczak May 8, 2024
1132d10
more cases
marcindsobczak May 8, 2024
86228e1
more Sha cases
marcindsobczak May 8, 2024
7c586f1
add SStore, polish metadata
marcindsobczak May 10, 2024
9ca2697
add new cases, refactor
marcindsobczak May 14, 2024
f1f0a32
add more test cases
marcindsobczak May 14, 2024
bf02269
add more cases
marcindsobczak May 14, 2024
d446918
add precompile test cases
marcindsobczak May 15, 2024
613e8bc
add Blake2 precompile
marcindsobczak May 15, 2024
55cfd97
add PointEvaluation precompile 1st scenario
marcindsobczak May 17, 2024
67e05ff
add Modexp precompile
marcindsobczak May 21, 2024
03bb3e0
metadata
marcindsobczak May 23, 2024
57b183e
add ecAdd precompile testcase
marcindsobczak May 28, 2024
69de730
add ecMul precompile
marcindsobczak May 29, 2024
245a613
first cases for ecPairing precompile
marcindsobczak Jun 3, 2024
368174a
more ecPairing
marcindsobczak Jun 4, 2024
cfdec1c
clean
marcindsobczak Jun 4, 2024
4be132d
add modexp vulnerability test cases
marcindsobczak Jun 5, 2024
e69ed67
fix modexp generator
marcindsobczak Jun 5, 2024
a415815
one more modexp vulnerability testcase
marcindsobczak Jun 5, 2024
7a1822c
fix Blake2 generator
marcindsobczak Jun 5, 2024
03379dd
fix ecPairing
marcindsobczak Jun 5, 2024
6304416
fix precompiles test cases generator
marcindsobczak Jun 7, 2024
021940d
some TStore cases
marcindsobczak Jun 27, 2024
28fb1f2
one more file
marcindsobczak Jun 27, 2024
8548404
cosmetics
marcindsobczak Jun 27, 2024
54a3fd0
cleaning
marcindsobczak Jun 27, 2024
7a91f7e
Merge remote-tracking branch 'origin/master' into feature/requests_ge…
marcindsobczak Jul 16, 2024
279c701
Merge remote-tracking branch 'origin/master' into feature/requests_ge…
marcindsobczak Jul 16, 2024
6fbd299
undo holesky json modification
marcindsobczak Jul 17, 2024
b3d7325
clean commented test cases
marcindsobczak Jul 17, 2024
e014e2c
cut unused things from generator
marcindsobczak Jul 17, 2024
2742ba4
clean test case classes
marcindsobczak Jul 17, 2024
1e03eec
remove (broken) balance checking case
marcindsobczak Jul 17, 2024
249f55c
cosmetics
marcindsobczak Jul 17, 2024
3b62949
clean one more place
marcindsobczak Jul 17, 2024
477e476
fix ethereum tests?
marcindsobczak Jul 18, 2024
7dbfb66
Secp256r1 benchmarks
alexb5dh Jul 19, 2024
f0e19f0
Always enable RIP-7212
alexb5dh Jul 19, 2024
991ea78
Disable precompile caching
alexb5dh Jul 22, 2024
b766605
Code cleanup
alexb5dh Jul 24, 2024
a260038
Revert temporary changes
alexb5dh Jul 24, 2024
1695aa1
Merge branch 'feature/request_generator_v2/secp256r1' into feature/re…
alexb5dh Jul 24, 2024
c046e53
Merge remote-tracking branch 'origin/master' into feature/requests_ge…
marcindsobczak Jul 25, 2024
df0df15
Merge branch 'feature/requests_generator_v2' of https://github.com/Ne…
marcindsobczak Jul 25, 2024
645049b
polish descriptions
marcindsobczak Jul 25, 2024
56f6694
draft
marcindsobczak Jul 31, 2024
b83ee20
Merge remote-tracking branch 'origin/feature/requests_generator_v2' i…
marcindsobczak Aug 14, 2024
46b9e33
cleaning
marcindsobczak Aug 14, 2024
4b602b3
Merge remote-tracking branch 'origin/master' into feature/requests_ge…
marcindsobczak Aug 20, 2024
954fb9b
Merge remote-tracking branch 'origin/feature/requests_generator_v2' i…
marcindsobczak Aug 29, 2024
e9b50bf
first cases
marcindsobczak Sep 2, 2024
9de7ca7
Merge remote-tracking branch 'origin/master' into feature/requests_ge…
marcindsobczak Oct 7, 2024
fc758db
address changes to common classes
marcindsobczak Oct 7, 2024
533b6e4
Merge remote-tracking branch 'origin/master' into feature/requests_ge…
marcindsobczak Oct 15, 2024
5797a08
Merge remote-tracking branch 'origin/master' into feature/requests_ge…
marcindsobczak Nov 5, 2024
803324e
dr2
marcindsobczak Dec 3, 2024
9fa5d9c
more cases
marcindsobczak Dec 4, 2024
0bbb51a
new case
marcindsobczak Dec 4, 2024
f562a7b
another case
marcindsobczak Dec 10, 2024
3d96df6
new cases
marcindsobczak Jan 8, 2025
a0a9712
modexp without cache
marcindsobczak May 5, 2025
c22b583
new test cases
marcindsobczak Jun 3, 2025
228e6ca
uncachable modexp
marcindsobczak Jun 3, 2025
bf90198
new cases (pawel)
marcindsobczak Jun 3, 2025
89345fd
ecrec
marcindsobczak Jun 4, 2025
e5d3435
modexp
marcindsobczak Jun 4, 2025
7c42e66
cases
marcindsobczak Jun 4, 2025
8c8d02a
ecrec
marcindsobczak Jun 5, 2025
f422984
Merge branch 'feature/requests_generator_v2_modexp_vulnerabilities_ex…
marcindsobczak Jun 5, 2025
838beeb
postmerge
marcindsobczak Jun 5, 2025
b3c34fd
Revert "cleaning"
marcindsobczak Jun 5, 2025
7f6e742
Merge branch 'feature/requests_generator_v2_vulnerabilitiesv2' into f…
marcindsobczak Jun 5, 2025
d2d2b6b
Merge remote-tracking branch 'origin/master' into feature/requests_ge…
marcindsobczak Jun 5, 2025
e26de3e
post merge fixes
marcindsobczak Jun 6, 2025
ceb8d57
cleaning
marcindsobczak Jun 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<PackageVersion Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.15.0" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.1" />
<PackageVersion Include="Ckzg.Bindings" Version="2.1.1.1401" />
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="CommunityToolkit.HighPerformance" Version="8.4.0" />
<PackageVersion Include="ConcurrentHashSet" Version="1.3.0" />
<PackageVersion Include="Crc32.NET" Version="1.2.0" />
Expand Down
65 changes: 35 additions & 30 deletions src/Nethermind/Nethermind.Core.Test/Blockchain/TestBlockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ ISealer Sealer
public class Configuration
{
public bool SuggestGenesisOnStart = true;
public bool KeepStateEmptyAtInit = false;
public bool AddBlockOnStart = true;
public UInt256 AccountInitialValue = InitialValue;
public long SlotTime = 1;
Expand All @@ -187,45 +188,49 @@ protected virtual async Task<TestBlockchain> Build(Action<ContainerBuilder>? con
IWorldState state = _fromContainer.WorldStateManager.GlobalWorldState;

ISpecProvider specProvider = SpecProvider;
// Eip4788 precompile state account
if (specProvider?.GenesisSpec?.IsBeaconBlockRootAvailable ?? false)
{
state.CreateAccount(SpecProvider.GenesisSpec.Eip4788ContractAddress!, 1);
}
Configuration testConfiguration = _fromContainer.Configuration;

// Eip2935
if (specProvider?.GenesisSpec?.IsBlockHashInStateAvailable ?? false)
if (!testConfiguration.KeepStateEmptyAtInit)
{
state.CreateAccount(SpecProvider.GenesisSpec.Eip2935ContractAddress, 1);
}
// Eip4788 precompile state account
if (specProvider?.GenesisSpec?.IsBeaconBlockRootAvailable ?? false)
{
state.CreateAccount(SpecProvider.GenesisSpec.Eip4788ContractAddress!, 1);
}

Configuration testConfiguration = _fromContainer.Configuration;
state.CreateAccount(TestItem.AddressA, testConfiguration.AccountInitialValue);
state.CreateAccount(TestItem.AddressB, testConfiguration.AccountInitialValue);
state.CreateAccount(TestItem.AddressC, testConfiguration.AccountInitialValue);
// Eip2935
if (specProvider?.GenesisSpec?.IsBlockHashInStateAvailable ?? false)
{
state.CreateAccount(SpecProvider.GenesisSpec.Eip2935ContractAddress, 1);
}

InitialStateMutator?.Invoke(state);
state.CreateAccount(TestItem.AddressA, testConfiguration.AccountInitialValue);
state.CreateAccount(TestItem.AddressB, testConfiguration.AccountInitialValue);
state.CreateAccount(TestItem.AddressC, testConfiguration.AccountInitialValue);

byte[] code = Bytes.FromHexString("0xabcd");
state.InsertCode(TestItem.AddressA, code, SpecProvider.GenesisSpec);
state.Set(new StorageCell(TestItem.AddressA, UInt256.One), Bytes.FromHexString("0xabcdef"));
InitialStateMutator?.Invoke(state);

IReleaseSpec? finalSpec = specProvider?.GetFinalSpec();
byte[] code = Bytes.FromHexString("0xabcd");
state.InsertCode(TestItem.AddressA, code, SpecProvider.GenesisSpec);
state.Set(new StorageCell(TestItem.AddressA, UInt256.One), Bytes.FromHexString("0xabcdef"));

if (finalSpec?.WithdrawalsEnabled is true)
{
state.CreateAccount(Eip7002Constants.WithdrawalRequestPredeployAddress, 0, Eip7002TestConstants.Nonce);
state.InsertCode(Eip7002Constants.WithdrawalRequestPredeployAddress, Eip7002TestConstants.CodeHash, Eip7002TestConstants.Code, SpecProvider.GenesisSpec);
}
IReleaseSpec? finalSpec = specProvider?.GetFinalSpec();

if (finalSpec?.ConsolidationRequestsEnabled is true)
{
state.CreateAccount(Eip7251Constants.ConsolidationRequestPredeployAddress, 0, Eip7251TestConstants.Nonce);
state.InsertCode(Eip7251Constants.ConsolidationRequestPredeployAddress, Eip7251TestConstants.CodeHash, Eip7251TestConstants.Code, SpecProvider.GenesisSpec);
}
if (finalSpec?.WithdrawalsEnabled is true)
{
state.CreateAccount(Eip7002Constants.WithdrawalRequestPredeployAddress, 0, Eip7002TestConstants.Nonce);
state.InsertCode(Eip7002Constants.WithdrawalRequestPredeployAddress, Eip7002TestConstants.CodeHash, Eip7002TestConstants.Code, SpecProvider.GenesisSpec);
}

state.Commit(SpecProvider.GenesisSpec);
state.CommitTree(0);
if (finalSpec?.ConsolidationRequestsEnabled is true)
{
state.CreateAccount(Eip7251Constants.ConsolidationRequestPredeployAddress, 0, Eip7251TestConstants.Nonce);
state.InsertCode(Eip7251Constants.ConsolidationRequestPredeployAddress, Eip7251TestConstants.CodeHash, Eip7251TestConstants.Code, SpecProvider.GenesisSpec);
}

state.Commit(SpecProvider.GenesisSpec);
state.CommitTree(0);
}

BlockProcessor = CreateBlockProcessor(WorldStateManager.GlobalWorldState);

Expand Down
30 changes: 30 additions & 0 deletions tools/EngineRequestsGenerator/BlockGasVariants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

namespace EngineRequestsGenerator;

public static class BlockGasVariants
{
public static long[] Variants =
[
30_000_000,
40_000_000,
50_000_000,
60_000_000,
70_000_000,
80_000_000,
90_000_000,
100_000_000,
110_000_000,
120_000_000,
130_000_000,
140_000_000,
150_000_000,
175_000_000,
200_000_000,
300_000_000,
400_000_000,
500_000_000,
1_000_000_000
];
}
102 changes: 102 additions & 0 deletions tools/EngineRequestsGenerator/ContractFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using Nethermind.Core.Extensions;
using Nethermind.Evm;

namespace EngineRequestsGenerator;

public static class ContractFactory
{
public static List<byte> GenerateCodeToDeployContract(List<byte> codeToDeploy)
{
List<byte> initCode = GenerateInitCode(codeToDeploy);
List<byte> byteCode = new();

for (long i = 0; i < initCode.Count; i += 32)
{
List<byte> currentWord = i == 0
? initCode.Slice(0, initCode.Count % 32)
: initCode.Slice((int)i - 32 + initCode.Count % 32, 32);
Comment on lines +18 to +20
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Spans

byteCode.Add((byte)(Instruction.PUSH1 + (byte)currentWord.Count - 1));
byteCode.AddRange(currentWord);

// push memory offset - i
byte[] memoryOffset = i.ToBigEndianByteArrayWithoutLeadingZeros();
if (memoryOffset is [0])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not compare i here?

{
byteCode.Add((byte)Instruction.PUSH0);
}
else
{
byteCode.Add((byte)(Instruction.PUSH1 + (byte)memoryOffset.Length - 1));
byteCode.AddRange(memoryOffset);
}

// save in memory
byteCode.Add((byte)Instruction.MSTORE);
}

// push size of init code to read from memory
byte[] sizeOfInitCode = initCode.Count.ToByteArray().WithoutLeadingZeros().ToArray();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ToArray() x2

byteCode.Add((byte)(Instruction.PUSH1 + (byte)sizeOfInitCode.Length - 1));
byteCode.AddRange(sizeOfInitCode);

// offset in memory
byteCode.Add((byte)(Instruction.PUSH1));
byteCode.AddRange(new[] { (byte)(32 - (initCode.Count % 32)) });

// 0 wei to send
byteCode.Add((byte)Instruction.PUSH0);

byteCode.Add((byte)Instruction.CREATE);

Console.WriteLine($"size of prepared code: {byteCode.Count}");

return byteCode;
}

private static List<byte> GenerateInitCode(List<byte> codeToDeploy)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same stuff here

{
List<byte> initCode = new();

for (long i = 0; i < codeToDeploy.Count; i += 32)
{
List<byte> currentWord = i == 0
? codeToDeploy.Slice(0, codeToDeploy.Count % 32)
: codeToDeploy.Slice((int)i - 32 + codeToDeploy.Count % 32, 32);

initCode.Add((byte)(Instruction.PUSH1 + (byte)currentWord.Count - 1));
initCode.AddRange(currentWord);

// push memory offset - i
byte[] memoryOffset = i.ToBigEndianByteArrayWithoutLeadingZeros();
if (memoryOffset is [0])
{
initCode.Add((byte)Instruction.PUSH0);
}
else
{
initCode.Add((byte)(Instruction.PUSH1 + (byte)memoryOffset.Length - 1));
initCode.AddRange(memoryOffset);
}

// save in memory
initCode.Add((byte)Instruction.MSTORE);
}

// push size of memory read
byte[] sizeOfCodeToDeploy = codeToDeploy.Count.ToByteArray().WithoutLeadingZeros().ToArray();
initCode.Add((byte)(Instruction.PUSH1 + (byte)sizeOfCodeToDeploy.Length - 1));
initCode.AddRange(sizeOfCodeToDeploy);

// push memory offset
initCode.Add((byte)(Instruction.PUSH1));
initCode.AddRange(new[] { (byte)(32 - (codeToDeploy.Count % 32)) });

// add return opcode
initCode.Add((byte)(Instruction.RETURN));

return initCode;
}
}
23 changes: 23 additions & 0 deletions tools/EngineRequestsGenerator/EngineRequestsGenerator.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\src\Nethermind\Nethermind.Core\Nethermind.Core.csproj" />
<ProjectReference Include="..\..\src\Nethermind\Nethermind.Merge.Plugin\Nethermind.Merge.Plugin.csproj" />
<ProjectReference Include="..\..\src\Nethermind\Nethermind.Merge.Plugin.Test\Nethermind.Merge.Plugin.Test.csproj" />
<PackageReference Include="CommandLineParser" />
</ItemGroup>

<ItemGroup>
<None Update="benchmarks_chainspec.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<StartupObject>EngineRequestsGenerator.Program</StartupObject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
61 changes: 61 additions & 0 deletions tools/EngineRequestsGenerator/MetadataGenerator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System.Reflection;
using Nethermind.Serialization.Json;
using Newtonsoft.Json;

namespace EngineRequestsGenerator;

public class MetadataGenerator
{
private readonly string _outputPath;

public MetadataGenerator(string outputPath)
{
_outputPath = outputPath;
}

public async Task GenerateAll()
{
TestCase[] testCases = (TestCase[])Enum.GetValues(typeof(TestCase));
var metadatas = new Metadata[testCases.Length];
for (int i = 0; i < testCases.Length; ++i)
{
metadatas[i] = GetOne(testCases[i]);
}
var str = JsonConvert.SerializeObject(metadatas);

await File.WriteAllTextAsync($"{_outputPath}/metadata.json", str);
Comment on lines +27 to +29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serialize directly to file


}

private Metadata GetOne(TestCase testCase)
{
TestCaseMetadataAttribute metadataAttribute = GetTestCaseMetadata(testCase);
var metadata = new Metadata(Enum.GetName(typeof(TestCase),testCase)!, metadataAttribute.Title, metadataAttribute.Description);
return metadata;
}

public class Metadata(string name, string title, string description)
{
public string Name { get; set; } = name;

public string Title { get; set; } = title;

public string Description { get; set; } = description;

public long[] GasUsed = BlockGasVariants.Variants;
}

static TestCaseMetadataAttribute GetTestCaseMetadata(TestCase testCase)
{
FieldInfo? fieldInfo = testCase.GetType().GetField(testCase.ToString());
TestCaseMetadataAttribute[]? attributes = (TestCaseMetadataAttribute[])fieldInfo!.GetCustomAttributes(typeof(TestCaseMetadataAttribute), false);

if (attributes == null || attributes.Length != 1)
throw new ArgumentException("Incorrect amount of attributes found");

return attributes[0];
Comment on lines +56 to +59
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (attributes == null || attributes.Length != 1)
throw new ArgumentException("Incorrect amount of attributes found");
return attributes[0];
return attributes?.First() ?? throw new ArgumentException("Incorrect amount of attributes found");

}
}
48 changes: 48 additions & 0 deletions tools/EngineRequestsGenerator/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using CommandLine;

namespace EngineRequestsGenerator;


public static class Program
{
public class Options
{
[Option('c', "chainspecpath", Required = false, HelpText = "Path to chainspec used to generate tests")]
public string? ChainspecPath { get; set; }

[Option('t', "testcase", Required = false, HelpText = "Title of the test case")]
public string? TestCaseName { get; set; }

[Option('o', "outputPath", Required = false, HelpText = "Output folder path")]
public string? OutputPath { get; set; }

[Option('m', "generateMetadataOnly", Required = false, HelpText = "Generating only metadata for test cases")]
public bool GenerateMetadata { get; set; }
}

static async Task Main(string[] args)
{
ParserResult<Options> result = Parser.Default.ParseArguments<Options>(args);
if (result is Parsed<Options> options)
await Run(options.Value);
}

private static async Task Run(Options options)
{
if (!options.GenerateMetadata)
{
var foundTestCase = Enum.TryParse(options.TestCaseName, out TestCase testCase);
if (!foundTestCase)
throw new ArgumentException($"Test case {options.TestCaseName} not found");

var testCaseGenerator = new TestCaseGenerator(options.ChainspecPath!, testCase, options.OutputPath!);
await testCaseGenerator.Generate();
}

if (options.GenerateMetadata)
{
MetadataGenerator metadataGenerator = new(options.OutputPath!);
await metadataGenerator.GenerateAll();
}
}
}
13 changes: 13 additions & 0 deletions tools/EngineRequestsGenerator/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"EngineRequestsGenerator": {
"commandName": "Project",
"commandLineArgs": "-c benchmarks_chainspec.json -t Modexp215GasExpHeavy -o testcases"
},
"MetadataGenerator": {
"commandName": "Project",
"commandLineArgs": "-m true -o testcases"
}
}
}
Loading