Skip to content

Backport release/v6.6: [codex] Harden multiversion iterator validation#3672

Open
seidroid[bot] wants to merge 1 commit into
release/v6.6from
backport-3656-to-release/v6.6
Open

Backport release/v6.6: [codex] Harden multiversion iterator validation#3672
seidroid[bot] wants to merge 1 commit into
release/v6.6from
backport-3656-to-release/v6.6

Conversation

@seidroid

@seidroid seidroid Bot commented Jun 30, 2026

Copy link
Copy Markdown

Backport of #3656 to release/v6.6.

## Summary

- Add a regression test for stale validation iterator keys after a
lower-index transaction is re-executed with a smaller writeset.
- Make validation iterators ignore removed multiversion entries without
treating real deletes as removed keys.
- Harden iterator validation so recovered panics become validation
failures with diagnostic logging, and abort notification cannot leave an
ownerless or blocked validation goroutine.

## Root Cause

`validationIterator.Value()` assumed every captured key still had a
multiversion value. When a lower-index transaction was re-executed and
stopped writing one of those keys, the stale key could remain in the
validation iterator's key list while `GetLatestBeforeIndex` returned
nil, leading to a nil pointer dereference.

## Validation

- `go test ./sei-cosmos/store/multiversion ./sei-cosmos/tasks
./giga/deps/tasks -count=1`
- `git diff --check`

Co-authored-by: Masih H. Derkani <m@derkani.org>
(cherry picked from commit cbb11cc)
@cursor

cursor Bot commented Jun 30, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches OCC transaction validation in core state storage; incorrect iterator replay could wrongly accept or reject parallel txs, though behavior is covered by new tests and failures degrade to invalid rather than node panic.

Overview
Hardens OCC multiversion iterateset replay so validation fails safely instead of panicking or hanging when the MVS view races with concurrent writesets.

The validation iterator now skips keys that no longer have a value at replay time (skipRemovedKeys on Valid/Next/Key), reads the underlying iterator key in Value() without re-entering skip logic, treats missing MVS entries as nil, and sends estimate aborts with a non-blocking WriteAbort so a full abort channel cannot deadlock validation.

Iterator validation in store.go runs replay inside a goroutine with panic recovery (logged, returns invalid), splits logic into validateIteratorReplay with explicit iterator cleanup, and poll`select`s the abort channel between steps via iteratorValidationAborted instead of blocking forever when multiple estimates would fill the channel.

Adds regression tests for lower-index writeset rewrites during validation, injected iterator panics, and multiple estimate aborts completing within a timeout.

Reviewed by Cursor Bugbot for commit 609343d. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJun 30, 2026, 4:59 PM

@github-actions

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJun 30, 2026, 4:21 PM

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.50575% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.02%. Comparing base (5ed245f) to head (609343d).
⚠️ Report is 1 commits behind head on release/v6.6.

Files with missing lines Patch % Lines
sei-cosmos/store/multiversion/store.go 86.66% 4 Missing and 4 partials ⚠️
sei-cosmos/store/multiversion/memiterator.go 92.59% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##           release/v6.6    #3672      +/-   ##
================================================
- Coverage         58.88%   58.02%   -0.87%     
================================================
  Files              2225     2151      -74     
  Lines            183482   174995    -8487     
================================================
- Hits             108041   101533    -6508     
+ Misses            65733    64451    -1282     
+ Partials           9708     9011     -697     
Flag Coverage Δ
sei-chain-pr 90.73% <88.50%> (?)
sei-db 70.41% <ø> (-0.22%) ⬇️
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-cosmos/store/multiversion/memiterator.go 86.48% <92.59%> (+2.81%) ⬆️
sei-cosmos/store/multiversion/store.go 89.96% <86.66%> (-2.01%) ⬇️

... and 76 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@masih masih enabled auto-merge (squash) June 30, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants