4

After building my node (tag monthly-10-2021) with --features runtime-benchmarks and/or --all-features, I tried to run benchmarks for the pallets and then use them for WeightInfo on various pallet configuartions. Besides pallet_election_phragmen and pallet_election_provider_multi_phase not even successfully completing their benchmarks, I get these errors:

     Compiling node-template-runtime v3.0.0-monthly-2021-10 (/home/node-template/runtime)
  error[E0407]: method `check_equivocation_proof` is not a member of trait `pallet_babe::WeightInfo`
    --> /home/node-template/runtime/src/weights/pallet_babe.rs:36:2
     |
  36 | /     fn check_equivocation_proof(x: u32, ) -> Weight {
  37 | |         (118_979_000 as Weight)
  38 | |             // Standard Error: 274_000
  39 | |             .saturating_add((2_965_000 as Weight).saturating_mul(x as Weight))
  40 | |     }
     | |_____^ not a member of trait `pallet_babe::WeightInfo`

  error[E0407]: method `check_equivocation_proof` is not a member of trait `pallet_grandpa::WeightInfo`
    --> /home/node-template/runtime/src/weights/pallet_grandpa.rs:36:2
     |
  36 | /     fn check_equivocation_proof(x: u32, ) -> Weight {
  37 | |         (104_612_000 as Weight)
  38 | |             // Standard Error: 37_000
  39 | |             .saturating_add((169_000 as Weight).saturating_mul(x as Weight))
  40 | |     }
     | |_____^ not a member of trait `pallet_grandpa::WeightInfo`

  error[E0046]: not all trait items implemented, missing: `plan_config_change`, `report_equivocation`
    --> /home/node-template/runtime/src/weights/pallet_babe.rs:35:1
     |
  35 | 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/node-template/runtime/src/weights/pallet_grandpa.rs:35:1
     |
  35 | 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!() }`

  Some errors have detailed explanations: E0046, E0407.
  For more information about an error, try `rustc --explain E0046`.
  error: could not compile `node-template-runtime` due to 4 previous errors

What could have possibly gone wrong?

1 Answer 1

2

Pallet Grandpa and Babe currently do not have automatic benchmarks.
They have some default weight files here and here instead.

The setup for these benchmarks is very complicated and currently it needs some manual tweaking to work.
Did you modify your node? Since the default runtime config for the node template does not list these benchmarks.
Or are you not using the template?

6
  • It's a modification of the node-template, yes. Commented Mar 22, 2022 at 17:49
  • Could you shed light on the question I linked, it is related . Commented Mar 22, 2022 at 17:49
  • I don't know why the election benchmarks are not working. Only from Babe and Grandpa I know they don't. Commented Mar 22, 2022 at 21:41
  • Okay I believe that we have to write a struct WeightInfo in those files and we are good to go right? Commented Mar 23, 2022 at 8:34
  • 1
    You can try again using this as --template argument if it is just a syntax error. Commented Mar 23, 2022 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.