diff --git a/ignite/cmd/bubblemodel/chain_debug_test.go b/ignite/cmd/bubblemodel/chain_debug_test.go index dce1f20763..3a2206f59a 100644 --- a/ignite/cmd/bubblemodel/chain_debug_test.go +++ b/ignite/cmd/bubblemodel/chain_debug_test.go @@ -7,23 +7,13 @@ import ( tea "github.com/charmbracelet/bubbletea" "github.com/stretchr/testify/require" -<<<<<<< HEAD:ignite/cmd/model/chain_debug_test.go - cmdmodel "github.com/ignite/cli/v28/ignite/cmd/model" - "github.com/ignite/cli/v28/ignite/cmd/model/testdata" + cmdmodel "github.com/ignite/cli/v28/ignite/cmd/bubblemodel" + "github.com/ignite/cli/v28/ignite/cmd/bubblemodel/testdata" "github.com/ignite/cli/v28/ignite/pkg/cliui/colors" "github.com/ignite/cli/v28/ignite/pkg/cliui/icons" cliuimodel "github.com/ignite/cli/v28/ignite/pkg/cliui/model" "github.com/ignite/cli/v28/ignite/pkg/errors" "github.com/ignite/cli/v28/ignite/pkg/events" -======= - cmdmodel "github.com/ignite/cli/v29/ignite/cmd/bubblemodel" - "github.com/ignite/cli/v29/ignite/cmd/bubblemodel/testdata" - "github.com/ignite/cli/v29/ignite/pkg/cliui/colors" - "github.com/ignite/cli/v29/ignite/pkg/cliui/icons" - cliuimodel "github.com/ignite/cli/v29/ignite/pkg/cliui/model" - "github.com/ignite/cli/v29/ignite/pkg/errors" - "github.com/ignite/cli/v29/ignite/pkg/events" ->>>>>>> b7e3ab3c (feat: Add multi node (validator) testnet (#4377)):ignite/cmd/bubblemodel/chain_debug_test.go ) func TestChainDebugErrorView(t *testing.T) { diff --git a/ignite/cmd/bubblemodel/chain_serve_test.go b/ignite/cmd/bubblemodel/chain_serve_test.go index 92487d067d..b0135a1258 100644 --- a/ignite/cmd/bubblemodel/chain_serve_test.go +++ b/ignite/cmd/bubblemodel/chain_serve_test.go @@ -9,23 +9,13 @@ import ( tea "github.com/charmbracelet/bubbletea" "github.com/stretchr/testify/require" -<<<<<<< HEAD:ignite/cmd/model/chain_serve_test.go - cmdmodel "github.com/ignite/cli/v28/ignite/cmd/model" - "github.com/ignite/cli/v28/ignite/cmd/model/testdata" + cmdmodel "github.com/ignite/cli/v28/ignite/cmd/bubblemodel" + "github.com/ignite/cli/v28/ignite/cmd/bubblemodel/testdata" "github.com/ignite/cli/v28/ignite/pkg/cliui/colors" "github.com/ignite/cli/v28/ignite/pkg/cliui/icons" cliuimodel "github.com/ignite/cli/v28/ignite/pkg/cliui/model" "github.com/ignite/cli/v28/ignite/pkg/errors" "github.com/ignite/cli/v28/ignite/pkg/events" -======= - cmdmodel "github.com/ignite/cli/v29/ignite/cmd/bubblemodel" - "github.com/ignite/cli/v29/ignite/cmd/bubblemodel/testdata" - "github.com/ignite/cli/v29/ignite/pkg/cliui/colors" - "github.com/ignite/cli/v29/ignite/pkg/cliui/icons" - cliuimodel "github.com/ignite/cli/v29/ignite/pkg/cliui/model" - "github.com/ignite/cli/v29/ignite/pkg/errors" - "github.com/ignite/cli/v29/ignite/pkg/events" ->>>>>>> b7e3ab3c (feat: Add multi node (validator) testnet (#4377)):ignite/cmd/bubblemodel/chain_serve_test.go ) var chainServeActions = colors.Faint("Press the 'q' key to stop serve") diff --git a/ignite/cmd/bubblemodel/testnet_multi_node.go b/ignite/cmd/bubblemodel/testnet_multi_node.go index 0ae5eb14c4..cb843c7573 100644 --- a/ignite/cmd/bubblemodel/testnet_multi_node.go +++ b/ignite/cmd/bubblemodel/testnet_multi_node.go @@ -13,7 +13,7 @@ import ( "github.com/charmbracelet/lipgloss" "golang.org/x/sync/errgroup" - "github.com/ignite/cli/v29/ignite/services/chain" + "github.com/ignite/cli/v28/ignite/services/chain" ) // NodeStatus is an integer data type that represents the status of a node. diff --git a/ignite/cmd/chain_debug.go b/ignite/cmd/chain_debug.go index be5d92e950..42407700cb 100644 --- a/ignite/cmd/chain_debug.go +++ b/ignite/cmd/chain_debug.go @@ -7,8 +7,7 @@ import ( tea "github.com/charmbracelet/bubbletea" "github.com/spf13/cobra" -<<<<<<< HEAD - cmdmodel "github.com/ignite/cli/v28/ignite/cmd/model" + cmdmodel "github.com/ignite/cli/v28/ignite/cmd/bubblemodel" chainconfig "github.com/ignite/cli/v28/ignite/config/chain" "github.com/ignite/cli/v28/ignite/pkg/chaincmd" "github.com/ignite/cli/v28/ignite/pkg/cliui" @@ -19,19 +18,6 @@ import ( "github.com/ignite/cli/v28/ignite/pkg/events" "github.com/ignite/cli/v28/ignite/pkg/xurl" "github.com/ignite/cli/v28/ignite/services/chain" -======= - cmdmodel "github.com/ignite/cli/v29/ignite/cmd/bubblemodel" - chainconfig "github.com/ignite/cli/v29/ignite/config/chain" - "github.com/ignite/cli/v29/ignite/pkg/chaincmd" - "github.com/ignite/cli/v29/ignite/pkg/cliui" - "github.com/ignite/cli/v29/ignite/pkg/cliui/icons" - cliuimodel "github.com/ignite/cli/v29/ignite/pkg/cliui/model" - "github.com/ignite/cli/v29/ignite/pkg/debugger" - "github.com/ignite/cli/v29/ignite/pkg/errors" - "github.com/ignite/cli/v29/ignite/pkg/events" - "github.com/ignite/cli/v29/ignite/pkg/xurl" - "github.com/ignite/cli/v29/ignite/services/chain" ->>>>>>> b7e3ab3c (feat: Add multi node (validator) testnet (#4377)) ) const ( diff --git a/ignite/cmd/chain_serve.go b/ignite/cmd/chain_serve.go index 3252a22108..cbbffc4392 100644 --- a/ignite/cmd/chain_serve.go +++ b/ignite/cmd/chain_serve.go @@ -6,23 +6,13 @@ import ( tea "github.com/charmbracelet/bubbletea" "github.com/spf13/cobra" -<<<<<<< HEAD - cmdmodel "github.com/ignite/cli/v28/ignite/cmd/model" + cmdmodel "github.com/ignite/cli/v28/ignite/cmd/bubblemodel" "github.com/ignite/cli/v28/ignite/pkg/cliui" uilog "github.com/ignite/cli/v28/ignite/pkg/cliui/log" cliuimodel "github.com/ignite/cli/v28/ignite/pkg/cliui/model" "github.com/ignite/cli/v28/ignite/pkg/errors" "github.com/ignite/cli/v28/ignite/pkg/events" "github.com/ignite/cli/v28/ignite/services/chain" -======= - cmdmodel "github.com/ignite/cli/v29/ignite/cmd/bubblemodel" - "github.com/ignite/cli/v29/ignite/pkg/cliui" - uilog "github.com/ignite/cli/v29/ignite/pkg/cliui/log" - cliuimodel "github.com/ignite/cli/v29/ignite/pkg/cliui/model" - "github.com/ignite/cli/v29/ignite/pkg/errors" - "github.com/ignite/cli/v29/ignite/pkg/events" - "github.com/ignite/cli/v29/ignite/services/chain" ->>>>>>> b7e3ab3c (feat: Add multi node (validator) testnet (#4377)) ) const ( diff --git a/ignite/cmd/testnet_multi_node.go b/ignite/cmd/testnet_multi_node.go index 0a3db23689..0c7503027d 100644 --- a/ignite/cmd/testnet_multi_node.go +++ b/ignite/cmd/testnet_multi_node.go @@ -9,13 +9,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" - cmdmodel "github.com/ignite/cli/v29/ignite/cmd/bubblemodel" - igcfg "github.com/ignite/cli/v29/ignite/config" - v1 "github.com/ignite/cli/v29/ignite/config/chain/v1" - "github.com/ignite/cli/v29/ignite/pkg/availableport" - "github.com/ignite/cli/v29/ignite/pkg/cliui" - "github.com/ignite/cli/v29/ignite/pkg/xfilepath" - "github.com/ignite/cli/v29/ignite/services/chain" + cmdmodel "github.com/ignite/cli/v28/ignite/cmd/bubblemodel" + igcfg "github.com/ignite/cli/v28/ignite/config" + v1 "github.com/ignite/cli/v28/ignite/config/chain/v1" + "github.com/ignite/cli/v28/ignite/pkg/availableport" + "github.com/ignite/cli/v28/ignite/pkg/cliui" + "github.com/ignite/cli/v28/ignite/pkg/xfilepath" + "github.com/ignite/cli/v28/ignite/services/chain" ) const ( diff --git a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/commands.go.plush b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/commands.go.plush index d608546255..d91cb16c07 100644 --- a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/commands.go.plush +++ b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/commands.go.plush @@ -20,6 +20,7 @@ import ( servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/types/module" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/spf13/cobra" @@ -34,14 +35,9 @@ func initRootCmd( basicManager module.BasicManager, ) { rootCmd.AddCommand( -<<<<<<< HEAD genutilcli.InitCmd(basicManager, app.DefaultNodeHome), NewInPlaceTestnetCmd(addModuleInitFlags), -======= - genutilcli.InitCmd(moduleManager), - NewInPlaceTestnetCmd(), - NewTestnetMultiNodeCmd(moduleManager), ->>>>>>> b7e3ab3c (feat: Add multi node (validator) testnet (#4377)) + NewTestnetMultiNodeCmd(basicManager, banktypes.GenesisBalancesIterator{}), debug.Cmd(), confixcmd.ConfigCommand(), pruning.Cmd(newApp, app.DefaultNodeHome), diff --git a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/testnet_multi_node.go.plush b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/testnet_multi_node.go.plush index 0f6532b750..8a02caab08 100644 --- a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/testnet_multi_node.go.plush +++ b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/testnet_multi_node.go.plush @@ -19,14 +19,11 @@ import ( "github.com/spf13/pflag" "cosmossdk.io/math" - banktypes "cosmossdk.io/x/bank/types" - stakingtypes "cosmossdk.io/x/staking/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/server" srvconfig "github.com/cosmos/cosmos-sdk/server/config" @@ -34,8 +31,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + runtime "github.com/cosmos/cosmos-sdk/runtime" ) var ( @@ -63,7 +64,7 @@ type initArgs struct { } // NewTestnetMultiNodeCmd returns a cmd to initialize all files for tendermint testnet and application -func NewTestnetMultiNodeCmd(mbm *module.Manager) *cobra.Command { +func NewTestnetMultiNodeCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command { cmd := &cobra.Command{ Use: "multi-node", Short: "Initialize config directories & files for a multi-validator testnet running locally via separate processes (e.g. Docker Compose or similar)", @@ -127,7 +128,7 @@ Example: } } - return initTestnetFiles(clientCtx, cmd, config, mbm, args) + return initTestnetFiles(clientCtx, cmd, config, mbm, genBalIterator, args) }, } @@ -163,7 +164,8 @@ func initTestnetFiles( clientCtx client.Context, cmd *cobra.Command, nodeConfig *cmtconfig.Config, - mbm *module.Manager, + mbm module.BasicManager, + genBalIterator banktypes.GenesisBalancesIterator, args initArgs, ) error { if args.chainID == "" { @@ -196,7 +198,7 @@ func initTestnetFiles( nodeConfig.SetRoot(nodeDir) nodeConfig.Moniker = nodeDirName - nodeConfig.RPC.ListenAddress = "tcp://0.0.0.0:" + args.ports[i] + nodeConfig.RPC.ListenAddress = "tcp://0.0.0.0:" + args.ports[i] var err error if err := os.MkdirAll(filepath.Join(nodeDir, "config"), nodeDirPerm); err != nil { @@ -204,7 +206,7 @@ func initTestnetFiles( return err } - nodeIDs[i], valPubKeys[i], err = genutil.InitializeNodeValidatorFiles(nodeConfig, ed25519.KeyType) + nodeIDs[i], valPubKeys[i], err = genutil.InitializeNodeValidatorFiles(nodeConfig) if err != nil { _ = os.RemoveAll(args.outputDir) return err @@ -231,7 +233,7 @@ func initTestnetFiles( return err } - addr, secret, err := testutil.GenerateSaveCoinKey(kb, nodeDirName, "", true, algo, sdk.GetFullBIP44Path()) + addr, secret, err := testutil.GenerateSaveCoinKey(kb, nodeDirName, "", true, algo) if err != nil { _ = os.RemoveAll(args.outputDir) return err @@ -291,7 +293,7 @@ func initTestnetFiles( WithKeybase(kb). WithTxConfig(clientCtx.TxConfig) - if err := tx.Sign(clientCtx, txFactory, nodeDirName, txBuilder, true); err != nil { + if err := tx.Sign(cmd.Context(), txFactory, nodeDirName, txBuilder, true); err != nil { return err } @@ -307,10 +309,7 @@ func initTestnetFiles( appConfig.GRPC.Address = args.startingIPAddress + ":" + strconv.Itoa(9090-2*i) appConfig.API.Address = "tcp://localhost:" + strconv.Itoa(1317-i) - err = srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), appConfig) - if err != nil { - return err - } + srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), appConfig) } if err := initGenFiles(clientCtx, mbm, args.chainID, genAccounts, genBalances, genFiles, args.numValidators); err != nil { @@ -327,15 +326,13 @@ func initTestnetFiles( if err != nil || yes { continue } - _, err = copyFile(file, gentxsDir) - if err != nil { - return err - } - + copyFile(file, gentxsDir) } } err := collectGenFiles( clientCtx, nodeConfig, nodeIDs, valPubKeys, + genBalIterator, + clientCtx.TxConfig.SigningContext().ValidatorAddressCodec(), persistentPeers, args, ) if err != nil { @@ -359,11 +356,11 @@ func writeFile(file, dir string, contents []byte) error { } func initGenFiles( - clientCtx client.Context, mbm *module.Manager, chainID string, + clientCtx client.Context, mbm module.BasicManager, chainID string, genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance, genFiles []string, numValidators int, ) error { - appGenState := mbm.DefaultGenesis() + appGenState := mbm.DefaultGenesis(clientCtx.Codec) // set the accounts in the genesis state var authGenState authtypes.GenesisState @@ -381,10 +378,7 @@ func initGenFiles( var bankGenState banktypes.GenesisState clientCtx.Codec.MustUnmarshalJSON(appGenState[banktypes.ModuleName], &bankGenState) - bankGenState.Balances, err = banktypes.SanitizeGenesisBalances(genBalances, clientCtx.AddressCodec) - if err != nil { - return err - } + bankGenState.Balances = banktypes.SanitizeGenesisBalances(genBalances) for _, bal := range bankGenState.Balances { bankGenState.Supply = bankGenState.Supply.Add(bal.Coins...) } @@ -413,7 +407,8 @@ func initGenFiles( func collectGenFiles( clientCtx client.Context, nodeConfig *cmtconfig.Config, nodeIDs []string, valPubKeys []cryptotypes.PubKey, - persistentPeers string, + genBalIterator banktypes.GenesisBalancesIterator, + valAddrCodec runtime.ValidatorAddressCodec, persistentPeers string, args initArgs, ) error { chainID := args.chainID @@ -440,8 +435,8 @@ func collectGenFiles( return err } - nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, appGenesis, genutiltypes.DefaultMessageValidator, - clientCtx.ValidatorAddressCodec, clientCtx.AddressCodec) + nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, appGenesis, genBalIterator, genutiltypes.DefaultMessageValidator, + valAddrCodec) if err != nil { return err }