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

Add tolerance to nom pool pending rewards try-state #1236

Merged
merged 5 commits into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions substrate/frame/nomination-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3134,6 +3134,10 @@ impl<T: Config> Pallet<T> {
// reward math rounds down, we might accumulate some dust here.
let pending_rewards_lt_leftover_bal = RewardPool::<T>::current_balance(id) >=
pools_members_pending_rewards.get(&id).copied().unwrap_or_default();

// this is currently broken in Kusama, a fix is being worked on in
// <https://github.com/paritytech/polkadot-sdk/pull/1255>. until it is fixed, log a
// warning instead of panicing with an `ensure` statement.
if !pending_rewards_lt_leftover_bal {
log::warn!(
"pool {:?}, sum pending rewards = {:?}, remaining balance = {:?}",
Expand All @@ -3142,10 +3146,6 @@ impl<T: Config> Pallet<T> {
RewardPool::<T>::current_balance(id)
);
}
ensure!(
pending_rewards_lt_leftover_bal,
"The sum of the pending rewards must be less than the leftover balance."
);
Ok(())
})?;

Expand Down