Raise offence queue eras bound limit#11435
Conversation
|
/cmd prdoc --audience runtime_dev --bump patch |
…time_dev --bump patch'
|
/cmd prdoc --audience runtime_dev --bump minor --force |
…time_dev --bump minor --force'
|
Few comments:
|
|
/cmd bench --pallet pallet_staking_async --runtime asset-hub-westend |
|
Command "bench --pallet pallet_staking_async --runtime asset-hub-westend" has started 🚀 See logs here |
…t_staking_async --runtime asset-hub-westend'
|
Command "bench --pallet pallet_staking_async --runtime asset-hub-westend" has finished ✅ See logs here DetailsSubweight results:
Command output:✅ Successful benchmarks of runtimes/pallets: |
| // Minimum execution time: 151_823_000 picoseconds. | ||
| Weight::from_parts(162_698_000, 0) | ||
| .saturating_add(Weight::from_parts(0, 0)) | ||
| // Estimated: `4218` |
There was a problem hiding this comment.
@ggwpez - weights generated by #10794 seemed a bit off. Bunch of Estimated: 0 for example etc
This PR doesn't introduce significant changes and affects only few benchmarks where we actually access the OffenceQueueEras and as expected - we are seeing e.g.
Staking::OffenceQueueEras max_size increased: 9 → 17 (added: 504 → 512) This is the change from this branch — the raised offence queue limit.
For the rest the results are basically very close to what we have on chain before #10794
There was a problem hiding this comment.
Hm weird... I think there is a non-determinism bug somewhere in the PoV benchmarking, but its highly unlikely to trigger for all extrinsics like it did in that MR.
No idea honestly, but can look into it when i have time.
@kianenigma , @Ank4n wdyt? Kian, in the related issue you were hinting as raising the bound as proper solution. I am fine with that, I would prefer the conversion to Vec + force_from approach but I would like to understand the reason behind your preference (or it was mostly because it was good enough and faster to implement?) |
| impl<T: Config> Get<u32> for OffenceQueueErasBound<T> { | ||
| fn get() -> u32 { | ||
| let bonding_duration = T::BondingDuration::get(); | ||
| bonding_duration.saturating_add(bonding_duration) |
There was a problem hiding this comment.
Maybe we should take a min of this and something like 10, so its never 0.
There was a problem hiding this comment.
Actually, we don't need to double it, we just need to add few eras so the system has time to clear the offences. So, something likebonding_duration.saturating_add(10) will do.
IMO this is a non-issue. I don't see how we can exceed In any case, I don't see any harm in going with this solution . Also benchmark should not really get affected because we still have bonding duration worth of eras. |
IIUC, this is true for polkadot / any real current runtime configuration. Let's consider this example:
In this case:
The check here discards new offences With After three offence reports arrive (one each for eras 0, 1, and 2), A fourth offence report for era 3 arrives => it is inserted into Do I get it right? If my example makes sense (maybe it's just theoretical / not plausible / not possible / I get something seriously wrong - all very possible 😄 ), then this PR makes the code more robust and maybe it's worth adding a similar test to prove it. |
| } | ||
| } | ||
|
|
||
| const OFFENCE_QUEUE_ERAS_BOUND: u32 = 10; |
There was a problem hiding this comment.
What is the purpose of this? Why is it 10? Why isn't it used anywhere besides the Get impl below?
There was a problem hiding this comment.
The scope could be limited since it's used only in the get impl below indeed - that came from (my 😅 ) comment where magic number 10 was used in two different places - but can be revised and kept where it is used only.
About why 10 and not 20, or 2*bonding_duration or anything else - this is very arbitrary. My understanding of this issue - but please @Ank4n , and @cirko33 (these days at EthCc so might not answer promptly) is that
- the original issue reporting during audit is not a realistic one since we have 1 era to apply all slashes in an era and so it is practically impossible for count to exceed
BondingDuration. - considering the above, the scope of
WeakBoundedVectorhere is not to protect against offence spam vs slow processing but rather being robust in case during a runtime upgrade we lowerBondingDurationand then we still want to be sure to be able to process offences from old eras that wouldn't fit in the post-RUOffenceQueueEras. Now,10is a magic number that might or might not work in this case and whatever number might not be good enough here. If we want to be more robust, and we still don't want to go for the hackish way of going through Vec conversion +force_from()discussed in other comments in this PR, one could assume that in the case someone wants to lower BondingDuration, it must provides also an ad-hoc migration or something like that.
Wdyt?
Fixes a bug where **OffenceQueueEras** bound (BondingDuration) was incorrect when `SlashDeferDuration=0`. The oldest reportable offence era formula allowed more eras than the bound could hold. --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com> (cherry picked from commit de0a245)
|
Successfully created backport PR for |
Squashed commit of the following: commit 1b3ad0b Author: Alexandru Vasile <alexandru.vasile@parity.io> Date: Wed Apr 1 10:55:36 2026 +0000 Adjust metrics Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> commit 61d37db Author: Alexandru Vasile <alexandru.vasile@parity.io> Date: Wed Apr 1 09:58:38 2026 +0000 metrics: Bump some other buckets Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> commit ab2a221 Author: Alexandru Vasile <alexandru.vasile@parity.io> Date: Wed Apr 1 09:57:11 2026 +0000 collator-proto/metrics: Fix blindspot in collation fetch latency metrics Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> commit 0d6888a Author: Ankan <10196091+Ank4n@users.noreply.github.com> Date: Wed Apr 1 00:18:21 2026 +0200 Implement Budget Distribution logic in pallet-dap (#11527) Stacked on #11513. Extracted from #10844. ## Overview Adds issuance drip and budget distribution to `pallet-dap`. DAP becomes a generic inflation engine: it mints new tokens on a configurable cadence and distributes them to registered budget recipients. No runtime behavior change: the existing chain configuration continues to mint via `EraPayout` trait in staking. DAP can be configured as a noop (cadence = 0 or empty budget). ## Changes ### pallet-dap - **Issuance drip**: `drip_issuance()` runs in `on_initialize`. Computes mint amount via `IssuanceCurve` (total issuance + elapsed time) and distributes to `BudgetRecipient`s per a governance-updatable `BudgetAllocation` map that must sum to 100%. - **Safety guards**: `MaxElapsedPerDrip` ceiling prevents over-minting if the chain stalls. First-block initialization skips drip to avoid minting for an unknown period. - **Buffer accounting**: buffer's share is deactivated on inflow (mint + `OnUnbalanced` slashes). - **`set_budget_allocation`** extrinsic (root-only): validates keys match registered recipients and percentages sum to exactly 100%. - **`BudgetRecipient` impl**: DAP exposes its buffer as a recipient (key: `"buffer"`). - **Migration**: `MigrateV1ToV2` seeds `LastIssuanceTimestamp` and `BudgetAllocation` for existing chains. Not wired up in WAH or other runtimes yet. ## TODOs - [x] Wire benchmark weights. ## In Later PR - Revert [these changes](9b388b2) --------- Co-authored-by: Paolo La Camera <paolo@parity.io> commit 8b53323 Author: Javier Viola <363911+pepoviola@users.noreply.github.com> Date: Tue Mar 31 21:26:58 2026 +0200 bump zombienet version to v0.4.9 (#11569) This version move the internal monitor to a diff log target, eliminating the current spam of tracing logs. Thx! --------- Co-authored-by: Bastian Köcher <git@kchr.de> commit 129a48a Author: Ankan <10196091+Ank4n@users.noreply.github.com> Date: Tue Mar 31 19:06:21 2026 +0200 [Staking] Add issuance and budget traits in prep for Budget Split (#11513) # Overview Moves `EraPayout` trait to `sp-staking` and adds new traits for issuance, budget distribution, and reward calculation. Extracted changes from the main PR: #10844 Also see: #11512 ## Changes ### sp-staking - `EraPayout`: moved from `pallet-staking` and `pallet-staking-async` to `sp-staking`, eliminating the duplicate definitions. - `budget` module: stake independent traits: - `IssuanceCurve`: successor to `EraPayout`, computes issuance from total supply + elapsed time (no staking state dependency). - `BudgetRecipient` / `BudgetRecipientList`: register pot accounts for inflation distribution. Runtime wires as a tuple. - `BudgetKey`: bounded identifier for budget categories. - `StakerRewardCalculator`: trait for calculating validator incentive weights and staker reward splits. ### pallet-staking / pallet-staking-async - Removed local `EraPayout` definitions, re-exported from `sp-staking`. --------- Co-authored-by: Paolo La Camera <paolo@parity.io> commit 10a517e Author: Dmitry Markin <dmitry@markin.tech> Date: Tue Mar 31 18:37:01 2026 +0300 Implement `bitswap_v1_get` RPC method (#11521) Implement `bitswap_v1_get` RPC method according to the [spec](https://github.com/paritytech/json-rpc-interface-spec/blob/main/src/api/bitswap_v1_get.md). --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Lukasz Rubaszewski <117115317+lrubasze@users.noreply.github.com> commit 2c99855 Author: Paolo La Camera <paolo@parity.io> Date: Tue Mar 31 16:42:03 2026 +0200 Fix can_inc_consumer check blocking session key rotation in pallet_session (#11573) Check consumer capacity only when we actually increment the consumer count (first-time local registration or external-to-local transition), not on key rotation. Notes: 1. setting keys via `stakingRcClient` didn't suffer of this issue since by-pass `do_set_keys()` 2. setting and purging keys via session pallet directly on RC is deprecated and will be removed soon - but better safe than sorry till then --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> commit de0a245 Author: Luka Ciric <luka.ciric2106@gmail.com> Date: Tue Mar 31 16:39:48 2026 +0200 Raise offence queue eras bound limit (#11435) Fixes a bug where **OffenceQueueEras** bound (BondingDuration) was incorrect when `SlashDeferDuration=0`. The oldest reportable offence era formula allowed more eras than the bound could hold. --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com> Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Backport #11435 into `stable2603` from cirko33. See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot. <!-- # To be used by other automation, do not modify: original-pr-number: #${pull_number} --> Co-authored-by: Luka Ciric <luka.ciric2106@gmail.com> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com>
Fixes a bug where **OffenceQueueEras** bound (BondingDuration) was incorrect when `SlashDeferDuration=0`. The oldest reportable offence era formula allowed more eras than the bound could hold. --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com>
Fixes a bug where OffenceQueueEras bound (BondingDuration) was incorrect when
SlashDeferDuration=0. The oldest reportable offence era formula allowed more eras than the bound could hold.