Conversation
ntn-x2
left a comment
There was a problem hiding this comment.
It will probably look much easier to follow and understand once refactored, so we are on the right path 🙂
pallets/parachain-staking/src/lib.rs
Outdated
|
|
||
| // TODO: Benchmark, unit tests, docs | ||
| #[pallet::weight(0)] | ||
| pub fn claim_rewards_for(origin: OriginFor<T>, target: <T::Lookup as StaticLookup>::Source) -> DispatchResult { |
There was a problem hiding this comment.
Any specific reason why we would allow anyone to trigger a payout for anyone else? I still don't understand what would be the use case for this, if I want to have control over when I would claim my rewards. If I want to delegate, I could set up a proxy,
There was a problem hiding this comment.
IMO, the main reason would be to cleanup storage and consume tiny rewards that have not been claimed by potentially exited users. I understand that's a very unlikely scenario and each user has an incentive to claim their rewards.
Moreover, in frame staking this is also possible by triggering a payout for a validator which rewards their nominators as well.
There was a problem hiding this comment.
I am completely fine changing this and would be interested in @weichweich 's opinion.
There was a problem hiding this comment.
Yeah I think Parity does that because otherwise users would just forget and keep piling up stuff, I think. Which would be fine in our case if that is the assumption. But of course the downside is that I can't simply decide to trigger my reward at any time, because someone else inside my delegation pool might do it for me.
There was a problem hiding this comment.
Let's first start with the more restrictive version. We might be able to change that later if we feel the need for it.
There was a problem hiding this comment.
By more restrictive you are referring to Antonio's proposal, e.g. origins can only claim for themselves?
Co-authored-by: Antonio <antonio@kilt.io>
* tests: 80% * feat: rm delegate_another_candidate and more * docs: remove deprecated weight * Apply suggestions from code review Co-authored-by: Antonio <antonio@kilt.io> Co-authored-by: Antonio <antonio@kilt.io>
…f/1930-staking-refactor-tmp
ntn-x2
left a comment
There was a problem hiding this comment.
I have one main question about the rewards for delegators. It seems to me they are incentivised to jump onboard right before some other event is supposed to happen (like a stake change or an inflation change). Is my understanding correct? Is that by design? Or am I missing something?
Co-authored-by: Antonio <antonio@kilt.io>
b98a254 to
02eb407
Compare
|
@weichweich Please review when you have the time, thanks! |
weichweich
left a comment
There was a problem hiding this comment.
Looks good. I would say we can merge it as it is. I just have a few naming suggestions and the RewardCounter is a bit hard to understand. Maybe my suggestion could make this part a bit easier to understand?
The yearly inflation config update is moved from on_initialize to a call that can be called by anyone? Is there a reason for that?
weichweich
left a comment
There was a problem hiding this comment.
LGTM very beautiful PR. Love the links to the commits. Nice comments.
Co-authored-by: Albrecht <albrecht@kilt.io>
fixes KILTProtocol/ticket#1930
Follow-up PRs
TLDR Description
claim_rewardswhich enables any signed origin to trigger a payout for themselvesLengthy Description
The proposed solution goes more into the direction of Substrate staking. Every time a collator authors a block, their rewards counter is incremented. The counter can be consumed to increment accumulated rewards. The rewards need to be actively claimed by the new
claim_rewards_forextrinsic.There are a lot of events which automatically consume the
RewardCounterand increment the accumulated rewards since the last actively requested payout:Background
The main reason for this refactor is that the current solution is not highly scalable as it inherently emits a
Rewardedevent for each address that gets rewarded. For the current configuration of delegators, this is rather unproblematic.Moreover, we currently enforce the taxable
Rewardedevent onto all stakers and it occurs very frequently. Therefore, it is quite a challenge to summarize all such events.TODO
Extrinsics
Checklist:
array[3]useget(3), ...)