Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Fix State Trie Migration Benchmarks #11502

Merged
merged 3 commits into from
May 23, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions frame/state-trie-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,8 @@ mod benchmarks {
// function.
let null = MigrationLimits::default();
let caller = frame_benchmarking::whitelisted_caller();
// Allow signed migrations.
SignedMigrationMaxLimits::<T>::put(MigrationLimits { size: 1024, item: 5 });
}: _(frame_system::RawOrigin::Signed(caller), null, 0, StateTrieMigration::<T>::migration_process())
verify {
assert_eq!(StateTrieMigration::<T>::migration_process(), Default::default())
Expand Down Expand Up @@ -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::<Test>::put(MigrationLimits { size: 1024, item: 5 });
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this genesis did not happen in benchmarks, which allowed tests to pass, but live benchmarks to fail.

Removing this from genesis to ensure that such an issue wont be missed.

});

ext
}

Expand Down Expand Up @@ -1292,6 +1289,9 @@ mod test {
new_test_ext(StateVersion::V0, true, None, None).execute_with(|| {
assert_eq!(MigrationProcess::<Test>::get(), Default::default());

// Allow signed migrations.
SignedMigrationMaxLimits::<Test>::put(MigrationLimits { size: 1024, item: 5 });

// can't submit if limit is too high.
frame_support::assert_err!(
StateTrieMigration::continue_migrate(
Expand Down