Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Withdraw unbounded possible before slash is applied #9469

Closed
ERussel opened this issue Aug 1, 2021 · 5 comments
Closed

Withdraw unbounded possible before slash is applied #9469

ERussel opened this issue Aug 1, 2021 · 5 comments
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.

Comments

@ERussel
Copy link

ERussel commented Aug 1, 2021

Staking pallet applies slashes up to but not including active_era - slashing_defer_duration (27)

Screenshot 2021-08-01 at 11 29 05

But withdraw unbonded is allowed starting from current_era = unbonded_era + bondig_duration (28).

Screenshot 2021-08-01 at 11 31 07

Taking into account that current_era is set before active_era i think it is possible to unbond in the era when unapplied slash is created and perform withraw unbonded when corresponding current era is set before active_era changes (so before slash is applied).

@github-actions github-actions bot added the J2-unconfirmed Issue might be valid, but it’s not yet known. label Aug 1, 2021
@kianenigma
Copy link
Contributor

The current_era and active_era are always the same except for 1 session, since the session pallet has 1 session delay. Only when we elect a new validator set, the current era is active_era + 1 for 1 session, and then they become the same again.

First glance, this does not seem like an issue for me.

Withdrawing happens on the basis of current_era, and you can only withdraw if current_era has been incremented at least 28 times after you called unbond.

Slashing happens on the basis of active_era, and your slash will be applied after active_era has been incremented 27 times.

While current_era and active_era can be phase-shifted, the progress at the same pace, so the slash should always happen before withdrawing is possible.

@ERussel
Copy link
Author

ERussel commented Aug 1, 2021

Yes, that is how it should be. But what I noticed is that the slash is not applied for the active_era - 27 in the active_era but one can withdraw unbonded chunk from current_era - 28 when current_era is set

@kianenigma
Copy link
Contributor

but one can withdraw unbonded chunk from current_era - 28 when current_era is set

Hmm yeah this seems to be the case: https://github.com/paritytech/substrate/blob/master/frame/staking/src/lib.rs#L447

The BondingDuration is not inclusive, but SlashDeferDuration is inclusive. This could cause issues, have to look into it more.

@kianenigma
Copy link
Contributor

(I haven't had time to confirm this yet, but added it to our backlog so eventually we get to it. )

@kianenigma
Copy link
Contributor

This was fixed as a part of #11823

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.
Projects
Status: Done
Development

No branches or pull requests

2 participants