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

#1994 Error when stake is more than available stakable balance #2228

Merged
merged 6 commits into from
Nov 26, 2024

Conversation

saraswatpuneet
Copy link
Collaborator

@saraswatpuneet saraswatpuneet commented Nov 21, 2024

Goal

The goal of this PR is to error out when stake is more than available stakable balance

Closes #1994

Discussion

Checklist

  • Updated Pallet Readme?
  • Updated js/api-augment for Custom RPC APIs?
  • Design doc(s) updated?
  • Unit Tests added?
  • e2e Tests added?
  • Benchmarks added?
  • Spec version incremented?

Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
pallets/capacity/src/lib.rs 94.84% <100.00%> (+0.01%) ⬆️

proposed_amount
} else {
Zero::zero()
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

At the calling end of this function a validation is to check if returned amount > 0 and a error is thrown then

@github-actions github-actions bot added the metadata-changed Metadata has changed since the latest full release label Nov 21, 2024
@saraswatpuneet saraswatpuneet requested a review from a team November 22, 2024 15:28
Copy link
Collaborator

@mattheworris mattheworris left a comment

Choose a reason for hiding this comment

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

  • Read through changes
    🚢 it!

Copy link
Collaborator

@JoeCap08055 JoeCap08055 left a comment

Choose a reason for hiding this comment

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

Should we add an e2e test case for this?

@github-actions github-actions bot added metadata-changed Metadata has changed since the latest full release and removed metadata-changed Metadata has changed since the latest full release labels Nov 25, 2024
@github-actions github-actions bot added metadata-changed Metadata has changed since the latest full release and removed metadata-changed Metadata has changed since the latest full release labels Nov 25, 2024
@saraswatpuneet saraswatpuneet enabled auto-merge (squash) November 25, 2024 18:36
Copy link
Collaborator

@wilwade wilwade left a comment

Choose a reason for hiding this comment

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

Nice improvement and tests

@saraswatpuneet saraswatpuneet merged commit 9d775c3 into main Nov 26, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
metadata-changed Metadata has changed since the latest full release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Throw error when staking is greater than balance
4 participants