mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
Aggregate all liquidity restrictions in a single place (#1921)
* Clean up session key rotation * Fix build * Bump version * Introduce feature to balances. * Move staking locking logic over to central point * ^^^ rest * First part of assimilation * More assimilation * More assimilation * Fix most tests * Fix build * Move Balances to new locking system * :q! * Bump runtime version * Build runtime * Convenience function * Test fix. * Whitespace * Improve type legibility. * Fix comment. * More tests. * More tests. * Bump version * Caps * Whitespace * Whitespace * Remove unneeded function.
This commit is contained in:
@@ -54,7 +54,6 @@ impl balances::Trait for Test {
|
||||
type Balance = u64;
|
||||
type OnFreeBalanceZero = Staking;
|
||||
type OnNewAccount = ();
|
||||
type EnsureAccountLiquid = Staking;
|
||||
type Event = ();
|
||||
}
|
||||
impl session::Trait for Test {
|
||||
@@ -120,22 +119,22 @@ impl ExtBuilder {
|
||||
self
|
||||
}
|
||||
pub fn build(self) -> runtime_io::TestExternalities<Blake2Hasher> {
|
||||
let mut t = system::GenesisConfig::<Test>::default().build_storage().unwrap().0;
|
||||
let (mut t, mut c) = system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let balance_factor = if self.existential_deposit > 0 {
|
||||
256
|
||||
} else {
|
||||
1
|
||||
};
|
||||
t.extend(consensus::GenesisConfig::<Test>{
|
||||
let _ = consensus::GenesisConfig::<Test>{
|
||||
code: vec![],
|
||||
authorities: vec![],
|
||||
}.build_storage().unwrap().0);
|
||||
t.extend(session::GenesisConfig::<Test>{
|
||||
}.assimilate_storage(&mut t, &mut c);
|
||||
let _ = session::GenesisConfig::<Test>{
|
||||
session_length: self.session_length,
|
||||
validators: vec![10, 20],
|
||||
keys: vec![],
|
||||
}.build_storage().unwrap().0);
|
||||
t.extend(balances::GenesisConfig::<Test>{
|
||||
}.assimilate_storage(&mut t, &mut c);
|
||||
let _ = balances::GenesisConfig::<Test>{
|
||||
balances: if self.monied {
|
||||
if self.reward > 0 {
|
||||
vec![(1, 10 * balance_factor), (2, 20 * balance_factor), (3, 300 * balance_factor), (4, 400 * balance_factor), (10, balance_factor), (11, balance_factor * 1000), (20, balance_factor), (21, balance_factor * 2000)]
|
||||
@@ -149,8 +148,8 @@ impl ExtBuilder {
|
||||
transfer_fee: 0,
|
||||
creation_fee: 0,
|
||||
vesting: vec![],
|
||||
}.build_storage().unwrap().0);
|
||||
t.extend(GenesisConfig::<Test>{
|
||||
}.assimilate_storage(&mut t, &mut c);
|
||||
let _ = GenesisConfig::<Test>{
|
||||
sessions_per_era: self.sessions_per_era,
|
||||
current_era: self.current_era,
|
||||
stakers: vec![(11, 10, balance_factor * 1000), (21, 20, balance_factor * 2000)],
|
||||
@@ -163,10 +162,10 @@ impl ExtBuilder {
|
||||
current_offline_slash: 20,
|
||||
offline_slash_grace: 0,
|
||||
invulnerables: vec![],
|
||||
}.build_storage().unwrap().0);
|
||||
t.extend(timestamp::GenesisConfig::<Test>{
|
||||
}.assimilate_storage(&mut t, &mut c);
|
||||
let _ = timestamp::GenesisConfig::<Test>{
|
||||
period: 5,
|
||||
}.build_storage().unwrap().0);
|
||||
}.assimilate_storage(&mut t, &mut c);
|
||||
t.into()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user