Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from all 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
14 changes: 6 additions & 8 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 @@ -1146,14 +1148,7 @@ 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
(custom_storage, version).into()
}

pub(crate) fn run_to_block(n: u32) -> (H256, u64) {
Expand Down Expand Up @@ -1292,6 +1287,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