Skip to content

Commit

Permalink
frame: ambiguity BuildStorage vs GenesisBuild fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkucharczyk committed Jun 6, 2023
1 parent 98398b4 commit 6017dad
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
5 changes: 2 additions & 3 deletions frame/bounties/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,12 @@ type TreasuryError = pallet_treasury::Error<Test>;
type TreasuryError1 = pallet_treasury::Error<Test, Instance1>;

pub fn new_test_ext() -> sp_io::TestExternalities {
let mut ext: sp_io::TestExternalities = RuntimeGenesisConfig {
let mut ext: sp_io::TestExternalities = BuildStorage::build_storage(&RuntimeGenesisConfig {
system: frame_system::GenesisConfig::default(),
balances: pallet_balances::GenesisConfig { balances: vec![(0, 100), (1, 98), (2, 1)] },
treasury: Default::default(),
treasury_1: Default::default(),
}
.build_storage()
})
.unwrap()
.into();
ext.execute_with(|| System::set_block_number(1));
Expand Down
28 changes: 14 additions & 14 deletions frame/collective/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,20 @@ impl ExtBuilder {
}

pub fn build(self) -> sp_io::TestExternalities {
let mut ext: sp_io::TestExternalities = RuntimeGenesisConfig {
collective: pallet_collective::GenesisConfig {
members: self.collective_members,
phantom: Default::default(),
},
collective_majority: pallet_collective::GenesisConfig {
members: vec![1, 2, 3, 4, 5],
phantom: Default::default(),
},
default_collective: Default::default(),
}
.build_storage()
.unwrap()
.into();
let mut ext: sp_io::TestExternalities =
BuildStorage::build_storage(&RuntimeGenesisConfig {
collective: pallet_collective::GenesisConfig {
members: self.collective_members,
phantom: Default::default(),
},
collective_majority: pallet_collective::GenesisConfig {
members: vec![1, 2, 3, 4, 5],
phantom: Default::default(),
},
default_collective: Default::default(),
})
.unwrap()
.into();
ext.execute_with(|| System::set_block_number(1));
ext
}
Expand Down
2 changes: 1 addition & 1 deletion frame/system/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub const CALL: &<Test as Config>::RuntimeCall =
/// Create new externalities for `System` module tests.
pub fn new_test_ext() -> sp_io::TestExternalities {
let mut ext: sp_io::TestExternalities =
RuntimeGenesisConfig::default().build_storage().unwrap().into();
BuildStorage::build_storage(&RuntimeGenesisConfig::default()).unwrap().into();
// Add to each test the initial weight of a block
ext.execute_with(|| {
System::register_extra_weight_unchecked(
Expand Down
5 changes: 2 additions & 3 deletions frame/tips/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,12 @@ impl Config<Instance1> for Test {
}

pub fn new_test_ext() -> sp_io::TestExternalities {
let mut ext: sp_io::TestExternalities = RuntimeGenesisConfig {
let mut ext: sp_io::TestExternalities = BuildStorage::build_storage(&RuntimeGenesisConfig {
system: frame_system::GenesisConfig::default(),
balances: pallet_balances::GenesisConfig { balances: vec![(0, 100), (1, 98), (2, 1)] },
treasury: Default::default(),
treasury_1: Default::default(),
}
.build_storage()
})
.unwrap()
.into();
ext.execute_with(|| System::set_block_number(1));
Expand Down

0 comments on commit 6017dad

Please sign in to comment.