From 81959df7c502a49269be123ca1b1df139f47dc10 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Fri, 3 Jul 2026 11:55:30 +0200 Subject: [PATCH] Clear Gloas payload received on reset --- .../src/proto_array_fork_choice.rs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/consensus/proto_array/src/proto_array_fork_choice.rs b/consensus/proto_array/src/proto_array_fork_choice.rs index 7aee9b16264..1681665f2b5 100644 --- a/consensus/proto_array/src/proto_array_fork_choice.rs +++ b/consensus/proto_array/src/proto_array_fork_choice.rs @@ -858,6 +858,10 @@ impl ProtoArrayForkChoice { .get_mut(node_index) .ok_or("unreachable index out of bounds in proto_array nodes")?; + if let ProtoNode::V29(node) = node { + node.payload_received = false; + } + match node.execution_status() { Ok(ExecutionStatus::Invalid(block_hash)) => { if let ProtoNode::V17(node) = node { @@ -1347,6 +1351,43 @@ mod test_compute_deltas { vec![Slot::new(0); count] } + #[test] + fn set_all_blocks_to_optimistic_clears_payload_received() { + let mut spec = MainnetEthSpec::default_spec(); + spec.gloas_fork_epoch = Some(Epoch::new(0)); + let genesis_slot = Slot::new(0); + let finalized_root = Hash256::from_low_u64_be(1); + let finalized_checkpoint = Checkpoint { + epoch: Epoch::new(0), + root: finalized_root, + }; + let junk_shuffling_id = + AttestationShufflingId::from_components(Epoch::new(0), Hash256::zero()); + + let mut fc = ProtoArrayForkChoice::new::( + genesis_slot, + genesis_slot, + Hash256::zero(), + finalized_checkpoint, + finalized_checkpoint, + junk_shuffling_id.clone(), + junk_shuffling_id, + ExecutionStatus::irrelevant(), + Some(ExecutionBlockHash::zero()), + Some(ExecutionBlockHash::repeat_byte(1)), + 0, + &spec, + ) + .unwrap(); + + fc.on_valid_payload_envelope_received(finalized_root) + .unwrap(); + assert!(fc.is_payload_received(&finalized_root)); + + fc.set_all_blocks_to_optimistic::().unwrap(); + assert!(!fc.is_payload_received(&finalized_root)); + } + #[test] fn finalized_descendant() { let spec = MainnetEthSpec::default_spec();