Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
11 changes: 7 additions & 4 deletions .github/workflows/run-nethtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -623,16 +623,19 @@ jobs:
# lane carried for ethereum/execution-specs#3582, #3406, the EIP-7610 collision scenario
# and the EIP-7928 boundary at test_tx_gas_limit are no longer needed.
#
# What remains is the aggregate inclusion-list size cap, which is ours rather than the
# spec's: these cases carry an ~131 KB initcode or calldata payload, 16x the per-list
# MAX_BYTES_PER_INCLUSION_LIST of EIP-7805, so engine_newPayloadV6 answers -32602 before
# validating and the fixture cannot demonstrate the rejection it expects.
# What remains is the inclusion-list size cap: these cases carry a single transaction over
# the per-list MAX_BYTES_PER_INCLUSION_LIST of EIP-7805, which fits no committee position,
# so engine_newPayloadV6 answers -32602 before validating and the fixture cannot
# demonstrate the rejection it expects.
'test_contract_creating_tx.*inclusion_list'
'test_tx_gas_limit_cap_contract_creation.*inclusion_list'
'test_oversized_initcode_tx_no_state_gas.*inclusion_list'
'test_max_initcode_size.*inclusion_list'
'test_calldata_floor_exceeding_tx_gas_limit_cap.*inclusion_list'
'test_tx_gas_limit_cap_authorized_tx.*inclusion_list'
'test_transaction_validity_type_.*inclusion_list.*multiple_access_lists_multiple_storage_keys'
'TestCreateTxGasBoundary::test_create_tx_gas_boundary.*inclusion_list'
'test_intrinsic_execution_gas_exceeds_cap.*inclusion_list'
# The inclusion-list variant keeps rlp_modifier while clearing header_verify, so header
# blob-gas fields are never recomputed. Fix pending as ethereum/execution-specs#3406.
'test_invalid_block_blob_count.*inclusion_list'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,24 @@
#nullable enable annotations

using Ethereum.Test.Base;
using Nethermind.JsonRpc;
using Nethermind.Merge.Plugin.Data;
using Nethermind.Serialization.Json;
using NUnit.Framework;

namespace Ethereum.Basic.Test;

// EIP-7805 compliance is reported twice: by engine_newPayloadV6 and again by the fork-choice update to
// that head, and a fixture's inclusionListSatisfied is the expectation for both.
// EIP-7805 inclusion is checked apart from execution: engine_newPayloadV6 returns the check's identifier, and a
// fixture's inclusionListSatisfied is the expectation for the verdict that check completes with.
[TestFixture]
public class EngineInclusionListExpectationTests
{
private static readonly IJsonSerializer _serializer = new EthereumJsonSerializer();

[TestCase("{}", true, ExpectedResult = null, TestName = "Silent fixture accepts any answer")]
[TestCase("""{"inclusionListSatisfied": true}""", true, ExpectedResult = null, TestName = "Reported value matches")]
[TestCase("""{"inclusionListSatisfied": true}""", false, ExpectedResult = "engine_forkchoiceUpdatedV5 returned VALID and reported inclusionListSatisfied=False, expected True", TestName = "Reported value contradicts")]
[TestCase("""{"inclusionListSatisfied": true}""", null, ExpectedResult = "engine_forkchoiceUpdatedV5 returned VALID and reported inclusionListSatisfied=null, expected True", TestName = "Field absent where one was expected")]
[TestCase("""{"inclusionListSatisfied": false}""", true, ExpectedResult = "engine_forkchoiceUpdatedV5 returned VALID and reported inclusionListSatisfied=True, expected False", TestName = "Unsatisfied expectation contradicts")]
public string? Forkchoice_response_is_checked_against_the_fixture(string json, bool? reported) =>
BlockchainTestBase.DescribeFcuInclusionListMismatch(ForkchoiceResponse(reported), _serializer.Deserialize<TestEngineNewPayloadsJson>(json), fcuVersion: 5);

// A head that never became VALID reports no compliance either, so the message must not read as an
// EIP-7805 contradiction.
[Test]
public void Non_valid_head_is_named_rather_than_blamed_on_the_inclusion_list() =>
Assert.That(BlockchainTestBase.DescribeFcuInclusionListMismatch(
ForkchoiceResponse(null, PayloadStatus.Syncing),
_serializer.Deserialize<TestEngineNewPayloadsJson>("""{"inclusionListSatisfied": true}"""), fcuVersion: 5),
Is.EqualTo("engine_forkchoiceUpdatedV5 returned SYNCING and reported inclusionListSatisfied=null, expected True"));

// A version that cannot carry the field must fail rather than read as an absent one.
[Test]
public void Fork_choice_version_that_cannot_report_compliance_is_a_mismatch() =>
Assert.That(BlockchainTestBase.DescribeFcuInclusionListMismatch(
ResultWrapper<ForkchoiceUpdatedV1Result>.Success(new ForkchoiceUpdatedV1Result()),
_serializer.Deserialize<TestEngineNewPayloadsJson>("""{"inclusionListSatisfied": true}"""), fcuVersion: 4),
Does.StartWith("engine_forkchoiceUpdatedV4 answered with ForkchoiceUpdatedV1Result, which cannot report inclusionListSatisfied"));

private static ResultWrapper<ForkchoiceUpdatedV2Result> ForkchoiceResponse(bool? inclusionListSatisfied, string status = PayloadStatus.Valid) =>
ResultWrapper<ForkchoiceUpdatedV2Result>.Success(new ForkchoiceUpdatedV2Result
{
PayloadStatus = new PayloadStatusV2 { Status = status, InclusionListSatisfied = inclusionListSatisfied }
});
[TestCase("{}", true, ExpectedResult = null, TestName = "Silent fixture accepts any verdict")]
[TestCase("{}", null, ExpectedResult = null, TestName = "Silent fixture accepts a missing verdict")]
[TestCase("""{"inclusionListSatisfied": true}""", true, ExpectedResult = null, TestName = "Verdict matches")]
[TestCase("""{"inclusionListSatisfied": true}""", false, ExpectedResult = "engine_newPayloadV6 inclusion check reported inclusionListSatisfied=False, expected True", TestName = "Verdict contradicts")]
[TestCase("""{"inclusionListSatisfied": false}""", true, ExpectedResult = "engine_newPayloadV6 inclusion check reported inclusionListSatisfied=True, expected False", TestName = "Unsatisfied expectation contradicts")]
[TestCase("""{"inclusionListSatisfied": false}""", null, ExpectedResult = "engine_newPayloadV6 inclusion check reported inclusionListSatisfied=null, expected False", TestName = "Missing verdict is never taken as either verdict")]
public string? Inclusion_verdict_is_checked_against_the_fixture(string json, bool? verdict) =>
BlockchainTestBase.DescribeInclusionVerdictMismatch(_serializer.Deserialize<TestEngineNewPayloadsJson>(json), verdict, payloadVersion: 6);
}
23 changes: 23 additions & 0 deletions src/Nethermind/Ethereum.Basic.Test/EngineNewPayloadParamsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-FileCopyrightText: 2026 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System.Text.Json;
using Ethereum.Test.Base;
using NUnit.Framework;

namespace Ethereum.Basic.Test;

[TestFixture]
public class EngineNewPayloadParamsTests
{
[TestCase("""["0xpayload",["0xh"],"0xroot",["0xreq"],["0x00","0x01","0x02","0x03","0x04","0x05","0x06","0x07","0x08","0x09","0x0a","0x0b","0x0c","0x0d","0x0e","0x0f","0x10"]]""", 5, 4, ExpectedResult = """["0xpayload",["0xh"],"0xroot",["0xreq"]]""", TestName = "Version below 6 passes through")]
[TestCase("""["0xpayload",["0xh"],"0xroot",["0xreq"],[["0x00","0x10"],["0x01"],["0x02"],["0x03"],["0x04"],["0x05"],["0x06"],["0x07"],["0x08"],["0x09"],["0x0a"],["0x0b"],["0x0c"],["0x0d"],["0x0e"],["0x0f"]],[]]""", 6, 6, ExpectedResult = """["0xpayload",["0xh"],"0xroot",["0xreq"],[["0x00","0x10"],["0x01"],["0x02"],["0x03"],["0x04"],["0x05"],["0x06"],["0x07"],["0x08"],["0x09"],["0x0a"],["0x0b"],["0x0c"],["0x0d"],["0x0e"],["0x0f"]],[]]""", TestName = "Nested inclusion lists pass through")]
[TestCase("""["0xpayload",["0xh"],"0xroot",["0xreq"],["0x00","0x01","0x02","0x03","0x04","0x05","0x06","0x07","0x08","0x09","0x0a","0x0b","0x0c","0x0d","0x0e","0x0f","0x10"]]""", 6, 6, ExpectedResult = """["0xpayload",["0xh"],"0xroot",["0xreq"],[["0x00","0x10"],["0x01"],["0x02"],["0x03"],["0x04"],["0x05"],["0x06"],["0x07"],["0x08"],["0x09"],["0x0a"],["0x0b"],["0x0c"],["0x0d"],["0x0e"],["0x0f"]],[]]""", TestName = "Flat list goes round-robin into 16 positions")]
[TestCase("""["0xpayload",["0xh"],"0xroot",["0xreq"],[]]""", 6, 6, ExpectedResult = """["0xpayload",["0xh"],"0xroot",["0xreq"],[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]],[]]""", TestName = "Empty flat list gives 16 empty positions")]
public string Flat_fixture_inclusion_list_is_split_across_committee_positions(string parameters, int payloadVersion, int paramCount)
{
using JsonDocument document = JsonDocument.Parse(parameters);
JsonElement[] elements = [.. document.RootElement.EnumerateArray()];
return "[" + string.Join(",", BlockchainTestBase.NewPayloadParams(elements, paramCount, payloadVersion)) + "]";
}
}
Loading
Loading