Skip to content

feat!: port LSM module to SDK v0.50.x#13

Open
stana-miric wants to merge 40 commits intorelease/v0.50.xfrom
feat/lsm/v0.50.x
Open

feat!: port LSM module to SDK v0.50.x#13
stana-miric wants to merge 40 commits intorelease/v0.50.xfrom
feat/lsm/v0.50.x

Conversation

@stana-miric
Copy link
Copy Markdown
Collaborator

@stana-miric stana-miric commented Feb 29, 2024

Description

Port the LSM module changes from feature/v0.47.x-ics-lsm
Ported PRs:
cosmos#18694
cosmos#19056
cosmos#19076
cosmos#19491
cosmos#19614
cosmos#20444

Backported:
cosmos#17352 and cosmos#18214 and partially cosmos#18737

Except those changes, code is adapted to follow the changes from sdk v0.50 such as the way addresses are parsed from strings and use of LegacyDec values. Also, when reviewing pay attention to the following changes:

x/staking/keeper/msg_server.go
->RedeemTokensForShares()
- GetDelegation used to return bool, and now returns error. If delegation is not found, types.ErrNoDelegation is returned and the code is changed according to it.

x/staking/keeper/liquid_stake.go
->RemoveExpiredTokenizeShareLocks()
- modified signature to return error
->GetTotalLiquidStakedTokens()
- added panic() call if store.Get() fails, because other panic() already existed before
->CheckExceedsGlobalLiquidStakingCap()
- modified signature to return error
->GetTokenizeSharesLock()
- added panic() call if store.Get() fails, because other panic() already existed before
->GetPendingTokenizeShareAuthorizations()
- added panic() call if store.Get() fails, because it makes more sense than returning an error

x/staking/keeper/tokenize_share_record.go
->hasTokenizeShareRecord()
- modified signature to return error
->GetLastTokenizeShareRecordID()
- added panic() call if store.Get() fails, because error should be returned only if the key is nil, which is not the case

x/staking/keeper/params.go
ValidatorBondFactor(), GlobalLiquidStakingCap(), ValidatorLiquidStakingCap()
- modified signature to return error

x/distribution/keeper/keeper.go
->WithdrawSingleShareRecordReward()
- this is only called from staking module hooks in RedeemTokensForShares() and delegation is removed as part of that execution, so it will never exist when called in WithdrawSingleShareRecordReward()
- we made the same change as in RedeemTokensForShares()

proto/cosmos/staking/v1beta1/tx.proto
proto/cosmos/distribution/v1beta1/tx.proto
-> for newly added msgs, ValidateBasic is in the msg server instead in separate ValidateBasic fn (core sdk v0.50 changed this for other msgs, so we addapted newly added lsm msgs according to this)


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

dusan-maksimovic and others added 6 commits February 9, 2024 16:06
Co-authored-by: Stana Miric <stana.miric@ethernal.tech>
Co-authored-by: Stana Miric <stana.miric@ethernal.tech>
Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
@sainoe
Copy link
Copy Markdown

sainoe commented Jun 18, 2024

All the LSM-related logic LGTM!
I just want to make sure that keeping #18214 is safe.
[DONE] A nice to have would also be to get rid of github.com/gogo/protobuf.

stana-miric and others added 16 commits June 18, 2024 09:33
Co-authored-by: Simon Noetzlin <simon.ntz@gmail.com>
Co-authored-by: Simon Noetzlin <simon.ntz@gmail.com>
Co-authored-by: Simon Noetzlin <simon.ntz@gmail.com>
…20690) (cosmos#20712)

Co-authored-by: Hieu Vu <72878483+hieuvubk@users.noreply.github.com>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
* replace the last gogo/protobuf imports and comment old migration codes using it

* go mod tidy

* fix go list
…smos#20692)

Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
Co-authored-by: Facundo <facundomedica@gmail.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
…osmos#20805)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
…osmos#20836)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
…tGenesis` in simulation test (backport cosmos#18196) (cosmos#20897)

Co-authored-by: Chenqun Lu <luchenqun@qq.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
… for simulation test. (backport cosmos#17911) (cosmos#20909)

Co-authored-by: Chenqun Lu <luchenqun@qq.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
@mpoke
Copy link
Copy Markdown
Collaborator

mpoke commented Aug 22, 2024

@stana-miric I guess this PR can be closed now, right?

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.

7 participants