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

Fix delegation queries #25

Merged
merged 4 commits into from
Mar 14, 2023
Merged

Fix delegation queries #25

merged 4 commits into from
Mar 14, 2023

Conversation

chipshort
Copy link
Contributor

The delegation queries should actually include the unbonding amounts. This should fix that behaviour.

@chipshort chipshort marked this pull request as ready for review March 13, 2023 09:59
@chipshort
Copy link
Contributor Author

The lint failure is unrelated to these changes

@chipshort chipshort force-pushed the fix-delegation-queries branch from d24febd to 2dd219d Compare March 13, 2023 10:38
@chipshort chipshort requested review from ethanfrey and ueco-jb March 14, 2023 08:22
Copy link
Contributor

@ueco-jb ueco-jb left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines -637 to +702
if amount > 0 {
if !amount.is_zero() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the same, isn't it?

Copy link
Contributor Author

@chipshort chipshort Mar 14, 2023

Choose a reason for hiding this comment

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

Yes, it's the same. amount now is Uint128 instead of u128 and I don't like the look of amount > Uint128::zero() when there is an explicit function to check that.

// save updated values
if shares.stake.is_zero() {
if shares.stake.is_zero() && unbonding.is_zero() {
Copy link
Contributor

Choose a reason for hiding this comment

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

And this was cruicial. 👍

src/staking.rs Outdated Show resolved Hide resolved
delegator,
validator,
amount: amount.clone(),
can_redelegate: amount, // TODO: not implemented right now
Copy link
Member

Choose a reason for hiding this comment

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

Fair enough, not implemented properly in wasmd either

Copy link
Member

@ethanfrey ethanfrey 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. Thanks for bringing this fix in

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.

3 participants