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

remove exit fee param #4440

Closed
wants to merge 29 commits into from
Closed

remove exit fee param #4440

wants to merge 29 commits into from

Conversation

hieuvubk
Copy link
Contributor

@hieuvubk hieuvubk commented Feb 27, 2023

Closes: #4371

What is the purpose of the change

Refer from #4371 , we should remove all exit fee params & remove pools with exit fee

Brief Changelog

  • Removed ExitFee in every related funcs & tests
  • Created old proto types for migration
  • Migrate old pool => new, remove pool which has exit fee != 0
  • Upgrade handler
  • Testing

Testing and Verifying

(Please pick one of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added unit test that validates ...
  • Added integration tests for end-to-end deployment with ...
  • Extended integration test for ...
  • Manually verified the change by ...

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)

@github-actions github-actions bot added C:app-wiring Changes to the app folder C:CLI C:docs Improvements or additions to documentation C:simulator Edits simulator or simulations C:x/concentrated-liquidity C:x/gamm Changes, features and bugs related to the gamm module. C:x/poolmanager C:x/superfluid C:x/twap Changes to the twap module labels Feb 27, 2023
@@ -2,6 +2,5 @@
"weights": "5ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518,5uosmo",
"initial-deposit": "499404ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518,500000uosmo",
"swap-fee": "0.01",
"exit-fee": "0.01",
Copy link
Member

Choose a reason for hiding this comment

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

e2e is failing because this is removed.

Basically, it tries to create a pool for pre-upgrade Osmosis (v14) that still has and expects this parameter.

I suggest copying this file and naming it pool1A-legacy.json and using it in:

config.PreUpgradePoolId = chainANode.CreateBalancerPool("pool1A.json", initialization.ValidatorWalletName)

Also, please do the same for pool1B.json. Please create an issue to track the removal of these legacy files later

@p0mvn p0mvn added A:backport/v15.x backport patches to v15.x branch V:state/breaking State machine breaking PR and removed A:backport/v15.x backport patches to v15.x branch labels Mar 11, 2023
Comment on lines 82 to 87
string exit_fee = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"exit_fee\"",
(gogoproto.nullable) = false
];
SmoothWeightChangeParams smooth_weight_change_params = 3 [
Copy link
Member

Choose a reason for hiding this comment

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

I think we should be able to make this field simply as reserved. That way, we would not need to generate v2 types and perform risky and complex migrations.

@p0mvn
Copy link
Member

p0mvn commented Mar 20, 2023

Hi @hieuvubk . Any updates on this?

@hieuvubk
Copy link
Contributor Author

Hi @hieuvubk . Any updates on this?

Hi @p0mvn . I reverted to use reserved. Its work with unit test but still got e2e err cause some poolId that we want to remove was not existed on testing

@p0mvn
Copy link
Member

p0mvn commented Mar 24, 2023

Hi @hieuvubk . Any updates on this?

Hi @p0mvn . I reverted to use reserved. Its work with unit test but still got e2e err cause some poolId that we want to remove was not existed on testing

Thanks for the update.

There are some known issues with e2e right now and the upgrade hander code gen in #4575

I'm going to work on resolving them this week. Let's wait until that PR is in, once it is, I can help with looking into e2e here.

totalSharesAmount := pool.GetTotalShares()
if req.ShareInAmount.GTE(totalSharesAmount) || req.ShareInAmount.LTE(sdk.ZeroInt()) {
return nil, sdkerrors.Wrapf(types.ErrInvalidMathApprox, "share ratio is zero or negative")
}

exitCoins, err := pool.CalcExitPoolCoinsFromShares(sdkCtx, req.ShareInAmount, exitFee)
exitCoins, err := pool.CalcExitPoolCoinsFromShares(sdkCtx, req.ShareInAmount, sdk.ZeroDec())
Copy link
Member

Choose a reason for hiding this comment

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

Why do we provide sdk.ZeroDec() as an argument? Let's just remove exit fee from the API?

Comment on lines 54 to 57
// N.B.: this is done to avoid initializing genesis for gamm module.
// Otherwise, it would overwrite migrations with InitGenesis().
// See RunMigrations() for details.
fromVM[gammtypes.ModuleName] = 0
Copy link
Member

Choose a reason for hiding this comment

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

This is only needed for newly added modules

Suggested change
// N.B.: this is done to avoid initializing genesis for gamm module.
// Otherwise, it would overwrite migrations with InitGenesis().
// See RunMigrations() for details.
fromVM[gammtypes.ModuleName] = 0


func removeExitFee(ctx sdk.Context, gammKeeper gammkeeper.Keeper, poolsWithExitFee []uint64) {
for _, poolId := range poolsWithExitFee {
err := gammKeeper.DeletePool(ctx, poolId)
Copy link
Member

Choose a reason for hiding this comment

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

Why are we deleting these pools? The pools should stay, only the exit fee setting is removed

@p0mvn
Copy link
Member

p0mvn commented Mar 26, 2023

Hi @hieuvubk . Any updates on this?

Hi @p0mvn . I reverted to use reserved. Its work with unit test but still got e2e err cause some poolId that we want to remove was not existed on testing

Thanks for the update.

There are some known issues with e2e right now and the upgrade hander code gen in #4575

I'm going to work on resolving them this week. Let's wait until that PR is in, once it is, I can help with looking into e2e here.

The known e2e issues are now resolved in: #4575

Please try rebasing and addressing my earlier comments. Please let me know if there are issues still after

@hieuvubk
Copy link
Contributor Author

@p0mvn Hi Roman i addressed change above, e2e passed now. Thank u

@p0mvn
Copy link
Member

p0mvn commented Mar 31, 2023

Discussed offline. Closing in favor of: #4767

Thanks @hieuvubk

@p0mvn p0mvn closed this Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:app-wiring Changes to the app folder C:CLI C:docs Improvements or additions to documentation C:simulator Edits simulator or simulations C:x/concentrated-liquidity C:x/gamm Changes, features and bugs related to the gamm module. C:x/poolmanager C:x/superfluid C:x/twap Changes to the twap module T:build V:state/breaking State machine breaking PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Exit Fee parameter from pools
2 participants