Claim a gossip block's slot and proposer before its stateful checks

オープン
#840 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 6 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust

調査の方向性

Start with crates/net/p2p/src/beacon/verdict.rs and gossip::block::cheap_checks, then trace the stateful checks run on spawn_blocking under gossip_validation_permits. Review payload_hash::tests::verify_block_cost for the hash cost and the validation behavior described in docs/spec_deviations.md. Add a concurrent test for two signed blocks with the same (slot, proposer) and confirm only one is hashed; the issue leaves the fix design open.

索引モデルが issue の本文から書いたものです。

説明

Beacon gossip records a block's (slot, proposer) in P2PServer::seen_blocks only when its verdict reaches the p2p actor (settle in crates/net/p2p/src/beacon/verdict.rs). The stateful checks run before that, on spawn_blocking threads under gossip_validation_permits (128). So several distinct blocks for one slot and proposer that arrive together all pass the cheap checks' AlreadySeen rule (gossip::block::cheap_checks) and are each checked in full:

  • the parent-state lookup and the proposer's BLS signature (on main already);
  • since lambdaclass/ethlambda#770, the payload block hash on an Accept: a transactions trie and keccak, measured at up to 0.6 s for a block at the 10 MiB gossip limit filled with 1,048,576 tiny transactions (payload_hash::tests::verify_block_cost).

It takes the slot's proposer signing equivocations (slashable) and sending them directly, since honest peers relay only the first. The work is bounded by the permit count: past it, blocks are forwarded unchecked under Overloaded. lambdaclass/ethlambda#770 documents the window in docs/spec_deviations.md and leaves the fix out, because it changes how every block is validated, not only the hash.

Possible fixes:

  • A shared claim set keyed by (slot, proposer) (an LRU sized like SEEN_BLOCKS_CAPACITY), taken by the blocking task before its signature check, or at least before the hash. A second block for a claimed key answers Ignore(AlreadySeen) without further work. A claim is released when its block fails its signature or an earlier rule, so it never stands for an invalid block, which keeps the specification's "first block with a valid signature".
  • Independently, a transaction-count budget above which block_verdict does not hash, leaving the block to the execution client. Mainnet's gas limit allows a few thousand transactions, so a cap such as 2^14 would bound the trie without touching real blocks.

A test should send two signed blocks for one key through the stateful checks at once and assert that only one is hashed.

主要言語
Rust
スター
86
フォーク
34
平均マージ
9日 20時間
マージ済み PR(30日)
77

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

lambdaclass/ethlambda のほかの issue

lambdaclass/ethlambda の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。