Skip to content

Commit

Permalink
Backport 1.12.0: check-weight: Disable total pov size check for manda…
Browse files Browse the repository at this point in the history
…tory extrinsics (paritytech#4592)

Backport of paritytech#4571

---------

Co-authored-by: command-bot <>
  • Loading branch information
skunert authored and dnjscksdn98 committed Sep 20, 2024
1 parent 51a1705 commit 84762bb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
17 changes: 17 additions & 0 deletions prdoc/1.12.0/pr_4571.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Ignore mandatory extrinsics in total PoV size check

doc:
- audience: Runtime Dev
description: |
The `CheckWeight` extension is checking that extrinsic length and used storage proof
weight together do not exceed the PoV size limit. This lead to problems when
the PoV size was already reached before mandatory extrinsics were applied.The `CheckWeight`
extension will now allow extrinsics of `DispatchClass::Mandatory` to be applied even if
the limit is reached.

crates:
- name: frame-system
bump: minor
14 changes: 13 additions & 1 deletion substrate/frame/system/src/extensions/check_weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::{limits::BlockWeights, Config, Pallet, LOG_TARGET};
use crate::{limits::BlockWeights, Config, DispatchClass, Pallet, LOG_TARGET};
use codec::{Decode, Encode};
use frame_support::{
dispatch::{DispatchInfo, PostDispatchInfo},
Expand Down Expand Up @@ -822,6 +822,12 @@ mod tests {
consumed.total().saturating_sub(all_weight.total()),
normal.weight.add_proof_size(100)
);
assert_ok!(check_combined_proof_size::<<Test as Config>::RuntimeCall>(
&mandatory,
&maximum_weight,
6,
&next_weight
));

let consumed = calculate_consumed_weight::<<Test as Config>::RuntimeCall>(
&maximum_weight,
Expand All @@ -835,6 +841,12 @@ mod tests {
consumed.total().saturating_sub(all_weight.total()),
mandatory.weight.add_proof_size(100)
);
assert_ok!(check_combined_proof_size::<<Test as Config>::RuntimeCall>(
&mandatory,
&maximum_weight,
1,
&next_weight
));

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

0 comments on commit 84762bb

Please sign in to comment.