Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Proof size for chains without PoV causes runtime panic #12655

Closed
2 tasks done
nazar-pc opened this issue Nov 9, 2022 · 6 comments
Closed
2 tasks done

Proof size for chains without PoV causes runtime panic #12655

nazar-pc opened this issue Nov 9, 2022 · 6 comments

Comments

@nazar-pc
Copy link
Contributor

nazar-pc commented Nov 9, 2022

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

#12383 in particular claims that chains without PoV should not care about proof size, but it doesn't seem to be the case.

The runtime I'm working on after Substrate upgrade was panicking with following:

Thread 'tokio-runtime-worker' panicked at 'Sensible defaults are tested to be valid; qed: ValidationErrors { has_errors: true, errors: ["[DispatchClass::Normal] Weight { ref_time: 1500000000000, proof_size: 0 } (total) has to be greater than Weight { ref_time: 5346284000, proof_size: 0 } (base block) & Weight { ref_time: 86298000, proof_size: 0 } (base extrinsic)", "[DispatchClass::Normal] Some(Weight { ref_time: 1299913702000, proof_size: 0 }) (max_extrinsic) must not be 0. Check base cost and average initialization cost.", "[DispatchClass::Normal] Weight { ref_time: 2000000000000, proof_size: 0 } (max block) must fit at least one extrinsic Weight { ref_time: 5432582000, proof_size: 0 } (base weight)", "[DispatchClass::Operational] Weight { ref_time: 2000000000000, proof_size: 0 } (total) has to be greater than Weight { ref_time: 5346284000, proof_size: 0 } (base block) & Weight { ref_time: 86298000, proof_size: 0 } (base extrinsic)", "[DispatchClass::Operational] Some(Weight { ref_time: 1799913702000, proof_size: 0 }) (max_extrinsic) must not be 0. Check base cost and average initialization cost.", "[DispatchClass::Operational] Weight { ref_time: 500000000000, proof_size: 0 } (reserved) has to be greater than Weight { ref_time: 86298000, proof_size: 0 } (base extrinsic) if set", "[DispatchClass::Operational] Weight { ref_time: 2000000000000, proof_size: 0 } (max block) must fit at least one extrinsic Weight { ref_time: 5432582000, proof_size: 0 } (base weight)", "[DispatchClass::Mandatory] Weight { ref_time: 2000000000000, proof_size: 0 } (max block) must fit at least one extrinsic Weight { ref_time: 5432582000, proof_size: 0 } (base weight)"] }', /home/nazar-pc/.cargo/git/checkouts/substrate-7bc20b373ca3e834/4fa79c1/frame/system/src/limits.rs:335

I have changed this:

BlockWeights::with_sensible_defaults(WEIGHT_PER_SECOND.saturating_mul(2), NORMAL_DISPATCH_RATIO)

To this:

BlockWeights::with_sensible_defaults(WEIGHT_PER_SECOND.saturating_mul(2).set_proof_size(1), NORMAL_DISPATCH_RATIO)

Now I'm getting another panic:

2022-11-09 03:43:28 [PrimaryChain] Proposing failed: Import failed: Error at calling runtime api: Execution failed: Runtime panicked: Sensible defaults are tested to be valid; qed: ValidationErrors { has_errors: true, errors: ["[DispatchClass::Operational] Weight { ref_time: 500000000000, proof_size: 0 } (reserved) has to be greater than Weight { ref_time: 86298000, proof_size: 0 } (base extrinsic) if set"] }    

There must be something wrong with Substrate if chains without PoV are required to be aware of such things.

Steps to reproduce

No response

@nazar-pc
Copy link
Contributor Author

nazar-pc commented Nov 9, 2022

u64::MAX instead of 1 worked, despite I don't see how from the error. Weird...

@nazar-pc nazar-pc closed this as completed Nov 9, 2022
@bkchr
Copy link
Member

bkchr commented Nov 9, 2022

CC @KiChjang

@ggwpez
Copy link
Member

ggwpez commented Nov 9, 2022

There was a SE question about it https://substrate.stackexchange.com/questions/5557/construct-runtime-integrity-test-failing
since some of the invariants dont hold anymore with pov_size = 0.

PS: Just saw that you already found that 😆

@bkchr
Copy link
Member

bkchr commented Nov 9, 2022

But he said that he used 1 and not 0?

@ggwpez
Copy link
Member

ggwpez commented Nov 9, 2022

But he said that he used 1 and not 0?

Looks like only for the NORMAL and not for the OPERATIONAL class.

@nazar-pc
Copy link
Contributor Author

Looks like only for the NORMAL and not for the OPERATIONAL class.

Yeah, I think because NORMAL_DISPATCH_RATIO was 75% and 75% of 1 is 0 🤷‍♂️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants