paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.38k stars 2.65k forks source link

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

Open jiguantong opened 2 years ago

jiguantong commented 2 years ago

Is there an existing issue?

Experiencing problems? Have you tried our Stack Exchange first?

Description of bug

Version: 4.0.0-dev

Benchmark result benchmarking.rs

/// 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

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

Build error

  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
ggwpez commented 2 years ago

This is already tracked here as well https://github.com/paritytech/polkadot-sdk/issues/395...
I dont really have the bandwidth to work on it, but it would definitely be good to have.