Manually remove identity at expiration from a non-mandatory inherent
Add an inherent remove_idty(idty_index)
that can be triggered by any authority as soon as the identity membership expire.
An inherent is better than a hook, because the inherent can be skipped if it's to big, and this will not stop the chain in case of a bug.
If the inherent is skipped, it can be re-triggered at next block.
The hook on_idle
can do that too, but in case of a bug in a hook, this will stop the chain and require a more complex fix (adding a runtime substitute in the chain spec).
Whereas, in case of a bug in a non-mandatory inherent, we can quickly publish a temporary hotfix that just not trigger the inherent, allowing the chain to continue, and let us more time to understand the bug, fix the bug, and test the fix.
In long-term, this will allow us to remove the StorageItem MembershipsExpireOn
, but this implies to add a DB on the binary side, that store for each block number, the membership acquired or renewed in this block. So, lets postpone that for a future issue.
The inherent data provider just need to read MembershipsExpireOn
to determine the next identity to remove. It's more complex than it seems, the inherent data provider should iterate the MembershipsExpireOn
entries to find the oldest not removed identity.