Beacon events report `execution_optimistic: false` for every gloas head and block

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

維護者通常 6 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
56/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
rust

研究方向

Start with crates/net/rpc/src/shared/optimistic.rs to understand block_is_optimistic and envelope_is_optimistic, then inspect the event call sites in crates/blockchain/src/events.rs and the storage maps they read. Check how the helper can live in a crate shared by RPC and blockchain. Done means a gloas head whose parent payload is recorded as Syncing emits head and head_v2 with execution_optimistic: true, while pre-gloas behavior stays unchanged.

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

描述

Problem. The head, head_v2, block and finalized_checkpoint events take execution_optimistic from Store::is_beacon_optimistic, i.e. the store's optimistic_roots set:

  • crates/blockchain/src/events.rs:806 (block);
  • events.rs:1162 (head, head_v2, chain_reorg);
  • events.rs:1249 (the second head_v2);
  • events.rs:1313 (finalized_checkpoint).

Only pre-gloas blocks ever enter that set. beacon_engine::new_payload_request returns None for a gloas block (crates/blockchain/src/beacon_engine.rs:134), so its import is PayloadValidity::NotRequired, and fork_choice::on_block adds a root only on Optimistic (crates/blockchain/state_transition/src/beacon/fork_choice.rs:5198-5203). From gloas on, every one of these events therefore reports execution_optimistic: false, even when the chain rests on a payload the execution client answered SYNCING. A consumer that holds off on optimistic heads (lighthouse suppresses those head events) is told the head is validated when it is not.

The Beacon API responses already get this right. crates/net/rpc/src/shared/optimistic.rs has block_is_optimistic (line 113), which walks back to the latest FULL payload a block builds on and reads its recorded verdict, and envelope_is_optimistic (line 100). docs/rpc.md ("execution_optimistic under gloas") describes the rule.

Why not in lambdaclass/ethlambda#748. That PR fixed the one event it added whose verdict is in hand, execution_payload, by passing the import's own verdict in. The other topics predate it on main (head_v2 inherits head's value), and the fix needs the walk in shared/optimistic.rs, which lives in ethlambda-rpc, a crate ethlambda-blockchain cannot depend on.

Fix. Move payload_link, payload_is_not_valid, block_is_optimistic and envelope_is_optimistic down to a crate both can use (ethlambda-storage, next to the maps they read, or ethlambda-state-transition), and have the events call block_is_optimistic where they now call is_beacon_optimistic. Pre-gloas results are unchanged, since the walk reads the optimistic set for a pre-gloas block. A test: a gloas head whose parent payload is recorded Syncing emits head/head_v2 with execution_optimistic: true.

主要語言
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 摘要。