From 92295c306194571d97c56b359c2dacc9fd1389d7 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 18 May 2022 16:08:56 +0800 Subject: [PATCH] clean up, rm unused --- app/simulation_test.go | 4 ++-- client/keys/add.go | 4 +++- client/keys/utils.go | 10 ---------- server/start.go | 1 - testutil/network/network.go | 17 +---------------- 5 files changed, 6 insertions(+), 30 deletions(-) diff --git a/app/simulation_test.go b/app/simulation_test.go index dc02f126..5dad080f 100644 --- a/app/simulation_test.go +++ b/app/simulation_test.go @@ -27,9 +27,9 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - // ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" "github.com/cosmos/cosmos-sdk/db/memdb" storetypes "github.com/cosmos/cosmos-sdk/store/types" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" @@ -190,7 +190,7 @@ func TestAppImportExport(t *testing.T) { {app.keys[evidencetypes.StoreKey], newApp.keys[evidencetypes.StoreKey], [][]byte{}}, {app.keys[capabilitytypes.StoreKey], newApp.keys[capabilitytypes.StoreKey], [][]byte{}}, {app.keys[ibchost.StoreKey], newApp.keys[ibchost.StoreKey], [][]byte{}}, - // {app.keys[ibctransfertypes.StoreKey], newApp.keys[ibctransfertypes.StoreKey], [][]byte{}}, + {app.keys[ibctransfertypes.StoreKey], newApp.keys[ibctransfertypes.StoreKey], [][]byte{}}, } for _, skp := range storeKeysPrefixes { diff --git a/client/keys/add.go b/client/keys/add.go index a8db3f8e..910977ab 100644 --- a/client/keys/add.go +++ b/client/keys/add.go @@ -156,7 +156,9 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf return err } - pks[i], err = k.GetPubKey() + if pks[i], err = k.GetPubKey(); err != nil { + return err + } } if noSort, _ := cmd.Flags().GetBool(flagNoSort); !noSort { diff --git a/client/keys/utils.go b/client/keys/utils.go index f86b1274..f27fe617 100644 --- a/client/keys/utils.go +++ b/client/keys/utils.go @@ -21,16 +21,6 @@ const ( type bechKeyOutFn func(keyInfo *cryptokeyring.Record) (cryptokeyring.KeyOutput, error) -// // NewLegacyKeyBaseFromDir initializes a legacy keybase at the rootDir directory. Keybase -// // options can be applied when generating this new Keybase. -// func NewLegacyKeyBaseFromDir(rootDir string, opts ...cryptokeyring.KeybaseOption) (cryptokeyring.LegacyKeybase, error) { -// return getLegacyKeyBaseFromDir(rootDir, opts...) -// } - -// func getLegacyKeyBaseFromDir(rootDir string, opts ...cryptokeyring.KeybaseOption) (cryptokeyring.LegacyKeybase, error) { -// return cryptokeyring.NewLegacy(defaultKeyDBName, filepath.Join(rootDir, "keys"), opts...) -// } - func printKeyInfo(w io.Writer, keyInfo *cryptokeyring.Record, bechKeyOut bechKeyOutFn, output string) { ko, err := bechKeyOut(keyInfo) if err != nil { diff --git a/server/start.go b/server/start.go index 7992ca22..5839cb42 100644 --- a/server/start.go +++ b/server/start.go @@ -148,7 +148,6 @@ which accepts a path for the resulting pprof file. cmd.Flags().Bool(server.FlagTrace, false, "Provide full stack traces for errors in ABCI Log") cmd.Flags().String(server.FlagPruning, storetypes.PruningOptionDefault, "Pruning strategy (default|nothing|everything|custom)") cmd.Flags().Uint64(server.FlagPruningKeepRecent, 0, "Number of recent heights to keep on disk (ignored if pruning is not 'custom')") - // cmd.Flags().Uint64(server.FlagPruningKeepEvery, 0, "Offset heights to keep on disk after 'keep-every' (ignored if pruning is not 'custom')") cmd.Flags().Uint64(server.FlagPruningInterval, 0, "Height interval at which pruned heights are removed from disk (ignored if pruning is not 'custom')") cmd.Flags().Uint(server.FlagInvCheckPeriod, 0, "Assert registered invariants every N blocks") cmd.Flags().Uint64(server.FlagMinRetainBlocks, 0, "Minimum block height offset during ABCI commit to prune Tendermint blocks") diff --git a/testutil/network/network.go b/testutil/network/network.go index 42714599..8edf2855 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -562,7 +562,7 @@ func (n *Network) LatestHeight() (int64, error) { // committed after a given block. If that height is not reached within a timeout, // an error is returned. Regardless, the latest height queried is returned. func (n *Network) WaitForHeight(h int64) (int64, error) { - return n.WaitForHeightWithTimeout(h, time.Duration(10*time.Second)) + return n.WaitForHeightWithTimeout(h, 10*time.Second) } // WaitForHeightWithTimeout is the same as WaitForHeight except the caller can @@ -638,21 +638,6 @@ func (n *Network) Cleanup() { _ = v.grpcWeb.Close() } } - - // if v.jsonrpc != nil { - // shutdownCtx, cancelFn := context.WithTimeout(context.Background(), 10*time.Second) - // defer cancelFn() - - // if err := v.jsonrpc.Shutdown(shutdownCtx); err != nil { - // v.tmNode.Logger.Error("HTTP server shutdown produced a warning", "error", err.Error()) - // } else { - // v.tmNode.Logger.Info("HTTP server shut down, waiting 5 sec") - // select { - // case <-time.Tick(5 * time.Second): - // case <-v.jsonrpcDone: - // } - // } - // } } if n.Config.CleanupDir {