Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 10 additions & 4 deletions src/Nethermind/Ethereum.Test.Base/JsonToEthereumTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,22 @@ private static List<TransactionTest> ConvertTransactionTests(Dictionary<string,
return tests;
}

// The shape fallback deliberately wraps deserialization only: letting it span conversion
// made an unmapped fork name resurface as an unrelated error against the trimmed shape.
public static IEnumerable<BlockchainTest> ConvertToBlockchainTests(string json)
{
try { return ConvertToBlockchainTests(_serializer.Deserialize<Dictionary<string, BlockchainTestJson>>(json)); }
catch (Exception) { return ConvertToBlockchainTests(CoerceFromHalf(_serializer.Deserialize<Dictionary<string, HalfBlockchainTestJson>>(json))); }
Dictionary<string, BlockchainTestJson> tests;
try { tests = _serializer.Deserialize<Dictionary<string, BlockchainTestJson>>(json); }
catch (Exception) { tests = CoerceFromHalf(_serializer.Deserialize<Dictionary<string, HalfBlockchainTestJson>>(json)); }
Comment thread
Marchhill marked this conversation as resolved.
Outdated
return ConvertToBlockchainTests(tests);
}

public static IEnumerable<BlockchainTest> ConvertToBlockchainTests(ReadOnlySpan<byte> json)
{
try { return ConvertToBlockchainTests(_serializer.Deserialize<Dictionary<string, BlockchainTestJson>>(json)); }
catch (Exception) { return ConvertToBlockchainTests(CoerceFromHalf(_serializer.Deserialize<Dictionary<string, HalfBlockchainTestJson>>(json))); }
Dictionary<string, BlockchainTestJson> tests;
try { tests = _serializer.Deserialize<Dictionary<string, BlockchainTestJson>>(json); }
catch (Exception) { tests = CoerceFromHalf(_serializer.Deserialize<Dictionary<string, HalfBlockchainTestJson>>(json)); }
return ConvertToBlockchainTests(tests);
}
Comment thread
Marchhill marked this conversation as resolved.

// Some BAL fixtures use the trimmed HalfBlockchainTestJson shape; coerce on demand.
Expand Down
27 changes: 27 additions & 0 deletions src/Nethermind/Nethermind.Specs.Test/SpecNameParserTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-FileCopyrightText: 2026 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using Nethermind.Core.Specs;
using NUnit.Framework;

namespace Nethermind.Specs.Test;

public class SpecNameParserTests
{
[Test]
public void Parse_maps_Bogota_to_the_frame_transactions_fork()
{
IReleaseSpec spec = SpecNameParser.Parse("Bogota");

Assert.That(spec.IsEip8141Enabled, Is.True);
Comment thread
Marchhill marked this conversation as resolved.
Outdated
}

[Test]
public void Parse_names_the_offending_fork_when_unmapped()
{
NotSupportedException e = Assert.Throws<NotSupportedException>(() => SpecNameParser.Parse("NotAFork"));

Assert.That(e.Message, Does.Contain("NotAFork"));
}
}
3 changes: 2 additions & 1 deletion src/Nethermind/Nethermind.Specs/SpecNameParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ private static IReleaseSpec ParseUncached(string specName)
"BPO4" => BPO4.Instance,
"BPO5" => BPO5.Instance,
"Amsterdam" => Amsterdam.Instance,
_ => throw new NotSupportedException()
"Bogota" => Bogota.Instance,
_ => throw new NotSupportedException($"Unknown fork name '{specName}'")
Comment thread
Marchhill marked this conversation as resolved.
Outdated
};
}
}
Expand Down
Loading