Repository: paritytech/substrate
File: frame/contracts/src/benchmarking/mod.rs (Rust)

Code before:
		let mut m = v10::Migration::<T>::default();
	}: {
		m.step();
	}

	// This benchmarks the v11 migration step.
	#[pov_mode = Measured]
	v11_migration_step {
		let k in 0 .. 1024;
		v11::fill_old_queue::<T>(k as usize);
		let mut m = v11::Migration::<T>::default();
	}: {
		m.step();
	}

	// This benchmarks the weight of executing Migration::migrate to execute a noop migration.
	#[pov_mode = Measured]
	migration_noop {
		assert_eq!(StorageVersion::get::<Pallet<T>>(), 2);
	}:  {
		Migration::<T>::migrate(Weight::MAX)
	} verify {
		assert_eq!(StorageVersion::get::<Pallet<T>>(), 2);
	}

	// This benchmarks the weight of executing 1 `NoopMigraton`
	#[pov_mode = Measured]
	migrate {
		StorageVersion::new(0).put::<Pallet<T>>();
		<Migration::<T> as frame_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade();
		let origin: RawOrigin<<T as frame_system::Config>::AccountId> = RawOrigin::Signed(whitelisted_caller());
	}: {
		<Contracts<T>>::migrate(origin.into(), Weight::MAX).unwrap()
	} verify {
		assert_eq!(StorageVersion::get::<Pallet<T>>(), 1);
	}

	// This benchmarks the weight of running on_runtime_upgrade when there are no migration in progress.
	#[pov_mode = Measured]
	on_runtime_upgrade_noop {
		assert_eq!(StorageVersion::get::<Pallet<T>>(), 2);
	}:  {
		<Migration::<T> as frame_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade()
	} verify {
		assert!(MigrationInProgress::<T>::get().is_none());
	}

	// This benchmarks the weight of running on_runtime_upgrade when there is a migration in progress.
	#[pov_mode = Measured]
	on_runtime_upgrade_in_progress {
		StorageVersion::new(0).put::<Pallet<T>>();

Review comment (suggestion):
no. this comment is valid for the benchmark `migration_noop`, but not here.
what you benchmark here is the `migrate` dispatchable, see my  [comment](https://github.com/paritytech/substrate/pull/14045#discussion_r1212116161) 

Code after:
		let mut m = v10::Migration::<T>::default();
	}: {
		m.step();
	}

	// This benchmarks the v11 migration step.
	#[pov_mode = Measured]
	v11_migration_step {
		let k in 0 .. 1024;
		v11::fill_old_queue::<T>(k as usize);
		let mut m = v11::Migration::<T>::default();
	}: {
		m.step();
	}

	// This benchmarks the weight of executing Migration::migrate to execute a noop migration.
	#[pov_mode = Measured]
	migration_noop {
		assert_eq!(StorageVersion::get::<Pallet<T>>(), 2);
	}:  {
		Migration::<T>::migrate(Weight::MAX)
	} verify {
		assert_eq!(StorageVersion::get::<Pallet<T>>(), 2);
	}

	// This benchmarks the weight of dispatching migrate to execute 1 `NoopMigraton`
	#[pov_mode = Measured]
	migrate {
		StorageVersion::new(0).put::<Pallet<T>>();
		<Migration::<T, false> as frame_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade();
		let caller: T::AccountId = whitelisted_caller();
		let origin = RawOrigin::Signed(caller.clone());
	}: _(origin, Weight::MAX)
	verify {
		assert_eq!(StorageVersion::get::<Pallet<T>>(), 1);
	}

	// This benchmarks the weight of running on_runtime_upgrade when there are no migration in progress.
	#[pov_mode = Measured]
	on_runtime_upgrade_noop {
		assert_eq!(StorageVersion::get::<Pallet<T>>(), 2);
	}:  {
		<Migration::<T, false> as frame_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade()
	} verify {
		assert!(MigrationInProgress::<T>::get().is_none());
	}

	// This benchmarks the weight of running on_runtime_upgrade when there is a migration in progress.
	#[pov_mode = Measured]
	on_runtime_upgrade_in_progress {
		StorageVersion::new(0).put::<Pallet<T>>();