Four docstrings disagree with the code in every fork

Aperta Adatta ai principianti
#4,101 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
documentation

Direzione di ricerca

Inizia dalle quattro posizioni documentate: Receipt.bloom in blocks.py, check_transaction in fork.py, e validate_transaction e recover_sender in transactions.py. Confronta ogni docstring con l’implementazione a cui fa riferimento, quindi aggiorna le copie corrispondenti in ogni fork applicabile senza modificare il codice. Il lavoro è completo quando la dimensione del bloom, la condizione per InvalidSenderError, il calcolo della capacità delle transazioni e la firma di recover_sender sono descritti correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Metadata
  • Hardfork: every fork from Frontier to Bogota (each fork's copy of the text)
What was wrong?

Four docstrings disagree with the code they describe. Each one is copied into every fork.

  1. Receipt.bloom (blocks.py) calls the bloom "a 2048-byte bit array". Bloom is Bytes256 and logs_bloom builds it from 256 bytes, so it is 256 bytes, or 2048 bits.
  2. In check_transaction (fork.py), the Raises section documents InvalidSenderError as "If the transaction is from an address that does not exist anymore". The code raises it when the sender has code (code_hash != EMPTY_CODE_HASH, EIP-3607), and from Prague when that code is not a delegation. The exception's own docstring says "an account that cannot send transactions".
  3. validate_transaction (transactions.py) says that 2**64-1 transactions "is the entire capacity of the Ethereum blockchain at 2022 gas limits for a little over 22 years". At 21000 gas each, they need 21000 * (2**64-1), about 3.87e23 gas (the figure in the rationale of EIP-2681). At 30M gas per 12-second block, that is about 4.9 billion years.
  4. recover_sender (transactions.py) says "This function takes chain_id and a transaction as parameters". It takes only tx, and chain_id(tx) reads the chain id. This sentence is in every fork from Spurious Dragon on.
Sources
  • The specification code itself: fork_types.Bloom, bloom.logs_bloom, the InvalidSenderError checks in check_transaction, and the signature of recover_sender.
  • EIP-2681 (Rationale) and EIP-3607.
Additional Context

Each fix is a docstring change in every fork, with no change to the code. I already have two open pull requests, the limit for contributors without write access, so I report the four together here. I can open one pull request per item if a maintainer wants them.

Lingua principale
Python
Stelle
1.2k
Fork
543
Merge medio
2g 19h
PR unite (30g)
81

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ethereum/execution-specs

Tutte le issue di ethereum/execution-specs

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.