Skip to content

Conversation

@technicallyty
Copy link
Contributor

@technicallyty technicallyty commented Oct 27, 2025

Description

updates the iavlx store impl to adhere to the changes required by blockSTM

Closes: #25496

@technicallyty technicallyty changed the base branch from main to aaronc/iavlx October 27, 2025 20:46
@github-actions github-actions bot added the C:CLI label Oct 27, 2025
@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

❌ Patch coverage is 8.75000% with 73 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (aaronc/iavlx@4feb860). Learn more about missing BASE report.

Files with missing lines Patch % Lines
iavl/multi_tree.go 0.00% 36 Missing ⚠️
iavl/commit_multi_tree.go 0.00% 30 Missing ⚠️
iavl/commit_tree.go 14.28% 6 Missing ⚠️
iavl/tree.go 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff               @@
##             aaronc/iavlx   #25504   +/-   ##
===============================================
  Coverage                ?   67.79%           
===============================================
  Files                   ?      887           
  Lines                   ?    58400           
  Branches                ?        0           
===============================================
  Hits                    ?    39590           
  Misses                  ?    18810           
  Partials                ?        0           
Files with missing lines Coverage Δ
iavl/tree_store.go 67.95% <100.00%> (ø)
iavl/tree.go 65.78% <50.00%> (ø)
iavl/commit_tree.go 73.20% <14.28%> (ø)
iavl/commit_multi_tree.go 0.00% <0.00%> (ø)
iavl/multi_tree.go 0.00% <0.00%> (ø)

Impacted file tree graph

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

func (db *CommitMultiTree) GetObjKVStore(key storetypes.StoreKey) storetypes.ObjKVStore {
treeIdx, ok := db.treesByKey[key]
if !ok {
panic(fmt.Sprintf("tree key not found in treesByKey: %v", key))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note, since we're changing the store interfaces for block stm anyway, is it maybe time to get rid of all these panics and add proper error values?

Copy link
Contributor Author

@technicallyty technicallyty Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could consider that. is it just for code cleanliness purposes? or is there some end user benefit to being able to react to these types of errors w/o a recover?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code cleanliness. Totally a side issue.

s := db.trees[index]
store, ok := s.(storetypes.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 Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
func (t *MultiTree) GetObjKVStore(key storetypes.StoreKey) storetypes.ObjKVStore {
store, ok := t.getCacheWrapper(key).(storetypes.ObjKVStore)
if !ok {
panic(fmt.Sprintf("store with key %v is not ObjKVStore", key))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
}
if index >= len(t.trees) {
panic(fmt.Sprintf("store index %d out of bounds for key %s (trees length: %d)", index, key.Name(), len(t.trees)))
panic(fmt.Sprintf("store with key %v is not KVStore: store type=%T", key, store))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@technicallyty technicallyty marked this pull request as ready for review October 29, 2025 16:57
@technicallyty technicallyty requested a review from aaronc October 29, 2025 17:07
func (db *CommitMultiTree) GetObjKVStore(key storetypes.StoreKey) storetypes.ObjKVStore {
treeIdx, ok := db.treesByKey[key]
if !ok {
panic(fmt.Sprintf("tree key not found in treesByKey: %v", key))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note, since we're changing the store interfaces for block stm anyway, is it maybe time to get rid of all these panics and add proper error values?

@github-actions
Copy link
Contributor

@technicallyty your pull request is missing a changelog!

if t.parentTree != nil {
store = t.initStore(key, t.parentTree(key))
} else {
panic(fmt.Sprintf("kv store with key %v has not been registered in stores", key))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@technicallyty technicallyty merged commit 7bd8e21 into aaronc/iavlx Oct 30, 2025
38 of 42 checks passed
@technicallyty technicallyty deleted the technicallyty/iavlx-blockstm branch October 30, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants