From 2afc90ac9e0263a126e7a00362a85efb47b4996b Mon Sep 17 00:00:00 2001 From: Matthew Witkowski Date: Fri, 5 Jan 2024 11:01:30 -0500 Subject: [PATCH] Clean up text and example code. --- app/app.go | 5 +---- app/store_loader.go | 21 +++------------------ 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/app/app.go b/app/app.go index bcb7c2fcb4..adf39047e6 100644 --- a/app/app.go +++ b/app/app.go @@ -1077,11 +1077,8 @@ func New( } // -- - // Verify configuration settings before boot - // storeLoader = DBBackendWrapper(app.Logger(), appOpts, storeLoader) + // Verify configuration settings storeLoader = PruningWrapper(app.Logger(), appOpts, storeLoader) - // storeLoader = IAVLWrapper(storeLoader) - // storeLoader = ValidatorWrapper(storeLoader) app.SetStoreLoader(storeLoader) if loadLatest { diff --git a/app/store_loader.go b/app/store_loader.go index 8878ecb4d6..dfbd97b7fe 100644 --- a/app/store_loader.go +++ b/app/store_loader.go @@ -7,11 +7,9 @@ import ( "time" "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" ) type StoreLoaderWrapper func(sdk.CommitMultiStore, baseapp.StoreLoader) error @@ -31,30 +29,17 @@ func WrapStoreLoader(wrapper StoreLoaderWrapper, storeLoader baseapp.StoreLoader } } -// DBBackendWrapper creates a new StoreLoader that first validates the DBBackend type before calling the provided StoreLoader. -func DBBackendWrapper(logger log.Logger, appOpts servertypes.AppOptions, storeLoader baseapp.StoreLoader) baseapp.StoreLoader { - return WrapStoreLoader(func(ms sdk.CommitMultiStore, sl baseapp.StoreLoader) error { - backend := server.GetAppDBBackend(appOpts) - if backend != dbm.GoLevelDBBackend { - logger.Error(fmt.Sprintf("%s IS NO LONGER SUPPORTED. MIGRATE TO %s", backend, dbm.GoLevelDBBackend)) - time.Sleep(30 * time.Second) - } - - return sl(ms) - }, storeLoader) -} - // PruningWrapper creates a new StoreLoader that first validates the pruning settings before calling the provided StoreLoader. func PruningWrapper(logger log.Logger, appOpts servertypes.AppOptions, storeLoader baseapp.StoreLoader) baseapp.StoreLoader { return WrapStoreLoader(func(ms sdk.CommitMultiStore, sl baseapp.StoreLoader) error { - const MAX_PRUNING_INTERVAL = 100 + const MaxPruningInterval = 100 // No error checking is needed because we leave that up to the sdk. pruningString, _ := appOpts.Get("pruning-interval").(string) interval, _ := strconv.ParseUint(pruningString, 10, 64) - if interval > MAX_PRUNING_INTERVAL { - logger.Error(fmt.Sprintf("pruning-interval %s IS INVALID AND CANNOT EXCEED %d", pruningString, MAX_PRUNING_INTERVAL)) + if interval > MaxPruningInterval { + logger.Error(fmt.Sprintf("pruning-interval %s EXCEEDS %d AND IS NOT RECOMMENDED, AS IT CAN LEAD TO MISSED BLOCKS ON VALIDATORS", pruningString, MaxPruningInterval)) time.Sleep(30 * time.Second) } return sl(ms)