Conversation
|
/cmd prdoc --audience runtime-dev |
|
Command "prdoc --audience runtime-dev" has failed ❌! See logs here |
|
|
||
| Ok(PostDispatchInfo { actual_weight: Some(total_weight), pays_fee: Pays::No }) | ||
| frame_system::Pallet::<T>::register_extra_weight_unchecked( | ||
| total_weight, |
There was a problem hiding this comment.
I assume we don't know an upper bound for this value pre-dispatch because it is calculated ad-hoc?
There was a problem hiding this comment.
Yes but it's once per block and we register the weight, meaning it will be correctly accounted for in the following transactions.
If we go with the worst case weight here before dispatching, we might greatly underestimate the block space we have since those stuctures in ParachainInherentData can grow a lot as far as I'm aware. This model works best IMO.
| DispatchClass::Mandatory, | ||
| ); | ||
|
|
||
| Ok(Pays::No.into()) |
There was a problem hiding this comment.
Nit: You can change the return type of the dispatchable to just DispatchResult.
|
|
||
| Ok(PostDispatchInfo { actual_weight: Some(total_weight), pays_fee: Pays::No }) | ||
| frame_system::Pallet::<T>::register_extra_weight_unchecked( | ||
| total_weight, |
There was a problem hiding this comment.
Yes but it's once per block and we register the weight, meaning it will be correctly accounted for in the following transactions.
If we go with the worst case weight here before dispatching, we might greatly underestimate the block space we have since those stuctures in ParachainInherentData can grow a lot as far as I'm aware. This model works best IMO.
| DispatchClass::Mandatory, | ||
| ); | ||
|
|
||
| Ok(Pays::No.into()) |
There was a problem hiding this comment.
Does it make a difference here if we just return this vs Ok(PostDispatchInfo { actual_weight: Some(total_weight), pays_fee: Pays::No })? It would look more correct to me
There was a problem hiding this comment.
That is what we were doing before (this PR removes this line) and it was incorrect. This is because you cant (or should not) return a post dispatch weight that is higher than the pre dispatch weight. It will not be charged. Hence the error that was emitted by try runtime.
|
This indeed gets rid of the message for Here only the polkadot-sdk/substrate/frame/support/src/dispatch.rs Lines 313 to 320 in e5a9dab Maybe we need to move it again so that we can differentiate between para and relaychain. |
|
Do you know which dispatchable is causing that? We can just give it the same treatment. Or if it is a pallet only used on the relay chain (where PoV doesn't matter) just set pre-dispatch PoV to something super high? |
Or do not print it if |
I have kept other logs in storage weight reclaim. I just added this log because it was scary to silently ignoring post dispatch excess weight.
If the pallet is only used in relay chain and we don't want to fix the benchmark or weight calculation for the call, we can also set the proof size in the post info equal to the pre-dispatch info. |
Command help: |
* master: (58 commits) [pallet-revive] pack exceeding syscall arguments into registers (#7319) cumulus: bump PARENT_SEARCH_DEPTH and add test for 12-core elastic scaling (#6983) xcm: fix for DenyThenTry Barrier (#7169) Migrating polkadot-runtime-common slots benchmarking to v2 (#6614) Add development chain-spec file for minimal/parachain templates for Omni Node compatibility (#6529) `Arc` definition in `TransactionPool` (#7042) [sync] Let new subscribers know about already connected peers (backward-compatible) (#7344) Removed unused dependencies (partial progress) (#7329) Improve debugging by using `#[track_caller]` in system `assert_last_event` and `assert_has_event` (#7142) `set_validation_data` register weight manually, do not use refund when the pre dispatch is zero. (#7327) Fix the link to the chain snapshots (#7330) revive: Fix compilation of `uapi` crate when `unstable-hostfn` is not set (#7318) [pallet-revive] eth-rpc minor fixes (#7325) sync-templates: enable syncing from stable release patches (#7227) Bridges: emulated tests small nits/improvements (#7322) fix(cmd bench-omni): build omni-bencher with production profile (#7299) Nits for collectives-westend XCM benchmarks setup (#7215) bench all weekly - and fix for pallet_multisig lib (#6789) Deprecate ParaBackingState API (#6867) Fix setting the image properly (#7315) ...
Related #6772
For an extrinsic, in the post dispatch info, the actual weight is only used to reclaim unused weight. If the actual weight is more than the pre dispatch weight, then the extrinsic is using the minimum, e.g., the weight used registered in pre dispatch.
In parachain-system pallet one call is
set_validation_data. This call is returning an actual weight, but the pre-dispatch weight is 0.This PR fix the disregard of actual weight of
set_validation_databy registering it manually.