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!: facilitate the tokenization of vested delegation in the LSM module #19614

Merged
merged 10 commits into from
Mar 8, 2024

Conversation

sainoe
Copy link
Contributor

@sainoe sainoe commented Mar 1, 2024

Description

This PR introduces a solution to facilitate the tokenizination of vested delegations in the LSM module.
More details are available in the Gaia #2877 issue.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

@sainoe sainoe requested a review from a team as a code owner March 1, 2024 10:21
@sainoe sainoe linked an issue Mar 1, 2024 that may be closed by this pull request
5 tasks
1 Outdated Show resolved Hide resolved
x/staking/keeper/liquid_stake.go Outdated Show resolved Hide resolved
x/staking/keeper/liquid_stake.go Outdated Show resolved Hide resolved
delVestingAmount := account.GetDelegatedVesting().AmountOf(coin.Denom)
delVested := account.GetDelegatedFree()

// Calculate the new vested delegated coins
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to perform any calc here? Shouldn't the vesting type give us the amount of total vested?

Copy link
Contributor Author

@sainoe sainoe Mar 4, 2024

Choose a reason for hiding this comment

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

The LSM module needs the total delegations vested at the current block time to know how many can be tokenized. Since the DelegatedVesting and DelegatedFree are lazily computed and therefore not rebalanced according to the new vested coins over time, we need these extra calculations.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, right we don't have an API for that. Would be nice to have this on the vesting types, but since it's legacy now maybe not worth it.

sainoe and others added 2 commits March 4, 2024 08:46
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
@@ -64,6 +64,7 @@ require (
google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.32.0
gopkg.in/yaml.v2 v2.4.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are there 2 imports for gopkg.in/yaml.v2 v2.4.0?

Copy link
Contributor Author

@sainoe sainoe Mar 4, 2024

Choose a reason for hiding this comment

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

Good catch. Was probably duplicated while resolving conflicts with feature/v0.47.x-ics-lsm.
Removed by 987a86d.

@MSalopek
Copy link
Contributor

MSalopek commented Mar 4, 2024

The test TestTokenizeAndRedeemVestedDelegation is failing in the pipeline - it seems related to this.
https://github.com/cosmos/cosmos-sdk/actions/runs/8137329247/job/22235409114?pr=19614

@sainoe
Copy link
Contributor Author

sainoe commented Mar 4, 2024

Thanks for the heads-up @MSalopek. The tests pass again.

delVestingAmount := account.GetDelegatedVesting().AmountOf(coin.Denom)
delVested := account.GetDelegatedFree()

// Calculate the new vested delegated coins
Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, right we don't have an API for that. Would be nice to have this on the vesting types, but since it's legacy now maybe not worth it.

Copy link

@mpoke mpoke left a comment

Choose a reason for hiding this comment

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

Great work @sainoe

@mpoke
Copy link

mpoke commented Mar 7, 2024

@sainoe Add a changelog entry before merging.

@sainoe sainoe merged commit 614fc7f into feature/v0.47.x-ics-lsm Mar 8, 2024
24 of 26 checks passed
@sainoe sainoe deleted the sainoe/lsm-vesting branch March 8, 2024 08:59
dreamer-zq added a commit to irisnet/irishub that referenced this pull request Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vesting accounts aren't accessible to liquid staking module
4 participants