Skip to content

Commit 39bb903

Browse files
authored
Export pre-kickoff heights memIAVL-only when FlatKV can't reach them (#4519)
On pacific-1 the state-sync snapshot at 236640000 started about 535 blocks before the FlatKV migration kicked off. The SC export correctly streamed memIAVL only, since FlatKV didn't exist yet. About 2h45m later the wasm extension snapshotter called `CacheMultiStoreForExport(236640000)`, which opens `CompositeCommitStore.LoadVersionReadOnly`. FlatKV existed by then, so it was loaded unconditionally and failed with `version unreachable: cannot reach version 236640000: nearest snapshot is 0 ... the WAL only holds 236640535-236661881`. Every state-sync node lost that snapshot. `Exporter` has the same flaw in its metadata gating when an export of a pre-kickoff height starts after kickoff. At those heights FlatKV isn't part of the AppHash, so memIAVL alone is the full state. When FlatKV can't reach the requested version, the export paths now look at the oldest retained FlatKV snapshot above it. Migration status only moves forward, so if the migration hadn't started at that snapshot it hadn't started at the target either. In that case `Exporter` streams memIAVL only, and the new `LoadVersionReadOnlyForExport`, which `CacheMultiStoreForExport` now uses under Auto, opens a memIAVL-only view. Any other unreachable version still fails, so a post-kickoff height whose FlatKV history was pruned can't produce a snapshot that silently leaves FlatKV out. FlatKV gets `OldestSnapshotAbove` on `LiveStateStore` to support the check. The generic `LoadVersionReadOnly` is unchanged and still refuses pre-FlatKV-era heights, as `TestComposite_Auto_ReadOnlyPreFlatKVEraHeightNowFails` pins. The new Auto tests reproduce the mainnet error on main for both export paths and pass with the fix.
1 parent 2009d55 commit 39bb903

9 files changed

Lines changed: 289 additions & 42 deletions

File tree

‎sei-cosmos/storev2/rootmulti/set_write_mode_test.go‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"testing"
88

99
seidbconfig "github.com/sei-protocol/sei-chain/sei-db/config"
10+
gigatypes "github.com/sei-protocol/sei-chain/sei-db/state_db/giga/types"
1011
"github.com/sei-protocol/sei-chain/sei-db/state_db/sc/migration"
1112
sctypes "github.com/sei-protocol/sei-chain/sei-db/state_db/sc/types"
1213
"github.com/stretchr/testify/require"
@@ -284,3 +285,31 @@ func TestRootMultiAutoKickoff_RestartBeforeFirstCommitReKicks(t *testing.T) {
284285
simulateBlock(t, store, storeKeys, i, addrBase)
285286
}
286287
}
288+
289+
// TestRootMultiCacheMultiStoreForExport_PreKickoffHeightAfterKickoff pins the wasm snapshot extension
290+
// path: a state-sync snapshot of a pre-kickoff height opens its export view after kickoff has created
291+
// FlatKV, which can't reach that height.
292+
func TestRootMultiCacheMultiStoreForExport_PreKickoffHeightAfterKickoff(t *testing.T) {
293+
store, storeKeys := newTestRootMulti(t, t.TempDir(), autoModeConfig())
294+
defer func() { require.NoError(t, store.Close()) }()
295+
296+
addr := newEVMTestData(0xD2)
297+
for i := 1; i <= 3; i++ {
298+
simulateBlock(t, store, storeKeys, i, addr)
299+
}
300+
const pre = int64(2)
301+
302+
require.NoError(t, store.SetMigrationBatchSize(100))
303+
for i := 4; i <= 6; i++ {
304+
simulateCosmosOnlyBlock(t, store, storeKeys, i)
305+
}
306+
307+
_, err := store.scStore.LoadVersion(pre, true)
308+
require.ErrorIs(t, err, gigatypes.ErrVersionUnreachable)
309+
310+
cms, err := store.CacheMultiStoreForExport(pre)
311+
require.NoError(t, err)
312+
defer cms.(interface{ Close() }).Close()
313+
require.Equal(t, []byte{2, 2}, cms.GetKVStore(storeKeys["bank"]).Get([]byte("supply")))
314+
require.Equal(t, makeSlot(2, 0xAA), cms.GetKVStore(storeKeys["evm"]).Get(addr.storKey))
315+
}

‎sei-cosmos/storev2/rootmulti/store.go‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,27 @@ func (rs *Store) validateSSReadVersion(version int64) error {
449449
return nil
450450
}
451451

452+
// exportVersionLoader is implemented by SC stores that can open a historical view for state-sync export
453+
// at heights their generic read-only load refuses.
454+
type exportVersionLoader interface {
455+
LoadVersionReadOnlyForExport(version int64) (sctypes.Committer, error)
456+
}
457+
458+
var _ exportVersionLoader = (*composite.CompositeCommitStore)(nil)
459+
460+
func (rs *Store) loadSCVersionForExport(version int64) (sctypes.Committer, error) {
461+
if loader, ok := rs.scStore.(exportVersionLoader); ok {
462+
return loader.LoadVersionReadOnlyForExport(version)
463+
}
464+
return rs.scStore.LoadVersion(version, true)
465+
}
466+
452467
func (rs *Store) CacheMultiStoreForExport(version int64) (types.CacheMultiStore, error) {
453468
if version <= 0 || (rs.lastCommitInfo != nil && version == rs.lastCommitInfo.Version) {
454469
return rs.CacheMultiStore(), nil
455470
}
456471
// Open SC stores for wasm snapshot, this op is blocking and could take a long time
457-
scStore, err := rs.scStore.LoadVersion(version, true)
472+
scStore, err := rs.loadSCVersionForExport(version)
458473
if err != nil {
459474
return nil, err
460475
}

‎sei-db/state_db/giga/types/live_state_store.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ type LiveStateStore interface {
4949
// unlike other errors from this store, that one is not fatal and the store stays usable.
5050
CheckVersionReachable(targetVersion int64) error
5151

52+
// OldestSnapshotAbove returns the oldest retained snapshot version above version; ok is false when
53+
// there is none. It does not modify the store.
54+
OldestSnapshotAbove(version int64) (snapshot int64, ok bool, err error)
55+
5256
// ApplyChangeSets buffers changesets at the given version, to be
5357
// persisted by the next Commit.
5458
//

‎sei-db/state_db/sc/composite/rollback_floor_test.go‎

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ func TestCompositeHistoricalReadBelowFlatKVFloorErrorsWithoutPanic(t *testing.T)
8888
require.Error(t, err)
8989
require.ErrorIs(t, err, flatkv.ErrVersionUnreachable)
9090

91-
_, err = cs.Exporter(target)
92-
require.Error(t, err)
93-
require.ErrorIs(t, err, flatkv.ErrVersionUnreachable)
91+
// The migration had not started at the FlatKV snapshot above the target, so the export is memiavl-only.
92+
exp, err := cs.Exporter(target)
93+
require.NoError(t, err)
94+
items := drainCompositeExporter(t, exp)
95+
require.NoError(t, exp.Close())
96+
require.NotContains(t, moduleNamesOf(items), keys.FlatKVStoreKey)
9497

9598
for _, reachable := range []int64{rollbackFloorKickoff - 1, rollbackFloorKickoff, cs.Version()} {
9699
ro, err := cs.LoadVersionReadOnly(reachable)
@@ -99,6 +102,29 @@ func TestCompositeHistoricalReadBelowFlatKVFloorErrorsWithoutPanic(t *testing.T)
99102
}
100103
}
101104

105+
func TestCompositeExportBelowFlatKVFloorAfterKickoffFailsLoud(t *testing.T) {
106+
dir := t.TempDir()
107+
workload := newMigrationWorkload(0x5703)
108+
cs := buildFixedModeMigrationStore(t, dir)
109+
defer func() { require.NoError(t, cs.Close()) }()
110+
for i := 0; i < 20; i++ {
111+
require.NoError(t, cs.ApplyChangeSets(workload.generateBlock(8, 4, 1, 2, 1)))
112+
_, err := cs.Commit(cs.Version() + 1)
113+
require.NoError(t, err)
114+
}
115+
flatKVStore, ok := cs.loadFlatKV().(*flatkv.CommitStore)
116+
require.True(t, ok)
117+
require.NoError(t, flatKVStore.FlushSnapshots())
118+
119+
// The migration had started at this height, so FlatKV is in its AppHash and can't be left out.
120+
target := int64(rollbackFloorKickoff + 1)
121+
require.ErrorIs(t, cs.loadFlatKV().CheckVersionReachable(target), flatkv.ErrVersionUnreachable)
122+
123+
_, err := cs.Exporter(target)
124+
require.Error(t, err)
125+
require.ErrorIs(t, err, flatkv.ErrVersionUnreachable)
126+
}
127+
102128
func rollbackFloorBlocks(seed int64, last int64) map[int64][]*proto.NamedChangeSet {
103129
w := newMigrationWorkload(seed)
104130
blocks := make(map[int64][]*proto.NamedChangeSet, last)

‎sei-db/state_db/sc/composite/store.go‎

Lines changed: 73 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,20 @@ func isStaleSeed(memIAVLVersion, flatKVVersion int64) bool {
459459

460460
// LoadVersionReadOnly returns an isolated read-only composite view at targetVersion (0 = latest). This store
461461
// is left untouched and must stay open while the view is in use; the caller owns the view and must Close it.
462-
func (cs *CompositeCommitStore) LoadVersionReadOnly(targetVersion int64) (_ types.Committer, retErr error) {
462+
func (cs *CompositeCommitStore) LoadVersionReadOnly(targetVersion int64) (types.Committer, error) {
463+
return cs.loadVersionReadOnly(targetVersion, false)
464+
}
465+
466+
// LoadVersionReadOnlyForExport is LoadVersionReadOnly for state-sync snapshot extensions. Under Auto, a height
467+
// FlatKV can't reach is served memIAVL-only when the migration had not started at the next retained FlatKV
468+
// snapshot above it, since FlatKV isn't in the AppHash there. Such a snapshot can start before kickoff and
469+
// reach its extensions after FlatKV was created. Fixed modes create FlatKV at a restart, which ends any
470+
// snapshot in progress, so their extensions never ask for a height before FlatKV existed.
471+
func (cs *CompositeCommitStore) LoadVersionReadOnlyForExport(targetVersion int64) (types.Committer, error) {
472+
return cs.loadVersionReadOnly(targetVersion, true)
473+
}
474+
475+
func (cs *CompositeCommitStore) loadVersionReadOnly(targetVersion int64, allowPreMigration bool) (_ types.Committer, retErr error) {
463476
if cs.derived {
464477
return nil, errDerivedStore
465478
}
@@ -497,12 +510,17 @@ func (cs *CompositeCommitStore) LoadVersionReadOnly(targetVersion int64) (_ type
497510
}
498511
}
499512

500-
if cs.loadFlatKV() != nil {
501-
fkv, err := cs.loadFlatKV().LoadVersionReadOnly(targetVersion)
502-
if err != nil {
513+
if flatKV := cs.loadFlatKV(); flatKV != nil {
514+
fkv, err := flatKV.LoadVersionReadOnly(targetVersion)
515+
switch {
516+
case err == nil:
517+
flatKVStore = fkv
518+
case allowPreMigration && cs.config.WriteMode == types.Auto &&
519+
errors.Is(err, gigatypes.ErrVersionUnreachable) && precedesMigration(flatKV, targetVersion):
520+
// Before kickoff FlatKV isn't in the AppHash, so memIAVL alone is the full state.
521+
default:
503522
return nil, fmt.Errorf("failed to load FlatKV version: %w", err)
504523
}
505-
flatKVStore = fkv
506524
}
507525

508526
// Build a per-handle composite with its own router. Without this the read-only handle has
@@ -1582,6 +1600,54 @@ func exportNeedsMetadataGating(mode types.WriteMode) bool {
15821600
return mode == types.Auto || mode == types.MigrateEVM || mode == types.MigrateBank
15831601
}
15841602

1603+
// exportMigrationState reads the migration metadata as of version, which decides whether each backend is
1604+
// in the AppHash there. FlatKV read-only clones replay the WAL to the target version, so the boundary and
1605+
// version keys reflect historical state, not the live store's.
1606+
//
1607+
// A version FlatKV can't reach is still pre-migration when the migration had not started at the next
1608+
// retained snapshot above it either, because migration status only moves forward. Under Auto this covers
1609+
// every height before kickoff, since FlatKV is created at the kickoff block. Any other unreachable
1610+
// version fails: silently omitting flatkv would produce a consensus-incomplete snapshot,
1611+
// byte-indistinguishable from a legitimate memiavl-only stream.
1612+
func exportMigrationState(flatKV gigatypes.LiveStateStore, version int64) (started, bankDone bool, err error) {
1613+
ro, err := flatKV.LoadVersionReadOnly(version)
1614+
if err != nil {
1615+
if errors.Is(err, gigatypes.ErrVersionUnreachable) && precedesMigration(flatKV, version) {
1616+
return false, false, nil
1617+
}
1618+
return false, false, fmt.Errorf("failed to load flatkv at export version %d: %w", version, err)
1619+
}
1620+
started, gateErr := migrationStarted(ro)
1621+
if gateErr == nil {
1622+
bankDone, gateErr = migration.IsModeComplete(ro, types.MigrateBank)
1623+
}
1624+
closeErr := ro.Close()
1625+
if gateErr != nil {
1626+
return false, false, fmt.Errorf("failed to read migration metadata for export gating: %w", gateErr)
1627+
}
1628+
if closeErr != nil {
1629+
return false, false, fmt.Errorf("failed to close export gating handle: %w", closeErr)
1630+
}
1631+
return started, bankDone, nil
1632+
}
1633+
1634+
// precedesMigration reports whether the migration had not started at the oldest FlatKV snapshot above
1635+
// version. Any error reading that snapshot reports false. For a pre-kickoff version that snapshot is the
1636+
// kickoff seed written by SetInitialVersion; once pruning drops it this reports false and exports fail loud.
1637+
func precedesMigration(flatKV gigatypes.LiveStateStore, version int64) bool {
1638+
snapshot, ok, err := flatKV.OldestSnapshotAbove(version)
1639+
if err != nil || !ok {
1640+
return false
1641+
}
1642+
ro, err := flatKV.LoadVersionReadOnly(snapshot)
1643+
if err != nil {
1644+
return false
1645+
}
1646+
started, gateErr := migrationStarted(ro)
1647+
closeErr := ro.Close()
1648+
return gateErr == nil && closeErr == nil && !started
1649+
}
1650+
15851651
// Exporter returns an exporter for state sync.
15861652
//
15871653
// Section selection follows the AppHash: a backend's section belongs in
@@ -1600,28 +1666,9 @@ func (cs *CompositeCommitStore) Exporter(version int64) (types.Exporter, error)
16001666
includeFlatKV := flatKV != nil
16011667

16021668
if includeFlatKV && exportNeedsMetadataGating(cs.config.WriteMode) {
1603-
// Evaluate the hash predicates against metadata as-of the exported
1604-
// version: flatkv read-only clones replay the WAL to the target
1605-
// version, so the boundary/version keys reflect historical state, not
1606-
// the live store's.
1607-
ro, err := flatKV.LoadVersionReadOnly(version)
1669+
started, bankDone, err := exportMigrationState(flatKV, version)
16081670
if err != nil {
1609-
// Silently omitting flatkv here would produce a consensus-incomplete
1610-
// snapshot, byte-indistinguishable from a legitimate memiavl-only
1611-
// stream, so fail loud instead.
1612-
return nil, fmt.Errorf("failed to load flatkv at export version %d: %w", version, err)
1613-
}
1614-
started, gateErr := migrationStarted(ro)
1615-
var bankDone bool
1616-
if gateErr == nil {
1617-
bankDone, gateErr = migration.IsModeComplete(ro, types.MigrateBank)
1618-
}
1619-
closeErr := ro.Close()
1620-
if gateErr != nil {
1621-
return nil, fmt.Errorf("failed to read migration metadata for export gating: %w", gateErr)
1622-
}
1623-
if closeErr != nil {
1624-
return nil, fmt.Errorf("failed to close export gating handle: %w", closeErr)
1671+
return nil, err
16251672
}
16261673
if cs.config.WriteMode == types.MigrateBank {
16271674
// Fixed MigrateBank descends from a flatkv-bearing predecessor;

‎sei-db/state_db/sc/composite/store_auto_test.go‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,66 @@ func TestComposite_Auto_ExportExcludesFlatKVUntilMigrationStarts(t *testing.T) {
371371
require.Contains(t, moduleNamesOf(postItems), keys.FlatKVStoreKey)
372372
}
373373

374+
// TestComposite_Auto_ExportBeforeKickoffAfterMigrationStarts pins that a
375+
// height before kickoff stays exportable once the migration is running.
376+
// FlatKV is created at kickoff and can't reach that height, but the
377+
// migration had not started there, so the export is memiavl-only and
378+
// matches the one taken before kickoff.
379+
func TestComposite_Auto_ExportBeforeKickoffAfterMigrationStarts(t *testing.T) {
380+
dir := t.TempDir()
381+
workload := newMigrationWorkload(0xA078)
382+
383+
cs := openAutoStoreWithConfig(t, dir, autoExportConfig(), 100)
384+
defer func() { _ = cs.Close() }()
385+
runBlocks(t, cs, workload, 3)
386+
pre := cs.Version() - 1
387+
388+
exp, err := cs.Exporter(pre)
389+
require.NoError(t, err)
390+
preItems := drainCompositeExporter(t, exp)
391+
require.NoError(t, exp.Close())
392+
393+
require.NoError(t, cs.SetWriteMode(types.MigrateEVM))
394+
runBlocks(t, cs, workload, 3)
395+
require.ErrorIs(t, cs.loadFlatKV().CheckVersionReachable(pre), flatkv.ErrVersionUnreachable)
396+
397+
exp, err = cs.Exporter(pre)
398+
require.NoError(t, err)
399+
items := drainCompositeExporter(t, exp)
400+
require.NoError(t, exp.Close())
401+
require.Equal(t, preItems, items)
402+
}
403+
404+
// TestComposite_Auto_ReadOnlyForExportBeforeKickoffAfterMigrationStarts pins the state-sync extension
405+
// path: a snapshot of a pre-kickoff height opens a read-only view at that height after kickoff, when
406+
// FlatKV exists but can't reach it. The generic read-only load still refuses that height.
407+
func TestComposite_Auto_ReadOnlyForExportBeforeKickoffAfterMigrationStarts(t *testing.T) {
408+
dir := t.TempDir()
409+
workload := newMigrationWorkload(0xA079)
410+
411+
cs := openAutoStoreWithConfig(t, dir, autoExportConfig(), 100)
412+
defer func() { _ = cs.Close() }()
413+
runBlocks(t, cs, workload, 3)
414+
pre := cs.Version() - 1
415+
416+
ro, err := cs.LoadVersionReadOnly(pre)
417+
require.NoError(t, err)
418+
preInfo := ro.LastCommitInfo()
419+
require.NoError(t, ro.Close())
420+
421+
require.NoError(t, cs.SetWriteMode(types.MigrateEVM))
422+
runBlocks(t, cs, workload, 3)
423+
require.ErrorIs(t, cs.loadFlatKV().CheckVersionReachable(pre), flatkv.ErrVersionUnreachable)
424+
425+
_, err = cs.LoadVersionReadOnly(pre)
426+
require.ErrorIs(t, err, flatkv.ErrVersionUnreachable)
427+
428+
ro, err = cs.LoadVersionReadOnlyForExport(pre)
429+
require.NoError(t, err)
430+
require.Equal(t, preInfo, ro.LastCommitInfo())
431+
require.NoError(t, ro.Close())
432+
}
433+
374434
// TestComposite_Auto_ExportImportRoundTrip pins the stream-driven import:
375435
// a migrated Auto node's snapshot restored onto a FRESH Auto node (no
376436
// flatkv directory) must materialize flatkv from the stream's section,
@@ -789,3 +849,32 @@ func TestComposite_Auto_ChildStoreIterationDuringWriteModeSwitch(t *testing.T) {
789849
require.NoError(t, readAll(view))
790850
require.NoError(t, stopReader())
791851
}
852+
853+
// TestComposite_Auto_ExportBeforeKickoffFailsOnceSeedSnapshotPruned pins the pre-kickoff export fallback's
854+
// dependency on FlatKV's kickoff seed snapshot: once pruning drops it, both export paths fail loud.
855+
func TestComposite_Auto_ExportBeforeKickoffFailsOnceSeedSnapshotPruned(t *testing.T) {
856+
cfg := autoExportConfig()
857+
cfg.FlatKVConfig.SnapshotKeepRecent = 1
858+
cs := openAutoStoreWithConfig(t, t.TempDir(), cfg, 100)
859+
defer func() { _ = cs.Close() }()
860+
workload := newMigrationWorkload(0x5EED)
861+
862+
runBlocks(t, cs, workload, 3)
863+
pre, seed := cs.Version()-1, cs.Version()
864+
865+
require.NoError(t, cs.SetWriteMode(types.MigrateEVM))
866+
runBlocks(t, cs, workload, 6)
867+
flatKVStore, ok := cs.loadFlatKV().(*flatkv.CommitStore)
868+
require.True(t, ok)
869+
require.NoError(t, flatKVStore.FlushSnapshots())
870+
871+
oldest, ok, err := flatKVStore.OldestSnapshotAbove(pre)
872+
require.NoError(t, err)
873+
require.True(t, ok)
874+
require.Greater(t, oldest, seed, "the seed snapshot must be pruned")
875+
876+
_, err = cs.LoadVersionReadOnlyForExport(pre)
877+
require.ErrorIs(t, err, flatkv.ErrVersionUnreachable)
878+
_, err = cs.Exporter(pre)
879+
require.ErrorIs(t, err, flatkv.ErrVersionUnreachable)
880+
}

‎sei-db/state_db/sc/composite/store_test.go‎

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,19 @@ func (f *failingEVMStore) Iterator(string, []byte, []byte, bool) (dbm.Iterator,
5757
func (f *failingEVMStore) RegisterHashListener(gigatypes.HashListener) (lthash.BlockHash, error) {
5858
return lthash.BlockHash{}, fmt.Errorf("flatkv unavailable")
5959
}
60-
func (f *failingEVMStore) FlushHashes() error { return nil }
61-
func (f *failingEVMStore) Flush() error { return nil }
62-
func (f *failingEVMStore) CommitPendingBlock() error { return nil }
63-
func (f *failingEVMStore) Version() int64 { return 0 }
64-
func (f *failingEVMStore) PendingVersion() int64 { return 0 }
65-
func (f *failingEVMStore) GetLatestVersion() (int64, error) { return 0, nil }
66-
func (f *failingEVMStore) Rollback(int64) error { return nil }
67-
func (f *failingEVMStore) Exporter(int64) (types.Exporter, error) { return nil, nil }
68-
func (f *failingEVMStore) Importer(int64) (types.Importer, error) { return nil, nil }
69-
func (f *failingEVMStore) GetPhaseTimer() *metrics.PhaseTimer { return nil }
70-
func (f *failingEVMStore) CleanupOrphanedReadOnlyDirs() error { return nil }
71-
func (f *failingEVMStore) Close() error { return nil }
60+
func (f *failingEVMStore) FlushHashes() error { return nil }
61+
func (f *failingEVMStore) Flush() error { return nil }
62+
func (f *failingEVMStore) CommitPendingBlock() error { return nil }
63+
func (f *failingEVMStore) Version() int64 { return 0 }
64+
func (f *failingEVMStore) PendingVersion() int64 { return 0 }
65+
func (f *failingEVMStore) GetLatestVersion() (int64, error) { return 0, nil }
66+
func (f *failingEVMStore) Rollback(int64) error { return nil }
67+
func (f *failingEVMStore) Exporter(int64) (types.Exporter, error) { return nil, nil }
68+
func (f *failingEVMStore) Importer(int64) (types.Importer, error) { return nil, nil }
69+
func (f *failingEVMStore) GetPhaseTimer() *metrics.PhaseTimer { return nil }
70+
func (f *failingEVMStore) CleanupOrphanedReadOnlyDirs() error { return nil }
71+
func (f *failingEVMStore) OldestSnapshotAbove(int64) (int64, bool, error) { return 0, false, nil }
72+
func (f *failingEVMStore) Close() error { return nil }
7273

7374
// flatKVRootHash returns the root hash of the store's flatkv backend once hashing has caught up with
7475
// what was committed. Hashing is asynchronous, so that barrier is what stops an assertion racing the
@@ -2675,3 +2676,7 @@ func TestNewCompositeCommitStoreKeepsFlatKVKeepRecent(t *testing.T) {
26752676
require.Equal(t, cfg.FlatKVConfig.SnapshotKeepRecent, cs.config.FlatKVConfig.SnapshotKeepRecent)
26762677
require.Equal(t, cfg.MemIAVLConfig.SnapshotInterval, cs.config.FlatKVConfig.SnapshotInterval)
26772678
}
2679+
2680+
func TestPrecedesMigrationFalseWithoutLaterSnapshot(t *testing.T) {
2681+
require.False(t, precedesMigration(&failingEVMStore{}, 5))
2682+
}

0 commit comments

Comments
 (0)