Skip to content

fix: backport check-weight Mandatory bypass for session-boundary panic (polkadot-sdk #4592)#22

Merged
kumanoko24 merged 1 commit into
release/v1.12.0from
fix/check-weight-mandatory
Apr 12, 2026
Merged

fix: backport check-weight Mandatory bypass for session-boundary panic (polkadot-sdk #4592)#22
kumanoko24 merged 1 commit into
release/v1.12.0from
fix/check-weight-mandatory

Conversation

@DrudgeRajen
Copy link
Copy Markdown
Collaborator

Summary

Cherry-pick of upstream polkadot-sdk PR #4592 (backport of #4571) from the release-polkadot-v1.12.0 maintenance branch.

Fixes: Leafchain collator panics with set_validation_data inherent needs to be present in every block! at every session boundary block after upgrading to polkadot-v1.12.0.

Root cause

  • pallet_session::on_initialize at session boundaries returns T::BlockWeights::get().max_block weight, filling the entire PoV budget (proof_size = 5,242,880)
  • check_combined_proof_size (introduced in PR CheckWeight SE: Check for extrinsic length + proof size combined paritytech/polkadot-sdk#4326, 3 days before the v1.12.0 tag) rejects ALL subsequent extrinsics — no DispatchClass::Mandatory bypass existed
  • basic_authorship::apply_inherents silently drops the Mandatory inherent as "non-mandatory" due to match arm ordering
  • parachain_system::on_finalize panics because ValidationData was never set

This is upstream bug polkadot-sdk#4559 — Asset Hub Rococo hit the exact same error after their v1.12.0 upgrade.

Why we didn't have the fix

The polkadot-v1.12.0 tag was cut on 2024-05-16. The fix was merged 11 days later (2024-05-27). Parity never cut a v1.12.1 patch tag. Our fork was built from the tag, missing all 6 maintenance-branch backports.

The fix

~15 lines in substrate/frame/system/src/extensions/check_weight.rs:

  • Adds info: &DispatchInfoOf<Call> parameter to check_combined_proof_size
  • After detecting over-limit: Mandatory → Ok(()), others → Err(ExhaustsResources)

Important: binary rebuild required

NativeElseWasmExecutor always picks native when versions match. WASM overrides and --execution=wasm are no-ops. Both binary AND WASM must be rebuilt.

Verified on forked testnet

  • Block #7182000 (session boundary) built successfully after deploying rebuilt binary
  • Chain advanced to #7182127+ producing/finalizing normally
  • Patched log confirmed: "Still including if mandatory. size: 5127kb, limit: 5120kb, is_mandatory: true"

References

🤖 Generated with Claude Code

…tory extrinsics (paritytech#4592)

Backport of paritytech#4571

---------

Co-authored-by: command-bot <>
@kumanoko24 kumanoko24 merged commit d525b93 into release/v1.12.0 Apr 12, 2026
19 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants