Skip to content

Commit

Permalink
chore: add back scaling factor choice (#7951)
Browse files Browse the repository at this point in the history
* chore: add back scaling factor choice

* chore: add more pools and test

* chore: add changelog

* chore: fix typo and test

* chore: remove old changelog entry
  • Loading branch information
PaddyMc authored Apr 5, 2024
1 parent 1b3449b commit f110508
Show file tree
Hide file tree
Showing 11 changed files with 158 additions and 843 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#7768](https://github.com/osmosis-labs/osmosis/pull/7768) Allow governance module account to transfer any CL position
* [#7746](https://github.com/osmosis-labs/osmosis/pull/7746) Make forfeited incentives redeposit into the pool instead of sending to community pool
* [#7785](https://github.com/osmosis-labs/osmosis/pull/7785) Remove reward claiming during position transfers
* [#7805](https://github.com/osmosis-labs/osmosis/pull/7805) Migrate remaining cl incentive accumulators
* [#7833](https://github.com/osmosis-labs/osmosis/pull/7833) Bump max gas wanted per tx to 60 mil
* [#7839](https://github.com/osmosis-labs/osmosis/pull/7839) Add ICA controller
* [#7527](https://github.com/osmosis-labs/osmosis/pull/7527) Add 30M gas limit to CW pool contract calls
* [#7855](https://github.com/osmosis-labs/osmosis/pull/7855) Whitelist address parameter for setting fee tokens
* [#7857](https://github.com/osmosis-labs/osmosis/pull/7857) SuperfluidDelegationsByValidatorDenom query now returns equivalent staked amount
* [#7912](https://github.com/osmosis-labs/osmosis/pull/7912) Default timeoutCommit to 2s
* [#7951](https://github.com/osmosis-labs/osmosis/pull/7951) Only migrate selected cl incentives
* [#7938](https://github.com/osmosis-labs/osmosis/pull/7938) Add missing swap events for missing swap event for cw pools.

### SDK
Expand Down
9 changes: 0 additions & 9 deletions app/upgrades/v23/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,3 @@ var Upgrade = upgrades.Upgrade{
Deleted: []string{},
},
}

var MigratedIncentiveAccumulatorPoolIDs = map[uint64]struct{}{
1423: {},
1213: {},
1298: {},
1297: {},
1292: {},
1431: {},
}
5 changes: 3 additions & 2 deletions app/upgrades/v23/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/osmosis-labs/osmosis/v24/app/keepers"
"github.com/osmosis-labs/osmosis/v24/app/upgrades"
concentratedliquidity "github.com/osmosis-labs/osmosis/v24/x/concentrated-liquidity"
concentratedtypes "github.com/osmosis-labs/osmosis/v24/x/concentrated-liquidity/types"
)

const (
Expand Down Expand Up @@ -81,8 +82,8 @@ func CreateUpgradeHandler(

// migrateMainnetPools migrates the specified mainnet pools to the new accumulator scaling factor.
func migrateMainnetPools(ctx sdk.Context, concentratedKeeper concentratedliquidity.Keeper) error {
poolIDsToMigrate := make([]uint64, 0, len(MigratedIncentiveAccumulatorPoolIDs))
for poolID := range MigratedIncentiveAccumulatorPoolIDs {
poolIDsToMigrate := make([]uint64, 0, len(concentratedtypes.MigratedIncentiveAccumulatorPoolIDs))
for poolID := range concentratedtypes.MigratedIncentiveAccumulatorPoolIDs {
poolIDsToMigrate = append(poolIDsToMigrate, poolID)
}

Expand Down
25 changes: 11 additions & 14 deletions app/upgrades/v23/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/osmosis-labs/osmosis/osmomath"
"github.com/osmosis-labs/osmosis/v24/app/apptesting"

v23 "github.com/osmosis-labs/osmosis/v24/app/upgrades/v23"
concentratedtypes "github.com/osmosis-labs/osmosis/v24/x/concentrated-liquidity/types"
)

Expand Down Expand Up @@ -88,29 +87,27 @@ func (s *UpgradeTestSuite) TestUpgrade() {
s.Require().NotEmpty(nonMigratedPoolBeforeUpgradeIncentives)

// Overwrite the migration list with the desired pool ID.
oldMigrationList := v23.MigratedIncentiveAccumulatorPoolIDs
v23.MigratedIncentiveAccumulatorPoolIDs = map[uint64]struct{}{}
v23.MigratedIncentiveAccumulatorPoolIDs[lastPoolID] = struct{}{}
oldMigrationList := concentratedtypes.MigratedIncentiveAccumulatorPoolIDs
concentratedtypes.MigratedIncentiveAccumulatorPoolIDs = map[uint64]struct{}{}
concentratedtypes.MigratedIncentiveAccumulatorPoolIDs[lastPoolID] = struct{}{}

dummyUpgrade(s)
s.Require().NotPanics(func() {
s.App.BeginBlocker(s.Ctx, abci.RequestBeginBlock{})
})

// NOTE: these no longer work as expected in versions later than v23, in v23 we decide between the old and new scaling factor.
// Since we're removing this choice, these test are not worrking as expected
// Migrated pool: ensure that the claimable incentives are the same before and after migration
//migratedPoolAfterUpgradeIncentives, _, err := s.App.ConcentratedLiquidityKeeper.GetClaimableIncentives(s.Ctx, lastPoolPositionID)
//s.Require().NoError(err)
//s.Require().Equal(migratedPoolBeforeUpgradeIncentives.String(), migratedPoolAfterUpgradeIncentives.String())
migratedPoolAfterUpgradeIncentives, _, err := s.App.ConcentratedLiquidityKeeper.GetClaimableIncentives(s.Ctx, lastPoolPositionID)
s.Require().NoError(err)
s.Require().Equal(migratedPoolBeforeUpgradeIncentives.String(), migratedPoolAfterUpgradeIncentives.String())

//// Non-migrated pool: ensure that the claimable incentives are the same before and after migration
//nonMigratedPoolAfterUpgradeIncentives, _, err := s.App.ConcentratedLiquidityKeeper.GetClaimableIncentives(s.Ctx, lastPoolPositionID-1)
//s.Require().NoError(err)
//s.Require().Equal(nonMigratedPoolBeforeUpgradeIncentives.String(), nonMigratedPoolAfterUpgradeIncentives.String())
// Non-migrated pool: ensure that the claimable incentives are the same before and after migration
nonMigratedPoolAfterUpgradeIncentives, _, err := s.App.ConcentratedLiquidityKeeper.GetClaimableIncentives(s.Ctx, lastPoolPositionID-1)
s.Require().NoError(err)
s.Require().Equal(nonMigratedPoolBeforeUpgradeIncentives.String(), nonMigratedPoolAfterUpgradeIncentives.String())

// Restore the migration list for use by other tests
v23.MigratedIncentiveAccumulatorPoolIDs = oldMigrationList
concentratedtypes.MigratedIncentiveAccumulatorPoolIDs = oldMigrationList
}

func dummyUpgrade(s *UpgradeTestSuite) {
Expand Down
Loading

0 comments on commit f110508

Please sign in to comment.