-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add BondingRestriction config trait for staking pallet #8
Add BondingRestriction config trait for staking pallet #8
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Co-authored-by: Leszek Wiesner <[email protected]>
…aking::Config impls
Applied suggestion and fixed mocks.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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.