Skip to content

Conversation

technicallyty
Copy link
Contributor

Description

Closes: #XXXX

yihuang and others added 15 commits March 27, 2025 16:15
generic interface

generic btree

generic cachekv

generic transient store

support ObjStore

changelog

Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

object store key

Apply review suggestions

fix merge conflict

fix snapshot

revert dependers

prefix store support object store (#236)

Problem: snapshot for object store is not skipped (#585)

resolve
// TODO overflow-safe math?
gs.gasMeter.ConsumeGas(gs.gasConfig.ReadCostPerByte*types.Gas(len(key)), types.GasReadPerByteDesc)
gs.gasMeter.ConsumeGas(gs.gasConfig.ReadCostPerByte*types.Gas(len(value)), types.GasReadPerByteDesc)
gs.gasMeter.ConsumeGas(gs.gasConfig.ReadCostPerByte*types.Gas(gs.valueLen(value)), types.GasReadPerByteDesc)

Check failure

Code scanning / gosec

integer overflow conversion uint64 -> uint32

integer overflow conversion int -> uint64
// TODO overflow-safe math?
gs.gasMeter.ConsumeGas(gs.gasConfig.WriteCostPerByte*types.Gas(len(key)), types.GasWritePerByteDesc)
gs.gasMeter.ConsumeGas(gs.gasConfig.WriteCostPerByte*types.Gas(len(value)), types.GasWritePerByteDesc)
gs.gasMeter.ConsumeGas(gs.gasConfig.WriteCostPerByte*types.Gas(gs.valueLen(value)), types.GasWritePerByteDesc)

Check failure

Code scanning / gosec

integer overflow conversion uint64 -> uint32

integer overflow conversion int -> uint64

gi.gasMeter.ConsumeGas(gi.gasConfig.ReadCostPerByte*types.Gas(len(key)), types.GasValuePerByteDesc)
gi.gasMeter.ConsumeGas(gi.gasConfig.ReadCostPerByte*types.Gas(len(value)), types.GasValuePerByteDesc)
gi.gasMeter.ConsumeGas(gi.gasConfig.ReadCostPerByte*types.Gas(gi.valueLen(value)), types.GasValuePerByteDesc)

Check failure

Code scanning / gosec

integer overflow conversion uint64 -> uint32

integer overflow conversion int -> uint64
func (cms Store) GetKVStore(key types.StoreKey) types.KVStore {
store, ok := cms.getCacheWrap(key).(types.KVStore)
if !ok {
panic(fmt.Sprintf("store with key %v is not KVStore", key))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
store := types.KVStore(s)
store, ok := s.(types.KVStore)
if !ok {
panic(fmt.Sprintf("store with key %v is not KVStore", key))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
// AssertValidValueGeneric checks if the value is valid(value is not nil and within length limit)
func AssertValidValueGeneric[V any](value V, isZero func(V) bool, valueLen func(V) int) {
if isZero(value) {
panic("value is nil")

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
// AssertValidValueLength checks if the value length is within length limit
func AssertValidValueLength(l int) {
if l > MaxValueLength {
panic(errors.New("value is too large"))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 76.41791% with 79 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.55%. Comparing base (d081460) to head (b37ab1f).

Files with missing lines Patch % Lines
store/internal/btreeadaptor.go 20.00% 16 Missing ⚠️
store/cachemulti/store.go 36.36% 14 Missing ⚠️
store/rootmulti/store.go 77.08% 11 Missing ⚠️
store/transient/store.go 52.63% 9 Missing ⚠️
store/prefix/store.go 80.00% 8 Missing ⚠️
store/cachekv/store.go 84.44% 7 Missing ⚠️
runtime/module.go 20.00% 4 Missing ⚠️
store/gaskv/store.go 90.24% 4 Missing ⚠️
store/internal/btree/btree.go 90.00% 2 Missing ⚠️
store/types/store.go 88.23% 2 Missing ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #25340       +/-   ##
===========================================
+ Coverage   52.88%   67.55%   +14.67%     
===========================================
  Files         797      852       +55     
  Lines       64903    68603     +3700     
===========================================
+ Hits        34322    46344    +12022     
+ Misses      30581    22259     -8322     
Files with missing lines Coverage Δ
baseapp/baseapp.go 82.23% <100.00%> (+3.25%) ⬆️
contrib/x/group/internal/orm/testsupport.go 62.22% <100.00%> (ø)
runtime/store.go 62.50% <100.00%> (+62.50%) ⬆️
store/listenkv/store.go 96.07% <100.00%> (ø)
store/tracekv/store.go 93.33% <100.00%> (ø)
store/types/validity.go 93.75% <100.00%> (ø)
types/context.go 91.62% <100.00%> (+13.65%) ⬆️
store/cachekv/internal/mergeiterator.go 91.97% <94.11%> (ø)
store/internal/btree/memiterator.go 93.24% <94.11%> (ø)
store/internal/btree/btree.go 89.74% <90.00%> (ø)
... and 9 more

... and 352 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Eric-Warehime Eric-Warehime marked this pull request as ready for review October 16, 2025 23:44
@Eric-Warehime Eric-Warehime requested a review from aljo242 October 16, 2025 23:45
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