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

Aberta
#840 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 6 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
rust

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Rust
Estrelas
86
Forks
34
Merge médio
9d 20h
PRs com merge (30d)
77

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de lambdaclass/ethlambda

Todas as issues de lambdaclass/ethlambda

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.