code/pallets/drand/src/weights.rs

weights.rs

56 lines · 1,762 bytes · 19a6485969RawGitHub
// Weights for `pallet_drand`.
//
// Stubbed entries were auto-generated by weight-stub.
// Re-generate with real values by running benchmarks:
//   ./scripts/benchmark_all.sh pallet_drand

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
#![allow(dead_code)]

use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use core::marker::PhantomData;

/// Weight functions needed for `pallet_drand`.
pub trait WeightInfo {
	fn set_beacon_config() -> Weight;
	fn write_pulse() -> Weight;
	fn set_oldest_stored_round() -> Weight;
}

/// Weights for `pallet_drand` using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
	fn set_beacon_config() -> Weight {
		Weight::from_parts(8_766_000, 0)
			.saturating_add(T::DbWeight::get().writes(2_u64))
	}
	fn write_pulse() -> Weight {
		Weight::from_parts(4_294_000_000, 0)
			.saturating_add(T::DbWeight::get().reads(3_u64))
			.saturating_add(T::DbWeight::get().writes(4_u64))
	}
	fn set_oldest_stored_round() -> Weight {
		Weight::from_parts(5_370_000, 0)
			.saturating_add(T::DbWeight::get().writes(1_u64))
	}
}

// For backwards compatibility and tests.
impl WeightInfo for () {
	fn set_beacon_config() -> Weight {
		Weight::from_parts(8_766_000, 0)
			.saturating_add(RocksDbWeight::get().writes(2_u64))
	}
	fn write_pulse() -> Weight {
		Weight::from_parts(4_294_000_000, 0)
			.saturating_add(RocksDbWeight::get().reads(3_u64))
			.saturating_add(RocksDbWeight::get().writes(4_u64))
	}
	fn set_oldest_stored_round() -> Weight {
		Weight::from_parts(5_370_000, 0)
			.saturating_add(RocksDbWeight::get().writes(1_u64))
	}
}