Closed stanly-johnson closed 2 years ago
I looked at this, the slashing mechanism does not care about the reference counters, its upto the caller to ensure it can be slashed safely.(https://github.com/paritytech/substrate/blob/715d004061cccbe900d9b2e6d3d624087a34eeef/frame/balances/src/lib.rs#L1562) (https://github.com/open-web3-stack/open-runtime-module-library/blob/a060819a722850ccaf945b78760c6c25f45a44e5/tokens/src/lib.rs#L1047)
Also how about using Locks, it is more easily slashed, but has the added advantage of not getting deleted if amount causes balance to drop below ED
This was not about slashing but about keeping the account data alive, tokens pallet for example uses the inc_providers
/dec_providers
to maintain the account based on whether the user has some minimum balance in any given token, we can use the inc_consumer
/dec_consumer
to indicate we depend on the account existing.
For reference https://docs.substrate.io/v3/advanced/account-info/#account-reference-counters Now I'm more convinced that's the way to go, in a way people are temporarily paying the pallet to store some data about themselves(payments) and with the reference counters mechanism we tap into the account managing system forcing users to resolve all their pending payments before they can reap their account and take the existential deposit back
_Originally posted by @olanod in https://github.com/virto-network/virto-node/pull/172#discussion_r783831317_