From d4fccb9d026475236a6ac5f75d94720e67b48837 Mon Sep 17 00:00:00 2001 From: anshalshukla Date: Thu, 25 Jun 2026 01:44:22 +0530 Subject: [PATCH] simplify block building --- .../spec/forks/lstar/block_production.py | 4 ++++ .../spec/forks/lstar/validator_duties.py | 17 ----------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/lean_spec/spec/forks/lstar/block_production.py b/src/lean_spec/spec/forks/lstar/block_production.py index 77602b218..a3e7ee7ac 100644 --- a/src/lean_spec/spec/forks/lstar/block_production.py +++ b/src/lean_spec/spec/forks/lstar/block_production.py @@ -148,6 +148,10 @@ def build_block( if attestation_data.head.root not in known_block_roots: continue + # Skip votes whose source slot is not the current justified checkpoint. + if attestation_data.source.slot != current_justified_checkpoint.slot: + continue + # Reject votes that do not match this chain. # # This also rejects any checkpoint past the chain view. diff --git a/src/lean_spec/spec/forks/lstar/validator_duties.py b/src/lean_spec/spec/forks/lstar/validator_duties.py index 22f7ca8b0..4b6520ade 100644 --- a/src/lean_spec/spec/forks/lstar/validator_duties.py +++ b/src/lean_spec/spec/forks/lstar/validator_duties.py @@ -170,23 +170,6 @@ def produce_block_with_signatures( aggregated_payloads=store.latest_known_aggregated_payloads, ) - # Invariant: the produced block must close any justified divergence. - # - # The store may have advanced its justified checkpoint from attestations - # on a minority fork that the head state never processed. The fixed-point - # loop above must incorporate those attestations from the pool, advancing - # the block's justified checkpoint to at least match the store. - # - # Without this, other nodes processing the block would never see the - # justification advance, degrading consensus liveness: only nodes that - # happened to receive the minority fork would know justification moved. - block_justified = final_post_state.latest_justified.slot - store_justified = store.latest_justified.slot - assert block_justified >= store_justified, ( - f"Produced block justified={block_justified} < store justified=" - f"{store_justified}. Fixed-point attestation loop did not converge." - ) - # Compute block hash for storage. block_hash = hash_tree_root(final_block)