diff --git a/cmd/gaiad/cmd/genaccounts.go b/cmd/gaiad/cmd/genaccounts.go deleted file mode 100644 index 473e3f85a6c..00000000000 --- a/cmd/gaiad/cmd/genaccounts.go +++ /dev/null @@ -1,194 +0,0 @@ -package cmd - -// -// import ( -// "bufio" -// "encoding/json" -// "errors" -// "fmt" -// -// "github.com/cosmos/cosmos-sdk/client" -// "github.com/cosmos/cosmos-sdk/client/flags" -// "github.com/cosmos/cosmos-sdk/crypto/keyring" -// "github.com/cosmos/cosmos-sdk/server" -// sdk "github.com/cosmos/cosmos-sdk/types" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -// authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/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" -// "github.com/spf13/cobra" -//) -// -// const ( -// flagVestingStart = "vesting-start-time" -// flagVestingEnd = "vesting-end-time" -// flagVestingAmt = "vesting-amount" -//) -// -//// AddGenesisAccountCmd returns add-genesis-account cobra Command. -// func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command { -// cmd := &cobra.Command{ -// Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", -// Short: "Add a genesis account to genesis.json", -// Long: `Add a genesis account to genesis.json. The provided account must specify -// the account address or key name and a list of initial coins. If a key name is given, -// the address will be looked up in the local Keybase. The list of initial tokens must -// contain valid denominations. Accounts may optionally be supplied with vesting parameters. -// `, -// Args: cobra.ExactArgs(2), -// RunE: func(cmd *cobra.Command, args []string) error { -// clientCtx := client.GetClientContextFromCmd(cmd) -// serverCtx := server.GetServerContextFromCmd(cmd) -// config := serverCtx.Config -// -// config.SetRoot(clientCtx.HomeDir) -// -// var kr keyring.Keyring -// addr, err := sdk.AccAddressFromBech32(args[0]) -// if err != nil { -// inBuf := bufio.NewReader(cmd.InOrStdin()) -// keyringBackend, err := cmd.Flags().GetString(flags.FlagKeyringBackend) -// if err != nil { -// return err -// } -// -// if keyringBackend != "" && clientCtx.Keyring == nil { -// var err error -// kr, err = keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.HomeDir, inBuf) -// if err != nil { -// return err -// } -// } else { -// kr = clientCtx.Keyring -// } -// -// k, err := kr.Key(args[0]) -// if err != nil { -// return fmt.Errorf("failed to get address from Keyring: %w", err) -// } -// -// addr = k.GetAddress() -// } -// -// coins, err := sdk.ParseCoinsNormalized(args[1]) -// if err != nil { -// return fmt.Errorf("failed to parse coins: %w", err) -// } -// -// vestingStart, err := cmd.Flags().GetInt64(flagVestingStart) -// if err != nil { -// return err -// } -// vestingEnd, err := cmd.Flags().GetInt64(flagVestingEnd) -// if err != nil { -// return err -// } -// vestingAmtStr, err := cmd.Flags().GetString(flagVestingAmt) -// if err != nil { -// return err -// } -// -// vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr) -// if err != nil { -// return fmt.Errorf("failed to parse vesting amount: %w", err) -// } -// -// // create concrete account type based on input parameters -// var genAccount authtypes.GenesisAccount -// -// balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()} -// baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0) -// -// if !vestingAmt.IsZero() { -// baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) -// -// if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) || -// baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) { -// return errors.New("vesting amount cannot be greater than total amount") -// } -// -// switch { -// case vestingStart != 0 && vestingEnd != 0: -// genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) -// -// case vestingEnd != 0: -// genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) -// -// default: -// return errors.New("invalid vesting parameters; must supply start and end time or end time") -// } -// } else { -// genAccount = baseAccount -// } -// -// if err := genAccount.Validate(); err != nil { -// return fmt.Errorf("failed to validate new genesis account: %w", err) -// } -// -// genFile := config.GenesisFile() -// appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) -// if err != nil { -// return fmt.Errorf("failed to unmarshal genesis state: %w", err) -// } -// -// authGenState := authtypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) -// -// accs, err := authtypes.UnpackAccounts(authGenState.Accounts) -// if err != nil { -// return fmt.Errorf("failed to get accounts from any: %w", err) -// } -// -// if accs.Contains(addr) { -// return fmt.Errorf("cannot add account at existing address %s", addr) -// } -// -// // Add the new account to the set of genesis accounts and sanitize the -// // accounts afterwards. -// accs = append(accs, genAccount) -// accs = authtypes.SanitizeGenesisAccounts(accs) -// -// genAccs, err := authtypes.PackAccounts(accs) -// if err != nil { -// return fmt.Errorf("failed to convert accounts into any's: %w", err) -// } -// authGenState.Accounts = genAccs -// -// authGenStateBz, err := clientCtx.Codec.MarshalJSON(&authGenState) -// if err != nil { -// return fmt.Errorf("failed to marshal auth genesis state: %w", err) -// } -// -// appState[authtypes.ModuleName] = authGenStateBz -// -// bankGenState := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) -// bankGenState.Balances = append(bankGenState.Balances, balances) -// bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) -// bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...) -// -// bankGenStateBz, err := clientCtx.Codec.MarshalJSON(bankGenState) -// if err != nil { -// return fmt.Errorf("failed to marshal bank genesis state: %w", err) -// } -// -// appState[banktypes.ModuleName] = bankGenStateBz -// -// appStateJSON, err := json.Marshal(appState) -// if err != nil { -// return fmt.Errorf("failed to marshal application genesis state: %w", err) -// } -// -// genDoc.AppState = appStateJSON -// return genutil.ExportGenesisFile(genDoc, genFile) -// }, -// } -// -// cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") -// cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") -// cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") -// cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") -// cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") -// flags.AddQueryFlagsToCmd(cmd) -// -// return cmd -//} diff --git a/tests/e2e/e2e_exec_test.go b/tests/e2e/e2e_exec_test.go index 3fa748d9b4b..cc611ef61e9 100644 --- a/tests/e2e/e2e_exec_test.go +++ b/tests/e2e/e2e_exec_test.go @@ -423,6 +423,7 @@ func (s *IntegrationTestSuite) runGovExec(c *chain, valIdx int, submitterAddr, g s.T().Logf("Successfully executed %s", govCommand) } +// NOTE: Tx unused, left here for future reference // func (s *IntegrationTestSuite) executeGKeysAddCommand(c *chain, valIdx int, name string, home string) string { // ctx, cancel := context.WithTimeout(context.Background(), time.Minute) // defer cancel() @@ -448,7 +449,8 @@ func (s *IntegrationTestSuite) runGovExec(c *chain, valIdx int, submitterAddr, g // return addrRecord.Address // } -// func (s *IntegrationTestSuite) executeKeysList(c *chain, valIdx int, home string) { +// NOTE: Tx unused, left here for future reference +// func (s *IntegrationTestSuite) executeKeysList(c *chain, valIdx int, home string) { // nolint:U1000 // ctx, cancel := context.WithTimeout(context.Background(), time.Minute) // defer cancel() @@ -678,6 +680,7 @@ func (s *IntegrationTestSuite) execWithdrawReward( } func (s *IntegrationTestSuite) executeGaiaTxCommand(ctx context.Context, c *chain, gaiaCommand []string, valIdx int, validation func([]byte, []byte) bool) { + fmt.Println("## RUNNING #XEC ###", gaiaCommand) if validation == nil { validation = s.defaultExecValidation(s.chainA, 0) } @@ -705,7 +708,8 @@ func (s *IntegrationTestSuite) executeGaiaTxCommand(ctx context.Context, c *chai stdOut := outBuf.Bytes() stdErr := errBuf.Bytes() - + fmt.Println("## EXECUTED STDOUT ###", string(stdOut)) + fmt.Println("## EXECUTED STDERR ###", string(stdErr)) if !validation(stdOut, stdErr) { s.Require().FailNowf("Exec validation failed", "stdout: %s, stderr: %s", string(stdOut), string(stdErr)) diff --git a/tests/e2e/e2e_lsm_test.go b/tests/e2e/e2e_lsm_test.go index 14749b65b61..cb30a9427b7 100644 --- a/tests/e2e/e2e_lsm_test.go +++ b/tests/e2e/e2e_lsm_test.go @@ -8,7 +8,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -20,17 +19,18 @@ func (s *IntegrationTestSuite) testLSM() { validatorAddressA := sdk.ValAddress(validatorAAddr).String() - // Set parameters (global liquid staking cap, validator liquid staking cap, validator bond factor) - s.writeLiquidStakingParamsUpdateProposal(s.chainA) + oldStakingParams, err := queryStakingParams(chainEndpoint) + s.Require().NoError(err) + s.writeLiquidStakingParamsUpdateProposal(s.chainA, oldStakingParams.Params) proposalCounter++ - submitGovFlags := []string{"param-change", configFile(proposalLSMParamUpdateFilename)} + submitGovFlags := []string{configFile(proposalLSMParamUpdateFilename)} depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()} voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} // gov proposing LSM parameters (global liquid staking cap, validator liquid staking cap, validator bond factor) s.T().Logf("Proposal number: %d", proposalCounter) s.T().Logf("Submitting, deposit and vote legacy Gov Proposal: Set parameters (global liquid staking cap, validator liquid staking cap, validator bond factor)") - s.runGovProcess(chainEndpoint, validatorAAddr.String(), proposalCounter, paramtypes.ProposalTypeChange, submitGovFlags, depositGovFlags, voteGovFlags, "vote", false) + s.runGovProcessV1(chainEndpoint, validatorAAddr.String(), proposalCounter, "stakingtypes.MsgUpdateProposal", submitGovFlags, depositGovFlags, voteGovFlags, "vote", false) // query the proposal status and new fee s.Require().Eventually( diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index d25627e06ee..ccbdb9032fa 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -910,45 +910,43 @@ func (s *IntegrationTestSuite) writeGovLegProposal(c *chain, height int64, name s.Require().NoError(err) } -func (s *IntegrationTestSuite) writeLiquidStakingParamsUpdateProposal(c *chain) { - type ParamInfo struct { - Subspace string `json:"subspace"` - Key string `json:"key"` - Value sdk.Dec `json:"value"` - } - - type ParamChangeMessage struct { - Title string `json:"title"` - Description string `json:"description"` - Changes []ParamInfo `json:"changes"` - Deposit string `json:"deposit"` - } - - paramChangeProposalBody, err := json.MarshalIndent(ParamChangeMessage{ - Title: "liquid staking params update", - Description: "liquid staking params update", - Changes: []ParamInfo{ - { - Subspace: "staking", - Key: "GlobalLiquidStakingCap", - Value: sdk.NewDecWithPrec(25, 2), // 25% - }, - { - Subspace: "staking", - Key: "ValidatorLiquidStakingCap", - Value: sdk.NewDecWithPrec(50, 2), // 50% - }, - { - Subspace: "staking", - Key: "ValidatorBondFactor", - Value: sdk.NewDec(250), // -1 - }, - }, - Deposit: "1000uatom", - }, "", " ") - s.Require().NoError(err) +func (s *IntegrationTestSuite) writeLiquidStakingParamsUpdateProposal(c *chain, oldParams stakingtypes.Params) { + template := ` + { + "messages": [ + { + "@type": "/cosmos.staking.v1beta1.MsgUpdateParams", + "authority": "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + "params": { + "unbonding_time": "%s", + "max_validators": %d, + "max_entries": %d, + "historical_entries": %d, + "bond_denom": "", + "min_commission_rate": "%s", + "validator_bond_factor":" %s," + "global_liquid_staking_cap": "%s", + "validator_liquid_staking_cap": "%s" + } + } + ], + "metadata": "ipfs://CID", + "deposit": "0uatom", + "title": "Update LSM Params", + "summary": "e2e-test updating LSM staking params" + }` + propMsgBody := fmt.Sprintf(template, + oldParams.UnbondingTime, + oldParams.MaxValidators, + oldParams.MaxEntries, + oldParams.HistoricalEntries, + oldParams.MinCommissionRate, + sdk.NewDec(250), // validator bond factor + sdk.NewDecWithPrec(25, 2), // 25 global_liquid_staking_cap + sdk.NewDecWithPrec(50, 2), // 50 validator_liquid_staking_cap + ) - err = writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalLSMParamUpdateFilename), paramChangeProposalBody) + err := writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalLSMParamUpdateFilename), []byte(propMsgBody)) s.Require().NoError(err) } diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 92e04590238..c603ed6ec90 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -3,18 +3,18 @@ package e2e import "fmt" var ( - runBankTest = true - runBypassMinFeeTest = true - runEncodeTest = true - runEvidenceTest = true - runFeeGrantTest = true - runGlobalFeesTest = true - runGovTest = true - runIBCTest = true - runSlashingTest = true - runStakingAndDistributionTest = true - runVestingTest = true - runRestInterfacesTest = true + runBankTest = false + runBypassMinFeeTest = false + runEncodeTest = false + runEvidenceTest = false + runFeeGrantTest = false + runGlobalFeesTest = false + runGovTest = false + runIBCTest = false + runSlashingTest = false + runStakingAndDistributionTest = false + runVestingTest = false + runRestInterfacesTest = false runLsmTest = true )