Properly set the max proof size weight on defaults and tests (#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
This commit is contained in:
Keith Yeung
2022-09-29 23:48:10 +08:00
committed by GitHub
parent 7bea0c0175
commit a4fb1d7096
22 changed files with 323 additions and 107 deletions
@@ -1011,10 +1011,8 @@ pub mod pallet {
// unlikely to ever return an error: if phase is signed, snapshot will exist.
let size = Self::snapshot_metadata().ok_or(Error::<T>::MissingSnapshotMetadata)?;
// TODO: account for proof size weight
ensure!(
Self::solution_weight_of(&raw_solution, size).ref_time() <
T::SignedMaxWeight::get().ref_time(),
Self::solution_weight_of(&raw_solution, size).all_lt(T::SignedMaxWeight::get()),
Error::<T>::SignedTooMuchWeight,
);
@@ -2342,9 +2340,8 @@ mod tests {
};
let mut active = 1;
// TODO: account for proof size weight
while weight_with(active).ref_time() <=
<Runtime as frame_system::Config>::BlockWeights::get().max_block.ref_time() ||
while weight_with(active)
.all_lte(<Runtime as frame_system::Config>::BlockWeights::get().max_block) ||
active == all_voters
{
active += 1;