#11834·substrate

The benchmark result of `pallet-babe` does not match `WeightInfo` trait

Author: jiguantongCreated Jul 14, 2022Updated Aug 24, 2023
LabelsJ2-unconfirmed

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

Version: 4.0.0-dev

Benchmark result benchmarking.rs

rust
/// Weight functions for `pallet_babe`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_babe::WeightInfo for WeightInfo<T> {
	fn check_equivocation_proof(x: u32, ) -> Weight {
		(75_858_000 as Weight)
			// Standard Error: 9_899_000
			.saturating_add((1_628_000 as Weight).saturating_mul(x as Weight))
	}
}

pallet_babe::WeightInfo trait

rust
pub trait WeightInfo {
	fn plan_config_change() -> Weight;
	fn report_equivocation(validator_count: u32) -> Weight;
}

Build error

bash
  error[E0407]: method `check_equivocation_proof` is not a member of trait `pallet_babe::WeightInfo`
    --> /home/workspace/darwinia-git/darwinia-common/node/runtime/pangolin/src/weights/pallet_babe.rs:58:2
     |
  58 | /     fn check_equivocation_proof(x: u32, ) -> Weight {
  59 | |         (75_858_000 as Weight)
  60 | |             // Standard Error: 9_899_000
  61 | |             .saturating_add((1_628_000 as Weight).saturating_mul(x as Weight))
  62 | |     }
     | |_____^ not a member of trait `pallet_babe::WeightInfo`

  error[E0407]: method `check_equivocation_proof` is not a member of trait `pallet_grandpa::WeightInfo`
    --> /home/workspace/darwinia-git/darwinia-common/node/runtime/pangolin/src/weights/pallet_grandpa.rs:58:2
     |
  58 | /     fn check_equivocation_proof(x: u32, ) -> Weight {
  59 | |         (62_998_000 as Weight)
  60 | |             // Standard Error: 8_580_000
  61 | |             .saturating_add((14_227_000 as Weight).saturating_mul(x as Weight))
  62 | |     }
     | |_____^ not a member of trait `pallet_grandpa::WeightInfo`

  error[E0046]: not all trait items implemented, missing: `plan_config_change`, `report_equivocation`
    --> /home/workspace/darwinia-git/darwinia-common/node/runtime/pangolin/src/weights/pallet_babe.rs:57:1
     |
  57 | impl<T: frame_system::Config> pallet_babe::WeightInfo for WeightInfo<T> {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `plan_config_change`, `report_equivocation` in implementation
     |
     = help: implement the missing item: `fn plan_config_change() -> u64 { todo!() }`
     = help: implement the missing item: `fn report_equivocation(_: u32) -> u64 { todo!() }`

  error[E0046]: not all trait items implemented, missing: `report_equivocation`
    --> /home/workspace/darwinia-git/darwinia-common/node/runtime/pangolin/src/weights/pallet_grandpa.rs:57:1
     |
  57 | impl<T: frame_system::Config> pallet_grandpa::WeightInfo for WeightInfo<T> {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `report_equivocation` in implementation
     |
     = help: implement the missing item: `fn report_equivocation(_: u32) -> u64 { todo!() }`

Steps to reproduce

  1. Benchmark for pallet_babe
  2. Update weight for pallet_babe
  3. Build