Skip to content

execution/state: preserve seeded Done flags on in-flight removal flush - #26297

Closed
Amirhosein wants to merge 1 commit into
erigontech:mainfrom
Amirhosein:fix/state-seed-empty-removal-in-flight-flush
Closed

Amirhosein wants to merge 1 commit into
erigontech:mainfrom
Amirhosein:fix/state-seed-empty-removal-in-flight-flush

Conversation

@Amirhosein

Copy link
Copy Markdown
Contributor

Summary

Keep the FlagDone state of SelfDestructPath and BalancePath cells seeded by SeedEmptyRemovals when a destroying transaction subsequently runs an in-flight flush (complete = false) with matching values, while leaving unseeded in-flight destructs unchanged.

  • Mark SelfDestructPath and BalancePath cells flushed by SeedEmptyRemovals as seeded via seedRemovalWrites.
  • Reuse matching seeded() && FlagDone cells for equal SelfDestructPath and BalancePath writes in FlushVersionedWrites / flushCell instead of overwriting them with FlagEstimate.
  • Add TestInFlightFlushOfSeededRemovalKeepsDoneFlags covering both matching removals (remaining MVReadResultDone through in-flight flush, validation, and completion) and mismatched flushes (falling back to MVReadResultDependency).

Closes #26286

Testing

  • go test -count=1 ./execution/state
  • ERIGON_ASSERT=true go test -count=1 ./execution/state
  • golangci-lint run ./execution/state/...

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The condition accepts ordinary BAL-seeded cells, allowing an equal-value write alongside unseeded SelfDestruct=true to retain a stale Done incarnation instead of becoming Estimate; the exception must be limited to seeded BalancePath cells with matching ValueDeleted status.

1 open issue
What changed in this PR

This PR addresses #26286 by preserving resolved removal cells during matching in-flight flushes, reducing unnecessary dependencies in versioned state reads.

Changes:

  • Mark cells written by SeedEmptyRemovals as seeded.
  • Reuse matching seeded Done cells during flushes.
  • Add regression coverage for matching removals and mismatched writes.
File Description
execution/​state/​versionmap.go Adds removal-seeding support and preserves matching seeded Done cells.
execution/​state/​versionmap_seed_removal_test.go Tests Done preservation through flush, validation, and completion, plus mismatch fallback.
execution/​state/​versionmap_access.go Marks removal cells as seeded after flushing them.

Review effort: Balanced

ci.accSource = AccountFromBase
vw.bind(e, ci)
return cells
keepSeededRemoval := destructed && ci.seeded() && ci.loadFlag() == FlagDone && ci.valStatus == vw.valStatus

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A critical version-reuse bug allows a self-destructed account’s changed balance to bypass read-set invalidation; the reuse guard must check the balance seed and have a regression test.

2 open issues

Review effort: Balanced

Comment on lines +1544 to +1547
if ci, ok := e.SelfDestruct.Get(vw.Version.TxIndex); ok && ci.seeded() && ci.loadFlag() == FlagDone && ci.Value == vw.Val && ci.valStatus == vw.valStatus {
ci.accSource = AccountFromBase
cell = ci
}
@Amirhosein

Copy link
Copy Markdown
Contributor Author

Closing since #26326 already fixed #26286 and has been merged.

@Amirhosein Amirhosein closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

execution/state: the in-flight flush of a destroying tx turns the seeded removal into Estimate cells

2 participants