diff --git a/.vscode/launch.json b/.vscode/launch.json index fba480ca4ce..4618a2f8c6d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -21,7 +21,7 @@ "OSMOSIS_E2E_SKIP_UPGRADE": "true", "OSMOSIS_E2E_SKIP_CLEANUP": "true", "OSMOSIS_E2E_SKIP_STATE_SYNC": "true", - "OSMOSIS_E2E_UPGRADE_VERSION": "v17", + "OSMOSIS_E2E_UPGRADE_VERSION": "v18", "OSMOSIS_E2E_DEBUG_LOG": "false", }, "preLaunchTask": "e2e-setup" diff --git a/Makefile b/Makefile index d04f3f7a644..b868b7aba29 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ LEDGER_ENABLED ?= true SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g') BUILDDIR ?= $(CURDIR)/build DOCKER := $(shell which docker) -E2E_UPGRADE_VERSION := "v17" +E2E_UPGRADE_VERSION := "v18" #SHELL := /bin/bash GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2) diff --git a/app/app.go b/app/app.go index ab126d38c01..56e97081517 100644 --- a/app/app.go +++ b/app/app.go @@ -58,6 +58,7 @@ import ( v15 "github.com/osmosis-labs/osmosis/v17/app/upgrades/v15" v16 "github.com/osmosis-labs/osmosis/v17/app/upgrades/v16" v17 "github.com/osmosis-labs/osmosis/v17/app/upgrades/v17" + v18 "github.com/osmosis-labs/osmosis/v17/app/upgrades/v18" v3 "github.com/osmosis-labs/osmosis/v17/app/upgrades/v3" v4 "github.com/osmosis-labs/osmosis/v17/app/upgrades/v4" v5 "github.com/osmosis-labs/osmosis/v17/app/upgrades/v5" @@ -103,7 +104,7 @@ var ( // _ sdksimapp.App = (*OsmosisApp)(nil) - Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade, v15.Upgrade, v16.Upgrade, v17.Upgrade} + Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade, v15.Upgrade, v16.Upgrade, v17.Upgrade, v18.Upgrade} Forks = []upgrades.Fork{v3.Fork, v6.Fork, v8.Fork, v10.Fork} ) diff --git a/app/upgrades/v18/constants.go b/app/upgrades/v18/constants.go new file mode 100644 index 00000000000..73c9b440825 --- /dev/null +++ b/app/upgrades/v18/constants.go @@ -0,0 +1,19 @@ +package v18 + +import ( + "github.com/osmosis-labs/osmosis/v17/app/upgrades" + + store "github.com/cosmos/cosmos-sdk/store/types" +) + +// UpgradeName defines the on-chain upgrade name for the Osmosis v18 upgrade. +const UpgradeName = "v18" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v18/upgrades.go b/app/upgrades/v18/upgrades.go new file mode 100644 index 00000000000..b35ce162a23 --- /dev/null +++ b/app/upgrades/v18/upgrades.go @@ -0,0 +1,28 @@ +package v18 + +import ( + 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/osmosis-labs/osmosis/v17/app/keepers" + "github.com/osmosis-labs/osmosis/v17/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + bpm upgrades.BaseAppParamManager, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + // Run migrations before applying any other state changes. + // NOTE: DO NOT PUT ANY STATE CHANGES BEFORE RunMigrations(). + migrations, err := mm.RunMigrations(ctx, configurator, fromVM) + if err != nil { + return nil, err + } + + return migrations, nil + } +} diff --git a/tests/e2e/configurer/upgrade.go b/tests/e2e/configurer/upgrade.go index 1ef5af70794..b71559fff5d 100644 --- a/tests/e2e/configurer/upgrade.go +++ b/tests/e2e/configurer/upgrade.go @@ -11,7 +11,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" appparams "github.com/osmosis-labs/osmosis/v17/app/params" - v17 "github.com/osmosis-labs/osmosis/v17/app/upgrades/v17" "github.com/osmosis-labs/osmosis/v17/tests/e2e/configurer/chain" "github.com/osmosis-labs/osmosis/v17/tests/e2e/configurer/config" "github.com/osmosis-labs/osmosis/v17/tests/e2e/containers" @@ -139,45 +138,6 @@ func (uc *UpgradeConfigurer) CreatePreUpgradeState() error { // Wait for all goroutines to complete wg.Wait() - // START: CAN REMOVE POST v17 UPGRADE - - v17SuperfluidAssets := v17GetSuperfluidAssets() - - wg.Add(2) - - // START: CAN REMOVE POST v17 UPGRADE - authorizedQuoteDenoms := "[\"uosmo\",\"ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2\",\"ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7\",\"ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858\",\"ibc/4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB\",\"ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5\",\"ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F\"]" - // END: CAN REMOVE POST v17 UPGRADE - - // Chain A - go func() { - defer wg.Done() - chainANode.EnableSuperfluidAsset(chainA, v17SuperfluidAssets) - // START: CAN REMOVE POST v17 UPGRADE - err := chainANode.ParamChangeProposal("concentratedliquidity", "AuthorizedQuoteDenoms", []byte(authorizedQuoteDenoms), chainA) - if err != nil { - uc.t.Logf("error during param change proposal: %v", err) - } - // END: CAN REMOVE POST v17 UPGRADE - }() - - // Chain B - - go func() { - defer wg.Done() - chainBNode.EnableSuperfluidAsset(chainB, v17SuperfluidAssets) - // START: CAN REMOVE POST v17 UPGRADE - err := chainBNode.ParamChangeProposal("concentratedliquidity", "AuthorizedQuoteDenoms", []byte(authorizedQuoteDenoms), chainB) - if err != nil { - uc.t.Logf("error during param change proposal: %v", err) - } - // END: CAN REMOVE POST v17 UPGRADE - }() - - wg.Wait() - - // END: CAN REMOVE POST v17 UPGRADE - var ( poolShareDenom = make([]string, 2) preUpgradePoolId = make([]uint64, 2) @@ -453,20 +413,3 @@ func (uc *UpgradeConfigurer) upgradeContainers(chainConfig *chain.Config, propHe uc.t.Logf("upgrade successful on chain %s", chainConfig.Id) return nil } - -// START: CAN REMOVE POST v17 UPGRADE - -func v17GetSuperfluidAssets() string { - assets := "" - for _, assetPair := range v17.AssetPairsForTestsOnly { - if assetPair.Superfluid { - assets += fmt.Sprintf("gamm/pool/%d,", assetPair.LinkedClassicPool) - } - } - if len(assets) > 0 { - assets = assets[:len(assets)-1] - } - return assets -} - -// END: CAN REMOVE POST v17 UPGRADE diff --git a/tests/e2e/containers/config.go b/tests/e2e/containers/config.go index d6f24d3b01f..95b3f8fd0b5 100644 --- a/tests/e2e/containers/config.go +++ b/tests/e2e/containers/config.go @@ -24,10 +24,10 @@ const ( // It should be uploaded to Docker Hub. OSMOSIS_E2E_SKIP_UPGRADE should be unset // for this functionality to be used. previousVersionOsmoRepository = "osmolabs/osmosis-dev" - previousVersionOsmoTag = "16.0-alpine" + previousVersionOsmoTag = "17.0-alpine" // Pre-upgrade repo/tag for osmosis initialization (this should be one version below upgradeVersion) previousVersionInitRepository = "osmolabs/osmosis-e2e-init-chain" - previousVersionInitTag = "v16-faster-epoch" + previousVersionInitTag = "17.0.0-rc0" // Hermes repo/version for relayer relayerRepository = "informalsystems/hermes" relayerTag = "1.5.1" diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index ab0dcd8aae5..9a72774afe4 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -29,7 +29,6 @@ import ( "github.com/osmosis-labs/osmosis/osmoutils/osmoassert" appparams "github.com/osmosis-labs/osmosis/v17/app/params" - v17 "github.com/osmosis-labs/osmosis/v17/app/upgrades/v17" "github.com/osmosis-labs/osmosis/v17/tests/e2e/configurer/chain" "github.com/osmosis-labs/osmosis/v17/tests/e2e/configurer/config" "github.com/osmosis-labs/osmosis/v17/tests/e2e/initialization" @@ -132,15 +131,6 @@ func (s *IntegrationTestSuite) TestAllE2E() { }) } - if s.skipUpgrade { - s.T().Skip("Skipping ConcentratedLiquidity_CanonicalPools test") - } else { - s.T().Run("ConcentratedLiquidity_CanonicalPools", func(t *testing.T) { - t.Parallel() - s.ConcentratedLiquidity_CanonicalPools() - }) - } - // IBC Dependent Tests if s.skipIBC { @@ -1220,11 +1210,10 @@ func (s *IntegrationTestSuite) IBCTokenTransferRateLimiting() { } func (s *IntegrationTestSuite) LargeWasmUpload() { - chainA := s.configurer.GetChainConfig(0) - chainANode, err := chainA.GetDefaultNode() + _, chainNode, err := s.getChainCfgs() s.Require().NoError(err) - validatorAddr := chainANode.GetWallet(initialization.ValidatorWalletName) - chainANode.StoreWasmCode("bytecode/large.wasm", validatorAddr) + validatorAddr := chainNode.GetWallet(initialization.ValidatorWalletName) + chainNode.StoreWasmCode("bytecode/large.wasm", validatorAddr) } func (s *IntegrationTestSuite) IBCWasmHooks() { @@ -1297,7 +1286,8 @@ func (s *IntegrationTestSuite) PacketForwarding() { } chainA, chainANode, err := s.getChainACfgs() s.Require().NoError(err) - chainB := s.configurer.GetChainConfig(1) + chainB, _, err := s.getChainBCfgs() + s.Require().NoError(err) // Instantiate the counter contract on chain A contractAddr := s.UploadAndInstantiateCounter(chainA) @@ -1799,64 +1789,3 @@ func (s *IntegrationTestSuite) GeometricTWAP() { // quote assset supply / base asset supply = 1_000_000 / 2_000_000 = 0.5 osmoassert.DecApproxEq(s.T(), sdk.NewDecWithPrec(5, 1), afterSwapTwapBOverA, sdk.NewDecWithPrec(1, 2)) } - -// START: CAN REMOVE POST v17 UPGRADE - -// Tests that v17 upgrade correctly creates the canonical pools in the upgrade handler. -func (s *IntegrationTestSuite) ConcentratedLiquidity_CanonicalPools() { - if s.skipUpgrade { - s.T().Skip("Skipping v17 canonical pools creation test because upgrade is not enabled") - } - - _, chainABNode, err := s.getChainCfgs() - s.Require().NoError(err) - - for _, assetPair := range v17.AssetPairsForTestsOnly { - expectedSpreadFactor := assetPair.SpreadFactor - concentratedPoolId := chainABNode.QueryConcentratedPooIdLinkFromCFMM(assetPair.LinkedClassicPool) - concentratedPool := s.updatedConcentratedPool(chainABNode, concentratedPoolId) - - s.Require().Equal(poolmanagertypes.Concentrated, concentratedPool.GetType()) - s.Require().Equal(assetPair.BaseAsset, concentratedPool.GetToken0()) - s.Require().Equal(assetPair.QuoteAsset, concentratedPool.GetToken1()) - s.Require().Equal(uint64(v17.TickSpacing), concentratedPool.GetTickSpacing()) - s.Require().Equal(expectedSpreadFactor.String(), concentratedPool.GetSpreadFactor(sdk.Context{}).String()) - - superfluidAssets := chainABNode.QueryAllSuperfluidAssets() - - found := false - for _, superfluidAsset := range superfluidAssets { - if superfluidAsset.Denom == cltypes.GetConcentratedLockupDenomFromPoolId(concentratedPoolId) { - found = true - break - } - } - - if assetPair.Superfluid { - s.Require().True(found, "concentrated liquidity pool denom not found in superfluid assets") - } else { - s.Require().False(found, "concentrated liquidity pool denom found in superfluid assets") - } - - // This spot price is taken from the balancer pool that was initiated pre upgrade. - balancerPool := s.updatedCFMMPool(chainABNode, assetPair.LinkedClassicPool) - expectedSpotPrice, err := balancerPool.SpotPrice(sdk.Context{}, assetPair.QuoteAsset, assetPair.BaseAsset) - s.Require().NoError(err) - - // Margin of error should be slightly larger than the gamm pool's spread factor, as the gamm pool is used to - // swap through when creating the initial position. The below implies a 0.1% margin of error. - tollerance := expectedSpreadFactor.Add(sdk.MustNewDecFromStr("0.0001")) - multiplicativeTolerance := osmomath.ErrTolerance{ - MultiplicativeTolerance: tollerance, - } - - s.Require().Equal(0, multiplicativeTolerance.CompareBigDec(osmomath.BigDecFromSDKDec(expectedSpotPrice), concentratedPool.GetCurrentSqrtPrice().PowerInteger(2))) - } - - // Check that the community pool module account possesses positions for all the canonical pools. - communityPoolAddress := chainABNode.QueryCommunityPoolModuleAccount() - positions := chainABNode.QueryConcentratedPositions(communityPoolAddress) - s.Require().Len(positions, len(v17.AssetPairsForTestsOnly)) -} - -// END: CAN REMOVE POST v17 UPGRADE