[Feature] Add deposit to fast-unstake (#12366)

* [Feature] Add deposit to fast-unstake

* disable on ErasToCheckPerBlock == 0

* removed signed ext

* remove obsolete import

* remove some obsolete stuff

* fix some comments

* fixed all the comments

* remove obsolete imports

* fix some tests

* CallNotAllowed tests

* Update frame/fast-unstake/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* fix tests

* fix deregister + tests

* more fixes

* make sure we go above existential deposit

* fixed the last test

* some nit fixes

* fix node

* fix bench

* last bench fix

* Update frame/fast-unstake/src/lib.rs

* ".git/.scripts/fmt.sh" 1

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: command-bot <>
This commit is contained in:
Roman Useinov
2022-09-27 19:31:12 +02:00
committed by GitHub
parent e6b1aae97f
commit 1f687256fb
6 changed files with 313 additions and 238 deletions
+10 -9
View File
@@ -164,12 +164,13 @@ impl Convert<sp_core::U256, Balance> for U256ToBalance {
}
parameter_types! {
pub static SlashPerEra: u32 = 100;
pub static DepositAmount: u128 = 7;
}
impl fast_unstake::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type SlashPerEra = SlashPerEra;
type Deposit = DepositAmount;
type DepositCurrency = Balances;
type ControlOrigin = frame_system::EnsureRoot<Self::AccountId>;
type WeightInfo = ();
}
@@ -213,11 +214,11 @@ impl Default for ExtBuilder {
fn default() -> Self {
Self {
exposed_nominators: vec![
(1, 2, 100),
(3, 4, 100),
(5, 6, 100),
(7, 8, 100),
(9, 10, 100),
(1, 2, 7 + 100),
(3, 4, 7 + 100),
(5, 6, 7 + 100),
(7, 8, 7 + 100),
(9, 10, 7 + 100),
],
}
}
@@ -270,8 +271,8 @@ impl ExtBuilder {
.into_iter()
.map(|(_, ctrl, balance)| (ctrl, balance * 2)),
)
.chain(validators_range.clone().map(|x| (x, 100)))
.chain(nominators_range.clone().map(|x| (x, 100)))
.chain(validators_range.clone().map(|x| (x, 7 + 100)))
.chain(nominators_range.clone().map(|x| (x, 7 + 100)))
.collect::<Vec<_>>(),
}
.assimilate_storage(&mut storage);