referrerpolicy=no-referrer-when-downgrade

pallet_pgas_allowance/
weights.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// SPDX-License-Identifier: Apache-2.0
3
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// 	http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! Weights for `pallet_pgas_allowance`.
17
18#![allow(unused_parens)]
19#![allow(unused_imports)]
20#![allow(missing_docs)]
21
22use core::marker::PhantomData;
23use frame_support::{
24	traits::Get,
25	weights::{Weight, constants::RocksDbWeight},
26};
27
28/// Weight functions needed for `pallet_pgas_allowance`.
29pub trait WeightInfo {
30	/// Full PGAS path: validate, withdraw into a credit and resolve refund.
31	fn charge_pgas() -> Weight;
32	/// PGAS path is skipped (unsigned, filter miss, or insufficient PGAS balance).
33	fn charge_pgas_skip() -> Weight;
34}
35
36/// Weights for `pallet_pgas_allowance` using the Substrate node and recommended hardware.
37pub struct SubstrateWeight<T>(PhantomData<T>);
38impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
39	fn charge_pgas() -> Weight {
40		Weight::from_parts(45_000_000, 3675)
41			.saturating_add(T::DbWeight::get().reads(5_u64))
42			.saturating_add(T::DbWeight::get().writes(2_u64))
43	}
44	fn charge_pgas_skip() -> Weight {
45		Weight::from_parts(1_000_000, 0).saturating_add(T::DbWeight::get().reads(1_u64))
46	}
47}
48
49// For backwards compatibility and tests.
50impl WeightInfo for () {
51	fn charge_pgas() -> Weight {
52		Weight::from_parts(45_000_000, 3675)
53			.saturating_add(RocksDbWeight::get().reads(5_u64))
54			.saturating_add(RocksDbWeight::get().writes(2_u64))
55	}
56	fn charge_pgas_skip() -> Weight {
57		Weight::from_parts(1_000_000, 0).saturating_add(RocksDbWeight::get().reads(1_u64))
58	}
59}