referrerpolicy=no-referrer-when-downgrade

pallet_babe/
default_weights.rs

1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// 	http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! Default weights for the Babe Pallet
19//! This file was not auto-generated.
20
21use frame_support::weights::{
22	constants::{RocksDbWeight as DbWeight, WEIGHT_REF_TIME_PER_MICROS, WEIGHT_REF_TIME_PER_NANOS},
23	Weight,
24};
25
26impl crate::WeightInfo for () {
27	fn plan_config_change() -> Weight {
28		DbWeight::get().writes(1)
29	}
30
31	fn report_equivocation(validator_count: u32, max_nominators_per_validator: u32) -> Weight {
32		// we take the validator set count from the membership proof to
33		// calculate the weight but we set a floor of 100 validators.
34		let validator_count = validator_count.max(100) as u64;
35
36		// checking membership proof
37		Weight::from_parts(35u64 * WEIGHT_REF_TIME_PER_MICROS, 0)
38			.saturating_add(
39				Weight::from_parts(175u64 * WEIGHT_REF_TIME_PER_NANOS, 0)
40					.saturating_mul(validator_count),
41			)
42			.saturating_add(DbWeight::get().reads(5))
43			// check equivocation proof
44			.saturating_add(Weight::from_parts(110u64 * WEIGHT_REF_TIME_PER_MICROS, 0))
45			// report offence
46			.saturating_add(Weight::from_parts(110u64 * WEIGHT_REF_TIME_PER_MICROS, 0))
47			.saturating_add(Weight::from_parts(
48				25u64 * WEIGHT_REF_TIME_PER_MICROS * max_nominators_per_validator as u64,
49				0,
50			))
51			.saturating_add(DbWeight::get().reads(14 + 3 * max_nominators_per_validator as u64))
52			.saturating_add(DbWeight::get().writes(10 + 3 * max_nominators_per_validator as u64))
53	}
54}