Skip to content
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

fix: disable pre deliver when raw db store is used #281

Merged
merged 5 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,10 @@ func (app *BaseApp) PreBeginBlock(req abci.RequestPreBeginBlock) (res abci.Respo
app.cms.SetTracingContext(map[string]interface{}{"blockHeight": req.Header.Height})
}

// Initialize the preDeliverTx state.
app.setPreState(req.StateNumber, req.Header)
if app.IsIavlStore() {
// Initialize the preDeliverTx state.
app.setPreState(req.StateNumber, req.Header)
}

res = abci.ResponsePrefetch{Code: abci.CodeTypeOK}
return
Expand All @@ -559,6 +561,10 @@ func (app *BaseApp) PreDeliverTx(req abci.RequestPreDeliverTx) {
}
}()

if !app.IsIavlStore() {
return
}

preState := app.preDeliverStates[req.StateIndex]
if preState == nil {
return
Expand All @@ -580,7 +586,9 @@ func (app *BaseApp) PreCommit(req abci.RequestPreCommit) (res abci.ResponsePrefe
}
}()

app.preDeliverStates[req.StateIndex].ms.Write()
if app.IsIavlStore() {
app.preDeliverStates[req.StateIndex].ms.Write()
}

res = abci.ResponsePrefetch{Code: abci.CodeTypeOK}
return
Expand Down
4 changes: 2 additions & 2 deletions store/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ func (rs *Store) DeepCopyAndCache() types.CacheMultiStore {
} else if _, ok := v.(*transient.Store); ok {
stores[k] = transient.NewStore()
} else if dbStore, ok := v.(commitDBStoreAdapter); ok {
stores[k] = commitDBStoreAdapter{Store: dbadapter.Store{DB: dbStore.Store.DB}}
stores[k] = cache.NewCommitKVStoreCache(commitDBStoreAdapter{Store: dbadapter.Store{DB: dbStore.Store.DB}}, 1000).CommitKVStore
}
}
return cachemulti.NewStore(rs.db, stores, rs.keysByName, rs.traceWriter, rs.getTracingContext())
Expand All @@ -598,7 +598,7 @@ func (rs *Store) DeepCopy() *Store {
} else if _, ok := v.(*transient.Store); ok {
stores[k] = transient.NewStore()
} else if dbStore, ok := v.(commitDBStoreAdapter); ok {
stores[k] = commitDBStoreAdapter{Store: dbadapter.Store{DB: dbStore.Store.DB}}
stores[k] = cache.NewCommitKVStoreCache(commitDBStoreAdapter{Store: dbadapter.Store{DB: dbStore.Store.DB}}, 1000).CommitKVStore
}
}

Expand Down