Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add back scaling factor choice (backport #7951) #7958

Merged
merged 2 commits into from
Apr 5, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 5, 2024

What is the purpose of the change

This PR migrates the selected cl pool incentives to the new scaling factor, in this PR we add back in the code path choice for selected pool scaling factors

currently the pool added to this migration are:

// MigratedIncentiveAccumulatorPoolIDsV24 is a map that defines pools to migrate to the latest scalingFactor for v24.
var MigratedIncentiveAccumulatorPoolIDsV24 = map[uint64]struct{}{
	// token0 eth
	// token1 uosmo
	// liquidity 272k
	1281: {},
	// token0 usdt
	// token1 dia
	// liquidity 500
	1276: {},
	// token0 usdc
	// token1 dai
	// liqudity 1.55k
	1275: {},
	// token0 usdc
	// token1 dai
	// liqudity 52.9k
	1260: {},
}

How to test

To test this PR you need to use the in-place-testnet

Download the latest snapshot and genesis

OSMOSIS_HOME=$HOME/.osmosisd

SNAPSHOT_URL=$(curl -sL https://snapshots.osmosis.zone/latest)
RPC_URL=https://rpc.osmosis.zone
ADDRBOOK_URL="https://rpc.osmosis.zone/addrbook"
GENESIS_URL=https://github.com/osmosis-labs/osmosis/raw/main/networks/osmosis-1/genesis.json

rm -rf $HOME/.osmosisd/

osmosisd init test --chain-id testing --home=$HOME/.osmosisd

# Copy genesis
echo -e "\nDownloading genesis file..."
wget $GENESIS_URL -O $OSMOSIS_HOME/config/genesis.json
echo ✅ Genesis file downloaded successfully.

# Download latest snapshot
echo -e "\nDownloading latest snapshot..."
wget -O - $SNAPSHOT_URL | lz4 -d | tar -C $OSMOSIS_HOME/ -xf -
echo -e ✅ Snapshot downloaded successfully.

# Run the node
osmosisd start --home=$HOME/.osmosisd

You need to install v23.0.8 to run the following command

osmosisd in-place-testnet edgenet osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj --trigger-testnet-upgrade v24

Wait until the node stops, build this branch and run

osmosisd start

This will run the v24 migration and migrate selected CL pool incentive accumlators

How to test manually:

  • Create an incentive for a pool
  • Create a CL position in a tight range
  • Swap tokens
  • Check that rewards have been distributed

Summary by CodeRabbit

  • New Features

    • Introduced functionality to selectively migrate CL incentives, enhancing the migration process.
    • Added a feature to retrieve and apply incentive scaling factors for pools, improving the accuracy of incentive calculations.
  • Refactor

    • Updated references and variable names related to migrated incentive accumulator pool IDs across multiple upgrade paths.
    • Adjusted logic for managing pool IDs during migration to ensure compatibility with new incentive scaling features.
  • Tests

    • Added and updated tests to verify the correct application of incentive scaling factors and the selective migration of incentives.

This is an automatic backport of pull request #7951 done by [Mergify](https://mergify.com).

* 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

(cherry picked from commit f110508)

# Conflicts:
#	CHANGELOG.md
@mergify mergify bot requested a review from czarcas7ic as a code owner April 5, 2024 13:21
@mergify mergify bot added the conflicts label Apr 5, 2024
Copy link
Contributor Author

mergify bot commented Apr 5, 2024

Cherry-pick of f110508 has failed:

On branch mergify/bp/v24.x/pr-7951
Your branch is up to date with 'origin/v24.x'.

You are currently cherry-picking commit f1105087.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   app/upgrades/v23/constants.go
	modified:   app/upgrades/v23/upgrades.go
	modified:   app/upgrades/v23/upgrades_test.go
	modified:   app/upgrades/v24/constants.go
	modified:   app/upgrades/v24/upgrades.go
	modified:   app/upgrades/v24/upgrades_test.go
	modified:   x/concentrated-liquidity/export_test.go
	modified:   x/concentrated-liquidity/incentives.go
	modified:   x/concentrated-liquidity/incentives_test.go
	new file:   x/concentrated-liquidity/types/migration.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   CHANGELOG.md

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@PaddyMc PaddyMc merged commit 8d5076a into v24.x Apr 5, 2024
1 check passed
@PaddyMc PaddyMc deleted the mergify/bp/v24.x/pr-7951 branch April 5, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant