5

After upgrading our chain to polkadot version 0.9.38 and run SKIP_WASM_BUILD= cargo test --all I get the following test error

'__construct_runtime_integrity_test::runtime_integrity_tests' panicked at 
'Builder finished with `build_or_panic`; 
The panic is expected if runtime weights are not correct: 
ValidationErrors { has_errors: true, errors: [
    "[DispatchClass::Normal] Weight { ref_time: 375000000000, proof_size: 0 } (total) has to be greater than Weight { ref_time: 381015000, proof_size: 0 } (base block) & Weight { ref_time: 99840000, proof_size: 0 } (base extrinsic)",
    "[DispatchClass::Normal] Some(Weight { ref_time: 349900160000, proof_size: 0 }) (max_extrinsic) must not be 0. Check base cost and average initialization cost.",
    "[DispatchClass::Normal] Weight { ref_time: 500000000000, proof_size: 0 } (max block) must fit at least one extrinsic Weight { ref_time: 480855000, proof_size: 0 } (base weight)",
    "[DispatchClass::Operational] Weight { ref_time: 500000000000, proof_size: 0 } (total) has to be greater than Weight { ref_time: 381015000, proof_size: 0 } (base block) & Weight { ref_time: 99840000, proof_size: 0 } (base extrinsic)",
    "[DispatchClass::Operational] Some(Weight { ref_time: 474900160000, proof_size: 0 }) (max_extrinsic) must not be 0. Check base cost and average initialization cost.",
    "[DispatchClass::Operational] Weight { ref_time: 125000000000, proof_size: 0 } (reserved) has to be greater than Weight { ref_time: 99840000, proof_size: 0 } (base extrinsic) if set",
    "[DispatchClass::Operational] Weight { ref_time: 500000000000, proof_size: 0 } (max block) must fit at least one extrinsic Weight { ref_time: 480855000, proof_size: 0 } (base weight)",
    "[DispatchClass::Mandatory] Weight { ref_time: 500000000000, proof_size: 0 } (max block) must fit at least one extrinsic Weight { ref_time: 480855000, proof_size: 0 } (base weight)"
]}

I was running the tests for each pallet separately and they seems to pass as expected. Any guidance on how to resolve it

Link to code here

1 Answer 1

1

You need to change your declaration of MAXIMUM_BLOCK_WEIGHT to:

pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
    WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
    polkadot_primitives::MAX_POV_SIZE as u64,
);

In your code base you don't set the pov size and this will make the initialization of RuntimeBlockWeights fail.

1
  • Thanks! All works as expected after updating the MAXIMUM_BLOCK_WEIGHT value
    – chexware
    Jun 21, 2023 at 2:16

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.