-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move memstore hydration initialized flag to memstore #2681
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,10 +31,7 @@ func TestInitMemStore_OnlyAllowedOnce(t *testing.T) { | |
|
||
ks.ClobKeeper.InitMemStore(ks.Ctx) | ||
|
||
// Initializing a second time causes a panic | ||
require.Panics(t, func() { | ||
ks.ClobKeeper.InitMemStore(ks.Ctx) | ||
}) | ||
require.True(t, ks.ClobKeeper.GetMemstoreInitialized(ks.Ctx)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test doesn't fully validate "OnlyAllowedOnce" behavior. The test name suggests it should verify that initialization is only allowed once, but it only checks if the first initialization succeeds. It should also verify that subsequent initialization attempts are properly handled. Consider updating the test to verify both cases: func TestInitMemStore_OnlyAllowedOnce(t *testing.T) {
memClob := memclob.NewMemClobPriceTimePriority(false)
ks := keepertest.NewClobKeepersTestContextWithUninitializedMemStore(
t,
memClob,
&mocks.BankKeeper{},
&mocks.IndexerEventManager{})
// First initialization should succeed
ks.ClobKeeper.InitMemStore(ks.Ctx)
require.True(t, ks.ClobKeeper.GetMemstoreInitialized(ks.Ctx))
+ // Second initialization should not be allowed
+ secondCtx := ks.Ctx.WithBlockHeight(ks.Ctx.BlockHeight() + 1)
+ ks.ClobKeeper.InitMemStore(secondCtx)
+
+ // Verify the initialization flag wasn't affected by second attempt
+ require.True(t, ks.ClobKeeper.GetMemstoreInitialized(secondCtx))
}
|
||
} | ||
|
||
func TestInitMemStore_StatefulOrderCount(t *testing.T) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename to
inMemStructsInitialized
or sth similar to disambiguate withmemStoreInitialized