mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 03:31:10 +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
@@ -245,13 +245,12 @@ impl<T: Config> Storage<T> {
|
||||
/// Calculates the weight that is necessary to remove one key from the trie and how many
|
||||
/// of those keys can be deleted from the deletion queue given the supplied queue length
|
||||
/// and weight limit.
|
||||
pub fn deletion_budget(queue_len: usize, weight_limit: Weight) -> (u64, u32) {
|
||||
pub fn deletion_budget(queue_len: usize, weight_limit: Weight) -> (Weight, u32) {
|
||||
let base_weight = T::WeightInfo::on_process_deletion_queue_batch();
|
||||
let weight_per_queue_item = T::WeightInfo::on_initialize_per_queue_item(1) -
|
||||
T::WeightInfo::on_initialize_per_queue_item(0);
|
||||
let weight_per_key = (T::WeightInfo::on_initialize_per_trie_key(1) -
|
||||
T::WeightInfo::on_initialize_per_trie_key(0))
|
||||
.ref_time();
|
||||
let weight_per_key = T::WeightInfo::on_initialize_per_trie_key(1) -
|
||||
T::WeightInfo::on_initialize_per_trie_key(0);
|
||||
let decoding_weight = weight_per_queue_item.saturating_mul(queue_len as u64);
|
||||
|
||||
// `weight_per_key` being zero makes no sense and would constitute a failure to
|
||||
@@ -259,9 +258,8 @@ impl<T: Config> Storage<T> {
|
||||
let key_budget = weight_limit
|
||||
.saturating_sub(base_weight)
|
||||
.saturating_sub(decoding_weight)
|
||||
.checked_div(weight_per_key)
|
||||
.unwrap_or(Weight::zero())
|
||||
.ref_time() as u32;
|
||||
.checked_div_per_component(&weight_per_key)
|
||||
.unwrap_or(0) as u32;
|
||||
|
||||
(weight_per_key, key_budget)
|
||||
}
|
||||
@@ -306,10 +304,7 @@ impl<T: Config> Storage<T> {
|
||||
}
|
||||
|
||||
<DeletionQueue<T>>::put(queue);
|
||||
let ref_time_weight = weight_limit
|
||||
.ref_time()
|
||||
.saturating_sub(weight_per_key.saturating_mul(u64::from(remaining_key_budget)));
|
||||
Weight::from_ref_time(ref_time_weight)
|
||||
weight_limit.saturating_sub(weight_per_key.saturating_mul(u64::from(remaining_key_budget)))
|
||||
}
|
||||
|
||||
/// Generates a unique trie id by returning `hash(account_id ++ nonce)`.
|
||||
|
||||
Reference in New Issue
Block a user