Skip to content

Commit 84762bb

Browse files
skunertdnjscksdn98
authored andcommitted
Backport 1.12.0: check-weight: Disable total pov size check for mandatory extrinsics (paritytech#4592)
Backport of paritytech#4571 --------- Co-authored-by: command-bot <>
1 parent 51a1705 commit 84762bb

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

prdoc/1.12.0/pr_4571.prdoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
2+
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
3+
4+
title: Ignore mandatory extrinsics in total PoV size check
5+
6+
doc:
7+
- audience: Runtime Dev
8+
description: |
9+
The `CheckWeight` extension is checking that extrinsic length and used storage proof
10+
weight together do not exceed the PoV size limit. This lead to problems when
11+
the PoV size was already reached before mandatory extrinsics were applied.The `CheckWeight`
12+
extension will now allow extrinsics of `DispatchClass::Mandatory` to be applied even if
13+
the limit is reached.
14+
15+
crates:
16+
- name: frame-system
17+
bump: minor

substrate/frame/system/src/extensions/check_weight.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
1717

18-
use crate::{limits::BlockWeights, Config, Pallet, LOG_TARGET};
18+
use crate::{limits::BlockWeights, Config, DispatchClass, Pallet, LOG_TARGET};
1919
use codec::{Decode, Encode};
2020
use frame_support::{
2121
dispatch::{DispatchInfo, PostDispatchInfo},
@@ -822,6 +822,12 @@ mod tests {
822822
consumed.total().saturating_sub(all_weight.total()),
823823
normal.weight.add_proof_size(100)
824824
);
825+
assert_ok!(check_combined_proof_size::<<Test as Config>::RuntimeCall>(
826+
&mandatory,
827+
&maximum_weight,
828+
6,
829+
&next_weight
830+
));
825831

826832
let consumed = calculate_consumed_weight::<<Test as Config>::RuntimeCall>(
827833
&maximum_weight,
@@ -835,6 +841,12 @@ mod tests {
835841
consumed.total().saturating_sub(all_weight.total()),
836842
mandatory.weight.add_proof_size(100)
837843
);
844+
assert_ok!(check_combined_proof_size::<<Test as Config>::RuntimeCall>(
845+
&mandatory,
846+
&maximum_weight,
847+
1,
848+
&next_weight
849+
));
838850

839851
// Using oversized zero length extrinsics.
840852
let consumed = calculate_consumed_weight::<<Test as Config>::RuntimeCall>(

0 commit comments

Comments
 (0)