5

I am looking at customising how we pay rewards for stakers. Instead of the default "minting" behaviour I would like to pay rewards out of some pot I will setup.

Looking at the staking pallet, I can see it has a Reward Config type that is meant to allow exactly what i need, but unfortunately its not called anywhere in the pallet.

I was expecting to see something similar to this on the result returned by make_payout():

if let Some(imbalance) =
            Self::make_payout(&ledger.stash, validator_staking_payout + validator_commission_payout)
{
    T::Reward::on_unbalanced(imbalance); // This to be added
    Self::deposit_event(Event::<T>::Rewarded(ledger.stash, imbalance.peek()));
}

Is there another way to achieve this?

1

1 Answer 1

7

The Staking pallet is not currently set up to be configured to behave in this way. Your best bet would be to design your own pallet with this functionality in mind.

Furthermore, there is a lot of questions to be had about a design change like this. For example, what mechanisms will be made to ensure the payout pot never runs empty? Will you adjust reward payments based on the available amount left? If so, that would also require a bunch more logic which is currently not integrated into our Staking Pallet.

Also, if these changes are intended for use in a Parachain, it should be noted that the Staking Pallet is not currently safe for Parachains to use due to its complexity and use of storage.

The relay chain has much higher limits in terms of what can be executed and how storage is accessed than a parachain, and we take advantage of that in the Staking Pallet.

3
  • Thanks, I was planning to use EraPayout to implement a custom payout logic that returns some amount from a dedicated pot and use Reward to handle the positive imbalance.
    – Nahu
    Commented Feb 21, 2022 at 11:10
  • 1
    This PR may address your needs: github.com/paritytech/substrate/pull/10887
    – Shawn Tabrizi
    Commented Feb 22, 2022 at 4:12
  • Nice, I ended up doing something similar too.
    – Nahu
    Commented Feb 24, 2022 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.