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

Code Cleanup: MsgLiquidStake #651

Merged
merged 6 commits into from
Mar 11, 2023
Merged

Code Cleanup: MsgLiquidStake #651

merged 6 commits into from
Mar 11, 2023

Conversation

sampocs
Copy link
Collaborator

@sampocs sampocs commented Mar 8, 2023

Closes: #XXX

Context and purpose of the change

Cleaned up MsgLiquidStake

Brief Changelog

  • Cleaned up variable naming, commenting, logging, and errors
  • Moved validation checks as upstream as possible so that they occur before any state changes (relevant to protocol directed liquid stakes)
  • Added filter to GetDepositRecordsByEpochAndChain to only grab transfer records
  • Added event emission after LS
  • Added check to error if the LS would result in 0 stTokens

Author's Checklist

I have...

  • Run and PASSED locally all GAIA integration tests
  • If the change is contentful, I either:
    • Added a new unit test OR
    • Added test cases to existing unit tests
  • OR this change is a trivial rework / code cleanup without any test coverage

If skipped any of the tests above, explain.

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...

  • reviewed state machine logic
  • reviewed API design and naming
  • manually tested (if applicable)
  • confirmed the author wrote unit tests for new logic
  • reviewed documentation exists and is accurate

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md?
  • This pull request updates existing proto field values (and require a backend and frontend migration)?
  • Does this pull request change existing proto field names (and require a frontend migration)?
    How is the feature or change documented?
    • not applicable
    • jira ticket XXX
    • specification (x/<module>/spec/)
    • README.md
    • not documented

@sampocs sampocs requested a review from a team March 8, 2023 19:11
@shellvish shellvish self-requested a review March 8, 2023 19:12
@asalzmann asalzmann self-requested a review March 8, 2023 19:12
@riley-stride riley-stride self-requested a review March 8, 2023 19:12
@sampocs sampocs added the v7 label Mar 8, 2023
Copy link
Contributor

@asalzmann asalzmann left a comment

Choose a reason for hiding this comment

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

Would prefer to push this to v8 since it touches our most sensitive code. Any reason we have to get this in for v7?

Copy link
Contributor

@asalzmann asalzmann left a comment

Choose a reason for hiding this comment

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

LGTM - although we should get multiple reviews before merging

x/stakeibc/keeper/msg_server_liquid_stake.go Show resolved Hide resolved
x/stakeibc/keeper/msg_server_liquid_stake.go Outdated Show resolved Hide resolved
x/stakeibc/keeper/msg_server_liquid_stake.go Show resolved Hide resolved
@asalzmann asalzmann self-requested a review March 10, 2023 17:24
Copy link
Contributor

@shellvish shellvish left a comment

Choose a reason for hiding this comment

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

Looks good to me!

I think we should revert changes though if MintCoins or SencdCoinsFromModuleToAccount fails, even though it'll be a bit tedious in the code. Happy to help out here!

x/stakeibc/keeper/msg_server_liquid_stake.go Show resolved Hide resolved
x/stakeibc/keeper/msg_server_liquid_stake.go Outdated Show resolved Hide resolved
x/stakeibc/keeper/msg_server_liquid_stake.go Show resolved Hide resolved
x/stakeibc/keeper/msg_server_liquid_stake.go Show resolved Hide resolved
x/stakeibc/keeper/msg_server_liquid_stake.go Show resolved Hide resolved
x/stakeibc/keeper/msg_server_liquid_stake.go Show resolved Hide resolved
@sampocs sampocs added the A:automerge Automatically merge PR once checks pass label Mar 11, 2023
@mergify mergify bot merged commit 3d4ba72 into main Mar 11, 2023
sontrinh16 pushed a commit to notional-labs/stride that referenced this pull request Mar 27, 2023
Closes: #XXX

## Context and purpose of the change
Cleaned up MsgLiquidStake

## Brief Changelog
* Cleaned up variable naming, commenting, logging, and errors
* Moved validation checks as upstream as possible so that they occur before any state changes (relevant to protocol directed liquid stakes)
* Added filter to GetDepositRecordsByEpochAndChain to only grab transfer records
* Added event emission after LS
* Added check to error if the LS would result in 0 stTokens


## Author's Checklist

I have...

- [ ] Run and PASSED locally all GAIA integration tests
- [ ] If the change is contentful, I either:
    - [ ] Added a new unit test OR 
    - [ ] Added test cases to existing unit tests
- [ ] OR this change is a trivial rework / code cleanup without any test coverage

If skipped any of the tests above, explain.


## 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...

- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] manually tested (if applicable)
- [ ] confirmed the author wrote unit tests for new logic
- [ ] reviewed documentation exists and is accurate


## Documentation and Release Note

  - [ ] Does this pull request introduce a new feature or user-facing behavior changes? 
  - [ ] Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`?
  - [ ] This pull request updates existing proto field values (and require a backend and frontend migration)? 
  - [ ] Does this pull request change existing proto field names (and require a frontend migration)?
  How is the feature or change documented? 
      - [ ] not applicable
      - [ ] jira ticket `XXX` 
      - [ ] specification (`x/<module>/spec/`) 
      - [ ] README.md 
      - [ ] not documented
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once checks pass C:docs C:records C:stakeibc v7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants