From fbe7d2040d61c20d2e65979f8a0607e8872be613 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Tue, 6 Feb 2024 09:26:16 -0600 Subject: [PATCH] remove v20 --- app/app.go | 2 - app/upgrades/v20/constants.go | 21 ---------- app/upgrades/v20/upgrade_test.go | 66 -------------------------------- app/upgrades/v20/upgrades.go | 47 ----------------------- 4 files changed, 136 deletions(-) delete mode 100644 app/upgrades/v20/constants.go delete mode 100644 app/upgrades/v20/upgrade_test.go delete mode 100644 app/upgrades/v20/upgrades.go diff --git a/app/app.go b/app/app.go index 69bc08ae4..0a118cfb5 100644 --- a/app/app.go +++ b/app/app.go @@ -81,7 +81,6 @@ import ( v17 "github.com/CosmosContracts/juno/v19/app/upgrades/v17" v18 "github.com/CosmosContracts/juno/v19/app/upgrades/v18" v19 "github.com/CosmosContracts/juno/v19/app/upgrades/v19" - v20 "github.com/CosmosContracts/juno/v19/app/upgrades/v20" "github.com/CosmosContracts/juno/v19/docs" ) @@ -120,7 +119,6 @@ var ( v17.Upgrade, v18.Upgrade, v19.Upgrade, - v20.Upgrade, } ) diff --git a/app/upgrades/v20/constants.go b/app/upgrades/v20/constants.go deleted file mode 100644 index 3675e5578..000000000 --- a/app/upgrades/v20/constants.go +++ /dev/null @@ -1,21 +0,0 @@ -package v19 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - - "github.com/CosmosContracts/juno/v19/app/upgrades" -) - -const ( - Core1MultisigVestingAccount = "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3" - CharterCouncil = "juno1nmezpepv3lx45mndyctz2lzqxa6d9xzd2xumkxf7a6r4nxt0y95qypm6c0" -) - -// UpgradeName defines the on-chain upgrade name for the upgrade. -const UpgradeName = "v20" - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateV20UpgradeHandler, - StoreUpgrades: store.StoreUpgrades{}, -} diff --git a/app/upgrades/v20/upgrade_test.go b/app/upgrades/v20/upgrade_test.go deleted file mode 100644 index 7242bc528..000000000 --- a/app/upgrades/v20/upgrade_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package v19_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - - "github.com/CosmosContracts/juno/v19/app/apptesting" - v20 "github.com/CosmosContracts/juno/v19/app/upgrades/v20" -) - -type UpgradeTestSuite struct { - apptesting.KeeperTestHelper -} - -func (s *UpgradeTestSuite) SetupTest() { - s.Setup() -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(UpgradeTestSuite)) -} - -// Ensures the test does not error out. -func (s *UpgradeTestSuite) TestUpgrade() { - s.Setup() - preUpgradeChecks(s) - - // == CREATE MOCK CORE-1 BASE ACCOUNT == - acc := sdk.MustAccAddressFromBech32(v20.Core1MultisigVestingAccount) - - // set account and mint it some balance - s.App.AppKeepers.AccountKeeper.SetAccount(s.Ctx, authtypes.NewBaseAccount(acc, nil, 0, 0)) - - amt := int64(9406347457268) - if err := s.App.AppKeepers.BankKeeper.MintCoins(s.Ctx, "mint", sdk.NewCoins(sdk.NewInt64Coin("ujuno", amt))); err != nil { - panic(fmt.Sprintf("failed to mint coins: %s", err)) - } - if err := s.App.AppKeepers.BankKeeper.SendCoinsFromModuleToAccount(s.Ctx, "mint", acc, sdk.NewCoins(sdk.NewInt64Coin("ujuno", amt))); err != nil { - panic(fmt.Sprintf("failed to send coins: %s", err)) - } - - accBal := s.App.AppKeepers.BankKeeper.GetAllBalances(s.Ctx, acc) - fmt.Printf("Core1 bal: %s\n", accBal) - - // == UPGRADE == - upgradeHeight := int64(5) - s.ConfirmUpgradeSucceeded(v20.UpgradeName, upgradeHeight) - postUpgradeChecks(s) - - // == POST VERIFICATION == - charterBal := s.App.AppKeepers.BankKeeper.GetAllBalances(s.Ctx, sdk.MustAccAddressFromBech32(v20.CharterCouncil)) - fmt.Printf("Council Post Upgrade Balance: %s\n", charterBal) - - s.Require().True(charterBal.AmountOf("ujuno").GTE(accBal.AmountOf("ujuno"))) -} - -func preUpgradeChecks(_ *UpgradeTestSuite) { -} - -func postUpgradeChecks(_ *UpgradeTestSuite) { -} diff --git a/app/upgrades/v20/upgrades.go b/app/upgrades/v20/upgrades.go deleted file mode 100644 index 732eb2af5..000000000 --- a/app/upgrades/v20/upgrades.go +++ /dev/null @@ -1,47 +0,0 @@ -package v19 - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - "github.com/CosmosContracts/juno/v19/app/keepers" - "github.com/CosmosContracts/juno/v19/app/upgrades" -) - -func CreateV20UpgradeHandler( - mm *module.Manager, - cfg module.Configurator, - k *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - logger := ctx.Logger().With("upgrade", UpgradeName) - - nativeDenom := upgrades.GetChainsDenomToken(ctx.ChainID()) - logger.Info(fmt.Sprintf("With native denom %s", nativeDenom)) - - // Run migrations - logger.Info(fmt.Sprintf("pre migrate version map: %v", vm)) - versionMap, err := mm.RunMigrations(ctx, cfg, vm) - if err != nil { - return nil, err - } - logger.Info(fmt.Sprintf("post migrate version map: %v", versionMap)) - - // migrate the rest of Core-1 funds to the council - if ctx.ChainID() == "juno-1" { - core1MultisigAcc := sdk.MustAccAddressFromBech32(Core1MultisigVestingAccount) - chaterAcc := sdk.MustAccAddressFromBech32(CharterCouncil) - - bal := k.BankKeeper.GetBalance(ctx, core1MultisigAcc, nativeDenom) - - if err = k.BankKeeper.SendCoins(ctx, core1MultisigAcc, chaterAcc, sdk.NewCoins(bal)); err != nil { - return nil, err - } - } - - return versionMap, err - } -}