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

feat: partial superfluid undelegate #5162

Conversation

czarcas7ic
Copy link
Member

@czarcas7ic czarcas7ic commented May 11, 2023

Closes: #XXX

What is the purpose of the change

After running via localosmosis, I realized that the UnlockAndMigrate message was taking a very large amount of gas (~1.4million). When breaking the message apart, I realized that if we do a partial migration, we could save a lot of gas by retaining the old lock and removing assets from it rather than forceUnlocking the entire lock and migrating to a new lock (having to re-establish superfluid connections, etc). This change bring the gas used to ~1million. We should investigate any further changes that can be made to reduce this overhead.

This is achieved by:

  • Not sending the cl/pool/x funds to the user just to have them sent back to the lockup module
  • Allow for a partial superfluid undelegate, so we dont have to delete the underlying lock and connection just to re-establish them (this happens when we do a partial migration)

Brief Changelog

(for example:)

  • The metadata is stored in the blob store on job creation time as a persistent artifact
  • Deployments RPC transmits only the blob storage reference
  • Daemons retrieve the RPC data from the blob cache

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? (yes / no)
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? (yes / no)
  • How is the feature or change documented? (not applicable / specification (x/<module>/spec/) / Osmosis docs repo / not documented)

@czarcas7ic czarcas7ic marked this pull request as ready for review May 12, 2023 02:24
x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
Comment on lines 294 to 302
if sharesToMigrate.Equal(gammSharesInLock) {
// If migrating the entire lock:

// This breaks and deletes associated synthetic locks.
err = k.lk.ForceUnlock(ctx, *lock)
if err != nil {
return sdk.Coins{}, err
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking: has the direct unit test been updated to account for this being conditional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This question led to uncovering a bug! We actually should have been doing a partialForceUnlock if the above branch is not hit. I also expanded the tests here to ensure this will get found in the future c7fd2bb

x/superfluid/keeper/migrate.go Outdated Show resolved Hide resolved
Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main logic lgtm, requesting for some additions in the test cases!

x/lockup/keeper/lock.go Show resolved Hide resolved
x/superfluid/keeper/migrate.go Outdated Show resolved Hide resolved
// The delegation from the intermediary account holder should still exist.
_, found := stakingKeeper.GetDelegation(ctx, balancerIntermediaryAcc.GetAccAddress(), valAddr)
suite.Require().True(found, "expected delegation, found delegation no delegation")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do deeper checks here for partial unlocks?
Some of the checks that comes into my mind are

  • Check if superfluid delegated amount is existing amount - coinsToMigrate
  • Check if what's remaining in the lock is existing amount - coinsToMigrate
  • Check if the new superfluid staked amount is equal to coinsToMigrate

and so on

Copy link
Member Author

@czarcas7ic czarcas7ic May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expanded these checks here, good call for this :) d71ad69 and a7cd212

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If partial unlocking, is there a way we can check that the amount to undelegate is succesfully in the queue of undelegation?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add checks for the new lock that has been created if this was a partial unlock? Apologies if I'm being picky here, but since we're touching core staking logic, I thought we might as well want to be as safe as possible

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If partial unlocking, there is no queue of undelegation. With superfluid, when we undelegate, the delegation amount is immediately removed from the validator and instantly unbonded

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a check to bonded, unbonding, and normal lock tests that check the newly created lock. Please let me know if I should expand! 1aa1f05

@@ -377,7 +437,7 @@ func (suite *KeeperTestSuite) TestMigrateSuperfluidUnbondingBalancerToConcentrat
}

// System under test.
positionId, amount0, amount1, _, _, newGammLockId, concentratedLockId, poolIdLeaving, poolIdEntering, err := superfluidKeeper.MigrateSuperfluidUnbondingBalancerToConcentrated(ctx, poolJoinAcc, originalGammLockId, coinsToMigrate, synthLockBeforeMigration[0].SynthDenom, tc.tokenOutMins)
positionId, amount0, amount1, _, _, concentratedLockId, poolIdLeaving, poolIdEntering, err := superfluidKeeper.MigrateSuperfluidUnbondingBalancerToConcentrated(ctx, poolJoinAcc, originalGammLockId, coinsToMigrate, synthLockBeforeMigration[0].SynthDenom, tc.tokenOutMins)
if tc.expectedError != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto here for additional checks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expanded checks for the route and delegating. For the undelegating checks though, what should be expanded? Since, with superfluid, once something is undelegating, it is instantly undelegated. So if something is in an undelegating status prior to migration, I am not sure what extra things we should check here.

x/superfluid/keeper/stake.go Outdated Show resolved Hide resolved
x/superfluid/keeper/stake_test.go Outdated Show resolved Hide resolved
x/superfluid/keeper/stake_test.go Outdated Show resolved Hide resolved
// If all shares are being migrated, this deletes the connection between the gamm lock and the intermediate account, deletes the synthetic lock, and burns the synthetic osmo.
intermediateAccount := types.SuperfluidIntermediaryAccount{}
if partialMigration {
intAccount, splitLock, err := k.partialSuperfluidUndelegate(ctx, sender.String(), lockId, sharesToMigrate)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why not just assign the variables here directly instead of routing through intAccount and splitLock?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol I have no idea why it was like this, must have happened while I was troubleshooting something and never changed it back, reverted here 91911c8

Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding so much test cases, leaving second round of reivew

x/superfluid/keeper/stake_test.go Outdated Show resolved Hide resolved
Comment on lines +313 to +326
// undelegate the desired lock amount, and burn the minted osmo.
amount, err := k.GetSuperfluidOSMOTokens(ctx, intermediaryAcc.Denom, amountToUndelegate.Amount)
if err != nil {
return types.SuperfluidIntermediaryAccount{}, &lockuptypes.PeriodLock{}, err
}
err = k.forceUndelegateAndBurnOsmoTokens(ctx, amount, intermediaryAcc)
if err != nil {
return types.SuperfluidIntermediaryAccount{}, &lockuptypes.PeriodLock{}, err
}

// Move the funds from the old lock to a new lock with the remaining amount.
newLock, err := k.lk.SplitLock(ctx, *lock, sdk.NewCoins(amountToUndelegate), true)
if err != nil {
return types.SuperfluidIntermediaryAccount{}, &lockuptypes.PeriodLock{}, err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coming to think about it, do we not need logic to handle the lock after calling forceUndelegateAndBurnOsmoTokens? Things that come to my mind are

  • lock id and intermediary account connection
  • handle synthethic lock for the undelegating lock
  • create synthlock for the unbonding amounts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on the asnwer for this, could we have according checks added for each of ^?

Copy link
Member Author

@czarcas7ic czarcas7ic May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good catch, but I think the logic of this function needs to stay as it is for the following reason:

We don't want to create all those connections just to remove those connections so we can migrate it. That means this function is to be used by CL migration only. That being said, two things need to be done:

  • This function should be renamed and a warning given that connections are not made after the lock is split
  • I can abstract this into a helper function to a real partialSuperfluidUndelegate function that DOES create the connections, but just not call that function and instead call the helper directly for this

Again, nice call on this!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So ended up making a shared function, I think you will agree with the implementation 9a91185

(still using the same logic as before, but if someone wants to make a partialSuperfluidUndelegate message in the future, they wont accidentally use the wrong method)

x/superfluid/keeper/stake_test.go Show resolved Hide resolved
x/superfluid/keeper/migrate.go Show resolved Hide resolved
// The delegation from the intermediary account holder should still exist.
_, found := stakingKeeper.GetDelegation(ctx, balancerIntermediaryAcc.GetAccAddress(), valAddr)
suite.Require().True(found, "expected delegation, found delegation no delegation")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If partial unlocking, is there a way we can check that the amount to undelegate is succesfully in the queue of undelegation?

// The delegation from the intermediary account holder should still exist.
_, found := stakingKeeper.GetDelegation(ctx, balancerIntermediaryAcc.GetAccAddress(), valAddr)
suite.Require().True(found, "expected delegation, found delegation no delegation")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add checks for the new lock that has been created if this was a partial unlock? Apologies if I'm being picky here, but since we're touching core staking logic, I thought we might as well want to be as safe as possible

@czarcas7ic
Copy link
Member Author

@mattverse addressed all comments, thanks for the thorough review!

Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@AlpinYukseloglu AlpinYukseloglu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic looks right, but still hesitant to approve personally since this is for part of the codebase I'm learning as I review. We should definitely revisit this flow during package-level review to ensure the holistic CL superfluid flow is airtight

@@ -533,6 +533,60 @@ func (suite *KeeperTestSuite) TestCreateLock() {
suite.Require().Equal(sdk.NewInt(30), balance.Amount)
}

func (suite *KeeperTestSuite) TestCreateLockNoSend() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason you made these non table driven?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the pre-existing TestCreateLock was not table driven, and I wanted to use the exact logic flow to ensure this method behaves just like CreateLock, just without the send

@@ -53,15 +53,28 @@ func (suite *KeeperTestSuite) TestRouteLockedBalancerToConcentratedMigration() {
"lock that is superfluid delegated, not unlocking (partial shares)": {
// migrateSuperfluidBondedBalancerToConcentrated
superfluidDelegated: true,
percentOfSharesToMigrate: sdk.MustNewDecFromStr("0.5"),
percentOfSharesToMigrate: sdk.MustNewDecFromStr("0.4"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, what motivated this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migrating exactly half made a nice number, and I wanted to ensure it wasn't just happenstance that the expected numbers aligned

Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice work. Going to address my comments that aren't likely to be disputed and will ping on anything remaining

return lock, nil
}

// CreateLockNoSend behaves the same as CreateLock, but does not send the coins to the lockup module account.
Copy link
Member

@p0mvn p0mvn May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate in the comment why this is needed? That is why we have CreateLockNoSend and CreateLock. I would also copy this context into CreateLock godoc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment expanded here c59c387

x/lockup/keeper/lock.go Outdated Show resolved Hide resolved
x/lockup/keeper/lock_test.go Outdated Show resolved Hide resolved
x/lockup/keeper/lock_test.go Outdated Show resolved Hide resolved
x/lockup/keeper/lock_test.go Outdated Show resolved Hide resolved
Comment on lines +30 to 32
func (k Keeper) RouteLockedBalancerToConcentratedMigration(ctx sdk.Context, sender sdk.AccAddress, lockId uint64, sharesToMigrate sdk.Coin, tokenOutMins sdk.Coins) (positionId uint64, amount0, amount1 sdk.Int, liquidity sdk.Dec, joinTime time.Time, poolIdLeaving, poolIdEntering, concentratedLockId uint64, err error) {
synthLocksBeforeMigration, migrationType, err := k.routeMigration(ctx, sender, lockId, sharesToMigrate)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up to 478aa10

Since it's always returning 1 synth lock. Let's not return a slice to avoid confusion

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have to be done in the other PR that contains latest state

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still am not entirely comfortable with my understanding of this. Why does GetAllSyntheticLockupsByLockup return an array in the first place? Is it normal for a lockId to have multiple synthetic locks? Getting this answered I think is really important before this gets swept under the rug

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know with 100% confidence but I'm not aware of a specific use case where we have multiple lock-ups per lock up

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with Roman offline, created an issue for this and will address once this PR and the PR it is merging into is merged to main

#5246

) (positionId uint64, amount0, amount1 sdk.Int, liquidity sdk.Dec, joinTime time.Time, gammLockId, concentratedLockId, poolIdLeaving, poolIdEntering uint64, err error) {
) (positionId uint64, amount0, amount1 sdk.Int, liquidity sdk.Dec, joinTime time.Time, concentratedLockId, poolIdLeaving, poolIdEntering uint64, err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update godoc to explain how lock is preserved for partial unlock

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment expanded here 315e8a0

x/superfluid/keeper/stake.go Show resolved Hide resolved
// where it is burnt. Note that this method does not include unbonding the lock
// itself.
// nolint: unused
func (k Keeper) partialSuperfluidUndelegate(ctx sdk.Context, sender string, lockID uint64, amountToUndelegate sdk.Coin) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a test for this if we are keeping this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same point above. Will action once we converge on what we want to do

@p0mvn
Copy link
Member

p0mvn commented May 19, 2023

Addressed all nits, leaving the rest @czarcas7ic

@czarcas7ic czarcas7ic merged commit d3545ec into adam/MsgUnlockAndMigrateSharesToFullRangeConcentratedPosition-audit May 20, 2023
@czarcas7ic czarcas7ic deleted the adam/partial-superfluid-unstake branch May 20, 2023 02:31
czarcas7ic added a commit that referenced this pull request May 20, 2023
…osition [2/2] (#5160)

* initial push

* update readme

* initial push audit changes

* use enum for migration type

* add back proto tag

* rename to validateGammLockForSuperfluidStaking

* remove unused errors

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Matt, Park <[email protected]>

* add check for both bonded and unbonding

* update gomod

* allow max length 1 for linked synth locks

* feat: partial superfluid undelegate (#5162)

* partial superfluid undelegate

* further reduction of gas

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Roman <[email protected]>

* reduce code duplication lock and lockNoSend

* lockNoSend as default

* add bug fix with expanded tests

* unit test for CreateLockNoSend

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Matt, Park <[email protected]>

* fix merge

* partialSuperfluidUndelegate named return values

* expand test checks for migrateDelegated

* expanded bonded checks

* check new lock and exact amount

* assign vars directly

* update merge

* check newly created lock

* add extra logic branch for fail case

* split up partial superfluid undelegate func

* expand partial undelegate test case

* roman's review

* Update x/lockup/keeper/lock_test.go

* nit

* fix test

* expand CreateLockNoSend comment

* rename lockNoSend back to lock

* expand partial unlock comment

---------

Co-authored-by: Roman <[email protected]>
Co-authored-by: Matt, Park <[email protected]>

* remove unused error

* lint

---------

Co-authored-by: Matt, Park <[email protected]>
Co-authored-by: Roman <[email protected]>
MasterPi-2124 added a commit to notional-labs/osmosis that referenced this pull request May 20, 2023
* chore(deps): bump lycheeverse/lychee-action from 1.6.1 to 1.7.0 (osmosis-labs#5158)

Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/lycheeverse/lychee-action/releases)
- [Commits](lycheeverse/lychee-action@v1.6.1...v1.7.0)

---
updated-dependencies:
- dependency-name: lycheeverse/lychee-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump actions/cache from 2 to 3 (osmosis-labs#5145)

Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v2...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump mheap/github-action-required-labels from 2 to 4 (osmosis-labs#5146)

Bumps [mheap/github-action-required-labels](https://github.com/mheap/github-action-required-labels) from 2 to 4.
- [Release notes](https://github.com/mheap/github-action-required-labels/releases)
- [Commits](mheap/github-action-required-labels@v2...v4)

---
updated-dependencies:
- dependency-name: mheap/github-action-required-labels
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Clarify error message when you try to completely exit a pool (osmosis-labs#5165)

* Clarify error message when you try to completely exit a pool

Closes osmosis-labs#3427

* Add changelog

* Remove a section of PR template (osmosis-labs#5166)

* Remove a section of PR template

* Update .github/pull_request_template.md

Co-authored-by: Adam Tucker <[email protected]>

---------

Co-authored-by: Roman <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>

* [CL Message Audit] MsgSwapExactAmountIn (osmosis-labs#5123)

* add comments from audit

* add tests for untested files and fix minor bugs and issues

* add test for rounding behavior

* clean up comments

* fix conflicts

* fix conflicts in tests relating to rounding changes

* romans and adams feedback

---------

Co-authored-by: stackman27 <[email protected]>

* Speedup accumulator prefix keys (osmosis-labs#5174)

* Speedup some of the swap logic by doing more pre-computation in tick math (osmosis-labs#5171)

* osmomath: disable thelper for some helper functions (osmosis-labs#5164)

* mark helper functions

* disable thelper warnings

* chore(deps): bump lycheeverse/lychee-action from 1.7.0 to 1.8.0 (osmosis-labs#5180)

Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/lycheeverse/lychee-action/releases)
- [Commits](lycheeverse/lychee-action@v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: lycheeverse/lychee-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix localosmosis (osmosis-labs#5183)

* [CL Message Audit]: MsgUnlockAndMigrateSharesToFullRangeConcentratedPosition [1/2] (osmosis-labs#5178)

* initial push audit changes

* add back proto tag

* rename to validateGammLockForSuperfluidStaking

* remove unused errors

* fix: duplicate price for multiple ticks (osmosis-labs#5173)

* initial push

* update readme

* initial push

* implement round tick

* add test for round tick

* add readme

* return new lower and upper tick when create pos

* initial push audit changes

* use enum for migration type

* add back proto tag

* rename to validateGammLockForSuperfluidStaking

* remove unused errors

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Matt, Park <[email protected]>

* add check for both bonded and unbonding

* named return values createPosition

* Update x/concentrated-liquidity/tick.go

Co-authored-by: Matt, Park <[email protected]>

* change roundTick to roundTickToCanonicalPriceTick

* initialize int64 vars

* Revert "Merge branch 'adam/MsgUnlockAndMigrateSharesToFullRangeConcentratedPosition-audit' into adam/duplicate-price-for-multiple-ticks-patch"

This reverts commit 3ace477, reversing
changes made to b5923f0.

---------

Co-authored-by: Matt, Park <[email protected]>

* fix: add split route message to codec and interface registration (osmosis-labs#5168)

* fix: add split route message to codec and interface registration

* Apply suggestions from code review

* Apply suggestions from code review

* refactor: remove cache context from swap out given in (osmosis-labs#5176)

* refactor: remove cache from swap out given in

* updates

* dead code

* update test name

* updates

* [CL][InternalReview] MsgAddToConcentratedLiquiditySuperfluidPosition (osmosis-labs#5157)

* [InternalReview] MsgAddToConcentratedLiquiditySuperfluidPosition

* updates

* updates

* updates

* updates

* revert me

* updates

* debug

* docs

* go sum

* go mod

* remove

* Update x/superfluid/README.md

* Update x/concentrated-liquidity/position.go

* comment

* coins

* remove Q

* remove Q

* revert name

* CL: benchmark for swaps (osmosis-labs#5170)

* test

* fix

* comments

* fix conflict

* updates

* normalize

* maxAmountDepositedFullRange

* chore(deps): bump lycheeverse/lychee-action from 1.7.0 to 1.8.0 (osmosis-labs#5188)

Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/lycheeverse/lychee-action/releases)
- [Commits](lycheeverse/lychee-action@v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: lycheeverse/lychee-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Revert "fix: duplicate price for multiple ticks (osmosis-labs#5173)" (osmosis-labs#5193)

* Revert "fix: duplicate price for multiple ticks (osmosis-labs#5173)"

This reverts commit f116d43.

* fix merge conflicts

* regen proto

* fix: duplicate price for multiple ticks (osmosis-labs#5196)

* initial push

* update gomod

* revert nolint

* update gomod

* perf: convert ticks to int64 (osmosis-labs#5189)

* perf: convert ticks to int64

* updates

* fix test

* updates

* updates

* Update x/concentrated-liquidity/math/tick.go

Co-authored-by: Dev Ojha <[email protected]>

* nit

* comment

* comment

* >=

* lint

* lint

---------

Co-authored-by: Dev Ojha <[email protected]>

* refactor: remove cache context from swap in given out (osmosis-labs#5198)

* remove cache context from in given out

* Update x/concentrated-liquidity/swaps_test.go

Co-authored-by: Roman <[email protected]>

* Update x/concentrated-liquidity/swaps_test.go

Co-authored-by: Roman <[email protected]>

---------

Co-authored-by: Roman <[email protected]>

* refactor: more discriptive error when no liquidity in swaps (osmosis-labs#5197)

* fix: merge conflict (osmosis-labs#5199)

* fix: make proto-docs; unsupported address proto tag (osmosis-labs#5195)

* [CL Message Audit]: MsgWithdrawPosition (osmosis-labs#5135)

* WIP

* Add test cases

* Uncomment tests

* Uncomment more tests

* Add lock test

* And uncomment test

* Update x/concentrated-liquidity/incentives.go

Co-authored-by: Roman <[email protected]>

* Romans feedback

* Update x/concentrated-liquidity/lp.go

Co-authored-by: Adam Tucker <[email protected]>

* Update x/concentrated-liquidity/lp_test.go

Co-authored-by: Adam Tucker <[email protected]>

* Adams review

---------

Co-authored-by: Roman <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>

* Fix CL client to be compatible with recent state of Bigbang (osmosis-labs#5200)

* Fix cl client to follow most recent state

* Run go mod tidy

* Change to A:no-changelog (osmosis-labs#5201)

* fix: merge conflict (osmosis-labs#5210)

* readme error fixes (osmosis-labs#5208)

* perf: conver tick and exponent at price one to int64 (osmosis-labs#5190)

Closes: #XXX

## What is the purpose of the change

Convert pool's tick and exponent at price one to int64 for performance and readability

* chore: add vs code debug config for every module (osmosis-labs#5212)

* chore: add vs code debug config for every module

* restore e2e

* refactor: prototype reducing iterator overhead in swaps (osmosis-labs#5177)

* refactor: prototype reducing iterator overhead in swaps

* updates

* updates

* clean up

* godoc updates

* updates

* updates

* updates

* clean up

* updates

* chore: skip wasm tests in wsl and add a vs code task (osmosis-labs#5214)

* chore: skip wasm tests in wsl and add a vs code task

* updates

* update golangci-lint settings per https://golangci-lint.run/usage/integrations (osmosis-labs#5221)

* style: s instead of suite (osmosis-labs#5222)

* just use s. instead of suite.

* complete migration of suite to s for *KeeperTestSuite

---------

Co-authored-by: Roman <[email protected]>

* perf: remove repeated reallocations in swap step iterations (osmosis-labs#5211)

* perf: remove repeated reallocations in swap step iterations

* smallest dec

* unused

* comment

* Update x/concentrated-liquidity/swaps.go

Co-authored-by: Dev Ojha <[email protected]>

* Update x/concentrated-liquidity/swaps.go

Co-authored-by: Dev Ojha <[email protected]>

---------

Co-authored-by: Dev Ojha <[email protected]>

* bug: add split route to message server in pool manager (osmosis-labs#5204)

* bug: add split route to message server in pool manager

* Update x/poolmanager/msg_server.go

Co-authored-by: Matt, Park <[email protected]>

* Update x/poolmanager/msg_server.go

Co-authored-by: Matt, Park <[email protected]>

---------

Co-authored-by: Matt, Park <[email protected]>

* chore(deps): bump json-pointer from 0.6.1 to 0.6.2 in /client/docs (osmosis-labs#5215)

Bumps [json-pointer](https://github.com/manuelstofer/json-pointer) from 0.6.1 to 0.6.2.
- [Commits](https://github.com/manuelstofer/json-pointer/commits)

---
updated-dependencies:
- dependency-name: json-pointer
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump minimist from 1.2.5 to 1.2.8 in /client/docs (osmosis-labs#5216)

Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.5 to 1.2.8.
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](minimistjs/minimist@v1.2.5...v1.2.8)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/docker/distribution (osmosis-labs#5220)

Bumps [github.com/docker/distribution](https://github.com/docker/distribution) from 2.8.1+incompatible to 2.8.2+incompatible.
- [Release notes](https://github.com/docker/distribution/releases)
- [Commits](distribution/distribution@v2.8.1...v2.8.2)

---
updated-dependencies:
- dependency-name: github.com/docker/distribution
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump ansi-regex from 5.0.0 to 5.0.1 in /client/docs (osmosis-labs#5226)

Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](chalk/ansi-regex@v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: commit at the end of benchmark (osmosis-labs#5229)

* chore: commit at the end of benchmark

* updates

* chore(deps): bump handlebars from 4.7.6 to 4.7.7 in /client/docs (osmosis-labs#5231)

Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.7.6 to 4.7.7.
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md)
- [Commits](handlebars-lang/handlebars.js@v4.7.6...v4.7.7)

---
updated-dependencies:
- dependency-name: handlebars
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: add chosing an exponentAtPriceOne docs (osmosis-labs#4919)

* add chosing an exponenetAtPriceOne docs

* increase header sizes

* center the equation

* Update x/concentrated-liquidity/README.md

Co-authored-by: Roman <[email protected]>

* Update x/concentrated-liquidity/README.md

Co-authored-by: Roman <[email protected]>

* Update x/concentrated-liquidity/README.md

Co-authored-by: Roman <[email protected]>

* specify asset0 and asset1

* fix headers

---------

Co-authored-by: Roman <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>

* [CL][Incentives Query][Bug]: Implement support for CL gauges to incentivized pools query (osmosis-labs#5187)

* implement and test query support for CL gauges

* update changelog

* fix conflicts

* remove MsgCreateIncentive (osmosis-labs#5234)

* feat[CL]: separate fees into different module account (osmosis-labs#5230)

* separate account for fees

* update test var name

* Update x/concentrated-liquidity/swaps.go

Co-authored-by: Matt, Park <[email protected]>

---------

Co-authored-by: Matt, Park <[email protected]>

* chore(deps): bump github.com/docker/distribution (osmosis-labs#5218)

Bumps [github.com/docker/distribution](https://github.com/docker/distribution) from 2.8.1+incompatible to 2.8.2+incompatible.
- [Release notes](https://github.com/docker/distribution/releases)
- [Commits](distribution/distribution@v2.8.1...v2.8.2)

---
updated-dependencies:
- dependency-name: github.com/docker/distribution
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [CL Message Audit] MsgSwapExactAmountOut (osmosis-labs#5179)

* progress

* more checks

* checked logic

* moved all fmterror to errors

* added test

* cleanup

* cli tested

* resolved feedbacks

* resolved feedbacks

* fixed ci

* Update x/poolmanager/router_test.go

* Update x/poolmanager/router.go

---------

Co-authored-by: Roman <[email protected]>

* chore: lint tests and sync for app, osmomath, tests, and wasmbinding (osmosis-labs#5206)

* lint tests and sync: app, osmomath, tests, and wasmbinding

* add osmomath to lp_test

* sync

* chore(deps): bump github.com/docker/distribution in /x/ibc-hooks (osmosis-labs#5217)

Bumps [github.com/docker/distribution](https://github.com/docker/distribution) from 2.8.1+incompatible to 2.8.2+incompatible.
- [Release notes](https://github.com/docker/distribution/releases)
- [Commits](distribution/distribution@v2.8.1...v2.8.2)

---
updated-dependencies:
- dependency-name: github.com/docker/distribution
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [x/pool-incentives][tests]: Add tests for external gauge query (osmosis-labs#5236)

* add tests for external gauge query

* refactor tests to use string map

* test comment fix

* chore(deps): bump github.com/docker/docker (osmosis-labs#5219)

Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.19+incompatible to 20.10.24+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](moby/moby@v20.10.19...v20.10.24)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: v16 upgrade handler updates (osmosis-labs#5213)

* initial push upgrade handler changes

* properly set staking denom to usomo in test

* add further tests

* use comm pool for swap

* correct pool ID

* update pool id

* [CL Message Audit]: AddToPositions  (osmosis-labs#5167)

* WIP

* Trying to fix test

* Fix test

* Add min amount

* Update proto/osmosis/concentrated-liquidity/tx.proto

Co-authored-by: alpo <[email protected]>

* Update proto/osmosis/concentrated-liquidity/tx.proto

Co-authored-by: Adam Tucker <[email protected]>

* Update proto/osmosis/concentrated-liquidity/tx.proto

Co-authored-by: alpo <[email protected]>

* Update proto/osmosis/concentrated-liquidity/tx.proto

Co-authored-by: alpo <[email protected]>

* Update proto/osmosis/concentrated-liquidity/tx.proto

Co-authored-by: Adam Tucker <[email protected]>

* WIP for comments

* Review comments

* updates

---------

Co-authored-by: alpo <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Roman <[email protected]>

* perf: change KVStore value from posID to boolean byte (osmosis-labs#5237)

* change KVStore value from posID to boolean byte

* replace redundant function

* fix prefix

* update godoc

* add incentive creation & querying section to readme (osmosis-labs#5242)

* add readme section on reward splitting (osmosis-labs#5244)

* refactor: rename swap fee to spread factor (osmosis-labs#5138)

* refactor: rename swap fee to spread factor

* lint

* updates

* updates

* [CL][bugfix] Update reward splitting logic to only use bonded balancer amounts (osmosis-labs#5239)

* implement/test necessary helper and implement/test bugfix for bonded share reward splitting

* changelog for gamm changes

* clean up tests and comments

* [CL Message Audit]: MsgUnlockAndMigrateSharesToFullRangeConcentratedPosition [2/2] (osmosis-labs#5160)

* initial push

* update readme

* initial push audit changes

* use enum for migration type

* add back proto tag

* rename to validateGammLockForSuperfluidStaking

* remove unused errors

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Matt, Park <[email protected]>

* add check for both bonded and unbonding

* update gomod

* allow max length 1 for linked synth locks

* feat: partial superfluid undelegate (osmosis-labs#5162)

* partial superfluid undelegate

* further reduction of gas

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Roman <[email protected]>

* reduce code duplication lock and lockNoSend

* lockNoSend as default

* add bug fix with expanded tests

* unit test for CreateLockNoSend

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Matt, Park <[email protected]>

* fix merge

* partialSuperfluidUndelegate named return values

* expand test checks for migrateDelegated

* expanded bonded checks

* check new lock and exact amount

* assign vars directly

* update merge

* check newly created lock

* add extra logic branch for fail case

* split up partial superfluid undelegate func

* expand partial undelegate test case

* roman's review

* Update x/lockup/keeper/lock_test.go

* nit

* fix test

* expand CreateLockNoSend comment

* rename lockNoSend back to lock

* expand partial unlock comment

---------

Co-authored-by: Roman <[email protected]>
Co-authored-by: Matt, Park <[email protected]>

* remove unused error

* lint

---------

Co-authored-by: Matt, Park <[email protected]>
Co-authored-by: Roman <[email protected]>

* Add amino proto annotations (osmosis-labs#4629)

* Add proto annotations

* Update go.mod

* Add changelog

* Adams review

* Make proto

---------

Co-authored-by: mattverse <[email protected]>

* refactor: reinvest dust fees into pool accumulator (osmosis-labs#5245)

* refactor: reinvest dust fees into pool accumulator

* updates

* updates

* Update x/concentrated-liquidity/fees_test.go

Co-authored-by: Adam Tucker <[email protected]>

---------

Co-authored-by: Adam Tucker <[email protected]>

* perf: iterator improvements for swap in given out and liquidity for full range query (osmosis-labs#5248)

* perf: iterator improvements for swap in given out and liquidity for full range query

* updates

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: alpo <[email protected]>
Co-authored-by: stackman27 <[email protected]>
Co-authored-by: Ruslan Akhtariev <[email protected]>
Co-authored-by: Matt, Park <[email protected]>
Co-authored-by: Jacob Gadikian <[email protected]>
Co-authored-by: mattverse <[email protected]>
pysel pushed a commit that referenced this pull request Jun 6, 2023
…osition [2/2] (#5160)

* initial push

* update readme

* initial push audit changes

* use enum for migration type

* add back proto tag

* rename to validateGammLockForSuperfluidStaking

* remove unused errors

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Matt, Park <[email protected]>

* add check for both bonded and unbonding

* update gomod

* allow max length 1 for linked synth locks

* feat: partial superfluid undelegate (#5162)

* partial superfluid undelegate

* further reduction of gas

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Roman <[email protected]>

* reduce code duplication lock and lockNoSend

* lockNoSend as default

* add bug fix with expanded tests

* unit test for CreateLockNoSend

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Matt, Park <[email protected]>

* fix merge

* partialSuperfluidUndelegate named return values

* expand test checks for migrateDelegated

* expanded bonded checks

* check new lock and exact amount

* assign vars directly

* update merge

* check newly created lock

* add extra logic branch for fail case

* split up partial superfluid undelegate func

* expand partial undelegate test case

* roman's review

* Update x/lockup/keeper/lock_test.go

* nit

* fix test

* expand CreateLockNoSend comment

* rename lockNoSend back to lock

* expand partial unlock comment

---------

Co-authored-by: Roman <[email protected]>
Co-authored-by: Matt, Park <[email protected]>

* remove unused error

* lint

---------

Co-authored-by: Matt, Park <[email protected]>
Co-authored-by: Roman <[email protected]>
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.

4 participants