-
Notifications
You must be signed in to change notification settings - Fork 0
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
Threw an error if weighted_stake_diffs.entry()
is empty
#25
Threw an error if weighted_stake_diffs.entry()
is empty
#25
Conversation
MTG-400 Throw errors on weighted_stake_diffs.entry()
s.cherviakov said in MTG-80:
|
programs/rewards/src/error.rs
Outdated
|
||
/// 13 | ||
/// No need to transfer zero amount of rewards. | ||
#[error("'weighted_stake_diffs' entry cannot be empty")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[error("'weighted_stake_diffs' entry cannot be empty")] | |
#[error("No changes at the date in weighted stake modifiers while they're expected")] |
programs/rewards/src/error.rs
Outdated
/// 13 | ||
/// No need to transfer zero amount of rewards. | ||
#[error("'weighted_stake_diffs' entry cannot be empty")] | ||
WeightedStakeDiffEntryIsEmpty, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May this error be slightly more meaningful? What about NoWeightedStakeModifiersAtADate
or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm besides error messages. Good job.
* rename RestakeDeposit to ExtendStake * add days lockup days to Flex * imporove uninitialize assertion * rename RewardPool:fill to RewardPool:distribute * from now fill cannot be invoked if rewards equals to zero * refactor DistributeRewards::process * refactor withdraw_mining * add fn for mining account closing * deposit_authority don't have to be mutable in close_mining ix * use more clear variable for RewardCalculator::update_index * regenerate IDL and clients * Initialize rewards-pool deposit authority signature (#15) * Initialize rewards-pool deposit authority signature * fixed comments and fmt * Throw an error instead of returning Ok() when 'rewards == 0' * removed elvis operator * [MTG-237] ci cd (#17) fixed CI/CD, added README.md and cargo audit * Fix comment in instruction.rs * Forbid closing mininig if there are pending rewards * Add comment regarding closing accounts * Unify Contexts && verification checks (#21) Unify Contexts and verification checks * mtg-425: Error handling improvements (#22) improved error handling * Threw an error if `weighted_stake_diffs.entry()` is empty (#25) Threw an error if `weighted_stake_diffs.entry()` is empty * [Mtg-296] delegated staking extend staking with delegate parameter (#18) * initial design * fix tests for delegated initial design * Extend extend_stake instruction with delegate parameter Extend deposit_mining instruction with delegate parameter * Refactor and make arithmetic operations more readable * Add tests for delegated staking * minor fix * [MTG-237] ci cd (#17) fixed CI/CD, added README.md and cargo audit * Change ordering for PartialOrd and Ord for LockupPeriod * refactor * refactor asserts * remove redundant substraction from delegated stake check * Forbid mining account from closing if it has stake_from_others * remove useless comment * add delegate_mining field to the withdraw_mining && remove verification for weighted stake since it's done on the staking contract * initial design * fix tests for delegated initial design * Extend extend_stake instruction with delegate parameter Extend deposit_mining instruction with delegate parameter * Refactor and make arithmetic operations more readable * Add tests for delegated staking * Change ordering for PartialOrd and Ord for LockupPeriod * refactor * refactor asserts * remove redundant substraction from delegated stake check * Forbid mining account from closing if it has stake_from_others * remove useless comment * add delegate_mining field to the withdraw_mining && remove verification for weighted stake since it's done on the staking contract * remove useless imports * add more packing on closing account * update tests * remove redundant packing * [mtg-308] (#24) * add change delegate function * change_delegate: add an early return for the case when new_delegate_mining and old_delegate_mining are the same * satisfy clippy * [mtg-297] add stake_from_others for rewards calculations (#26) * add change delegate function * change_delegate: add an early return for the case when new_delegate_mining and old_delegate_mining are the same * satisfy clippy * add stake_from_others for rewards calculations * satisfy clippy * update tests && rebase * Add refreshing of rewards for delegate mining each time it's stake_from_others changes * Update programs/rewards/src/instruction.rs Co-authored-by: Stanislav Cherviakov <[email protected]> * minor fix after merge commit --------- Co-authored-by: Stanislav Cherviakov <[email protected]> --------- Co-authored-by: Matiukhin Vlad <[email protected]> Co-authored-by: Stanislav Cherviakov <[email protected]> --------- Co-authored-by: Kyrylo Stepanov <[email protected]> Co-authored-by: Matiukhin Vlad <[email protected]> Co-authored-by: rwwwx <[email protected]>
No description provided.