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

Reap pool member whose balance goes below ED #5769

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eagr
Copy link
Contributor

@eagr eagr commented Sep 19, 2024

Fixes #5009

TODO

  • reap delegator & staked balance
  • benchmark -> weight function?
  • tests

New to the pallet code. I'd appreciate it if you could take a look to see if it's on the right direction before I do the bench and tests @Ank4n

@eagr eagr marked this pull request as draft September 19, 2024 10:41
}
}

Ok(())
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 basically a service for the greater good of the chain. If the account has been successfully reaped it would make sense to return fees at the end.

/// Remove the member if stake falls below the existential deposit.
#[pallet::call_index(26)]
// FIXME weight functions
#[pallet::weight(T::WeightInfo::reap_member_below_ed())]
Copy link
Contributor

Choose a reason for hiding this comment

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

you could just put a constant value in here before you create the benchmarks. then the compiler won't complain.

let pool = Pool::from(bonded_pool.bonded_account());

// Ensure any dangling delegation is withdrawn.
let dangling_withdrawal = match T::StakeAdapter::member_delegation_balance(member.clone()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The general approach looks fine to me. Good next step would be to write an integration test (delegate-stake and transfer stake) to ensure the stake is updated and storages are cleaned as expected.

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.

[NPoS] When pool contribution of a pool member goes below ED, it should be reaped.
3 participants