From abbace93f51d99274af4b6bca2dde39aedc082fa Mon Sep 17 00:00:00 2001 From: violet <158512193+fastfadingviolets@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:21:51 -0400 Subject: [PATCH 1/6] Add tests for commission rates & changing an allowlist after launching. (#3351) These are ports from hypha's `cosmos-release-testing` suite. --- tests/interchain/chainsuite/chain_ics.go | 7 + tests/interchain/chainsuite/config.go | 1 + tests/interchain/chainsuite/utils.go | 17 ++ tests/interchain/permissionless_test.go | 261 +++++++++++++++++++++-- 4 files changed, 271 insertions(+), 15 deletions(-) create mode 100644 tests/interchain/chainsuite/utils.go diff --git a/tests/interchain/chainsuite/chain_ics.go b/tests/interchain/chainsuite/chain_ics.go index 4d1f5fcb764..0124af7773b 100644 --- a/tests/interchain/chainsuite/chain_ics.go +++ b/tests/interchain/chainsuite/chain_ics.go @@ -38,6 +38,8 @@ type ConsumerConfig struct { ValidatorPowerCap int AllowInactiveVals bool MinStake uint64 + Allowlist []string + Denylist []string spec *interchaintest.ChainSpec DuringDepositPeriod ConsumerBootstrapCb @@ -227,6 +229,8 @@ func (p *Chain) CreateConsumerPermissionless(ctx context.Context, chainID string ValidatorsPowerCap: uint32(config.ValidatorPowerCap), AllowInactiveVals: config.AllowInactiveVals, MinStake: config.MinStake, + Allowlist: config.Allowlist, + Denylist: config.Denylist, } params := providertypes.MsgCreateConsumer{ ChainId: chainID, @@ -344,6 +348,9 @@ func (p *Chain) DefaultConsumerChainSpec(ctx context.Context, chainID string, co } genesisOverrides := []cosmos.GenesisKV{ cosmos.NewGenesisKV("app_state.slashing.params.signed_blocks_window", strconv.Itoa(SlashingWindowConsumer)), + cosmos.NewGenesisKV("app_state.ccvconsumer.params.reward_denoms", []string{denom}), + cosmos.NewGenesisKV("app_state.ccvconsumer.params.provider_reward_denoms", []string{p.Config().Denom}), + cosmos.NewGenesisKV("app_state.ccvconsumer.params.blocks_per_distribution_transmission", BlocksPerDistribution), } if config.TopN >= 0 { genesisOverrides = append(genesisOverrides, cosmos.NewGenesisKV("app_state.ccvconsumer.params.soft_opt_out_threshold", "0.0")) diff --git a/tests/interchain/chainsuite/config.go b/tests/interchain/chainsuite/config.go index 7a4d4dfdd88..f67bd2a272f 100644 --- a/tests/interchain/chainsuite/config.go +++ b/tests/interchain/chainsuite/config.go @@ -48,6 +48,7 @@ const ( ValidatorFunds = 11_000_000_000 ChainSpawnWait = 155 * time.Second SlashingWindowConsumer = 20 + BlocksPerDistribution = 10 ) func (c SuiteConfig) Merge(other SuiteConfig) SuiteConfig { diff --git a/tests/interchain/chainsuite/utils.go b/tests/interchain/chainsuite/utils.go new file mode 100644 index 00000000000..a7222820f60 --- /dev/null +++ b/tests/interchain/chainsuite/utils.go @@ -0,0 +1,17 @@ +package chainsuite + +import ( + "fmt" + "strings" + + sdkmath "cosmossdk.io/math" +) + +func StrToSDKInt(s string) (sdkmath.Int, error) { + s, _, _ = strings.Cut(s, ".") + i, ok := sdkmath.NewIntFromString(s) + if !ok { + return sdkmath.Int{}, fmt.Errorf("s: %s", s) + } + return i, nil +} diff --git a/tests/interchain/permissionless_test.go b/tests/interchain/permissionless_test.go index 47b888c2755..17cea56aabb 100644 --- a/tests/interchain/permissionless_test.go +++ b/tests/interchain/permissionless_test.go @@ -10,6 +10,7 @@ import ( "testing" "time" + sdkmath "cosmossdk.io/math" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/cosmos/gaia/v20/tests/interchain/chainsuite" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" @@ -21,6 +22,7 @@ import ( "github.com/strangelove-ventures/interchaintest/v8/testutil" "github.com/stretchr/testify/suite" "github.com/tidwall/sjson" + "golang.org/x/mod/semver" "golang.org/x/sync/errgroup" ) @@ -28,19 +30,26 @@ const ( permissionlessDepositPeriod = 7 * time.Minute ) -type ConsumerPropMigrationSuite struct { +type PermissionlessConsumersSuite struct { *chainsuite.Suite consumerCfg chainsuite.ConsumerConfig } -func (s *ConsumerPropMigrationSuite) addConsumer() *chainsuite.Chain { +func (s *PermissionlessConsumersSuite) addConsumer() *chainsuite.Chain { consumer, err := s.Chain.AddConsumerChain(s.GetContext(), s.Relayer, s.consumerCfg) s.Require().NoError(err) s.Require().NoError(s.Chain.CheckCCV(s.GetContext(), consumer, s.Relayer, 1_000_000, 0, 1)) return consumer } -func (s *ConsumerPropMigrationSuite) TestConsumerAddition() { +func (s *PermissionlessConsumersSuite) isOverV19() bool { + return semver.Compare(s.Env.OldGaiaImageVersion, "v19.0.0") > 0 +} + +func (s *PermissionlessConsumersSuite) TestConsumerAdditionMigration() { + if s.isOverV19() { + s.T().Skip("Migration test for v19 -> v20") + } consumer := s.addConsumer() json, _, err := s.Chain.GetNode().ExecQuery(s.GetContext(), "gov", "proposals") s.Require().NoError(err) @@ -93,7 +102,11 @@ func (s *ConsumerPropMigrationSuite) TestConsumerAddition() { s.Require().Equal(uint64(100), chain2.Get("top_N").Uint()) } -func (s *ConsumerPropMigrationSuite) TestConsumerRemoval() { +func (s *PermissionlessConsumersSuite) TestConsumerRemovalMigration() { + if s.isOverV19() { + s.T().Skip("Migration test for v19 -> v20") + } + consumer := s.addConsumer() stopTime := time.Now().Add(permissionlessDepositPeriod + 2*time.Minute) @@ -124,7 +137,11 @@ func (s *ConsumerPropMigrationSuite) TestConsumerRemoval() { s.Require().Equal("CONSUMER_PHASE_STOPPED", chain.Get("phase").String()) } -func (s *ConsumerPropMigrationSuite) TestConsumerModification() { +func (s *PermissionlessConsumersSuite) TestConsumerModificationMigration() { + if s.isOverV19() { + s.T().Skip("Migration test for v19 -> v20") + } + consumer := s.addConsumer() propID := s.submitConsumerModification(consumer) @@ -145,7 +162,11 @@ func (s *ConsumerPropMigrationSuite) TestConsumerModification() { s.Require().Equal(uint64(80), chain.Get("top_N").Uint()) } -func (s *ConsumerPropMigrationSuite) TestChangeRewardDenom() { +func (s *PermissionlessConsumersSuite) TestChangeRewardDenomMigration() { + if s.isOverV19() { + s.T().Skip("Migration test for v19 -> v20") + } + consumer := s.addConsumer() denom, propID := s.submitChangeRewardDenoms(consumer) @@ -165,14 +186,17 @@ func (s *ConsumerPropMigrationSuite) TestChangeRewardDenom() { s.Require().Contains(denoms.String(), denom) } -func (s *ConsumerPropMigrationSuite) depositAndPass(propID string) { +func (s *PermissionlessConsumersSuite) depositAndPass(propID string) { _, err := s.Chain.GetNode().ExecTx(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, "gov", "deposit", propID, chainsuite.GovDepositAmount) s.Require().NoError(err) s.Require().NoError(s.Chain.PassProposal(s.GetContext(), propID)) s.Require().NoError(testutil.WaitForBlocks(s.GetContext(), 2, s.Chain)) } -func (s *ConsumerPropMigrationSuite) TestPassedProposalsDontChange() { +func (s *PermissionlessConsumersSuite) TestPassedProposalsDontChange() { + if s.isOverV19() { + s.T().Skip("Migration test for v19 -> v20") + } consumer := s.addConsumer() _, denomPropID := s.submitChangeRewardDenoms(consumer) @@ -223,7 +247,7 @@ func (s *ConsumerPropMigrationSuite) TestPassedProposalsDontChange() { s.Require().Equal("CONSUMER_PHASE_STOPPED", chain.Get("phase").String()) } -func (s *ConsumerPropMigrationSuite) TestChangeOwner() { +func (s *PermissionlessConsumersSuite) TestChangeOwner() { s.UpgradeChain() cfg := s.consumerCfg @@ -279,7 +303,7 @@ func (s *ConsumerPropMigrationSuite) TestChangeOwner() { s.Require().NoError(s.Chain.PassProposal(s.GetContext(), propID)) } -func (s *ConsumerPropMigrationSuite) TestChangePowerShaping() { +func (s *PermissionlessConsumersSuite) TestChangePowerShaping() { s.UpgradeChain() cfg := s.consumerCfg @@ -338,13 +362,220 @@ func (s *ConsumerPropMigrationSuite) TestChangePowerShaping() { } } +func (s *PermissionlessConsumersSuite) TestConsumerCommissionRate() { + s.UpgradeChain() + cfg := s.consumerCfg + + cfg.TopN = 0 + cfg.BeforeSpawnTime = func(ctx context.Context, consumer *cosmos.CosmosChain) { + consumerID, err := s.Chain.GetConsumerID(s.GetContext(), consumer.Config().ChainID) + s.Require().NoError(err) + _, err = s.Chain.Validators[0].ExecTx(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, "provider", "opt-in", consumerID) + s.Require().NoError(err) + } + consumer1, err := s.Chain.AddConsumerChain(s.GetContext(), s.Relayer, cfg) + s.Require().NoError(err) + s.Require().NoError(s.Chain.CheckCCV(s.GetContext(), consumer1, s.Relayer, 1_000_000, 0, 1)) + + consumer2, err := s.Chain.AddConsumerChain(s.GetContext(), s.Relayer, cfg) + s.Require().NoError(err) + s.Require().NoError(s.Chain.CheckCCV(s.GetContext(), consumer2, s.Relayer, 1_000_000, 0, 1)) + + for i := 1; i < chainsuite.ValidatorCount; i++ { + s.Require().NoError(consumer1.Validators[i].StopContainer(s.GetContext())) + s.Require().NoError(consumer2.Validators[i].StopContainer(s.GetContext())) + } + + consumer1Ch, err := s.Relayer.GetTransferChannel(s.GetContext(), s.Chain, consumer1) + s.Require().NoError(err) + consumer2Ch, err := s.Relayer.GetTransferChannel(s.GetContext(), s.Chain, consumer2) + s.Require().NoError(err) + denom1 := transfertypes.ParseDenomTrace(transfertypes.GetPrefixedDenom("transfer", consumer1Ch.ChannelID, consumer1.Config().Denom)).IBCDenom() + denom2 := transfertypes.ParseDenomTrace(transfertypes.GetPrefixedDenom("transfer", consumer2Ch.ChannelID, consumer2.Config().Denom)).IBCDenom() + + s.Require().NotEqual(denom1, denom2, "denom1: %s, denom2: %s; channel1: %s, channel2: %s", denom1, denom2, consumer1Ch.Counterparty.ChannelID, consumer2Ch.Counterparty.ChannelID) + + govAuthority, err := s.Chain.GetGovernanceAddress(s.GetContext()) + s.Require().NoError(err) + rewardDenomsProp := providertypes.MsgChangeRewardDenoms{ + DenomsToAdd: []string{denom1, denom2}, + Authority: govAuthority, + } + prop, err := s.Chain.BuildProposal([]cosmos.ProtoMessage{&rewardDenomsProp}, + "add denoms to list of registered reward denoms", + "add denoms to list of registered reward denoms", + "", chainsuite.GovDepositAmount, "", false) + s.Require().NoError(err) + propResult, err := s.Chain.SubmitProposal(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, prop) + s.Require().NoError(err) + s.Require().NoError(s.Chain.PassProposal(s.GetContext(), propResult.ProposalID)) + + eg := errgroup.Group{} + + _, err = s.Chain.Validators[0].ExecTx(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, "distribution", "withdraw-all-rewards") + s.Require().NoError(err) + + _, err = s.Chain.GetNode().ExecTx(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, "distribution", "withdraw-rewards", s.Chain.ValidatorWallets[0].ValoperAddress, "--commission") + s.Require().NoError(err) + + consumerID1, err := s.Chain.GetConsumerID(s.GetContext(), consumer1.Config().ChainID) + s.Require().NoError(err) + consumerID2, err := s.Chain.GetConsumerID(s.GetContext(), consumer2.Config().ChainID) + s.Require().NoError(err) + + eg.Go(func() error { + _, err := s.Chain.GetNode().ExecTx(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, "provider", "set-consumer-commission-rate", consumerID1, "0.5") + return err + }) + eg.Go(func() error { + _, err := s.Chain.GetNode().ExecTx(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, "provider", "set-consumer-commission-rate", consumerID2, "0.5") + return err + }) + s.Require().NoError(eg.Wait()) + + _, err = s.Chain.Validators[0].ExecTx(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, "distribution", "withdraw-rewards", s.Chain.ValidatorWallets[0].ValoperAddress, "--commission") + s.Require().NoError(err) + + s.Require().NoError(testutil.WaitForBlocks(s.GetContext(), 1, consumer1, consumer2)) + + eg.Go(func() error { + _, err := consumer1.Validators[0].ExecTx(s.GetContext(), consumer1.ValidatorWallets[0].Moniker, "bank", "send", consumer1.ValidatorWallets[0].Address, consumer1.ValidatorWallets[1].Address, "1"+consumer1.Config().Denom, "--fees", "100000000"+consumer1.Config().Denom) + return err + }) + eg.Go(func() error { + _, err := consumer2.Validators[0].ExecTx(s.GetContext(), consumer2.ValidatorWallets[0].Moniker, "bank", "send", consumer2.ValidatorWallets[0].Address, consumer2.ValidatorWallets[1].Address, "1"+consumer2.Config().Denom, "--fees", "100000000"+consumer2.Config().Denom) + return err + }) + s.Require().NoError(eg.Wait()) + + s.Require().NoError(testutil.WaitForBlocks(s.GetContext(), chainsuite.BlocksPerDistribution+3, s.Chain, consumer1, consumer2)) + + rewardStr, err := s.Chain.QueryJSON(s.GetContext(), fmt.Sprintf("total.#(%%\"*%s\")", denom1), "distribution", "rewards", s.Chain.ValidatorWallets[0].Address) + s.Require().NoError(err) + rewardsDenom1, err := chainsuite.StrToSDKInt(rewardStr.String()) + s.Require().NoError(err) + rewardStr, err = s.Chain.QueryJSON(s.GetContext(), fmt.Sprintf("total.#(%%\"*%s\")", denom2), "distribution", "rewards", s.Chain.ValidatorWallets[0].Address) + s.Require().NoError(err) + rewardsDenom2, err := chainsuite.StrToSDKInt(rewardStr.String()) + s.Require().NoError(err) + + s.Require().NotEmpty(rewardsDenom1) + s.Require().NotEmpty(rewardsDenom2) + s.Require().True(rewardsDenom1.Sub(rewardsDenom2).Abs().LT(sdkmath.NewInt(1000)), "rewards1Int: %s, rewards2Int: %s", rewardsDenom1.String(), rewardsDenom2.String()) + + _, err = s.Chain.Validators[0].ExecTx(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, "distribution", "withdraw-rewards", s.Chain.ValidatorWallets[0].ValoperAddress, "--commission") + s.Require().NoError(err) + + eg.Go(func() error { + _, err := s.Chain.GetNode().ExecTx(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, "provider", "set-consumer-commission-rate", consumerID1, "0.25") + return err + }) + eg.Go(func() error { + _, err := s.Chain.GetNode().ExecTx(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, "provider", "set-consumer-commission-rate", consumerID2, "0.5") + return err + }) + s.Require().NoError(eg.Wait()) + + _, err = s.Chain.GetNode().ExecTx(s.GetContext(), s.Chain.ValidatorWallets[0].Moniker, "distribution", "withdraw-rewards", s.Chain.ValidatorWallets[0].ValoperAddress, "--commission") + s.Require().NoError(err) + + s.Require().NoError(testutil.WaitForBlocks(s.GetContext(), 1, consumer1, consumer2)) + + eg.Go(func() error { + _, err := consumer1.Validators[0].ExecTx(s.GetContext(), consumer1.ValidatorWallets[0].Moniker, "bank", "send", consumer1.ValidatorWallets[0].Address, consumer1.ValidatorWallets[1].Address, "1"+consumer1.Config().Denom, "--fees", "100000000"+consumer1.Config().Denom) + return err + }) + eg.Go(func() error { + _, err := consumer2.Validators[0].ExecTx(s.GetContext(), consumer2.ValidatorWallets[0].Moniker, "bank", "send", consumer2.ValidatorWallets[0].Address, consumer2.ValidatorWallets[1].Address, "1"+consumer2.Config().Denom, "--fees", "100000000"+consumer2.Config().Denom) + return err + }) + s.Require().NoError(eg.Wait()) + + s.Require().NoError(testutil.WaitForBlocks(s.GetContext(), chainsuite.BlocksPerDistribution+3, s.Chain, consumer1, consumer2)) + + rewardStr, err = s.Chain.QueryJSON(s.GetContext(), fmt.Sprintf("total.#(%%\"*%s\")", denom1), "distribution", "rewards", s.Chain.ValidatorWallets[0].Address) + s.Require().NoError(err) + rewardsDenom1, err = chainsuite.StrToSDKInt(rewardStr.String()) + s.Require().NoError(err) + rewardStr, err = s.Chain.QueryJSON(s.GetContext(), fmt.Sprintf("total.#(%%\"*%s\")", denom2), "distribution", "rewards", s.Chain.ValidatorWallets[0].Address) + s.Require().NoError(err) + rewardsDenom2, err = chainsuite.StrToSDKInt(rewardStr.String()) + s.Require().NoError(err) + + s.Require().True(rewardsDenom1.GT(rewardsDenom2), "rewards1Int: %s, rewards2Int: %s", rewardsDenom1.String(), rewardsDenom2.String()) + s.Require().False(rewardsDenom1.Sub(rewardsDenom2).Abs().LT(sdkmath.NewInt(1000)), "rewards1Int: %s, rewards2Int: %s", rewardsDenom1.String(), rewardsDenom2.String()) +} + +func (s *PermissionlessConsumersSuite) TestLaunchWithAllowListThenModify() { + s.UpgradeChain() + + consumerConfig := s.consumerCfg + consumerConfig.Allowlist = []string{ + s.Chain.ValidatorWallets[0].ValConsAddress, + s.Chain.ValidatorWallets[1].ValConsAddress, + s.Chain.ValidatorWallets[2].ValConsAddress, + } + consumerConfig.TopN = 0 + consumerConfig.BeforeSpawnTime = func(ctx context.Context, consumer *cosmos.CosmosChain) { + consumerID, err := s.Chain.GetConsumerID(s.GetContext(), consumer.Config().ChainID) + s.Require().NoError(err) + eg := errgroup.Group{} + for i := 0; i < 3; i++ { + i := i + eg.Go(func() error { + _, err := s.Chain.Validators[i].ExecTx(s.GetContext(), s.Chain.ValidatorWallets[i].Moniker, "provider", "opt-in", consumerID) + return err + }) + } + s.Require().NoError(eg.Wait()) + } + + consumer, err := s.Chain.AddConsumerChain(s.GetContext(), s.Relayer, consumerConfig) + s.Require().NoError(err) + + s.Require().NoError(s.Chain.CheckCCV(s.GetContext(), consumer, s.Relayer, 1_000_000, 0, 1)) + + consumerID, err := s.Chain.GetConsumerID(s.GetContext(), consumer.Config().ChainID) + s.Require().NoError(err) + + // ensure we can't opt in a non-allowlisted validator + _, err = s.Chain.Validators[3].ExecTx(s.GetContext(), s.Chain.ValidatorWallets[3].Moniker, + "provider", "opt-in", consumerID) + s.Require().NoError(err) + + validators, err := consumer.QueryJSON(s.GetContext(), "validators", "tendermint-validator-set") + s.Require().NoError(err) + s.Require().Equal(3, len(validators.Array())) + + update := &providertypes.MsgUpdateConsumer{ + ConsumerId: consumerID, + PowerShapingParameters: &providertypes.PowerShapingParameters{ + Allowlist: []string{}, + }, + } + updateBz, err := json.Marshal(update) + s.Require().NoError(err) + err = s.Chain.GetNode().WriteFile(s.GetContext(), updateBz, "consumer-update.json") + s.Require().NoError(err) + _, err = s.Chain.GetNode().ExecTx(s.GetContext(), interchaintest.FaucetAccountKeyName, + "provider", "update-consumer", path.Join(s.Chain.GetNode().HomeDir(), "consumer-update.json")) + s.Require().NoError(err) + + // // ensure we can opt in a non-allowlisted validator after the modification + _, err = s.Chain.Validators[3].ExecTx(s.GetContext(), s.Chain.ValidatorWallets[3].Moniker, + "provider", "opt-in", consumerID) + s.Require().NoError(err) + validators, err = consumer.QueryJSON(s.GetContext(), "validators", "tendermint-validator-set") + s.Require().NoError(err) + s.Require().Equal(4, len(validators.Array())) +} -func TestConsumerPropMigration(t *testing.T) { +func TestPermissionlessConsumers(t *testing.T) { genesis := chainsuite.DefaultGenesis() genesis = append(genesis, cosmos.NewGenesisKV("app_state.gov.params.max_deposit_period", permissionlessDepositPeriod.String()), ) - s := &ConsumerPropMigrationSuite{ + s := &PermissionlessConsumersSuite{ Suite: chainsuite.NewSuite(chainsuite.SuiteConfig{ CreateRelayer: true, Scope: chainsuite.ChainScopeTest, @@ -367,7 +598,7 @@ func TestConsumerPropMigration(t *testing.T) { suite.Run(t, s) } -func (s *ConsumerPropMigrationSuite) submitChangeRewardDenoms(consumer *chainsuite.Chain) (string, string) { +func (s *PermissionlessConsumersSuite) submitChangeRewardDenoms(consumer *chainsuite.Chain) (string, string) { consumerCh, err := s.Relayer.GetTransferChannel(s.GetContext(), s.Chain, consumer) s.Require().NoError(err) denom := transfertypes.ParseDenomTrace(transfertypes.GetPrefixedDenom("transfer", consumerCh.ChannelID, consumer.Config().Denom)).IBCDenom() @@ -402,7 +633,7 @@ func (s *ConsumerPropMigrationSuite) submitChangeRewardDenoms(consumer *chainsui return denom, propID } -func (s *ConsumerPropMigrationSuite) submitConsumerModification(consumer *chainsuite.Chain) string { +func (s *PermissionlessConsumersSuite) submitConsumerModification(consumer *chainsuite.Chain) string { modifyProp := &ccvclient.ConsumerModificationProposalJSON{ Title: "modify consumer", Summary: "modify consumer", @@ -436,7 +667,7 @@ func (s *ConsumerPropMigrationSuite) submitConsumerModification(consumer *chains return propID } -func (s *ConsumerPropMigrationSuite) submitConsumerRemoval(consumer *chainsuite.Chain, stopTime time.Time) string { +func (s *PermissionlessConsumersSuite) submitConsumerRemoval(consumer *chainsuite.Chain, stopTime time.Time) string { removalProp := &ccvclient.ConsumerRemovalProposalJSON{ Title: "remove consumer", Summary: "remove consumer", From c501b43babaff63a1dbf4610869f840f99a99ada Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Wed, 2 Oct 2024 17:45:53 +0200 Subject: [PATCH 2/6] chore: bump version to v21 (#3367) * replace gaia/v20 with gaia/v21 * add v21 upgrade handler * update tests * appease linters --------- Co-authored-by: MSalopek --- .github/workflows/test.yml | 6 ++-- ante/ante.go | 2 +- ante/gov_expedited_ante.go | 2 +- ante/gov_expedited_ante_test.go | 4 +-- ante/gov_vote_ante.go | 2 +- ante/gov_vote_ante_test.go | 4 +-- app/app.go | 10 +++--- app/app_test.go | 4 +-- app/helpers/test_helpers.go | 2 +- app/modules.go | 4 +-- app/post.go | 2 +- app/sim/sim_state.go | 2 +- app/sim/sim_utils.go | 2 +- app/sim_bench_test.go | 4 +-- app/sim_test.go | 6 ++-- app/upgrades/types.go | 2 +- app/upgrades/v19/constants.go | 2 +- app/upgrades/v19/upgrades.go | 2 +- app/upgrades/v20/constants.go | 2 +- app/upgrades/v20/upgrades.go | 2 +- app/upgrades/v20/upgrades_test.go | 4 +-- app/upgrades/v21/constants.go | 15 +++++++++ app/upgrades/v21/upgrades.go | 31 +++++++++++++++++++ cmd/gaiad/cmd/bech32_convert.go | 2 +- cmd/gaiad/cmd/root.go | 2 +- cmd/gaiad/cmd/root_test.go | 4 +-- cmd/gaiad/cmd/testnet_set_local_validator.go | 2 +- cmd/gaiad/main.go | 4 +-- go.mod | 2 +- tests/e2e/chain.go | 6 ++-- tests/e2e/e2e_bank_test.go | 2 +- tests/e2e/e2e_setup_test.go | 2 +- tests/integration/feemarket_test.go | 4 +-- tests/integration/ibcfee_test.go | 4 +-- tests/integration/interchain_security_test.go | 4 +-- tests/integration/test_utils.go | 2 +- tests/interchain/consensus_test.go | 2 +- tests/interchain/consumer_launch_test.go | 2 +- tests/interchain/cosmwasm_test.go | 2 +- tests/interchain/endpoints_test.go | 2 +- tests/interchain/go.mod | 2 +- tests/interchain/permissionless_test.go | 4 +-- tests/interchain/txs_test.go | 2 +- tests/interchain/unbonding_test.go | 2 +- x/metaprotocols/module.go | 2 +- 45 files changed, 111 insertions(+), 65 deletions(-) create mode 100644 app/upgrades/v21/constants.go create mode 100644 app/upgrades/v21/upgrades.go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd889406d21..d239b1e6889 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -163,10 +163,10 @@ jobs: # the old gaiad binary version is hardcoded, need to be updated each major release. - name: Install Old Gaiad run: | - curl -LO https://github.com/cosmos/gaia/releases/download/v19.1.0/gaiad-v19.1.0-linux-amd64 - chmod a+x gaiad-v19.1.0-linux-amd64 + curl -LO https://github.com/cosmos/gaia/releases/download/v20.0.0/gaiad-v20.0.0-linux-amd64 + chmod a+x gaiad-v20.0.0-linux-amd64 mkdir build - mv ./gaiad-v19.1.0-linux-amd64 ./build/gaiadold + mv ./gaiad-v20.0.0-linux-amd64 ./build/gaiadold if: env.GIT_DIFF - name: Install New Gaiad run: | diff --git a/ante/ante.go b/ante/ante.go index c6dd21f7b0b..536abf05356 100644 --- a/ante/ante.go +++ b/ante/ante.go @@ -22,7 +22,7 @@ import ( wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - gaiaerrors "github.com/cosmos/gaia/v20/types/errors" + gaiaerrors "github.com/cosmos/gaia/v21/types/errors" ) // UseFeeMarketDecorator to make the integration testing easier: we can switch off its ante and post decorators with this flag diff --git a/ante/gov_expedited_ante.go b/ante/gov_expedited_ante.go index dc7191779f3..d9924a0e0f9 100644 --- a/ante/gov_expedited_ante.go +++ b/ante/gov_expedited_ante.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - gaiaerrors "github.com/cosmos/gaia/v20/types/errors" + gaiaerrors "github.com/cosmos/gaia/v21/types/errors" ) var expeditedPropDecoratorEnabled = true diff --git a/ante/gov_expedited_ante_test.go b/ante/gov_expedited_ante_test.go index 2e531f1fe4f..124a5d9ccc7 100644 --- a/ante/gov_expedited_ante_test.go +++ b/ante/gov_expedited_ante_test.go @@ -14,8 +14,8 @@ import ( govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/gaia/v20/ante" - "github.com/cosmos/gaia/v20/app/helpers" + "github.com/cosmos/gaia/v21/ante" + "github.com/cosmos/gaia/v21/app/helpers" ) func TestGovExpeditedProposalsDecorator(t *testing.T) { diff --git a/ante/gov_vote_ante.go b/ante/gov_vote_ante.go index b29a84fa6ab..c00ca8ac624 100644 --- a/ante/gov_vote_ante.go +++ b/ante/gov_vote_ante.go @@ -12,7 +12,7 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - gaiaerrors "github.com/cosmos/gaia/v20/types/errors" + gaiaerrors "github.com/cosmos/gaia/v21/types/errors" ) var ( diff --git a/ante/gov_vote_ante_test.go b/ante/gov_vote_ante_test.go index c2866abaec0..66a2b1fb6b7 100644 --- a/ante/gov_vote_ante_test.go +++ b/ante/gov_vote_ante_test.go @@ -15,8 +15,8 @@ import ( govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/gaia/v20/ante" - "github.com/cosmos/gaia/v20/app/helpers" + "github.com/cosmos/gaia/v21/ante" + "github.com/cosmos/gaia/v21/app/helpers" ) // Test that the GovVoteDecorator rejects v1beta1 vote messages from accounts with less than 1 atom staked diff --git a/app/app.go b/app/app.go index 330488b080a..1f660e665ec 100644 --- a/app/app.go +++ b/app/app.go @@ -66,17 +66,17 @@ import ( wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - gaiaante "github.com/cosmos/gaia/v20/ante" - "github.com/cosmos/gaia/v20/app/keepers" - "github.com/cosmos/gaia/v20/app/upgrades" - v20 "github.com/cosmos/gaia/v20/app/upgrades/v20" + gaiaante "github.com/cosmos/gaia/v21/ante" + "github.com/cosmos/gaia/v21/app/keepers" + "github.com/cosmos/gaia/v21/app/upgrades" + v21 "github.com/cosmos/gaia/v21/app/upgrades/v21" ) var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - Upgrades = []upgrades.Upgrade{v20.Upgrade} + Upgrades = []upgrades.Upgrade{v21.Upgrade} ) var ( diff --git a/app/app_test.go b/app/app_test.go index 2e87646f0b9..bd300ac0dde 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -14,8 +14,8 @@ import ( wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - gaia "github.com/cosmos/gaia/v20/app" - gaiahelpers "github.com/cosmos/gaia/v20/app/helpers" + gaia "github.com/cosmos/gaia/v21/app" + gaiahelpers "github.com/cosmos/gaia/v21/app/helpers" ) type EmptyAppOptions struct{} diff --git a/app/helpers/test_helpers.go b/app/helpers/test_helpers.go index ecd38f2b85d..be59014284d 100644 --- a/app/helpers/test_helpers.go +++ b/app/helpers/test_helpers.go @@ -30,7 +30,7 @@ import ( wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - gaiaapp "github.com/cosmos/gaia/v20/app" + gaiaapp "github.com/cosmos/gaia/v21/app" ) // SimAppChainID hardcoded chainID for simulation diff --git a/app/modules.go b/app/modules.go index 8afebc13489..a5aa6b7c69d 100644 --- a/app/modules.go +++ b/app/modules.go @@ -62,8 +62,8 @@ import ( wasm "github.com/CosmWasm/wasmd/x/wasm" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - "github.com/cosmos/gaia/v20/x/metaprotocols" - metaprotocolstypes "github.com/cosmos/gaia/v20/x/metaprotocols/types" + "github.com/cosmos/gaia/v21/x/metaprotocols" + metaprotocolstypes "github.com/cosmos/gaia/v21/x/metaprotocols/types" ) var maccPerms = map[string][]string{ diff --git a/app/post.go b/app/post.go index 47f439101ef..543ec95d0f3 100644 --- a/app/post.go +++ b/app/post.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/gaia/v20/ante" + "github.com/cosmos/gaia/v21/ante" ) // PostHandlerOptions are the options required for constructing a FeeMarket PostHandler. diff --git a/app/sim/sim_state.go b/app/sim/sim_state.go index 9bd3f118559..e393d733efd 100644 --- a/app/sim/sim_state.go +++ b/app/sim/sim_state.go @@ -22,7 +22,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - gaia "github.com/cosmos/gaia/v20/app" + gaia "github.com/cosmos/gaia/v21/app" ) // Simulation parameter constants diff --git a/app/sim/sim_utils.go b/app/sim/sim_utils.go index 521a1293124..d57f9a96772 100644 --- a/app/sim/sim_utils.go +++ b/app/sim/sim_utils.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - gaia "github.com/cosmos/gaia/v20/app" + gaia "github.com/cosmos/gaia/v21/app" ) // SimulationOperations retrieves the simulation params from the provided file path diff --git a/app/sim_bench_test.go b/app/sim_bench_test.go index 746679adff2..96dedb81d8d 100644 --- a/app/sim_bench_test.go +++ b/app/sim_bench_test.go @@ -13,8 +13,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/simulation" simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" - gaia "github.com/cosmos/gaia/v20/app" - "github.com/cosmos/gaia/v20/app/sim" + gaia "github.com/cosmos/gaia/v21/app" + "github.com/cosmos/gaia/v21/app/sim" ) // Profile with: diff --git a/app/sim_test.go b/app/sim_test.go index f4de591f576..007d53e9cd5 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -23,11 +23,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/simulation" simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" - "github.com/cosmos/gaia/v20/ante" - gaia "github.com/cosmos/gaia/v20/app" + "github.com/cosmos/gaia/v21/ante" + gaia "github.com/cosmos/gaia/v21/app" // "github.com/cosmos/gaia/v11/app/helpers" // "github.com/cosmos/gaia/v11/app/params" - "github.com/cosmos/gaia/v20/app/sim" + "github.com/cosmos/gaia/v21/app/sim" ) // AppChainID hardcoded chainID for simulation diff --git a/app/upgrades/types.go b/app/upgrades/types.go index eacfa0e2364..a2a1e50c93d 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/gaia/v20/app/keepers" + "github.com/cosmos/gaia/v21/app/keepers" ) // Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal diff --git a/app/upgrades/v19/constants.go b/app/upgrades/v19/constants.go index baec135063d..85c4e043390 100644 --- a/app/upgrades/v19/constants.go +++ b/app/upgrades/v19/constants.go @@ -1,7 +1,7 @@ package v19 import ( - "github.com/cosmos/gaia/v20/app/upgrades" + "github.com/cosmos/gaia/v21/app/upgrades" ) const ( diff --git a/app/upgrades/v19/upgrades.go b/app/upgrades/v19/upgrades.go index cb9215d772d..7042b8ebd98 100644 --- a/app/upgrades/v19/upgrades.go +++ b/app/upgrades/v19/upgrades.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/gaia/v20/app/keepers" + "github.com/cosmos/gaia/v21/app/keepers" ) func CreateUpgradeHandler( diff --git a/app/upgrades/v20/constants.go b/app/upgrades/v20/constants.go index d91171e99c9..3c362c6ec63 100644 --- a/app/upgrades/v20/constants.go +++ b/app/upgrades/v20/constants.go @@ -1,7 +1,7 @@ package v20 import ( - "github.com/cosmos/gaia/v20/app/upgrades" + "github.com/cosmos/gaia/v21/app/upgrades" ) const ( diff --git a/app/upgrades/v20/upgrades.go b/app/upgrades/v20/upgrades.go index 6969cd00cbe..70a303828d2 100644 --- a/app/upgrades/v20/upgrades.go +++ b/app/upgrades/v20/upgrades.go @@ -23,7 +23,7 @@ import ( govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - "github.com/cosmos/gaia/v20/app/keepers" + "github.com/cosmos/gaia/v21/app/keepers" ) // Constants for the new parameters in the v20 upgrade. diff --git a/app/upgrades/v20/upgrades_test.go b/app/upgrades/v20/upgrades_test.go index c42afb9716a..a5d52890319 100644 --- a/app/upgrades/v20/upgrades_test.go +++ b/app/upgrades/v20/upgrades_test.go @@ -21,8 +21,8 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/cosmos/gaia/v20/app/helpers" - v20 "github.com/cosmos/gaia/v20/app/upgrades/v20" + "github.com/cosmos/gaia/v21/app/helpers" + v20 "github.com/cosmos/gaia/v21/app/upgrades/v20" ) func GetTestMsgConsumerAddition() providertypes.MsgConsumerAddition { //nolint:staticcheck diff --git a/app/upgrades/v21/constants.go b/app/upgrades/v21/constants.go new file mode 100644 index 00000000000..022e20ff366 --- /dev/null +++ b/app/upgrades/v21/constants.go @@ -0,0 +1,15 @@ +package v21 + +import ( + "github.com/cosmos/gaia/v21/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name. + UpgradeName = "v21" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, +} diff --git a/app/upgrades/v21/upgrades.go b/app/upgrades/v21/upgrades.go new file mode 100644 index 00000000000..5575045bbc0 --- /dev/null +++ b/app/upgrades/v21/upgrades.go @@ -0,0 +1,31 @@ +package v21 + +import ( + "context" + + upgradetypes "cosmossdk.io/x/upgrade/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/cosmos/gaia/v21/app/keepers" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(c context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx := sdk.UnwrapSDKContext(c) + ctx.Logger().Info("Starting module migrations...") + + vm, err := mm.RunMigrations(ctx, configurator, vm) + if err != nil { + return vm, err + } + + ctx.Logger().Info("Upgrade v21 complete") + return vm, nil + } +} diff --git a/cmd/gaiad/cmd/bech32_convert.go b/cmd/gaiad/cmd/bech32_convert.go index d0b05017250..63170133aff 100644 --- a/cmd/gaiad/cmd/bech32_convert.go +++ b/cmd/gaiad/cmd/bech32_convert.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" - addressutil "github.com/cosmos/gaia/v20/pkg/address" + addressutil "github.com/cosmos/gaia/v21/pkg/address" ) var flagBech32Prefix = "prefix" diff --git a/cmd/gaiad/cmd/root.go b/cmd/gaiad/cmd/root.go index ee172e10359..fce0ccb2e7b 100644 --- a/cmd/gaiad/cmd/root.go +++ b/cmd/gaiad/cmd/root.go @@ -57,7 +57,7 @@ import ( wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - gaia "github.com/cosmos/gaia/v20/app" + gaia "github.com/cosmos/gaia/v21/app" ) // NewRootCmd creates a new root command for simd. It is called once in the diff --git a/cmd/gaiad/cmd/root_test.go b/cmd/gaiad/cmd/root_test.go index 53daf7b4568..f715564ba0c 100644 --- a/cmd/gaiad/cmd/root_test.go +++ b/cmd/gaiad/cmd/root_test.go @@ -7,8 +7,8 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - app "github.com/cosmos/gaia/v20/app" - "github.com/cosmos/gaia/v20/cmd/gaiad/cmd" + app "github.com/cosmos/gaia/v21/app" + "github.com/cosmos/gaia/v21/cmd/gaiad/cmd" ) func TestRootCmdConfig(t *testing.T) { diff --git a/cmd/gaiad/cmd/testnet_set_local_validator.go b/cmd/gaiad/cmd/testnet_set_local_validator.go index c83c073e31d..427b43454ac 100644 --- a/cmd/gaiad/cmd/testnet_set_local_validator.go +++ b/cmd/gaiad/cmd/testnet_set_local_validator.go @@ -19,7 +19,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" - gaia "github.com/cosmos/gaia/v20/app" + gaia "github.com/cosmos/gaia/v21/app" "github.com/spf13/cast" "github.com/spf13/cobra" diff --git a/cmd/gaiad/main.go b/cmd/gaiad/main.go index 056b65d6f1e..b0dcfc74bca 100644 --- a/cmd/gaiad/main.go +++ b/cmd/gaiad/main.go @@ -5,8 +5,8 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - app "github.com/cosmos/gaia/v20/app" - "github.com/cosmos/gaia/v20/cmd/gaiad/cmd" + app "github.com/cosmos/gaia/v21/app" + "github.com/cosmos/gaia/v21/cmd/gaiad/cmd" ) func main() { diff --git a/go.mod b/go.mod index c968d51d8d1..57887a0bb8d 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/cosmos/gaia/v20 +module github.com/cosmos/gaia/v21 go 1.22.6 diff --git a/tests/e2e/chain.go b/tests/e2e/chain.go index c2ab65ec2be..88e9fbae469 100644 --- a/tests/e2e/chain.go +++ b/tests/e2e/chain.go @@ -27,9 +27,9 @@ import ( paramsproptypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - gaia "github.com/cosmos/gaia/v20/app" - gaiaparams "github.com/cosmos/gaia/v20/app/params" - metaprotocoltypes "github.com/cosmos/gaia/v20/x/metaprotocols/types" + gaia "github.com/cosmos/gaia/v21/app" + gaiaparams "github.com/cosmos/gaia/v21/app/params" + metaprotocoltypes "github.com/cosmos/gaia/v21/x/metaprotocols/types" ) const ( diff --git a/tests/e2e/e2e_bank_test.go b/tests/e2e/e2e_bank_test.go index 7eb7109299e..6f064722c4f 100644 --- a/tests/e2e/e2e_bank_test.go +++ b/tests/e2e/e2e_bank_test.go @@ -12,7 +12,7 @@ import ( authTx "github.com/cosmos/cosmos-sdk/x/auth/tx" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - extensiontypes "github.com/cosmos/gaia/v20/x/metaprotocols/types" + extensiontypes "github.com/cosmos/gaia/v21/x/metaprotocols/types" ) func (s *IntegrationTestSuite) testBankTokenTransfer() { diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index c41f2823514..e2dd2307fe4 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -43,7 +43,7 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/gaia/v20/types" + "github.com/cosmos/gaia/v21/types" ) const ( diff --git a/tests/integration/feemarket_test.go b/tests/integration/feemarket_test.go index e693aa316c6..f90aa48a8b9 100644 --- a/tests/integration/feemarket_test.go +++ b/tests/integration/feemarket_test.go @@ -14,8 +14,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/gaia/v20/ante" - gaiaApp "github.com/cosmos/gaia/v20/app" + "github.com/cosmos/gaia/v21/ante" + gaiaApp "github.com/cosmos/gaia/v21/app" ) const ( diff --git a/tests/integration/ibcfee_test.go b/tests/integration/ibcfee_test.go index c1dfd1a0014..61766a96ebc 100644 --- a/tests/integration/ibcfee_test.go +++ b/tests/integration/ibcfee_test.go @@ -14,8 +14,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/gaia/v20/ante" - gaiaApp "github.com/cosmos/gaia/v20/app" + "github.com/cosmos/gaia/v21/ante" + gaiaApp "github.com/cosmos/gaia/v21/app" ) // These integration tests were modified to work with the GaiaApp diff --git a/tests/integration/interchain_security_test.go b/tests/integration/interchain_security_test.go index f835538bda1..d4d1ae7abf6 100644 --- a/tests/integration/interchain_security_test.go +++ b/tests/integration/interchain_security_test.go @@ -17,8 +17,8 @@ import ( crysistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/gaia/v20/ante" - gaiaApp "github.com/cosmos/gaia/v20/app" + "github.com/cosmos/gaia/v21/ante" + gaiaApp "github.com/cosmos/gaia/v21/app" ) var ccvSuite *integration.CCVTestSuite diff --git a/tests/integration/test_utils.go b/tests/integration/test_utils.go index 399608f7d1a..ce0573f2b64 100644 --- a/tests/integration/test_utils.go +++ b/tests/integration/test_utils.go @@ -23,7 +23,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" - gaiaApp "github.com/cosmos/gaia/v20/app" + gaiaApp "github.com/cosmos/gaia/v21/app" ) var app *gaiaApp.GaiaApp diff --git a/tests/interchain/consensus_test.go b/tests/interchain/consensus_test.go index 67ef37e815e..8f09f9f09e4 100644 --- a/tests/interchain/consensus_test.go +++ b/tests/interchain/consensus_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/cosmos/gaia/v20/tests/interchain/chainsuite" + "github.com/cosmos/gaia/v21/tests/interchain/chainsuite" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" "github.com/tidwall/gjson" diff --git a/tests/interchain/consumer_launch_test.go b/tests/interchain/consumer_launch_test.go index 0c942099665..8cf9204f9ab 100644 --- a/tests/interchain/consumer_launch_test.go +++ b/tests/interchain/consumer_launch_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/suite" - "github.com/cosmos/gaia/v20/tests/interchain/chainsuite" + "github.com/cosmos/gaia/v21/tests/interchain/chainsuite" ) type ConsumerLaunchSuite struct { diff --git a/tests/interchain/cosmwasm_test.go b/tests/interchain/cosmwasm_test.go index c0c15592c5a..9d3bbb76af7 100644 --- a/tests/interchain/cosmwasm_test.go +++ b/tests/interchain/cosmwasm_test.go @@ -6,7 +6,7 @@ import ( "path" "testing" - "github.com/cosmos/gaia/v20/tests/interchain/chainsuite" + "github.com/cosmos/gaia/v21/tests/interchain/chainsuite" "github.com/strangelove-ventures/interchaintest/v8" "github.com/stretchr/testify/suite" ) diff --git a/tests/interchain/endpoints_test.go b/tests/interchain/endpoints_test.go index 25f2e75d92c..c888cef6ddf 100644 --- a/tests/interchain/endpoints_test.go +++ b/tests/interchain/endpoints_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/cosmos/gaia/v20/tests/interchain/chainsuite" + "github.com/cosmos/gaia/v21/tests/interchain/chainsuite" "github.com/stretchr/testify/suite" "golang.org/x/mod/semver" ) diff --git a/tests/interchain/go.mod b/tests/interchain/go.mod index 55eb527d3f8..b5355dc503d 100644 --- a/tests/interchain/go.mod +++ b/tests/interchain/go.mod @@ -1,4 +1,4 @@ -module github.com/cosmos/gaia/v20/tests/interchain +module github.com/cosmos/gaia/v21/tests/interchain go 1.22.5 diff --git a/tests/interchain/permissionless_test.go b/tests/interchain/permissionless_test.go index 17cea56aabb..4087cfcd361 100644 --- a/tests/interchain/permissionless_test.go +++ b/tests/interchain/permissionless_test.go @@ -11,8 +11,8 @@ import ( "time" sdkmath "cosmossdk.io/math" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/cosmos/gaia/v20/tests/interchain/chainsuite" + govtypes "github.cogaia/v21/cosmos-sdk/x/gov/types/v1" + "github.com/cosmos/gaia/v21/tests/interchain/chainsuite" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ccvclient "github.com/cosmos/interchain-security/v5/x/ccv/provider/client" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" diff --git a/tests/interchain/txs_test.go b/tests/interchain/txs_test.go index 28ab6e30c99..85d2b40df27 100644 --- a/tests/interchain/txs_test.go +++ b/tests/interchain/txs_test.go @@ -15,7 +15,7 @@ import ( sdkmath "cosmossdk.io/math" - "github.com/cosmos/gaia/v20/tests/interchain/chainsuite" + "github.com/cosmos/gaia/v21/tests/interchain/chainsuite" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) diff --git a/tests/interchain/unbonding_test.go b/tests/interchain/unbonding_test.go index b74cf3dac75..86c7656b333 100644 --- a/tests/interchain/unbonding_test.go +++ b/tests/interchain/unbonding_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/cosmos/gaia/v20/tests/interchain/chainsuite" + "github.com/cosmos/gaia/v21/tests/interchain/chainsuite" "github.com/strangelove-ventures/interchaintest/v8" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v8/ibc" diff --git a/x/metaprotocols/module.go b/x/metaprotocols/module.go index 832ccbf284d..ebdab3b03b4 100644 --- a/x/metaprotocols/module.go +++ b/x/metaprotocols/module.go @@ -15,7 +15,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/gaia/v20/x/metaprotocols/types" + "github.com/cosmos/gaia/v21/x/metaprotocols/types" ) const consensusVersion uint64 = 1 From 341eafe8c37eb48f2ab3a68f177f691ee72a6b17 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Wed, 2 Oct 2024 17:46:05 +0200 Subject: [PATCH 3/6] deps!: bump wasmvm to v2.1.3 (#3366) * deps!: bump wasmvm to v2.1.3 * update changelogs * update test.yml --- .../unreleased/dependencies/3366-bump-wasmvm-version.md | 2 ++ .dockerignore | 4 +++- .github/dependabot.yml | 2 +- .github/workflows/test.yml | 4 ++-- .mergify.yml | 6 +++--- Dockerfile | 6 +++--- go.mod | 2 +- go.sum | 4 ++-- 8 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 .changelog/unreleased/dependencies/3366-bump-wasmvm-version.md diff --git a/.changelog/unreleased/dependencies/3366-bump-wasmvm-version.md b/.changelog/unreleased/dependencies/3366-bump-wasmvm-version.md new file mode 100644 index 00000000000..24fe96abd5e --- /dev/null +++ b/.changelog/unreleased/dependencies/3366-bump-wasmvm-version.md @@ -0,0 +1,2 @@ +- Update wasmvm to v2.1.3 - security patch + ([\#3366](https://github.com/cosmos/gaia/pull/3366)) diff --git a/.dockerignore b/.dockerignore index 4a11244b79b..faa1f90c538 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,6 @@ node_modules build .github -.vscode \ No newline at end of file +.vscode +docs +.changelog diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7cead4c66c6..f23552186a3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -21,7 +21,7 @@ updates: directory: "/" schedule: interval: daily - target-branch: "release/v19.2.x" + target-branch: "release/v21.x" # Only allow automated security-related dependency updates on release branches. open-pull-requests-limit: 0 labels: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d239b1e6889..a7deed99220 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -170,8 +170,8 @@ jobs: if: env.GIT_DIFF - name: Install New Gaiad run: | - curl -LO https://github.com/CosmWasm/wasmvm/releases/download/v2.1.2/libwasmvm.x86_64.so - curl -LO https://github.com/CosmWasm/wasmvm/releases/download/v2.1.2/libwasmvm.aarch64.so + curl -LO https://github.com/CosmWasm/wasmvm/releases/download/v2.1.3/libwasmvm.x86_64.so + curl -LO https://github.com/CosmWasm/wasmvm/releases/download/v2.1.3/libwasmvm.aarch64.so uname -m sudo cp "./libwasmvm.$(uname -m).so" /usr/lib/ make build diff --git a/.mergify.yml b/.mergify.yml index 2a0004c821c..7eb29f16060 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -24,14 +24,14 @@ pull_request_rules: {{ title }} (#{{ number }}) {{ body }} - - name: Backport patches to the release/v19.2.x branch + - name: Backport patches to the release/v21.x branch conditions: - base=main - - label=A:backport/v19.2.x + - label=A:backport/v21.x actions: backport: branches: - - release/v19.2.x + - release/v21.x - name: Backport patches to the release/v20.x branch conditions: diff --git a/Dockerfile b/Dockerfile index ee5ef73d792..26c334bc930 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,11 +8,11 @@ ENV PACKAGES="curl make git libc-dev bash file gcc linux-headers eudev-dev" RUN apk add --no-cache $PACKAGES # See https://github.com/CosmWasm/wasmvm/releases -ARG WASMVM_VERSION=v2.1.2 +ARG WASMVM_VERSION=v2.1.3 ADD https://github.com/CosmWasm/wasmvm/releases/download/${WASMVM_VERSION}/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a ADD https://github.com/CosmWasm/wasmvm/releases/download/${WASMVM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a -RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 0881c5b463e89e229b06370e9e2961aec0a5c636772d5142c68d351564464a66 -RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 58e1f6bfa89ee390cb9abc69a5bc126029a497fe09dd399f38a82d0d86fe95ef +RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep faea4e15390e046d2ca8441c21a88dba56f9a0363f92c5d94015df0ac6da1f2d +RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 8dab08434a5fe57a6fbbcb8041794bc3c31846d31f8ff5fb353ee74e0fcd3093 RUN cp "/lib/libwasmvm_muslc.$(uname -m).a" /lib/libwasmvm_muslc.a COPY go.mod go.sum* ./ diff --git a/go.mod b/go.mod index 57887a0bb8d..897fd23cf20 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect - github.com/CosmWasm/wasmvm/v2 v2.1.2 // indirect + github.com/CosmWasm/wasmvm/v2 v2.1.3 // indirect github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect diff --git a/go.sum b/go.sum index 37ad3e61794..92fff64ada3 100644 --- a/go.sum +++ b/go.sum @@ -243,8 +243,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CosmWasm/wasmd v0.53.0 h1:kdaoAi20bIb4VCsxw9pRaT2g5PpIp82Wqrr9DRVN9ao= github.com/CosmWasm/wasmd v0.53.0/go.mod h1:FJl/aWjdpGof3usAMFQpDe07Rkx77PUzp0cygFMOvtw= -github.com/CosmWasm/wasmvm/v2 v2.1.2 h1:GkJ5bAsRlLHfIQVg/FY1VHwLyBwlCjAhDea0B8L+e20= -github.com/CosmWasm/wasmvm/v2 v2.1.2/go.mod h1:bMhLQL4Yp9CzJi9A83aR7VO9wockOsSlZbT4ztOl6bg= +github.com/CosmWasm/wasmvm/v2 v2.1.3 h1:CSJTauZqkHyb9yic6JVYCjiGUgxI2MJV2QzfSu8m49c= +github.com/CosmWasm/wasmvm/v2 v2.1.3/go.mod h1:bMhLQL4Yp9CzJi9A83aR7VO9wockOsSlZbT4ztOl6bg= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= From 76495660c8bf026669c56d1101f19ebcdf61696a Mon Sep 17 00:00:00 2001 From: MSalopek Date: Wed, 2 Oct 2024 17:46:23 +0200 Subject: [PATCH 4/6] docs: bump docs to use latest version (#3368) * docs: fix issues with versioning * docs: rm banner * cleanup --- docs/docs/index.md | 57 +++++++++++++++++++-------------------- docs/docusaurus.config.js | 8 +----- docs/versions.json | 4 +-- 3 files changed, 30 insertions(+), 39 deletions(-) diff --git a/docs/docs/index.md b/docs/docs/index.md index c05a0f4918b..1f96ef2e3d7 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -18,45 +18,44 @@ Learn more about [being a delegator](./delegators/delegator-faq.md), learn about ## Cosmos Hub Wallets -:::warning +:::tip Do your own research and take precautions in regards to wallet security. Maintaining proper security practices is solely your responsibility when using third party wallets. ::: These community-maintained web and mobile wallets allow you to store & transfer ATOM, delegate ATOM to validators, and vote on on-chain governance proposals. Note that we do not endorse any of the wallets, they are listed for your convenience. -* [Keplr](https://wallet.keplr.app) - Web -* [Ledger](https://www.ledger.com/cosmos-wallet) - Hardware -* [Cosmostation](https://www.cosmostation.io/) - Android, iOS -* [Leap Wallet](https://www.leapwallet.io/) - Android, iOS, Web -* [Atomic Wallet](https://atomicwallet.io/) - Android, Linux, macOS, Windows -* [Citadel.One](https://citadel.one/#mobile) - Android, iOS -* [Cobo](https://cobo.com/) - Android, iOS -* [Crypto.com](https://crypto.com/) - Android, iOS -* [Huobi Wallet](https://www.huobiwallet.com/) - Android, iOS -* [ShapeShift](https://app.shapeshift.com/) - Android, iOS, Web -* [imToken](https://token.im/) - Android, iOS -* [Math Wallet](https://www.mathwallet.org/en/) - Android, iOS, Web -* [Rainbow Wallet](https://www.rainbow.one) - Android, iOS -* [Trust Wallet](https://trustwallet.com/) Android, iOS -* [Komodo Wallet](https://atomicdex.io/en/) - +- [Keplr](https://wallet.keplr.app) - Web +- [Ledger](https://www.ledger.com/cosmos-wallet) - Hardware +- [Cosmostation](https://www.cosmostation.io/) - Android, iOS +- [Leap Wallet](https://www.leapwallet.io/) - Android, iOS, Web +- [Atomic Wallet](https://atomicwallet.io/) - Android, Linux, macOS, Windows +- [Citadel.One](https://citadel.one/#mobile) - Android, iOS +- [Cobo](https://cobo.com/) - Android, iOS +- [Crypto.com](https://crypto.com/) - Android, iOS +- [Huobi Wallet](https://www.huobiwallet.com/) - Android, iOS +- [ShapeShift](https://app.shapeshift.com/) - Android, iOS, Web +- [imToken](https://token.im/) - Android, iOS +- [Math Wallet](https://www.mathwallet.org/en/) - Android, iOS, Web +- [Rainbow Wallet](https://www.rainbow.one) - Android, iOS +- [Trust Wallet](https://trustwallet.com/) Android, iOS +- [Komodo Wallet](https://atomicdex.io/en/) ## Metamask Snaps -* [Leap Wallet](https://www.leapwallet.io/snaps) -* [Mystic Lab](https://metamask.mysticlabs.xyz/) +- [Leap Wallet](https://www.leapwallet.io/snaps) +- [Mystic Lab](https://metamask.mysticlabs.xyz/) ## Cosmos Hub Explorers These block explorers allow you to search, view and analyze Cosmos Hub data—like blocks, transactions, validators, etc. -* [Mintscan](https://mintscan.io) -* [Numia](https://www.datalenses.zone/chain/cosmos) -* [ATOMScan](https://atomscan.com) -* [IOBScan](https://cosmoshub.iobscan.io/) -* [Ping.Pub](https://ping.pub/cosmos) -* [BronBro](https://monitor.bronbro.io/d/cosmos-stats/cosmos) -* [SmartStake](https://cosmos.smartstake.io/stats) +- [Mintscan](https://mintscan.io) +- [Numia](https://www.datalenses.zone/chain/cosmos) +- [ATOMScan](https://atomscan.com) +- [IOBScan](https://cosmoshub.iobscan.io/) +- [Ping.Pub](https://ping.pub/cosmos) +- [BronBro](https://monitor.bronbro.io/d/cosmos-stats/cosmos) +- [SmartStake](https://cosmos.smartstake.io/stats) ## Cosmos Hub CLI @@ -72,8 +71,8 @@ ator-setup). Have questions, comments, or new ideas? Participate in the Cosmos community through one of the following channels. -* [Discord](https://discord.gg/interchain) -* [Cosmos Forum](https://forum.cosmos.network) -* [Cosmos on Reddit](https://reddit.com/r/cosmosnetwork) +- [Discord](https://discord.gg/interchain) +- [Cosmos Forum](https://forum.cosmos.network) +- [Cosmos on Reddit](https://reddit.com/r/cosmosnetwork) To learn more about the Cosmos Hub and how it fits within the Cosmos Network, visit [cosmos.network](https://cosmos.network). diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 9181df2ec03..9120b8419cd 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -53,16 +53,10 @@ const config = { docs: { routeBasePath: "/", sidebarPath: require.resolve("./sidebars.js"), - lastVersion: "v19.2.0", versions: { current: { path: "main", - label: "Unreleased (main)", - banner: "unreleased", - }, - "v19.2.0": { - path: "v19.2.0", - label: "On chain (v19.2.0)", + label: "Latest", banner: "none", }, }, diff --git a/docs/versions.json b/docs/versions.json index 29c46b000ad..fe51488c706 100644 --- a/docs/versions.json +++ b/docs/versions.json @@ -1,3 +1 @@ -[ - "v19.2.0" -] \ No newline at end of file +[] From a8076952ccd81955e6d726bdd7576ba922eda911 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 17:50:42 +0200 Subject: [PATCH 5/6] chore(deps): Bump JamesIves/github-pages-deploy-action (#3363) Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.4 to 4.6.8. - [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases) - [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.6.4...v4.6.8) --- updated-dependencies: - dependency-name: JamesIves/github-pages-deploy-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/deploy-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 43c3f65f28f..c556ad45010 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -40,7 +40,7 @@ jobs: make build-docs - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.6.4 + uses: JamesIves/github-pages-deploy-action@v4.6.8 with: branch: gh-pages folder: ~/output From 7f16da6ead07985bb21dd3c4ee54feccca8623a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 17:51:00 +0200 Subject: [PATCH 6/6] chore(deps): Bump docker/build-push-action from 6.7.0 to 6.9.0 (#3362) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.7.0 to 6.9.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v6.7.0...v6.9.0) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/docker-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml index bfd427afc56..66e913a023d 100644 --- a/.github/workflows/docker-push.yml +++ b/.github/workflows/docker-push.yml @@ -46,7 +46,7 @@ jobs: flavor: "latest=false" - name: Build and push docker image - uses: docker/build-push-action@v6.7.0 + uses: docker/build-push-action@v6.9.0 with: context: . file: Dockerfile