Skip to content

Update Eip4844Tests.cs #7740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
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
39 changes: 39 additions & 0 deletions src/Nethermind/Nethermind.Evm.Test/Eip4844Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ public class Eip4844Tests : VirtualMachineTestsBase
protected override long BlockNumber => MainnetSpecProvider.ParisBlockNumber;
protected override ulong Timestamp => MainnetSpecProvider.CancunBlockTimestamp;

// Define hard fork labels and their corresponding block timestamps
private static readonly Dictionary<string, ulong> HardForkLabels = new Dictionary<string, ulong>
{
{ "cancun", 0x65687fd0 }
};

// Define EIP timestamps
private static readonly Dictionary<string, long> EipTimestamps = new Dictionary<string, long>
{
{ "EIP4844", MainnetSpecProvider.CancunBlockTimestamp }
// Add other EIPs and their timestamps here if needed
};


[TestCase(0, 0, Description = "Should return 0 when no hashes")]
[TestCase(1, 1, Description = "Should return 0 when out of range")]
[TestCase(2, 1, Description = "Should return 0 when way out of range")]
Expand Down Expand Up @@ -56,4 +70,29 @@ protected override TestAllTracerWithOutput CreateTracer()
tracer.IsTracingAccess = false;
return tracer;
}
public static void ValidateHardForks()
{
var activatedEips = new HashSet<string>();

foreach (var label in HardForkLabels)
{
var eipKeysWithSameTimestamp = EipTimestamps
.Where(eip => eip.Value == label.Value)
.Select(eip => eip.Key)
.ToList();

if (eipKeysWithSameTimestamp.Count > 1)
{
throw new InvalidOperationException($"Conflicting EIP activations found: {string.Join(", ", eipKeysWithSameTimestamp)}");
}

if (eipKeysWithSameTimestamp.Any())
{
activatedEips.Add(eipKeysWithSameTimestamp.First());
}
}

// Additional logic for processing activated EIPs can be added here.
}

}