Skip to content

Commit f4d6426

Browse files
committed
take() is a write operation
1 parent dd5b06e commit f4d6426

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

substrate/frame/balances/src/migration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for ResetInactive<T, I> {
9191
StorageVersion::new(0).put::<Pallet<T, I>>();
9292

9393
log::info!(target: LOG_TARGET, "Storage to version 0");
94-
T::DbWeight::get().reads_writes(1, 2)
94+
T::DbWeight::get().reads_writes(1, 3)
9595
} else {
9696
log::info!(
9797
target: LOG_TARGET,

substrate/frame/democracy/src/migrations/v1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub mod v1 {
108108
.collect::<Vec<_>>();
109109
let bounded = BoundedVec::<_, T::MaxProposals>::truncate_from(props.clone());
110110
PublicProps::<T>::put(bounded);
111-
weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 1));
111+
weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 2));
112112

113113
if props.len() as u32 > T::MaxProposals::get() {
114114
log::error!(
@@ -126,7 +126,7 @@ pub mod v1 {
126126

127127
StorageVersion::new(1).put::<Pallet<T>>();
128128

129-
weight.saturating_add(T::DbWeight::get().reads_writes(1, 2))
129+
weight.saturating_add(T::DbWeight::get().writes(3))
130130
}
131131

132132
#[cfg(feature = "try-runtime")]

substrate/frame/examples/single-block-migrations/src/migrations/v1.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ impl<T: crate::Config> UncheckedOnRuntimeUpgrade for InnerMigrateV0ToV1<T> {
6767
// Write the new value to storage
6868
let new = crate::CurrentAndPreviousValue { current: old_value, previous: None };
6969
crate::Value::<T>::put(new);
70-
// One read for the old value, one write for the new value
71-
T::DbWeight::get().reads_writes(1, 1)
70+
// One read + write for taking the old value, and one write for setting the new value
71+
T::DbWeight::get().reads_writes(1, 2)
7272
} else {
73-
// One read for trying to access the old value
73+
// No writes since there was no old value, just one read for checking
7474
T::DbWeight::get().reads(1)
7575
}
7676
}

substrate/frame/staking/src/migrations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ pub mod v10 {
319319
StorageVersion::<T>::put(ObsoleteReleases::V10_0_0);
320320

321321
log!(info, "MigrateToV10 executed successfully");
322-
T::DbWeight::get().reads_writes(1, 1)
322+
T::DbWeight::get().reads_writes(1, 2)
323323
} else {
324324
log!(warn, "MigrateToV10 should be removed.");
325325
T::DbWeight::get().reads(1)

0 commit comments

Comments
 (0)