Measure per byte and not kb for certain benchmarks (#10863)

This commit is contained in:
Alexander Theißen
2022-02-16 11:49:31 +01:00
committed by GitHub
parent 6b7eb2e2d7
commit 1a744befd4
5 changed files with 667 additions and 670 deletions
+5 -8
View File
@@ -410,10 +410,7 @@ pub mod pallet {
/// - The `value` is transferred to the new account.
/// - The `deploy` function is executed in the context of the newly-created account.
#[pallet::weight(
T::WeightInfo::instantiate_with_code(
code.len() as u32 / 1024,
salt.len() as u32 / 1024,
)
T::WeightInfo::instantiate_with_code(code.len() as u32, salt.len() as u32)
.saturating_add(*gas_limit)
)]
pub fn instantiate_with_code(
@@ -445,7 +442,7 @@ pub mod pallet {
}
output.gas_meter.into_dispatch_result(
output.result.map(|(_address, result)| result),
T::WeightInfo::instantiate_with_code(code_len / 1024, salt_len / 1024),
T::WeightInfo::instantiate_with_code(code_len, salt_len),
)
}
@@ -455,7 +452,7 @@ pub mod pallet {
/// code deployment step. Instead, the `code_hash` of an on-chain deployed wasm binary
/// must be supplied.
#[pallet::weight(
T::WeightInfo::instantiate(salt.len() as u32 / 1024).saturating_add(*gas_limit)
T::WeightInfo::instantiate(salt.len() as u32).saturating_add(*gas_limit)
)]
pub fn instantiate(
origin: OriginFor<T>,
@@ -485,7 +482,7 @@ pub mod pallet {
}
output.gas_meter.into_dispatch_result(
output.result.map(|(_address, output)| output),
T::WeightInfo::instantiate(salt_len / 1024),
T::WeightInfo::instantiate(salt_len),
)
}
@@ -505,7 +502,7 @@ pub mod pallet {
/// To avoid this situation a constructor could employ access control so that it can
/// only be instantiated by permissioned entities. The same is true when uploading
/// through [`Self::instantiate_with_code`].
#[pallet::weight(T::WeightInfo::upload_code(code.len() as u32 / 1024))]
#[pallet::weight(T::WeightInfo::upload_code(code.len() as u32))]
pub fn upload_code(
origin: OriginFor<T>,
code: Vec<u8>,