mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 00:41:03 +00:00
Weight v1.5: Opaque Struct (#12138)
* initial idea * update frame_support * update a bunch more * add ord * adjust RuntimeDbWeight * frame_system builds * re-export * frame_support tests pass * frame_executive compile * frame_executive builds * frame_system tests passing * pallet-utility tests pass * fix a bunch of pallets * more * phragmen * state-trie-migration * scheduler and referenda * pallet-election-provider-multi-phase * aura * staking * more * babe * balances * bunch more * sudo * transaction-payment * asset-tx-payment * last pallets * fix alliance merge * fix node template runtime * fix pallet-contracts cc @athei * fix node runtime * fix compile on runtime-benchmarks feature * comment * fix frame-support-test * fix more tests * weight regex * frame system works * fix a bunch * more * more * more * more * more * more fixes * update templates * fix contracts benchmarks * Update lib.rs * Update lib.rs * fix ui * make scalar saturating mul const * more const functions * scalar div * refactor using constant functions * move impl * fix overhead template * use compactas * Update lib.rs
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
use crate::{weights::WeightInfo, Config};
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{weights::Weight, DefaultNoBound};
|
||||
use frame_support::{weights::RefTimeWeight, DefaultNoBound};
|
||||
use pallet_contracts_proc_macro::{ScheduleDebug, WeightDebug};
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(feature = "std")]
|
||||
@@ -255,166 +255,166 @@ pub struct InstructionWeights<T: Config> {
|
||||
#[scale_info(skip_type_params(T))]
|
||||
pub struct HostFnWeights<T: Config> {
|
||||
/// Weight of calling `seal_caller`.
|
||||
pub caller: Weight,
|
||||
pub caller: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_is_contract`.
|
||||
pub is_contract: Weight,
|
||||
pub is_contract: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_code_hash`.
|
||||
pub code_hash: Weight,
|
||||
pub code_hash: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_own_code_hash`.
|
||||
pub own_code_hash: Weight,
|
||||
pub own_code_hash: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_caller_is_origin`.
|
||||
pub caller_is_origin: Weight,
|
||||
pub caller_is_origin: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_address`.
|
||||
pub address: Weight,
|
||||
pub address: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_gas_left`.
|
||||
pub gas_left: Weight,
|
||||
pub gas_left: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_balance`.
|
||||
pub balance: Weight,
|
||||
pub balance: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_value_transferred`.
|
||||
pub value_transferred: Weight,
|
||||
pub value_transferred: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_minimum_balance`.
|
||||
pub minimum_balance: Weight,
|
||||
pub minimum_balance: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_block_number`.
|
||||
pub block_number: Weight,
|
||||
pub block_number: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_now`.
|
||||
pub now: Weight,
|
||||
pub now: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_weight_to_fee`.
|
||||
pub weight_to_fee: Weight,
|
||||
pub weight_to_fee: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `gas`.
|
||||
pub gas: Weight,
|
||||
pub gas: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_input`.
|
||||
pub input: Weight,
|
||||
pub input: RefTimeWeight,
|
||||
|
||||
/// Weight per input byte copied to contract memory by `seal_input`.
|
||||
pub input_per_byte: Weight,
|
||||
pub input_per_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_return`.
|
||||
pub r#return: Weight,
|
||||
pub r#return: RefTimeWeight,
|
||||
|
||||
/// Weight per byte returned through `seal_return`.
|
||||
pub return_per_byte: Weight,
|
||||
pub return_per_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_terminate`.
|
||||
pub terminate: Weight,
|
||||
pub terminate: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_random`.
|
||||
pub random: Weight,
|
||||
pub random: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_reposit_event`.
|
||||
pub deposit_event: Weight,
|
||||
pub deposit_event: RefTimeWeight,
|
||||
|
||||
/// Weight per topic supplied to `seal_deposit_event`.
|
||||
pub deposit_event_per_topic: Weight,
|
||||
pub deposit_event_per_topic: RefTimeWeight,
|
||||
|
||||
/// Weight per byte of an event deposited through `seal_deposit_event`.
|
||||
pub deposit_event_per_byte: Weight,
|
||||
pub deposit_event_per_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_debug_message`.
|
||||
pub debug_message: Weight,
|
||||
pub debug_message: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_set_storage`.
|
||||
pub set_storage: Weight,
|
||||
pub set_storage: RefTimeWeight,
|
||||
|
||||
/// Weight per written byten of an item stored with `seal_set_storage`.
|
||||
pub set_storage_per_new_byte: Weight,
|
||||
pub set_storage_per_new_byte: RefTimeWeight,
|
||||
|
||||
/// Weight per overwritten byte of an item stored with `seal_set_storage`.
|
||||
pub set_storage_per_old_byte: Weight,
|
||||
pub set_storage_per_old_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_set_code_hash`.
|
||||
pub set_code_hash: Weight,
|
||||
pub set_code_hash: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_clear_storage`.
|
||||
pub clear_storage: Weight,
|
||||
pub clear_storage: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_clear_storage` per byte of the stored item.
|
||||
pub clear_storage_per_byte: Weight,
|
||||
pub clear_storage_per_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_contains_storage`.
|
||||
pub contains_storage: Weight,
|
||||
pub contains_storage: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_contains_storage` per byte of the stored item.
|
||||
pub contains_storage_per_byte: Weight,
|
||||
pub contains_storage_per_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_get_storage`.
|
||||
pub get_storage: Weight,
|
||||
pub get_storage: RefTimeWeight,
|
||||
|
||||
/// Weight per byte of an item received via `seal_get_storage`.
|
||||
pub get_storage_per_byte: Weight,
|
||||
pub get_storage_per_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_take_storage`.
|
||||
pub take_storage: Weight,
|
||||
pub take_storage: RefTimeWeight,
|
||||
|
||||
/// Weight per byte of an item received via `seal_take_storage`.
|
||||
pub take_storage_per_byte: Weight,
|
||||
pub take_storage_per_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_transfer`.
|
||||
pub transfer: Weight,
|
||||
pub transfer: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_call`.
|
||||
pub call: Weight,
|
||||
pub call: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_delegate_call`.
|
||||
pub delegate_call: Weight,
|
||||
pub delegate_call: RefTimeWeight,
|
||||
|
||||
/// Weight surcharge that is claimed if `seal_call` does a balance transfer.
|
||||
pub call_transfer_surcharge: Weight,
|
||||
pub call_transfer_surcharge: RefTimeWeight,
|
||||
|
||||
/// Weight per byte that is cloned by supplying the `CLONE_INPUT` flag.
|
||||
pub call_per_cloned_byte: Weight,
|
||||
pub call_per_cloned_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_instantiate`.
|
||||
pub instantiate: Weight,
|
||||
pub instantiate: RefTimeWeight,
|
||||
|
||||
/// Weight surcharge that is claimed if `seal_instantiate` does a balance transfer.
|
||||
pub instantiate_transfer_surcharge: Weight,
|
||||
pub instantiate_transfer_surcharge: RefTimeWeight,
|
||||
|
||||
/// Weight per salt byte supplied to `seal_instantiate`.
|
||||
pub instantiate_per_salt_byte: Weight,
|
||||
pub instantiate_per_salt_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_hash_sha_256`.
|
||||
pub hash_sha2_256: Weight,
|
||||
pub hash_sha2_256: RefTimeWeight,
|
||||
|
||||
/// Weight per byte hashed by `seal_hash_sha_256`.
|
||||
pub hash_sha2_256_per_byte: Weight,
|
||||
pub hash_sha2_256_per_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_hash_keccak_256`.
|
||||
pub hash_keccak_256: Weight,
|
||||
pub hash_keccak_256: RefTimeWeight,
|
||||
|
||||
/// Weight per byte hashed by `seal_hash_keccak_256`.
|
||||
pub hash_keccak_256_per_byte: Weight,
|
||||
pub hash_keccak_256_per_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_hash_blake2_256`.
|
||||
pub hash_blake2_256: Weight,
|
||||
pub hash_blake2_256: RefTimeWeight,
|
||||
|
||||
/// Weight per byte hashed by `seal_hash_blake2_256`.
|
||||
pub hash_blake2_256_per_byte: Weight,
|
||||
pub hash_blake2_256_per_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_hash_blake2_128`.
|
||||
pub hash_blake2_128: Weight,
|
||||
pub hash_blake2_128: RefTimeWeight,
|
||||
|
||||
/// Weight per byte hashed by `seal_hash_blake2_128`.
|
||||
pub hash_blake2_128_per_byte: Weight,
|
||||
pub hash_blake2_128_per_byte: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_ecdsa_recover`.
|
||||
pub ecdsa_recover: Weight,
|
||||
pub ecdsa_recover: RefTimeWeight,
|
||||
|
||||
/// Weight of calling `seal_ecdsa_to_eth_address`.
|
||||
pub ecdsa_to_eth_address: Weight,
|
||||
pub ecdsa_to_eth_address: RefTimeWeight,
|
||||
|
||||
/// The type parameter is used in the default implementation.
|
||||
#[codec(skip)]
|
||||
@@ -435,19 +435,19 @@ macro_rules! call_zero {
|
||||
|
||||
macro_rules! cost_args {
|
||||
($name:ident, $( $arg: expr ),+) => {
|
||||
(T::WeightInfo::$name($( $arg ),+).saturating_sub(call_zero!($name, $( $arg ),+)))
|
||||
(T::WeightInfo::$name($( $arg ),+).saturating_sub(call_zero!($name, $( $arg ),+))).ref_time()
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! cost_batched_args {
|
||||
($name:ident, $( $arg: expr ),+) => {
|
||||
cost_args!($name, $( $arg ),+) / Weight::from(API_BENCHMARK_BATCH_SIZE)
|
||||
cost_args!($name, $( $arg ),+) / RefTimeWeight::from(API_BENCHMARK_BATCH_SIZE)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! cost_instr_no_params_with_batch_size {
|
||||
($name:ident, $batch_size:expr) => {
|
||||
(cost_args!($name, 1) / Weight::from($batch_size)) as u32
|
||||
(cost_args!($name, 1) / RefTimeWeight::from($batch_size)) as u32
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user