diff --git a/app/app.go b/app/app.go index 301b9fb348..81f774ddcf 100644 --- a/app/app.go +++ b/app/app.go @@ -19,7 +19,6 @@ import ( tmos "github.com/cometbft/cometbft/libs/os" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" @@ -790,7 +789,7 @@ func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig } func (app *App) RegisterNodeService(clientCtx client.Context) { - node.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) + nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) } // RegisterSwaggerAPI registers swagger route with API Server diff --git a/testutil/network/network_setup.go b/testutil/network/network_setup.go index 7cb0c8f2fc..ea8d5b2596 100644 --- a/testutil/network/network_setup.go +++ b/testutil/network/network_setup.go @@ -41,15 +41,9 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - _ "github.com/cosmos/cosmos-sdk/x/auth" - _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - _ "github.com/cosmos/cosmos-sdk/x/bank" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - _ "github.com/cosmos/cosmos-sdk/x/consensus" "github.com/cosmos/cosmos-sdk/x/genutil" - _ "github.com/cosmos/cosmos-sdk/x/params" - _ "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -331,12 +325,12 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) { clientDir := filepath.Join(network.BaseDir, nodeDirName, "simcli") gentxsDir := filepath.Join(network.BaseDir, "gentxs") - err := os.MkdirAll(filepath.Join(nodeDir, "config"), 0o755) + err := os.MkdirAll(filepath.Join(nodeDir, "config"), 0o755) // #nosec G301 if err != nil { return nil, err } - err = os.MkdirAll(clientDir, 0o755) + err = os.MkdirAll(clientDir, 0o755) // #nosec G301 if err != nil { return nil, err } @@ -605,40 +599,6 @@ func (n *Network) WaitForHeightWithTimeout(h int64, t time.Duration) (int64, err } } -// RetryForBlocks will wait for the next block and execute the function provided. -// It will do this until the function returns a nil error or until the number of -// blocks has been reached. -func (n *Network) RetryForBlocks(retryFunc func() error, blocks int) error { - for i := 0; i < blocks; i++ { - n.WaitForNextBlock() - err := retryFunc() - if err == nil { - return nil - } - // we've reached the last block to wait, return the error - if i == blocks-1 { - return err - } - } - return nil -} - -// WaitForNextBlock waits for the next block to be committed, returning an error -// upon failure. -func (n *Network) WaitForNextBlock() error { - lastBlock, err := n.LatestHeight() - if err != nil { - return err - } - - _, err = n.WaitForHeight(lastBlock + 1) - if err != nil { - return err - } - - return err -} - // Cleanup removes the root testing (temporary) directory and stops both the // Tendermint and API services. It allows other callers to create and start // test networks. This method must be called when a test is finished, typically diff --git a/x/crosschain/client/cli/cli_out_tx_tracker_test.go b/x/crosschain/client/cli/cli_out_tx_tracker_test.go index 01976193dc..9c648322df 100644 --- a/x/crosschain/client/cli/cli_out_tx_tracker_test.go +++ b/x/crosschain/client/cli/cli_out_tx_tracker_test.go @@ -1,36 +1,25 @@ package cli_test -import ( - "fmt" - "testing" +// func networkWithOutTxTrackerObjects(t *testing.T, n int) (*network.Network, []types.OutTxTracker) { +// t.Helper() +// cfg := network.DefaultConfig() +// state := types.GenesisState{} +// require.NoError(t, cfg.Codec.UnmarshalJSON(cfg.GenesisState[types.ModuleName], &state)) - "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/app" - "github.com/zeta-chain/zetacore/testutil/network" - "github.com/zeta-chain/zetacore/testutil/nullify" - "github.com/zeta-chain/zetacore/x/crosschain/types" -) - -func networkWithOutTxTrackerObjects(t *testing.T, n int) (*network.Network, []types.OutTxTracker) { - t.Helper() - cfg := network.DefaultConfig() - state := types.GenesisState{} - require.NoError(t, cfg.Codec.UnmarshalJSON(cfg.GenesisState[types.ModuleName], &state)) - - for i := 0; i < n; i++ { - outTxTracker := types.OutTxTracker{ - Index: fmt.Sprintf("testchain-%d", i), - } - nullify.Fill(&outTxTracker) - state.OutTxTrackerList = append(state.OutTxTrackerList, outTxTracker) - } - buf, err := cfg.Codec.MarshalJSON(&state) - require.NoError(t, err) - cfg.GenesisState[types.ModuleName] = buf - //cfg.GenesisState = network.SetupZetaGenesisState(t, cfg.GenesisState, cfg.Codec) - net, err := network.New(t, app.NodeDir, cfg) - return net, state.OutTxTrackerList -} +// for i := 0; i < n; i++ { +// outTxTracker := types.OutTxTracker{ +// Index: fmt.Sprintf("testchain-%d", i), +// } +// nullify.Fill(&outTxTracker) +// state.OutTxTrackerList = append(state.OutTxTrackerList, outTxTracker) +// } +// buf, err := cfg.Codec.MarshalJSON(&state) +// require.NoError(t, err) +// cfg.GenesisState[types.ModuleName] = buf +// //cfg.GenesisState = network.SetupZetaGenesisState(t, cfg.GenesisState, cfg.Codec) +// net, err := network.New(t, app.NodeDir, cfg) +// return net, state.OutTxTrackerList +// } // //func TestShowOutTxTracker(t *testing.T) {