-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Enable an easy way to unbond, if you are not *exposed*
#8436
Comments
We could touch all nominators after every election to record "when last exposed", not sure what happens currently there. In principle, we could provide some tool off-chain that crawls the old exposure sets of their current nominations, which plays okay with BEEFY, except all those past block references gets heavy. |
That's one way. But of course we don't do this right now, and doing so won't be trivial. We would need to touch tens of thousands of accounts, as opposed to the current validator-major exposures that are stored, which is only a few hundred keys. Alternatively, we could also store a separate storage item that stored the exposed nominators per era. But this is even more expensive than the previous solution. All in all, both of these need us to do a lot more work upon finishing an election on the staking side. We can only allow such a thing to happen as a kind of background task (#8197) or if we finish the election multi-block. @thiolliere one way or another, reducing history depth will help with this. Any reason to keep this at the current, seemingly overkill 84? |
I'm not convinced we really need this honestly.. it's definitely nicer ux.. but does it buy us any concrete benefit? |
For anyone who bonded by mistake, or bonded but is not capable of participating in nomination, this would be useful. It is not important, as you said. Just nice ux. |
I see.. yes, we could do bonded and never nominated rather cleanly. We could likely handle bonded but chilled cleanly too. Also bonded but all nominations dropped out or kicked me. It's maybe simpler to cover all special cases like these directly? It's bonded but my nominations never win that sucks, although maybe not wholly impossible even there. Could we just make issues for all special cases and mark them as "good first issue" or whatever? |
But history depth is not related to bounding duration, as far as I can see. history depth is for giving time to call the reward. |
I just looked at the fact that to prove that you are not exposed you have to prove that you are not in Although, I think it is enough to prove that you are not in the NOTE: should we not have an integrity test to assert |
I actually think it is correct to have BondingDuration higher than HistoryDepth. BondingDuration store only the hash of the exposure on chain while HistoryDepth store the full exposure, so it is usually sensible to have HistoryDepth < BondingDuration |
With @rossbulat we came up with a different approach to solving this: By default, in the current polkadot config, the cost of checking if someone is exposed or not is 28 * 300 = 8400 storage reads. In kusama, it is 28000. The reason is that we have to check every validator, every era. Ross's suggestion was that if we knew historical nomination info, we can only check a smaller subset of validators. We create a new map, called
Needless to say, for this to work, this union vector will be bounded, e.g. 128. This implies that:
The only missing piece here is that I really want to make this opt-in. This functionality is only useful for those who are ACTUALLY not exposed. Within an ideal staking system, we won't have that many of these people around, so constraining everyone for the sake of this small minority is wrong. |
To throw another idea out there, we could eliminate the Users can opt-in when they call
where This is more of a convenience function for new users who may not be aware of how nominations work and therefore choose totally inactive nominations. After 28 ears pass, perhaps storage could be pruned somehow within another call. |
I’ve thought quite deeply about how a quick unstake system can be introduced in staking. Here are my findings. A nominator should be able to immediately unstake if their nominations have not been exposed in the last Such a feature will not be useful for everyone, so this should ideally be an opt-in feature. We want to do this in a way that is easy to clean up stale era data. The most efficient way to do this is by calling a single To achieve this, we introduce 2 new storage items: New Storage itemsA
We also introduce a
We now have a means of tracking which eras nominees are set, and which nominees were set per era, in a way we can easily remove outdated records. Managing stale storageWe can use
New calls
Updates to existing calls
Shortfalls:
Benefits
Other Possible Benefits:
|
For numerous reasons, we might have nominators who don't end up in the exposure, because of resource limits of the offchain solution submitted to the chain. So the setting is:
Exposure
.We can, in practice, let someone who's unbonding off the hook (and let them not wait the whole
BondingDuration
) if we know that they are not in theExposure
of any validator, both in the current era and all the previousBondingDuration
eras.With the current storage layout, doing this is quite expensive. I think that transaction would cost a lot -- potentially not even fitting into a single block, so you probably have a better time waiting for the
BondingDuration
.That being said, I want to open this meta-issue to bring up that this is a matter that could be improved here. Usually, I would say that this is a matter of UX, and good UX is not the main priority of the protocol. Nonetheless, it would be good to discuss if any other options exist to achieve this, without sacrificing security.
Inspired by comment from @horaciob paritytech/polkadot#2418 (comment)
The text was updated successfully, but these errors were encountered: