-
Notifications
You must be signed in to change notification settings - Fork 238
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
Problem: memiavl is not integrated with state machine #950
Conversation
for k, v := range rs.stores { | ||
store := types.KVStore(v) | ||
// Wire the listenkv.Store to allow listeners to observe the writes from the cache store, | ||
// set same listeners on cache store will observe duplicated writes. | ||
if rs.ListeningEnabled(k) { | ||
store = listenkv.NewStore(store, k, rs.listeners[k]) | ||
} | ||
stores[k] = store | ||
} |
Check failure
Code scanning / gosec
the value in the range statement should be _ unless copying a map: want: for key := range m
for k, v := range rs.stores { | ||
store := types.KVStore(v) | ||
// Wire the listenkv.Store to allow listeners to observe the writes from the cache store, | ||
// set same listeners on cache store will observe duplicated writes. | ||
if rs.ListeningEnabled(k) { | ||
store = listenkv.NewStore(store, k, rs.listeners[k]) | ||
} | ||
stores[k] = store | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map
Solution: - implement custom rootmulti store and kvstore wrappers add flag --memiavl to enable memiavl kvstore use change set api
store/rootmulti/store.go
Outdated
for key, store := range rs.stores { | ||
if memiavlStore, ok := store.(*memiavlstore.Store); ok { | ||
changeSets = append(changeSets, &memiavl.NamedChangeSet{ | ||
Name: key.Name(), | ||
Changeset: memiavlStore.PopChangeSet(), | ||
}) | ||
} else { | ||
commitID := store.Commit() | ||
// to keep the root hash compatible with cosmos-sdk 0.46 | ||
if store.GetStoreType() != types.StoreTypeTransient { | ||
si := types.StoreInfo{ | ||
Name: key.Name(), | ||
CommitId: commitID, | ||
} | ||
extraStoreInfos = append(extraStoreInfos, si) | ||
} | ||
} | ||
} |
Check failure
Code scanning / gosec
the value in the range statement should be _ unless copying a map: want: for key := range m
Co-authored-by: mmsqe <[email protected]> Signed-off-by: yihuang <[email protected]>
if importer != nil { | ||
importer.Close() | ||
} | ||
importer = NewTreeImporter(filepath.Join(dir, snapshotDir, item.Store.Name), int64(height)) |
Check failure
Code scanning / gosec
Potential integer overflow by integer type conversion
if height > math.MaxUint32 { | ||
return snapshottypes.SnapshotItem{}, fmt.Errorf("version overflows uint32: %d", height) | ||
} | ||
snapshotDir := snapshotName(uint32(height)) |
Check failure
Code scanning / gosec
Potential integer overflow by integer type conversion
1918e48
to
1b274f7
Compare
Codecov Report
@@ Coverage Diff @@
## main #950 +/- ##
===========================================
+ Coverage 21.57% 43.67% +22.10%
===========================================
Files 48 80 +32
Lines 3004 6537 +3533
===========================================
+ Hits 648 2855 +2207
- Misses 2293 3379 +1086
- Partials 63 303 +240
|
Closes: #938
Solution:
👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻
PR Checklist:
make
)make test
)go fmt
)golangci-lint run
)go list -json -m all | nancy sleuth
)Thank you for your code, it's appreciated! :)