Clearing a delegation at nonce 0 wipes the authority's storage

Aperta
#4,093 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à
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend, databases

Direzione di ricerca

Start with src/ethereum/forks/prague/vm/eoa_delegation.py, especially set_delegation around lines 222–228, and trace how set_code reaches modify_state in src/ethereum/forks/prague/state_tracker.py. Check existing tests for clearing a delegation when the authority has nonce 0 and storage. Done when that case preserves storage and the relevant tests pass across Prague and later forks.

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

Descrizione

Metadata
  • Hardfork: Prague and later
What was wrong?

set_delegation sets the code of the authority before it increments the nonce (prague/vm/eoa_delegation.py, lines 222-228). set_code goes through modify_state, which destroys an account that is empty right after the change, storage included (prague/state_tracker.py, line 484).

So take an authority with nonce 0, balance 0, a delegation indicator as its code and some storage, and an authorization from it at nonce 0 to the zero address. Clearing the code leaves the account empty for a moment, destroy_account wipes its storage, and increment_nonce then recreates it with nonce 1 and no storage.

Such an account cannot arise from transactions, since every authorization raises the nonce, but a genesis or a test pre-state can hold it. EIP-161 deletes touched empty accounts at the end of the transaction, and by then this account has nonce 1. Incrementing the nonce first, or deleting only at the end of the transaction, would keep the storage.

Is wiping the storage here intended? If not, swapping the two calls in set_delegation keeps it, in every fork from Prague.

Sources
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.