-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial draft implementation of MCOPY * added a couple of tests * put flag activation for mcopy * updated tests * ws fix * reverted unused change * Minor fixes and refactors : - fixed gas miscalculation - refactored expansion gas calculations * update tests * Add Eip5656 configs glue to chainspec loader * - Updated opcode value - Added one extra test - Update implementation to match opcode change * - update name tests * - update GetName * - Aligned MCOPY implementation with Ben's Stack optimizations * Add hive tests for Eip5656-MCOPY * - turn off Ethereum tests untill tests are merged
- Loading branch information
Showing
21 changed files
with
276 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using System.Collections.Generic; | ||
using Ethereum.Test.Base; | ||
using NUnit.Framework; | ||
|
||
namespace Ethereum.Blockchain.Test; | ||
|
||
[TestFixture] | ||
[Parallelizable(ParallelScope.All)] | ||
public class Eip5656Tests : GeneralStateTestBase | ||
{ | ||
// wait untill Eip5656 tests are merged to de-comment this | ||
|
||
// [TestCaseSource(nameof(LoadTests))] | ||
// public void Test(GeneralStateTest test) | ||
// { | ||
// Assert.True(RunTest(test).Pass); | ||
// } | ||
|
||
public static IEnumerable<GeneralStateTest> LoadTests() | ||
{ | ||
var loader = new TestsSourceLoader(new LoadEipTestsStrategy(), "stEIP5656-MCOPY"); | ||
return (IEnumerable<GeneralStateTest>)loader.LoadTests(); | ||
} | ||
} |
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,72 @@ | ||
// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Ethereum.Test.Base.Interfaces; | ||
|
||
namespace Ethereum.Test.Base | ||
{ | ||
public class LoadEipTestsStrategy : ITestLoadStrategy | ||
{ | ||
public IEnumerable<IEthereumTest> Load(string testsDirectoryName, string wildcard = null) | ||
{ | ||
IEnumerable<string> testDirs; | ||
if (!Path.IsPathRooted(testsDirectoryName)) | ||
{ | ||
string testsDirectory = GetGeneralStateTestsDirectory(); | ||
|
||
|
||
testDirs = Directory.EnumerateDirectories(testsDirectory, testsDirectoryName, new EnumerationOptions { RecurseSubdirectories = true }); | ||
} | ||
else | ||
{ | ||
testDirs = new[] { testsDirectoryName }; | ||
} | ||
|
||
List<GeneralStateTest> testJsons = new(); | ||
foreach (string testDir in testDirs) | ||
{ | ||
testJsons.AddRange(LoadTestsFromDirectory(testDir, wildcard)); | ||
} | ||
|
||
return testJsons; | ||
} | ||
|
||
private string GetGeneralStateTestsDirectory() | ||
{ | ||
char pathSeparator = Path.AltDirectorySeparatorChar; | ||
string currentDirectory = AppDomain.CurrentDomain.BaseDirectory; | ||
|
||
return currentDirectory.Remove(currentDirectory.LastIndexOf("src")) + $"src{pathSeparator}tests{pathSeparator}EipTests{pathSeparator}StateTests"; | ||
} | ||
|
||
private IEnumerable<GeneralStateTest> LoadTestsFromDirectory(string testDir, string wildcard) | ||
{ | ||
List<GeneralStateTest> testsByName = new(); | ||
IEnumerable<string> testFiles = Directory.EnumerateFiles(testDir); | ||
|
||
foreach (string testFile in testFiles) | ||
{ | ||
FileTestsSource fileTestsSource = new(testFile, wildcard); | ||
try | ||
{ | ||
var tests = fileTestsSource.LoadGeneralStateTests(); | ||
foreach (GeneralStateTest blockchainTest in tests) | ||
{ | ||
blockchainTest.Category = testDir; | ||
} | ||
|
||
testsByName.AddRange(tests); | ||
} | ||
catch (Exception e) | ||
{ | ||
testsByName.Add(new GeneralStateTest { Name = testFile, LoadFailure = $"Failed to load: {e}" }); | ||
} | ||
} | ||
|
||
return testsByName; | ||
} | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.