Add BondingRestriction config trait for staking pallet#8
Conversation
Lezek123
left a comment
There was a problem hiding this comment.
When trying to run tests (cargo test) I'm getting:
error[E0046]: not all trait items implemented, missing: `BondingRestriction`
--> frame/offences/benchmarking/src/mock.rs:159:1
|
159 | impl pallet_staking::Config for Test {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `BondingRestriction` in implementation
|
= help: implement the missing item: `type BondingRestriction = Type;`
| /// Allows for parts of the runtime that might implement other forms fund locking to prevent | ||
| /// incompatible locking on accounts which could lead to unsafe state. | ||
| pub trait BondingRestriction<AccountId> { | ||
| /// Determine if bonding is allowed with stash and controller combination |
There was a problem hiding this comment.
I'm wondering whether it's a good idea to include controller here, since the controller account can also be changed via set_controller, in which case some controller-specific restrictions may be bypassed.
There was a problem hiding this comment.
We are of course mainly concerned with the stash account, I added controller to give ability to prevent bond in-case the controller had some other lock on it which would prevent user from unbonding or doing other actions with their controller account. Obviously I didn't see the set_controller. (And coming to think of it, even if we detected it earlier, nothing would prevent user from using their controller account to stake so it would not have really prevented that anyway) I will drop controller as suggested.
Co-authored-by: Leszek Wiesner <leszek@jsgenesis.com>
Co-authored-by: Leszek Wiesner <leszek@jsgenesis.com>
…aking::Config impls
|
Applied suggestion and fixed mocks.
|
BondingRestriction configuration trait on staking pallet to provide a means to add an external check before bonding a stash account, if other parts of the runtime might have an opinion about whether to allow it or not.
Main usecase would be if there are other pallets that lock funds and we wish to avoid any conflicting locks.