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

chore: debug statements #399

Merged
merged 3 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 17 additions & 11 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ type BaseApp struct { // nolint: maligned
moduleRouter
migrator

// volatile states:
//
// checkState is set on InitChain and reset on Commit
// deliverState is set on InitChain and BeginBlock and set to nil on Commit
checkState *state // for CheckTx
// checkState is used for CheckTx, which is set based on the previous
// block's state. This state is never committed. This state is volatile in
// that it is set on InitChain and every subsequent Commit.
checkState *state
// deliverState is used for DeliverTx. This state is volatile in that it is
// set on InitChain and BeginBlock and set to nil on Commit.
deliverState *state // for DeliverTx

// paramStore is used to query for ABCI consensus parameters from an
Expand Down Expand Up @@ -309,6 +310,7 @@ func (app *BaseApp) MountStores(keys ...storetypes.StoreKey) {
// BaseApp multistore.
func (app *BaseApp) MountKVStores(keys map[string]*storetypes.KVStoreKey) {
for _, key := range keys {
app.logger.Debug("Mounting KVStore", key)
rootulp marked this conversation as resolved.
Show resolved Hide resolved
rootulp marked this conversation as resolved.
Show resolved Hide resolved
if !app.fauxMerkleMode {
app.MountStore(key, storetypes.StoreTypeIAVL)
} else {
Expand Down Expand Up @@ -341,9 +343,13 @@ func (app *BaseApp) MountStore(key storetypes.StoreKey, typ storetypes.StoreType
app.cms.MountStoreWithDB(key, typ, nil)
}

// LoadLatestVersion loads the latest application version. It will panic if
// called more than once on a running BaseApp.
// LoadLatestVersion loads the latest version from the commit multi-store. In
// this context version == block height. It will panic if called more than once
// on a running BaseApp.
//
// Side-effect: calls baseapp.Init()
func (app *BaseApp) LoadLatestVersion() error {
app.logger.Debug(fmt.Sprintf("Loading latest version %v\n", app.cms.LatestVersion()))
rootulp marked this conversation as resolved.
Show resolved Hide resolved
err := app.storeLoader(app.cms)
if err != nil {
return fmt.Errorf("failed to load latest version: %w", err)
Expand Down Expand Up @@ -464,10 +470,10 @@ func (app *BaseApp) Seal() { app.sealed = true }
// IsSealed returns true if the BaseApp is sealed and false otherwise.
func (app *BaseApp) IsSealed() bool { return app.sealed }

// setCheckState sets the BaseApp's checkState with a branched multi-store
// (i.e. a CacheMultiStore) and a new Context with the same multi-store branch,
// provided header, and minimum gas prices set. It is set on InitChain and reset
// on Commit.
// setCheckState sets the BaseApp's checkState with a branched multi-store (i.e.
// a CacheMultiStore) and a new Context with the same multi-store branch,
// provided header, and minimum gas prices set. This function should be invoked
// on InitChain and reset every Commit.
func (app *BaseApp) setCheckState(header tmproto.Header) {
ms := app.cms.CacheMultiStore()
app.checkState = &state{
Expand Down
2 changes: 1 addition & 1 deletion baseapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (app *BaseApp) SimDeliver(txEncoder sdk.TxEncoder, tx sdk.Tx) (sdk.GasInfo,
return gasInfo, result, err
}

// Context with current {check, deliver}State of the app used by tests.
// Context with current {check, deliver}State of the app.
func (app *BaseApp) NewContext(isCheckTx bool, header tmproto.Header) sdk.Context {
if isCheckTx {
return sdk.NewContext(app.checkState.ms, header, true, app.logger).
Expand Down
1 change: 1 addition & 0 deletions store/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type Store struct {
}

var (
// Store implements the CommitMultiStore interface.
_ types.CommitMultiStore = (*Store)(nil)
_ types.Queryable = (*Store)(nil)
)
Expand Down
Loading