From e34c591b028ecf3db76e97611b7c6654c57397a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Thu, 11 Jun 2026 16:32:45 -0300 Subject: [PATCH 1/2] fix: don't bound source-target distance --- crates/blockchain/src/store.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/crates/blockchain/src/store.rs b/crates/blockchain/src/store.rs index cf8e8f7c..20fe46db 100644 --- a/crates/blockchain/src/store.rs +++ b/crates/blockchain/src/store.rs @@ -116,12 +116,6 @@ fn update_safe_target(store: &mut Store) { store.set_safe_target(safe_target); } -/// Maximum number of parent links [`checkpoint_is_ancestor`] walks before -/// giving up. Bounds the per-attestation work on the gossip path; a vote whose -/// source/target sits more than this many slots below the descendant is -/// conservatively rejected. -const MAX_ANCESTRY_WALK_SLOTS: u64 = 128; - /// Return whether `ancestor` lies on `descendant`'s parent chain. /// /// `descendant_header` is the descendant's already-fetched header, so the walk @@ -144,7 +138,6 @@ fn checkpoint_is_ancestor( // The descendant header is already in hand, so begin the walk at its parent. let mut current_root = descendant_header.parent_root; - let mut steps: u64 = 0; while let Some(current_header) = store.get_block_header(¤t_root) { if current_header.slot == ancestor.slot { return current_root == ancestor.root; @@ -152,14 +145,6 @@ fn checkpoint_is_ancestor( if current_header.slot < ancestor.slot { return false; } - steps += 1; - if steps >= MAX_ANCESTRY_WALK_SLOTS { - warn!( - cap = MAX_ANCESTRY_WALK_SLOTS, - "Attestation ancestry walk exceeded cap, rejecting" - ); - return false; - } current_root = current_header.parent_root; } From ab4868c2fcf27af4ec8c25dd939377c9e1b43199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Thu, 11 Jun 2026 16:47:46 -0300 Subject: [PATCH 2/2] docs: update function documentation --- crates/blockchain/src/store.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/blockchain/src/store.rs b/crates/blockchain/src/store.rs index 20fe46db..8fd1b36c 100644 --- a/crates/blockchain/src/store.rs +++ b/crates/blockchain/src/store.rs @@ -120,10 +120,8 @@ fn update_safe_target(store: &mut Store) { /// /// `descendant_header` is the descendant's already-fetched header, so the walk /// starts from its parent without re-reading it. Walks parent links down to the -/// ancestor's slot, up to [`MAX_ANCESTRY_WALK_SLOTS`] steps. Empty (skipped) -/// slots on the path are traversed transparently since they carry no block. -/// Conservative: a block missing from the store, or exceeding the walk cap, -/// yields `false`. +/// ancestor's slot. Empty (skipped) slots on the path are traversed transparently +/// since they carry no block. A block missing from the store yields `false`. fn checkpoint_is_ancestor( store: &Store, ancestor: &Checkpoint,