From 9395e7d8bab4e2ce4068a9da020206c613834d6f Mon Sep 17 00:00:00 2001 From: dudong2 Date: Wed, 17 Jan 2024 18:16:34 +0900 Subject: [PATCH] test: fix lint --- app/upgrades.go | 4 +++- cmd/ethermintd/commands.go | 28 ++++++++++++++++++++++------ cmd/ethermintd/root.go | 2 +- testutil/network/network.go | 5 ++++- testutil/network/util.go | 11 +++++++++-- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index 6be3a085f8..cf50df59de 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -101,7 +101,9 @@ func (app *EthermintApp) RegisterUpgradeHandlers( } legacyBaseAppSubspace := paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) - baseapp.MigrateParams(sdkCtx, legacyBaseAppSubspace, &consensusParamsKeeper.ParamsStore) + if err := baseapp.MigrateParams(sdkCtx, legacyBaseAppSubspace, &consensusParamsKeeper.ParamsStore); err != nil { + return nil, err + } // ibc v7.1 // explicitly update the IBC 02-client params, adding the localhost client type diff --git a/cmd/ethermintd/commands.go b/cmd/ethermintd/commands.go index 29bf4969f2..0acea882ae 100644 --- a/cmd/ethermintd/commands.go +++ b/cmd/ethermintd/commands.go @@ -39,8 +39,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdkserver "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -62,8 +60,6 @@ func initRootCmd( encodingConfig params.EncodingConfig, rootCmd *cobra.Command, txConfig client.TxConfig, - interfaceRegistry codectypes.InterfaceRegistry, - appCodec codec.Codec, basicManager module.BasicManager, ) { cfg := sdk.GetConfig() @@ -266,13 +262,33 @@ func (a appCreator) appExport( } if height != -1 { - ethermintApp = ethermintapp.NewEthermintApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1), appOpts, baseapp.SetChainID(ethermintapp.ChainID)) + ethermintApp = ethermintapp.NewEthermintApp( + logger, + db, + traceStore, + false, + map[int64]bool{}, + "", + uint(1), + appOpts, + baseapp.SetChainID(ethermintapp.ChainID), + ) if err := ethermintApp.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } } else { - ethermintApp = ethermintapp.NewEthermintApp(logger, db, traceStore, true, map[int64]bool{}, "", uint(1), appOpts, baseapp.SetChainID(ethermintapp.ChainID)) + ethermintApp = ethermintapp.NewEthermintApp( + logger, + db, + traceStore, + true, + map[int64]bool{}, + "", + uint(1), + appOpts, + baseapp.SetChainID(ethermintapp.ChainID), + ) } return ethermintApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) diff --git a/cmd/ethermintd/root.go b/cmd/ethermintd/root.go index 44aea74120..0669e46ae1 100644 --- a/cmd/ethermintd/root.go +++ b/cmd/ethermintd/root.go @@ -133,7 +133,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { // TODO: double-check // authclient.Codec = encodingConfig.Codec - initRootCmd(tempApp, encodingConfig, rootCmd, encodingConfig.TxConfig, encodingConfig.InterfaceRegistry, encodingConfig.Codec, tempApp.BasicModuleManager) + initRootCmd(tempApp, encodingConfig, rootCmd, encodingConfig.TxConfig, tempApp.BasicModuleManager) autoCliOpts := tempApp.AutoCliOpts() initClientCtx, _ = config.ReadFromClientConfig(initClientCtx) diff --git a/testutil/network/network.go b/testutil/network/network.go index eba7bb06aa..f7200ab0ad 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -738,7 +738,10 @@ func (n *Network) WaitForHeightWithTimeout(h int64, t time.Duration) (int64, err // blocks has been reached. func (n *Network) RetryForBlocks(retryFunc func() error, blocks int) error { for i := 0; i < blocks; i++ { - n.WaitForNextBlock() + if err := n.WaitForNextBlock(); err != nil { + return err + } + err := retryFunc() if err == nil { return nil diff --git a/testutil/network/util.go b/testutil/network/util.go index 9c2127a647..4201eec651 100644 --- a/testutil/network/util.go +++ b/testutil/network/util.go @@ -193,8 +193,15 @@ func collectGenFiles(cfg Config, vals []*Validator, outputDir string) error { return err } - appState, err := genutil.GenAppStateFromConfig(cfg.Codec, cfg.TxConfig, - tmCfg, initCfg, appGenesis, banktypes.GenesisBalancesIterator{}, genutiltypes.DefaultMessageValidator, cfg.TxConfig.SigningContext().ValidatorAddressCodec()) + appState, err := genutil.GenAppStateFromConfig( + cfg.Codec, cfg.TxConfig, + tmCfg, + initCfg, + appGenesis, + banktypes.GenesisBalancesIterator{}, + genutiltypes.DefaultMessageValidator, + cfg.TxConfig.SigningContext().ValidatorAddressCodec(), + ) if err != nil { return err }