Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ public void DecodeFcuV3Request_spec_layout_roundtrips_parent_beacon_block_root()
public void DecodeFcuV4Request_spec_layout_roundtrips_parent_beacon_block_root_and_slot_number()
{
ulong expectedSlot = 0xAABBCCDD_11223344UL;
ulong expectedTargetGasLimit = 0x0123456789ABCDEFUL;

ForkchoiceUpdatedRequestWire wire = new()
{
Expand All @@ -552,6 +553,7 @@ public void DecodeFcuV4Request_spec_layout_roundtrips_parent_beacon_block_root_a
Withdrawals = [],
ParentBeaconBlockRoot = TestItem.KeccakE,
SlotNumber = expectedSlot,
TargetGasLimit = expectedTargetGasLimit,
}
]
};
Expand All @@ -569,6 +571,8 @@ public void DecodeFcuV4Request_spec_layout_roundtrips_parent_beacon_block_root_a
"parent_beacon_block_root must round-trip in V4 as a fixed Bytes32");
attrs.SlotNumber.Should().Be(expectedSlot,
"slot_number must be decoded from the fixed uint64 that follows parent_beacon_block_root");
attrs.TargetGasLimit.Should().Be((long)expectedTargetGasLimit,
"target_gas_limit must be decoded from the fixed uint64 that follows slot_number");
attrs.SuggestedFeeRecipient.Should().Be(TestItem.AddressB);
}

Expand Down
9 changes: 6 additions & 3 deletions src/Nethermind/Nethermind.Merge.Plugin/SszRest/SszCodec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,22 +288,25 @@ internal static PayloadAttributes PayloadAttributesFromWire(PayloadAttributesWir
BuildPayloadAttributes(pa.Timestamp, pa.PrevRandao, pa.SuggestedFeeRecipient,
withdrawals: pa.Withdrawals.ToDomain(),
parentBeaconBlockRoot: pa.ParentBeaconBlockRoot,
slotNumber: pa.SlotNumber);
slotNumber: pa.SlotNumber,
targetGasLimit: (long)pa.TargetGasLimit);

private static PayloadAttributes BuildPayloadAttributes(
ulong timestamp,
Hash256 prevRandao,
Address suggestedFeeRecipient,
Withdrawal[]? withdrawals = null,
Hash256? parentBeaconBlockRoot = null,
ulong? slotNumber = null) => new()
ulong? slotNumber = null,
long? targetGasLimit = null) => new()
{
Timestamp = timestamp,
PrevRandao = prevRandao,
SuggestedFeeRecipient = suggestedFeeRecipient,
Withdrawals = withdrawals,
ParentBeaconBlockRoot = parentBeaconBlockRoot,
SlotNumber = slotNumber
SlotNumber = slotNumber,
TargetGasLimit = targetGasLimit
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public partial struct PayloadAttributesWire
[SszList(16)] public SszWithdrawal[]? Withdrawals { get; set; }
public Hash256 ParentBeaconBlockRoot { get; set; }
public ulong SlotNumber { get; set; }
public ulong TargetGasLimit { get; set; }
}

[SszContainer]
Expand Down
Loading