From dd673e3255c0933562930b18af0a8fc470d70f55 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Sun, 22 Mar 2026 00:13:47 +0100 Subject: [PATCH 1/2] store: better typing for Interval matching --- src/lean_spec/subspecs/forkchoice/store.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lean_spec/subspecs/forkchoice/store.py b/src/lean_spec/subspecs/forkchoice/store.py index fbeb1130..c64fc73f 100644 --- a/src/lean_spec/subspecs/forkchoice/store.py +++ b/src/lean_spec/subspecs/forkchoice/store.py @@ -1037,11 +1037,11 @@ def tick_interval( Tuple of (new store with advanced time, list of new signed aggregated attestation). """ # Advance time by one interval - store = self.model_copy(update={"time": Interval(int(self.time) + 1)}) + store = self.model_copy(update={"time": self.time + 1}) current_interval = store.time % INTERVALS_PER_SLOT new_aggregates: list[SignedAggregatedAttestation] = [] - match int(current_interval): + match current_interval: case 0 if has_proposal: store = store.accept_new_attestations() case 2 if is_aggregator: From be1c4d319f85983e2110937950d4f3c38030d8a7 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Sun, 22 Mar 2026 00:18:38 +0100 Subject: [PATCH 2/2] fix --- src/lean_spec/subspecs/forkchoice/store.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/lean_spec/subspecs/forkchoice/store.py b/src/lean_spec/subspecs/forkchoice/store.py index c64fc73f..81a36dc4 100644 --- a/src/lean_spec/subspecs/forkchoice/store.py +++ b/src/lean_spec/subspecs/forkchoice/store.py @@ -1037,19 +1037,18 @@ def tick_interval( Tuple of (new store with advanced time, list of new signed aggregated attestation). """ # Advance time by one interval - store = self.model_copy(update={"time": self.time + 1}) + store = self.model_copy(update={"time": self.time + Interval(1)}) current_interval = store.time % INTERVALS_PER_SLOT new_aggregates: list[SignedAggregatedAttestation] = [] - match current_interval: - case 0 if has_proposal: - store = store.accept_new_attestations() - case 2 if is_aggregator: - store, new_aggregates = store.aggregate() - case 3: - store = store.update_safe_target() - case 4: - store = store.accept_new_attestations() + if current_interval == Interval(0) and has_proposal: + store = store.accept_new_attestations() + elif current_interval == Interval(2) and is_aggregator: + store, new_aggregates = store.aggregate() + elif current_interval == Interval(3): + store = store.update_safe_target() + elif current_interval == Interval(4): + store = store.accept_new_attestations() return store, new_aggregates