Commit 306e2c9
authored
db/state: skip DomainDel(AccountsDomain) when prev value is already nil (erigontech#21939)
Fixes erigontech#21685.
## Summary
A second `DomainDel(AccountsDomain, addr)` against an already-deleted
account currently writes a duplicate nil-history entry; serial's IBS
short-circuits in this case so the duplicate is parallel-only. Per
@sudeepdino008's analysis on erigontech#21685, mainnet block 2,713,395's two
DAO-cleanup txs each emit `SelfDestructPath=true` against the same ~200
already-empty accounts when run under parallel exec — both flushes write
nil entries where serial writes only one. Final domain value is the same
(nil) in both modes, so reads are correct, but the on-disk
`accounts.0-256.v/.ef`, `commitment.0-256.v/.ef`, `rcache.0-256.v`
history files diverge from r3.4.
Fix: mirror the existing `kv.CodeDomain` skip a few lines below — when
`prevVal == nil` after the GetLatest fetch, skip the AccountsDomain
delete entirely. Storage prefix wipe and CodeDomain delete that would
have run downstream would have been no-ops anyway.
## Test
- `TestSharedDomain_DomainDel_IdempotentForAlreadyDeletedAccount` — puts
an account at txNum=0, deletes at txNum=1, re-deletes at txNum=2;
asserts the history index records exactly `[0, 1]`, not `[0, 1, 2]`.
- Red-first verified: without the fix, the test fails with `[0, 1, 2]`.
- Existing `db/state/execctx` test suite still green.
## Test plan
- [x] New test green; red-first behaviour confirmed.
- [x] `make lint` clean (x2, lint is non-deterministic).
- [x] `make erigon` clean.
- [ ] Mainnet exec-from-0 on the deterministic-snapshot harness: verify
the three history-file hashes (`accounts.0-256.v/.ef`,
`commitment.0-256.v/.ef`, `rcache.0-256.v`) match r3.4 baseline after
this fix.
- [ ] CI green.
## Backport
A `[r3.5]` cherry-pick PR will follow.1 parent 7dd7942 commit 306e2c9
2 files changed
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
400 | 449 | | |
401 | 450 | | |
402 | 451 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1205 | 1205 | | |
1206 | 1206 | | |
1207 | 1207 | | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
1208 | 1214 | | |
1209 | 1215 | | |
1210 | 1216 | | |
| |||
0 commit comments