state: build_diff() reports deletions for accounts that never existed

Aperta
#1,718 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à
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
blockchain

Direzione di ricerca

Start at build_diff() in test/state/state.cpp (the erase_if_empty / deleted_accounts path around the linked lines). Reproduce with state_transition.tx_legacy and state_transition.touch_nonexistent_sd, then add the pre.contains check on receipt.state_diff.deleted_accounts (fails 28/132). Decide a flag or skip for accounts inserted only because they were touched; #1717’s in_diff expectation can pin the chosen behaviour. Done when those accounts are not listed as deleted and related modified_accounts TODOs are considered.

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

Descrizione

#1709 fixed one instance of this: an account warmed up by a cold access and then reverted was reported in StateDiff::deleted_accounts. The artifact still appears when the account is inserted some other way and ends up empty.

The shortest case is a transaction to an address that does not exist — state_transition.tx_legacy, where 0xc0de is not in the pre-state:

tx.to = To;  // no code, no value

execute_message() inserts the recipient with erase_if_empty, it ends empty, and build_diff() puts it in deleted_accounts. Same for a non-existent SELFDESTRUCT beneficiary (state_transition.touch_nonexistent_sd, 0x4e).

build_diff() skips m.nonexistent (set only when a revert restores the account) and m.just_created (set only by CREATE). There is no flag for "inserted because it was touched", so these fall through to the erase_if_empty branch.

As with #1709 the state is correct — applying such a delete is a no-op — so only the diff is affected.

Scale: adding this to the state_transition fixture fails 28 of 132 tests on master:

for (const auto& a : receipt.state_diff.deleted_accounts)
    EXPECT_TRUE(pre.contains(a)) << a << ": deleted, never existed";

Related, and already noted in the TODO below: modified_accounts also lists accounts that were only read or warmed, with nonce and balance unchanged — e.g. state_transition.touch_access_list_storage_only, where 0x5a is warmed by the access list alone.

#1717 adds an in_diff expectation to the state_transition fixture, which can be used to pin down whatever behaviour is decided here.

Lingua principale
C++
Stelle
979
Fork
340
Merge medio
12h 16m
PR unite (30g)
25

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

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 ipsilon/evmone

Tutte le issue di ipsilon/evmone

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.