referrerpolicy=no-referrer-when-downgrade

pallet_grandpa/
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 GRANDPA 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 report_equivocation(validator_count: u32, max_nominators_per_validator: u32) -> Weight {
28		// we take the validator set count from the membership proof to
29		// calculate the weight but we set a floor of 100 validators.
30		let validator_count = validator_count.max(100) as u64;
31
32		// checking membership proof
33		Weight::from_parts(35u64 * WEIGHT_REF_TIME_PER_MICROS, 0)
34			.saturating_add(
35				Weight::from_parts(175u64 * WEIGHT_REF_TIME_PER_NANOS, 0)
36					.saturating_mul(validator_count),
37			)
38			.saturating_add(DbWeight::get().reads(5))
39			// check equivocation proof
40			.saturating_add(Weight::from_parts(95u64 * WEIGHT_REF_TIME_PER_MICROS, 0))
41			// report offence
42			.saturating_add(Weight::from_parts(110u64 * WEIGHT_REF_TIME_PER_MICROS, 0))
43			.saturating_add(Weight::from_parts(
44				25u64 * WEIGHT_REF_TIME_PER_MICROS * max_nominators_per_validator as u64,
45				0,
46			))
47			.saturating_add(DbWeight::get().reads(14 + 3 * max_nominators_per_validator as u64))
48			.saturating_add(DbWeight::get().writes(10 + 3 * max_nominators_per_validator as u64))
49			// fetching set id -> session index mappings
50			.saturating_add(DbWeight::get().reads(2))
51	}
52
53	fn note_stalled() -> Weight {
54		Weight::from_parts(3u64 * WEIGHT_REF_TIME_PER_MICROS, 0)
55			.saturating_add(DbWeight::get().writes(1))
56	}
57}