Range sync: step past a span with no blocks instead of failing the peer that serves it

未關閉
#812 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 6 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
rust

研究方向

Start with RangeSyncState::complete_batch in crates/net/p2p/src/lib.rs and the Lean and Beacon BlocksByRange handlers named in the issue. Read the stall-window note in docs/spec_deviations.md and the linked discussion in lambdaclass/ethlambda#791 to understand the prior attempt. A fix should advance across empty spans, verify skips using the next batch's parent link, and retry or count a failure when that check does not match.

由索引模型根據 Issue 內容生成。

描述

Problem. Range sync cannot pass a stretch of slots with no block on the chain, such as a long run of missed proposals during a non-finality incident.

  • A BlocksByRange answer with no block in the requested range counts as a failed request. Lean: crates/net/p2p/src/req_resp/handlers.rs:943-953. Beacon: handlers.rs:2905-2913.
  • The range session's cursor only moves when a batch delivers blocks (RangeSyncState::complete_batch, crates/net/p2p/src/lib.rs:865-867). Across a span a whole batch long with no block on the chain, range sync therefore never advances.
  • The honest peers asked for that span cool down. After three such answers in a row they become suspects (SUSPECT_AFTER_FAILURES, crates/net/p2p/src/peer_heads.rs), and their claims stop counting towards the network head.
  • The node can then read as synced while it is still behind, and only the parent lookups of newer gossip blocks fill the gap.

The trade-off is stated in docs/spec_deviations.md (the stall-window bullet of the sync-gate section). It was discussed in rounds seven, eight, eleven and thirteen of lambdaclass/ethlambda#791.

Why it is out of that PR's scope.

  • main already stops at such a span. Its lean handler fails an empty answer and returns before complete_batch (crates/net/p2p/src/req_resp/handlers.rs:817-821 on main), so its cursor does not move either.
  • Excusing empty answers in place was tried and reverted in lambdaclass/ethlambda#791. A peer claiming a high head was then excused on every batch below it, and took a batch on every Status it sent.
  • The fix is a change to range sync itself, not to the sync gate.

What a fix could look like.

  • Advance the cursor: when a peer whose Status head is past the span answers it empty, move the cursor past it.
  • Remember the skip: keep the skipped span and who answered it.
  • Check it with the next batch: use the parent link HeadWatch::note_delivery already uses. If the next batch's first block names, as its parent, the last block delivered below the span, the span was empty and the peer is credited.
  • Otherwise: re-ask the span from another peer, and count a failure against the peer that answered it empty.
主要語言
Rust
星號
86
分支
34
平均合併
9 天 20 小時
30 天內合併 PR
77

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

lambdaclass/ethlambda 的其他 Issue

查看 lambdaclass/ethlambda 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。