Skip to content

Commit d054315

Browse files
shawntabriziggwpez
authored andcommitted
Fix State Trie Migration Benchmarks (paritytech#11502)
* enable signed migrations in benchmarks * T instead of Test Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Remove 'mut' Signed-off-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]>
1 parent b752ebb commit d054315

File tree

1 file changed

+6
-8
lines changed
  • frame/state-trie-migration/src

1 file changed

+6
-8
lines changed

frame/state-trie-migration/src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,8 @@ mod benchmarks {
848848
// function.
849849
let null = MigrationLimits::default();
850850
let caller = frame_benchmarking::whitelisted_caller();
851+
// Allow signed migrations.
852+
SignedMigrationMaxLimits::<T>::put(MigrationLimits { size: 1024, item: 5 });
851853
}: _(frame_system::RawOrigin::Signed(caller), null, 0, StateTrieMigration::<T>::migration_process())
852854
verify {
853855
assert_eq!(StateTrieMigration::<T>::migration_process(), Default::default())
@@ -1146,14 +1148,7 @@ mod mock {
11461148
}
11471149

11481150
sp_tracing::try_init_simple();
1149-
let mut ext: sp_io::TestExternalities = (custom_storage, version).into();
1150-
1151-
// set some genesis values for this pallet as well.
1152-
ext.execute_with(|| {
1153-
SignedMigrationMaxLimits::<Test>::put(MigrationLimits { size: 1024, item: 5 });
1154-
});
1155-
1156-
ext
1151+
(custom_storage, version).into()
11571152
}
11581153

11591154
pub(crate) fn run_to_block(n: u32) -> (H256, u64) {
@@ -1292,6 +1287,9 @@ mod test {
12921287
new_test_ext(StateVersion::V0, true, None, None).execute_with(|| {
12931288
assert_eq!(MigrationProcess::<Test>::get(), Default::default());
12941289

1290+
// Allow signed migrations.
1291+
SignedMigrationMaxLimits::<Test>::put(MigrationLimits { size: 1024, item: 5 });
1292+
12951293
// can't submit if limit is too high.
12961294
frame_support::assert_err!(
12971295
StateTrieMigration::continue_migrate(

0 commit comments

Comments
 (0)