From bc76e90b8db363721ecf3a7596f804ace29731cf Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Mon, 3 Oct 2022 10:19:38 -0500 Subject: [PATCH] fix app init mount stores & loadlatestversion --- app/app.go | 11 +++++++++++ app/app_test.go | 1 - app/test_helpers.go | 34 ++++++++++++++++++---------------- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/app/app.go b/app/app.go index a9c25c1c..a11a823d 100644 --- a/app/app.go +++ b/app/app.go @@ -641,6 +641,11 @@ func NewEthermintApp( app.sm.RegisterStoreDecoders() + // initialize stores + app.MountKVStores(keys) + app.MountTransientStores(tkeys) + app.MountMemoryStores(memKeys) + // initialize BaseApp app.SetInitChainer(app.InitChainer) app.SetBeginBlocker(app.BeginBlocker) @@ -670,6 +675,12 @@ func NewEthermintApp( app.ScopedIBCKeeper = scopedIBCKeeper app.ScopedTransferKeeper = scopedTransferKeeper + if loadLatest { + if err := app.LoadLatestVersion(); err != nil { + tmos.Exit(err.Error()) + } + } + return app } diff --git a/app/app_test.go b/app/app_test.go index cd3edb6b..fe0ce855 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -41,7 +41,6 @@ func TestEthermintAppExport(t *testing.T) { // Making a new app object with the db, so that initchain hasn't been called app2 := NewEthermintApp(logger2, db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, EmptyAppOptions{}) - require.NoError(t, app2.Init()) _, err := app2.ExportAppStateAndValidators(false, []string{}) require.NoError(t, err, "ExportAppStateAndValidators should not have an error") } diff --git a/app/test_helpers.go b/app/test_helpers.go index 821998a5..aefa16e3 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -5,31 +5,33 @@ import ( "testing" "time" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/testutil/mock" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/cerc-io/laconicd/crypto/ethsecp256k1" - "github.com/cerc-io/laconicd/encoding" - ethermint "github.com/cerc-io/laconicd/types" - "github.com/cosmos/cosmos-sdk/simapp/params" - "github.com/stretchr/testify/require" - tmjson "github.com/tendermint/tendermint/libs/json" - - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/ed25519" + tmjson "github.com/tendermint/tendermint/libs/json" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmtypes "github.com/tendermint/tendermint/types" dbm "github.com/tendermint/tm-db" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/simapp/params" + "github.com/cosmos/cosmos-sdk/testutil/mock" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/cerc-io/laconicd/crypto/ethsecp256k1" + "github.com/cerc-io/laconicd/encoding" + ethermint "github.com/cerc-io/laconicd/types" ) // GenesisState of the blockchain is represented here as a map of raw json