Skip to content

Commit e82a104

Browse files
tcoratgerclaude
andauthored
refactor(fork-choice): enumerate payload key union without copying values (#1137)
Promoting pending aggregate proofs iterated a throwaway merged dict built only to walk its keys, copying every set value just to discard it. Enumerate the key union directly with an order-preserving construction. The new enumeration yields keys in exactly the same order as the old merged dict: all counted-pool keys in insertion order, then pending-pool keys not already present, in their insertion order. This preserves the LMD determinism invariant, where equal-slot ties resolve by first-seen insertion order. A set union would not preserve that order. just check passes. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 11dc4b6 commit e82a104

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/lean_spec/spec/forks/lstar/fork_choice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ def accept_new_attestations(self, store: LstarStore) -> LstarStore:
869869
merged_aggregated_payloads = {
870870
attestation_data: known_payloads.get(attestation_data, set())
871871
| new_payloads.get(attestation_data, set())
872-
for attestation_data in {**known_payloads, **new_payloads}
872+
for attestation_data in dict.fromkeys((*known_payloads, *new_payloads))
873873
}
874874

875875
# Promote into the counted pool and clear the pending one.

0 commit comments

Comments
 (0)