-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Properly set the max proof size weight on defaults and tests #12383
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much needed, thanks.
You chose u64::MAX
as a default since it would get rejected by any sensible relay-chain config (if used in a para-chain)?
Because it allows chains that don't care about PoV sizes to safely ignore this weight component. Maybe I should write this in the docs somewhere so that people know that they should use |
I guess this brings to mind that maybe this should be an But generally speaking, this kind of thing is what Rust is good at describing with explicit types, so just want to call that out. |
Exactly what I said on element :P |
I thought about this, but it actually doesn't help much, because there's actually two default values: one defaults to max where it's being used to determine the maximum proof size for a block, and the other defaults to 0 where it's sensible for measuring the proof size of an actual operation. Even if we create new types for this, we can't escape the fact that whenever you define the max block for a chain, you'd still have to manually define the max proof size, rather than relying on the 0 default. And if we try and do it the other way around and make the default |
/// We allow for 2 seconds of compute with a 6 second average block time. | ||
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_mul(2); | ||
/// We allow for 2 seconds of compute with a 6 second average block time, with maximum proof size. | ||
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_mul(2).set_proof_size(u64::MAX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a general note, this will not work for Parachains. Parachains have the max proof size defined by the relay chain and this value could change any block (it isn't but it is a value that is changeable on the relay chain). So, we would need to have a dynamic way of getting the max proof size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkchr getting the weight of the pov from the validation data is a solution here right? Because, this "could" change from the relay side dynamically, or can we just assume that MAX_POV_SIZE
from the primitives is always good to use statically?
Maybe we should get rid off the |
bot merge |
* Properly set the max proof size weight on defaults and tests * cargo fmt * Set proper max proof size for contracts pallet tests * Properly set max proof size for node * Properly set max proof size for frame system mock * Update test expectations * Update test expectations * Properly set max proof size for balances mock * Update test expectations * Update test expectations * Properly set max proof size for democracy mock * Properly set max proof size for scheduler mock * Properly set max proof size for fast unstake mock * Properly set max proof size for tx payment mock * Properly set max proof size for elections phragmen mock * Properly set max proof size for node template
* master: (42 commits) Adapt `pallet-contracts` to WeightV2 (#12421) Improved election pallet testing (#12327) Bump prost to 0.11+ (#12419) Use saturating add for alliance::disband witness data (#12418) [Fix] Rename VoterBagsList -> VoterList to match pdot (#12416) client/beefy: small code improvements (#12414) BEEFY: Simplify hashing for pallet-beefy-mmr (#12393) Add @koute to `docs/CODEOWNERS` and update stale paths (#12408) docs/CODEOWNERS: add @acatangiu as MMR owner (#12406) Remove unnecessary Clone trait bounds on CountedStorageMap (#12402) Fix `Weight::is_zero` (#12396) Beefy on-demand justifications as a custom RequestResponse protocol (#12124) Remove contracts RPCs (#12358) pallet-mmr: generate historical proofs (#12324) unsafe_pruning flag removed (#12385) Carry over where clauses defined in Config to Call and Hook (#12388) Properly set the max proof size weight on defaults and tests (#12383) BEEFY: impl TypeInfo for SignedCommitment (#12382) bounding staking: `BoundedElectionProvider` trait (#12362) New Pallet: Root offences (#11943) ...
…ech#12383) * Properly set the max proof size weight on defaults and tests * cargo fmt * Set proper max proof size for contracts pallet tests * Properly set max proof size for node * Properly set max proof size for frame system mock * Update test expectations * Update test expectations * Properly set max proof size for balances mock * Update test expectations * Update test expectations * Properly set max proof size for democracy mock * Properly set max proof size for scheduler mock * Properly set max proof size for fast unstake mock * Properly set max proof size for tx payment mock * Properly set max proof size for elections phragmen mock * Properly set max proof size for node template
Part of paritytech/polkadot-sdk#256.
This PR sets the default proof size weight correctly, so that it passes unit tests as intended.
The default max proof size is set at
u64::MAX
, because not all substrate-based chains require submitting PoV blocks to the relay -- standalone sovereign chains can safely ignore this weight component.For parachains however, the proper parameter to set for the max proof size comes from the relay chain, and is stored a field called
max_pov_size
in this struct: https://github.com/paritytech/cumulus/blob/032540dbf9afc9f5a0d5db7279fc81048f3a168b/pallets/parachain-system/src/lib.rs#L526.