difftreelog
fix remove from_ref_time usages
in: master
9 files changed
pallets/common/src/dispatch.rsdiffbeforeafterboth19 // Read collection19 // Read collection20 <T as frame_system::Config>::DbWeight::get().reads(1)20 <T as frame_system::Config>::DbWeight::get().reads(1)21 // Dynamic dispatch?21 // Dynamic dispatch?22 + Weight::from_ref_time(6_000_000)22 + Weight::from_parts(6_000_000, 0)23 // submit_logs is measured as part of collection pallets23 // submit_logs is measured as part of collection pallets24}24}2525pallets/common/src/lib.rsdiffbeforeafterboth92pub mod dispatch;92pub mod dispatch;93pub mod erc;93pub mod erc;94pub mod eth;94pub mod eth;95#[allow(missing_docs)]95pub mod weights;96pub mod weights;969797/// Weight info.98/// Weight info.157 reads: u64,158 reads: u64,158 ) -> pallet_evm_coder_substrate::execution::Result<()> {159 ) -> pallet_evm_coder_substrate::execution::Result<()> {159 self.recorder160 self.recorder160 .consume_gas(T::GasWeightMapping::weight_to_gas(Weight::from_ref_time(161 .consume_gas(T::GasWeightMapping::weight_to_gas(Weight::from_parts(161 <T as frame_system::Config>::DbWeight::get()162 <T as frame_system::Config>::DbWeight::get()162 .read163 .read163 .saturating_mul(reads),164 .saturating_mul(reads),165 // TODO: measure proof166 0,164 )))167 )))165 }168 }166169170 writes: u64,173 writes: u64,171 ) -> pallet_evm_coder_substrate::execution::Result<()> {174 ) -> pallet_evm_coder_substrate::execution::Result<()> {172 self.recorder175 self.recorder173 .consume_gas(T::GasWeightMapping::weight_to_gas(Weight::from_ref_time(176 .consume_gas(T::GasWeightMapping::weight_to_gas(Weight::from_parts(174 <T as frame_system::Config>::DbWeight::get()177 <T as frame_system::Config>::DbWeight::get()175 .write178 .write176 .saturating_mul(writes),179 .saturating_mul(writes),180 // TODO: measure proof181 0,177 )))182 )))178 }183 }179184187 let reads = weight.read.saturating_mul(reads);192 let reads = weight.read.saturating_mul(reads);188 let writes = weight.read.saturating_mul(writes);193 let writes = weight.read.saturating_mul(writes);189 self.recorder194 self.recorder190 .consume_gas(T::GasWeightMapping::weight_to_gas(Weight::from_ref_time(195 .consume_gas(T::GasWeightMapping::weight_to_gas(Weight::from_parts(191 reads.saturating_add(writes),196 reads.saturating_add(writes),197 // TODO: measure proof198 0,192 )))199 )))193 }200 }194201pallets/evm-coder-substrate/src/execution.rsdiffbeforeafterboth61 fn dispatch_info(&self) -> DispatchInfo {61 fn dispatch_info(&self) -> DispatchInfo {62 DispatchInfo {62 DispatchInfo {63 // ERC165 impl should be cheap63 // ERC165 impl should be cheap64 weight: Weight::from_ref_time(200),64 weight: Weight::from_parts(200, 0),65 }65 }66 }66 }67}67}77 Self { weight }77 Self { weight }78 }78 }79}79}80// TODO: use 2-dimensional weight after frontier upgrade80impl From<u64> for DispatchInfo {81impl From<u64> for DispatchInfo {81 fn from(weight: u64) -> Self {82 fn from(weight: u64) -> Self {82 Self {83 Self {83 weight: Weight::from_ref_time(weight),84 weight: Weight::from_parts(weight, 0),84 }85 }85 }86 }86}87}pallets/evm-migration/src/lib.rsdiffbeforeafterboth21pub use pallet::*;21pub use pallet::*;22#[cfg(feature = "runtime-benchmarks")]22#[cfg(feature = "runtime-benchmarks")]23pub mod benchmarking;23pub mod benchmarking;24#[allow(missing_docs)]24pub mod weights;25pub mod weights;252626#[frame_support::pallet]27#[frame_support::pallet]pallets/unique/src/benchmarking.rsdiffbeforeafterboth26 Config as CommonConfig,26 Config as CommonConfig,27 benchmarking::{create_data, create_u16_data},27 benchmarking::{create_data, create_u16_data},28};28};29use up_data_structs::{30 CollectionId, CollectionMode, MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,31 MAX_COLLECTION_DESCRIPTION_LENGTH, CollectionLimits,32};33use pallet_common::erc::CrossAccountId;293430const SEED: u32 = 1;35const SEED: u32 = 1;313634 mode: CollectionMode,39 mode: CollectionMode,35) -> Result<CollectionId, DispatchError> {40) -> Result<CollectionId, DispatchError> {36 <T as CommonConfig>::Currency::deposit_creating(&owner, T::CollectionCreationPrice::get());41 <T as CommonConfig>::Currency::deposit_creating(&owner, T::CollectionCreationPrice::get());37 let col_name = create_u16_data::<MAX_COLLECTION_NAME_LENGTH>();42 let col_name = create_u16_data::<{ MAX_COLLECTION_NAME_LENGTH }>();38 let col_desc = create_u16_data::<MAX_COLLECTION_DESCRIPTION_LENGTH>();43 let col_desc = create_u16_data::<{ MAX_COLLECTION_DESCRIPTION_LENGTH }>();39 let token_prefix = create_data::<MAX_TOKEN_PREFIX_LENGTH>();44 let token_prefix = create_data::<{ MAX_TOKEN_PREFIX_LENGTH }>();40 <Pallet<T>>::create_collection(45 <Pallet<T>>::create_collection(41 RawOrigin::Signed(owner).into(),46 RawOrigin::Signed(owner).into(),42 col_name,47 col_name,545955benchmarks! {60benchmarks! {56 create_collection {61 create_collection {57 let col_name = create_u16_data::<MAX_COLLECTION_NAME_LENGTH>();62 let col_name = create_u16_data::<{MAX_COLLECTION_NAME_LENGTH}>();58 let col_desc = create_u16_data::<MAX_COLLECTION_DESCRIPTION_LENGTH>();63 let col_desc = create_u16_data::<{MAX_COLLECTION_DESCRIPTION_LENGTH}>();59 let token_prefix = create_data::<MAX_TOKEN_PREFIX_LENGTH>();64 let token_prefix = create_data::<{MAX_TOKEN_PREFIX_LENGTH}>();60 let mode: CollectionMode = CollectionMode::NFT;65 let mode: CollectionMode = CollectionMode::NFT;61 let caller: T::AccountId = account("caller", 0, SEED);66 let caller: T::AccountId = account("caller", 0, SEED);62 <T as CommonConfig>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());67 <T as CommonConfig>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());pallets/unique/src/lib.rsdiffbeforeafterboth89 use frame_support::{89 use frame_support::{90 dispatch::DispatchResult,90 dispatch::DispatchResult,91 ensure, fail,91 ensure, fail,92 weights::{Weight},93 pallet_prelude::{*},94 BoundedVec,92 BoundedVec,95 storage::Key,93 storage::Key,96 };94 };97 use frame_system::pallet_prelude::*;98 use scale_info::TypeInfo;95 use scale_info::TypeInfo;99 use frame_system::{self as system, ensure_signed, ensure_root};96 use frame_system::{ensure_signed, ensure_root};100 use sp_std::{vec, vec::Vec};97 use sp_std::{vec, vec::Vec};101 use up_data_structs::{98 use up_data_structs::{102 MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,99 MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,primitives/common/src/constants.rsdiffbeforeafterboth64/// by Operational extrinsics.64/// by Operational extrinsics.65pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);65pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);66/// We allow for 2 seconds of compute with a 6 second average block time.66/// We allow for 2 seconds of compute with a 6 second average block time.67pub const MAXIMUM_BLOCK_WEIGHT: Weight =67pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(68 Weight::from_ref_time(WEIGHT_REF_TIME_PER_SECOND.saturating_div(2))68 WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),69 .set_proof_size(MAX_POV_SIZE as u64);69 MAX_POV_SIZE as u64,70);707171parameter_types! {72parameter_types! {72 pub const TransactionByteFee: Balance = 501 * MICROUNIQUE / 2;73 pub const TransactionByteFee: Balance = 501 * MICROUNIQUE / 2;runtime/common/config/ethereum.rsdiffbeforeafterboth28 pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;28 pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;29 pub const WeightTimePerGas: u64 = WEIGHT_REF_TIME_PER_SECOND / GasPerSecond::get();29 pub const WeightTimePerGas: u64 = WEIGHT_REF_TIME_PER_SECOND / GasPerSecond::get();303031 pub const WeightPerGas: Weight = Weight::from_ref_time(WeightTimePerGas::get());31 pub const WeightPerGas: Weight = Weight::from_parts(WeightTimePerGas::get(), 0);32}32}333334/// Limiting EVM execution to 50% of block for substrate users and management tasks34/// Limiting EVM execution to 50% of block for substrate users and management tasksruntime/common/mod.rsdiffbeforeafterboth27pub mod scheduler;27pub mod scheduler;282829pub mod sponsoring;29pub mod sponsoring;30#[allow(missing_docs)]30pub mod weights;31pub mod weights;313232#[cfg(test)]33#[cfg(test)]152 }153 }153 #[cfg(feature = "runtime-benchmarks")]154 #[cfg(feature = "runtime-benchmarks")]154 fn set_block_number(block: Self::BlockNumber) {155 fn set_block_number(block: Self::BlockNumber) {155 cumulus_pallet_parachain_system::RelaychainBlockNumberProvider::<T>::set_block_number(block)156 cumulus_pallet_parachain_system::RelaychainDataProvider::<T>::set_block_number(block)156 }157 }157}158}158159