From 11c70d688d18f7256a82fd8a7205f1362c3cf9ab Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sun, 22 May 2022 21:29:17 -0400 Subject: [PATCH 1/3] enable signed migrations in benchmarks --- frame/state-trie-migration/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frame/state-trie-migration/src/lib.rs b/frame/state-trie-migration/src/lib.rs index d78fd7d9ca932..a3cd3f22a1352 100644 --- a/frame/state-trie-migration/src/lib.rs +++ b/frame/state-trie-migration/src/lib.rs @@ -848,6 +848,8 @@ mod benchmarks { // function. let null = MigrationLimits::default(); let caller = frame_benchmarking::whitelisted_caller(); + // Allow signed migrations. + SignedMigrationMaxLimits::::put(MigrationLimits { size: 1024, item: 5 }); }: _(frame_system::RawOrigin::Signed(caller), null, 0, StateTrieMigration::::migration_process()) verify { assert_eq!(StateTrieMigration::::migration_process(), Default::default()) @@ -1148,11 +1150,6 @@ mod mock { sp_tracing::try_init_simple(); let mut ext: sp_io::TestExternalities = (custom_storage, version).into(); - // set some genesis values for this pallet as well. - ext.execute_with(|| { - SignedMigrationMaxLimits::::put(MigrationLimits { size: 1024, item: 5 }); - }); - ext } @@ -1292,6 +1289,9 @@ mod test { new_test_ext(StateVersion::V0, true, None, None).execute_with(|| { assert_eq!(MigrationProcess::::get(), Default::default()); + // Allow signed migrations. + SignedMigrationMaxLimits::::put(MigrationLimits { size: 1024, item: 5 }); + // can't submit if limit is too high. frame_support::assert_err!( StateTrieMigration::continue_migrate( From aa49e3192ad43242bcec737dc584f876acbac0dc Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 23 May 2022 11:22:22 +0200 Subject: [PATCH 2/3] T instead of Test Signed-off-by: Oliver Tale-Yazdi --- frame/state-trie-migration/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/state-trie-migration/src/lib.rs b/frame/state-trie-migration/src/lib.rs index a3cd3f22a1352..da86ebd335397 100644 --- a/frame/state-trie-migration/src/lib.rs +++ b/frame/state-trie-migration/src/lib.rs @@ -849,7 +849,7 @@ mod benchmarks { let null = MigrationLimits::default(); let caller = frame_benchmarking::whitelisted_caller(); // Allow signed migrations. - SignedMigrationMaxLimits::::put(MigrationLimits { size: 1024, item: 5 }); + SignedMigrationMaxLimits::::put(MigrationLimits { size: 1024, item: 5 }); }: _(frame_system::RawOrigin::Signed(caller), null, 0, StateTrieMigration::::migration_process()) verify { assert_eq!(StateTrieMigration::::migration_process(), Default::default()) From 05bdcbc1d164d3996cdbac631ff61c4c65e8f3cb Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 23 May 2022 11:37:56 +0200 Subject: [PATCH 3/3] Remove 'mut' Signed-off-by: Oliver Tale-Yazdi --- frame/state-trie-migration/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frame/state-trie-migration/src/lib.rs b/frame/state-trie-migration/src/lib.rs index da86ebd335397..899250cc3f3c3 100644 --- a/frame/state-trie-migration/src/lib.rs +++ b/frame/state-trie-migration/src/lib.rs @@ -1148,9 +1148,7 @@ mod mock { } sp_tracing::try_init_simple(); - let mut ext: sp_io::TestExternalities = (custom_storage, version).into(); - - ext + (custom_storage, version).into() } pub(crate) fn run_to_block(n: u32) -> (H256, u64) {