referrerpolicy=no-referrer-when-downgrade

pallet_beefy/
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 BEEFY 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_voting_equivocation(
28		votes_count: u32,
29		validator_count: u32,
30		max_nominators_per_validator: u32,
31	) -> 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(
45				(50u64 * WEIGHT_REF_TIME_PER_MICROS).saturating_mul(votes_count as u64),
46				0,
47			))
48			// report offence
49			.saturating_add(Weight::from_parts(110u64 * WEIGHT_REF_TIME_PER_MICROS, 0))
50			.saturating_add(Weight::from_parts(
51				25u64 * WEIGHT_REF_TIME_PER_MICROS * max_nominators_per_validator as u64,
52				0,
53			))
54			.saturating_add(DbWeight::get().reads(14 + 3 * max_nominators_per_validator as u64))
55			.saturating_add(DbWeight::get().writes(10 + 3 * max_nominators_per_validator as u64))
56			// fetching set id -> session index mappings
57			.saturating_add(DbWeight::get().reads(2))
58	}
59
60	fn set_new_genesis() -> Weight {
61		DbWeight::get().writes(1)
62	}
63}