mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
contracts: Use proof_size from benchmarks (#13268)
* Avoid reading contract code when it is supplied in the extrinsic * Remove custom proof size injection from schedule * Set benchmarks pov_mode to Measure * Reduce overestimation of code size on re-instrument * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts * Do not override proof size from benchmark * Do not charge proof size for basic block * Incrase gas limit for tests * Fix deletion queue to also use `proof_size` * Fix tests * Update frame/contracts/src/schedule.rs Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com> * Fix wrong schedule macro invocations * Remove stale docs * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts * Handle zero components * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts * Fix instruction weight --------- Co-authored-by: command-bot <> Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
committed by
GitHub
parent
3c0d8fe149
commit
1c04ab0f6f
@@ -205,13 +205,13 @@ benchmarks! {
|
||||
}
|
||||
|
||||
// The base weight consumed on processing contracts deletion queue.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
on_process_deletion_queue_batch {}: {
|
||||
Storage::<T>::process_deletion_queue_batch(Weight::MAX)
|
||||
}
|
||||
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
on_initialize_per_trie_key {
|
||||
let k in 0..1024;
|
||||
let instance = Contract::<T>::with_storage(WasmModule::dummy(), k, T::Schedule::get().limits.payload_len)?;
|
||||
@@ -220,7 +220,7 @@ benchmarks! {
|
||||
Storage::<T>::process_deletion_queue_batch(Weight::MAX)
|
||||
}
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
on_initialize_per_queue_item {
|
||||
let q in 0..1024.min(T::DeletionQueueDepth::get());
|
||||
for i in 0 .. q {
|
||||
@@ -235,7 +235,7 @@ benchmarks! {
|
||||
// This benchmarks the additional weight that is charged when a contract is executed the
|
||||
// first time after a new schedule was deployed: For every new schedule a contract needs
|
||||
// to re-run the instrumentation once.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
reinstrument {
|
||||
let c in 0 .. Perbill::from_percent(49).mul_ceil(T::MaxCodeLen::get());
|
||||
let WasmModule { code, hash, .. } = WasmModule::<T>::sized(c, Location::Call);
|
||||
@@ -252,7 +252,7 @@ benchmarks! {
|
||||
// is responsible. This is achieved by generating all code to the `deploy` function
|
||||
// which is in the wasm module but not executed on `call`.
|
||||
// The results are supposed to be used as `call_with_code_kb(c) - call_with_code_kb(0)`.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
call_with_code_per_byte {
|
||||
let c in 0 .. T::MaxCodeLen::get();
|
||||
let instance = Contract::<T>::with_caller(
|
||||
@@ -278,7 +278,7 @@ benchmarks! {
|
||||
//
|
||||
// We cannot let `c` grow to the maximum code size because the code is not allowed
|
||||
// to be larger than the maximum size **after instrumentation**.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
instantiate_with_code {
|
||||
let c in 0 .. Perbill::from_percent(49).mul_ceil(T::MaxCodeLen::get());
|
||||
let i in 0 .. code::max_pages::<T>() * 64 * 1024;
|
||||
@@ -310,7 +310,7 @@ benchmarks! {
|
||||
// Instantiate uses a dummy contract constructor to measure the overhead of the instantiate.
|
||||
// `i`: Size of the input in kilobytes.
|
||||
// `s`: Size of the salt in kilobytes.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
instantiate {
|
||||
let i in 0 .. code::max_pages::<T>() * 64 * 1024;
|
||||
let s in 0 .. code::max_pages::<T>() * 64 * 1024;
|
||||
@@ -342,7 +342,7 @@ benchmarks! {
|
||||
// part of `seal_input`. The costs for invoking a contract of a specific size are not part
|
||||
// of this benchmark because we cannot know the size of the contract when issuing a call
|
||||
// transaction. See `invoke_per_code_kb` for this.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
call {
|
||||
let data = vec![42u8; 1024];
|
||||
let instance = Contract::<T>::with_caller(
|
||||
@@ -375,7 +375,7 @@ benchmarks! {
|
||||
//
|
||||
// We cannot let `c` grow to the maximum code size because the code is not allowed
|
||||
// to be larger than the maximum size **after instrumentation**.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
upload_code {
|
||||
let c in 0 .. Perbill::from_percent(49).mul_ceil(T::MaxCodeLen::get());
|
||||
let caller = whitelisted_caller();
|
||||
@@ -392,7 +392,7 @@ benchmarks! {
|
||||
// Removing code does not depend on the size of the contract because all the information
|
||||
// needed to verify the removal claim (refcount, owner) is stored in a separate storage
|
||||
// item (`OwnerInfoOf`).
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
remove_code {
|
||||
let caller = whitelisted_caller();
|
||||
T::Currency::make_free_balance_be(&caller, caller_funding::<T>());
|
||||
@@ -409,7 +409,7 @@ benchmarks! {
|
||||
assert!(<Contract<T>>::code_removed(&hash));
|
||||
}
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
set_code {
|
||||
let instance = <Contract<T>>::with_caller(
|
||||
whitelisted_caller(), WasmModule::dummy(), vec![],
|
||||
@@ -424,7 +424,7 @@ benchmarks! {
|
||||
assert_eq!(instance.info()?.code_hash, hash);
|
||||
}
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_caller {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
@@ -433,7 +433,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_is_contract {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let accounts = (0 .. r * API_BENCHMARK_BATCH_SIZE)
|
||||
@@ -471,7 +471,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_code_hash {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let accounts = (0 .. r * API_BENCHMARK_BATCH_SIZE)
|
||||
@@ -517,7 +517,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_own_code_hash {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
@@ -526,7 +526,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_caller_is_origin {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
@@ -547,7 +547,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_address {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
@@ -556,7 +556,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_gas_left {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
@@ -565,7 +565,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_balance {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
@@ -574,7 +574,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_value_transferred {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
@@ -583,7 +583,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_minimum_balance {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
@@ -592,7 +592,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_block_number {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
@@ -601,7 +601,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_now {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let instance = Contract::<T>::new(WasmModule::getter(
|
||||
@@ -610,7 +610,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_weight_to_fee {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let pages = code::max_pages::<T>();
|
||||
@@ -638,7 +638,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_gas {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
@@ -659,7 +659,7 @@ benchmarks! {
|
||||
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_input {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
@@ -687,7 +687,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_input_per_kb {
|
||||
let n in 0 .. code::max_pages::<T>() * 64;
|
||||
let pages = code::max_pages::<T>();
|
||||
@@ -721,7 +721,7 @@ benchmarks! {
|
||||
// We cannot call `seal_return` multiple times. Therefore our weight determination is not
|
||||
// as precise as with other APIs. Because this function can only be called once per
|
||||
// contract it cannot be used as an attack vector.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_return {
|
||||
let r in 0 .. 1;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
@@ -744,7 +744,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_return_per_kb {
|
||||
let n in 0 .. code::max_pages::<T>() * 64;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
@@ -769,7 +769,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
// The same argument as for `seal_return` is true here.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_terminate {
|
||||
let r in 0 .. 1;
|
||||
let beneficiary = account::<T::AccountId>("beneficiary", 0, 0);
|
||||
@@ -812,7 +812,7 @@ benchmarks! {
|
||||
// We benchmark only for the maximum subject length. We assume that this is some lowish
|
||||
// number (< 1 KB). Therefore we are not overcharging too much in case a smaller subject is
|
||||
// used.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_random {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let pages = code::max_pages::<T>();
|
||||
@@ -847,7 +847,7 @@ benchmarks! {
|
||||
|
||||
// Overhead of calling the function without any topic.
|
||||
// We benchmark for the worst case (largest event).
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_deposit_event {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
@@ -874,7 +874,7 @@ benchmarks! {
|
||||
// Benchmark the overhead that topics generate.
|
||||
// `t`: Number of topics
|
||||
// `n`: Size of event payload in kb
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_deposit_event_per_topic_and_kb {
|
||||
let t in 0 .. T::Schedule::get().limits.event_topics;
|
||||
let n in 0 .. T::Schedule::get().limits.payload_len / 1024;
|
||||
@@ -913,7 +913,7 @@ benchmarks! {
|
||||
// Benchmark debug_message call with zero input data.
|
||||
// Whereas this function is used in RPC mode only, it still should be secured
|
||||
// against an excessive use.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_debug_message {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
@@ -1003,7 +1003,7 @@ benchmarks! {
|
||||
// because re-writing at an existing key is always more expensive than writing
|
||||
// it at a virgin key.
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_set_storage {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES/2;
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
@@ -1052,7 +1052,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_set_storage_per_new_kb {
|
||||
let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
@@ -1101,7 +1101,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_set_storage_per_old_kb {
|
||||
let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
@@ -1154,7 +1154,7 @@ benchmarks! {
|
||||
// deleting a non existing key. We generate keys of a maximum length, and have to
|
||||
// reduce batch size in order to make resulting contract code size less than MaxCodeLen.
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_clear_storage {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES/2;
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
@@ -1202,7 +1202,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_clear_storage_per_kb {
|
||||
let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
@@ -1250,7 +1250,7 @@ benchmarks! {
|
||||
|
||||
// We make sure that all storage accesses are to unique keys.
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_get_storage {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES/2;
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
@@ -1305,7 +1305,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_get_storage_per_kb {
|
||||
let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
@@ -1361,7 +1361,7 @@ benchmarks! {
|
||||
|
||||
// We make sure that all storage accesses are to unique keys.
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_contains_storage {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES/2;
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
@@ -1410,7 +1410,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_contains_storage_per_kb {
|
||||
let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
@@ -1458,7 +1458,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_take_storage {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES/2;
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
@@ -1513,7 +1513,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[skip_meta]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_take_storage_per_kb {
|
||||
let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb
|
||||
let max_key_len = T::MaxStorageKeyLen::get();
|
||||
@@ -1568,7 +1568,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
// We transfer to unique accounts.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_transfer {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let accounts = (0..r * API_BENCHMARK_BATCH_SIZE)
|
||||
@@ -1622,7 +1622,7 @@ benchmarks! {
|
||||
}
|
||||
|
||||
// We call unique accounts.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_call {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let dummy_code = WasmModule::<T>::dummy_with_bytes(0);
|
||||
@@ -1681,7 +1681,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_delegate_call {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let hashes = (0..r * API_BENCHMARK_BATCH_SIZE)
|
||||
@@ -1734,7 +1734,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller);
|
||||
}: call(origin, callee, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_call_per_transfer_clone_kb {
|
||||
let t in 0 .. 1;
|
||||
let c in 0 .. code::max_pages::<T>() * 64;
|
||||
@@ -1793,7 +1793,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, bytes)
|
||||
|
||||
// We assume that every instantiate sends at least the minimum balance.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_instantiate {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let hashes = (0..r * API_BENCHMARK_BATCH_SIZE)
|
||||
@@ -1907,7 +1907,7 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_instantiate_per_transfer_input_salt_kb {
|
||||
let t in 0 .. 1;
|
||||
let i in 0 .. (code::max_pages::<T>() - 1) * 64;
|
||||
@@ -2002,7 +2002,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
// Only the overhead of calling the function itself with minimal arguments.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_sha2_256 {
|
||||
let r in 0 .. 1;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
@@ -2012,7 +2012,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
// `n`: Input to hash in kilobytes
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_sha2_256_per_kb {
|
||||
let n in 0 .. code::max_pages::<T>() * 64;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
@@ -2022,7 +2022,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
// Only the overhead of calling the function itself with minimal arguments.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_keccak_256 {
|
||||
let r in 0 .. 1;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
@@ -2032,7 +2032,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
// `n`: Input to hash in kilobytes
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_keccak_256_per_kb {
|
||||
let n in 0 .. code::max_pages::<T>() * 64;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
@@ -2042,7 +2042,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
// Only the overhead of calling the function itself with minimal arguments.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_blake2_256 {
|
||||
let r in 0 .. 1;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
@@ -2052,7 +2052,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
// `n`: Input to hash in kilobytes
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_blake2_256_per_kb {
|
||||
let n in 0 .. code::max_pages::<T>() * 64;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
@@ -2062,7 +2062,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
// Only the overhead of calling the function itself with minimal arguments.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_blake2_128 {
|
||||
let r in 0 .. 1;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
@@ -2072,7 +2072,7 @@ benchmarks! {
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
// `n`: Input to hash in kilobytes
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_hash_blake2_128_per_kb {
|
||||
let n in 0 .. code::max_pages::<T>() * 64;
|
||||
let instance = Contract::<T>::new(WasmModule::hasher(
|
||||
@@ -2083,7 +2083,7 @@ benchmarks! {
|
||||
|
||||
// Only calling the function itself with valid arguments.
|
||||
// It generates different private keys and signatures for the message "Hello world".
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_ecdsa_recover {
|
||||
let r in 0 .. 1;
|
||||
|
||||
@@ -2132,7 +2132,7 @@ benchmarks! {
|
||||
|
||||
// Only calling the function itself for the list of
|
||||
// generated different ECDSA keys.
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_ecdsa_to_eth_address {
|
||||
let r in 0 .. 1;
|
||||
let key_type = sp_core::crypto::KeyTypeId(*b"code");
|
||||
@@ -2168,7 +2168,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_set_code_hash {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let code_hashes = (0..r * API_BENCHMARK_BATCH_SIZE)
|
||||
@@ -2209,7 +2209,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_reentrance_count {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
@@ -2230,7 +2230,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_account_reentrance_count {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let dummy_code = WasmModule::<T>::dummy_with_bytes(0);
|
||||
@@ -2264,7 +2264,7 @@ benchmarks! {
|
||||
let origin = RawOrigin::Signed(instance.caller.clone());
|
||||
}: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![])
|
||||
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
seal_instantiation_nonce {
|
||||
let r in 0 .. API_BENCHMARK_BATCHES;
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
@@ -3103,7 +3103,7 @@ benchmarks! {
|
||||
// This is no benchmark. It merely exist to have an easy way to pretty print the curently
|
||||
// configured `Schedule` during benchmark development.
|
||||
// It can be outputed using the following command:
|
||||
// cargo run --manifest-path=bin/node/cli/Cargo.toml --release \
|
||||
// cargo run --manifest-path=bin/node/cli/Cargo.toml \
|
||||
// --features runtime-benchmarks -- benchmark pallet --extra --dev --execution=native \
|
||||
// -p pallet_contracts -e print_schedule --no-median-slopes --no-min-squares
|
||||
#[extra]
|
||||
@@ -3111,17 +3111,15 @@ benchmarks! {
|
||||
print_schedule {
|
||||
#[cfg(feature = "std")]
|
||||
{
|
||||
let weight_per_key = T::WeightInfo::on_initialize_per_trie_key(1) -
|
||||
T::WeightInfo::on_initialize_per_trie_key(0);
|
||||
let weight_per_queue_item = T::WeightInfo::on_initialize_per_queue_item(1) -
|
||||
T::WeightInfo::on_initialize_per_queue_item(0);
|
||||
let weight_limit = T::DeletionWeightLimit::get();
|
||||
let queue_depth: u64 = T::DeletionQueueDepth::get().into();
|
||||
let max_queue_depth = T::DeletionQueueDepth::get() as usize;
|
||||
let empty_queue_throughput = Storage::<T>::deletion_budget(0, weight_limit);
|
||||
let full_queue_throughput = Storage::<T>::deletion_budget(max_queue_depth, weight_limit);
|
||||
println!("{:#?}", Schedule::<T>::default());
|
||||
println!("###############################################");
|
||||
println!("Lazy deletion weight per key: {}", empty_queue_throughput.0);
|
||||
println!("Lazy deletion throughput per block (empty queue, full queue): {}, {}",
|
||||
weight_limit / weight_per_key.ref_time(),
|
||||
(weight_limit - weight_per_queue_item * queue_depth) / weight_per_key.ref_time(),
|
||||
empty_queue_throughput.1, full_queue_throughput.1,
|
||||
);
|
||||
}
|
||||
#[cfg(not(feature = "std"))]
|
||||
@@ -3133,7 +3131,7 @@ benchmarks! {
|
||||
// `g` is used to enable gas instrumentation to compare the performance impact of
|
||||
// that instrumentation at runtime.
|
||||
#[extra]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
ink_erc20_transfer {
|
||||
let g in 0 .. 1;
|
||||
let gas_metering = g != 0;
|
||||
@@ -3172,7 +3170,7 @@ benchmarks! {
|
||||
// `g` is used to enable gas instrumentation to compare the performance impact of
|
||||
// that instrumentation at runtime.
|
||||
#[extra]
|
||||
#[pov_mode = Ignored]
|
||||
#[pov_mode = Measured]
|
||||
solang_erc20_transfer {
|
||||
let g in 0 .. 1;
|
||||
let gas_metering = g != 0;
|
||||
|
||||
Reference in New Issue
Block a user