- Mar 06, 2025
-
-
Dónal Murray authored
Asset Hub Next has been deployed on Westend as parachain 1100, but it's not yet a trusted teleporter. This minimal PR adds it in stable2412 so that it can be deployed right away without waiting for the rest of the release to be finalised and deployed. --------- Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
Raymond Cheung authored
This PR enhances **`test_log_capture`**, ensuring logs are **captured for assertions** and **printed to the console** during test execution. ## **Motivation** - Partially addresses #6119 and #6125, to improves developer **tracing and debugging** in XCM-related tests. - Builds on #7594, improving **log visibility** while maintaining test **log capture capabilities**. - While writing tests for #7234, I noticed this function was missing. This PR adds it to streamline log handling in unit tests. ## **Changes** - Ensures logs up to `TRACE` level are **captured** (for assertions) and **printed** (for visibility). - Refines documentation to clearly specify **when to use** each function. - **Removes ANSI escape codes** from captured logs to ensure clean, readable assertions. ## **When to Use?** | Usage | Captures Logs? | Prints Logs? | Example | |----------------------------------------------|-----------------|--------------|-----------------------------------------------| | `init_log_capture(LevelFilter::INFO, false)` |
Yes | No | Capture logs for assertions without printing. | | `init_log_capture(LevelFilter::TRACE, true)` | Yes | Yes | Capture logs and print them in test output. | | `sp_tracing::init_for_tests()` | No | Yes | Print logs to the console without capturing. | --------- Co-authored-by:cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
Andrei Sandu authored
Fixes https://github.com/paritytech/polkadot-sdk/issues/7664 The discussion in https://github.com/paritytech/polkadot-sdk/pull/7710 should provide the context for why this solution was picked. --------- Signed-off-by:
Andrei Sandu <andrei-mihail@parity.io> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
- Mar 05, 2025
-
-
Nathaniel Bajo authored
I added a new `ExternalConsensusLocationsConverterFor` struct to handle external global consensus locations and their child locations. This struct extends the functionality of existing converters (`GlobalConsensusParachainConvertsFor` and `EthereumLocationsConverterFor`) while maintaining backward compatibility. Fixes https://github.com/paritytech/polkadot-sdk/issues/7129 Polkadot address: 121HJWZtD13GJQPD82oEj3gSeHqsRYm1mFgRALu4L96kfPD1 --------- Co-authored-by:
Adrian Catangiu <adrian@parity.io> Co-authored-by:
ndk <ndk@parity.io>
-
Dmitry Markin authored
Allow adding extra request-response protocols during polkadot service initialization. This is required to add a request-response protocol described in [RFC-0008](https://polkadot-fellows.github.io/RFCs/approved/0008-parachain-bootnodes-dht.html) to the relay chain side of the parachain node. ### Review notes The PR might look scary due to a lot of code being moved. It is easier to review it on a per-commit basis. The commits do not containing changes to the code logic are named accordingly. --------- Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
- Mar 04, 2025
-
-
Xavier Lau authored
- Refactor to use the `frame` crate. - Use procedural macro version `construct_runtime` in mock. - Expose `PalletId` to `frame::pallet_prelude`. - Part of #6202. --- Polkadot address: 156HGo9setPcU2qhFMVWLkcmtCEGySLwNqa3DaEiYSWtte4Y --------- Signed-off-by:
Xavier Lau <x@acg.box> Co-authored-by:
GitHub Action <action@github.com> Co-authored-by:
Giuseppe Re <giuseppe.re@parity.io> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
Ludovic_Domingues authored
# Description Migrating polkadot-runtime-parachains configuration benchmarking to the new benchmarking syntax v2. This is a part of #6202 --------- Co-authored-by:
Giuseppe Re <giuseppe.re@parity.io> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by:
seemantaggarwal <32275622+seemantaggarwal@users.noreply.github.com>
-
- Feb 28, 2025
-
-
Serban Iorga authored
Related to https://github.com/paritytech/polkadot-sdk/issues/7360 This PR adds `DecodeWithMemTracking` as a trait bound for `Header`, `Block` and `TransactionExtension` and derives it for all the types that implement these traits in `polkadot-sdk`.
-
- Feb 27, 2025
-
-
Raymond Cheung authored
A follow-up PR to simplify event assertions by introducing `contains_event`, allowing event checks without needing exact field matches. This reduces redundancy and makes tests more flexible. Partially addresses #6119 by providing an alternative way to assert events. Reference: [PR #7594 - Discussion](https://github.com/paritytech/polkadot-sdk/pull/7594#discussion_r1965566349) --------- Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by:
Branislav Kontur <bkontur@gmail.com> Co-authored-by:
Bastian Köcher <git@kchr.de>
-
Utkarsh Bhardwaj authored
# Description * This PR adds a new extrinsic `poke_deposit` to `pallet-multisig`. This extrinsic will be used to re-adjust the deposits made in the pallet to create a multisig operation after AHM. * Part of #5591 ## Review Notes * Added a new extrinsic `poke_deposit` in `pallet-multisig`. * Added a new event `DepositPoked` to be emitted upon a successful call of the extrinsic. * Although the immediate use of the extrinsic will be to give back some of the deposit after the AH-migration, the extrinsic is written such that it can work if the deposit decreases or increases (both). * The call to the extrinsic would be `free` if an actual adjustment is made to the deposit and `paid` otherwise. * Added tests to test all scenarios. ## TO-DOs * [x] Add Benchmark * [x] Run CI cmd bot to benchmark --------- Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by:
Giuseppe Re <giuseppe.re@parity.io>
-
Egor_P authored
This PR backports version bumps and prdocs reorg from the latest stable branch back to master
-
- Feb 26, 2025
-
-
Ankan authored
closes https://github.com/paritytech/polkadot-sdk/issues/5742 Need to be backported to stable2503 release. With the migration of staking accounts to [fungible currency](https://github.com/paritytech/polkadot-sdk/pull/5501), we can now allow pool users to stake directly and vice versa. This update introduces a configurable filter mechanism to determine which accounts can join a nomination pool. ## Example Usage ### 1. Allow any account to join a pool To permit all accounts to join a nomination pool, use the `Nothing` filter: ```rust impl pallet_nomination_pools::Config for Runtime { ... type Filter = Nothing; } ``` ### 2. Restrict direct stakers from joining a pool To prevent direct stakers from joining a nomination pool, use `pallet_staking::AllStakers`: ```rust impl pallet_nomination_pools::Config for Runtime { ... type Filter = pallet_staking::AllStakers<Runtime>; } ``` ### 3. Define a custom filter For more gra...
-
Ludovic_Domingues authored
# Description Migrated polkadot-runtime-common paras_registrar benchmarking to the new benchmarking syntax v2. This is part of #6202 --------- Co-authored-by:
Giuseppe Re <giuseppe.re@parity.io>
-
Ludovic_Domingues authored
# Description Migrating polkadot-runtime-parachains paras_inherent benchmarking to the new benchmarking syntax v2. This is part of #6202 --------- Co-authored-by:
Giuseppe Re <giuseppe.re@parity.io>
-
Ludovic_Domingues authored
# Description Migrated polkadot-runtime-parachains initializer benchmarking to the new benchmarking syntax v2. This is part of #6202 Co-authored-by:
Giuseppe Re <giuseppe.re@parity.io>
-
Ludovic_Domingues authored
# Description Migrated polkadot-runtime-common crowdloan benchmarking to the new benchmarking syntax v2. this is part of #6202 Co-authored-by:
Giuseppe Re <giuseppe.re@parity.io> Co-authored-by:
seemantaggarwal <32275622+seemantaggarwal@users.noreply.github.com>
-
- Feb 24, 2025
-
-
Niklas Adolfsson authored
Partly fixes #7403 Subxt depends still on sp-crypto-hashing v0.7 but it's only one dependency after removing the substrate-compat feature which is probably "acceptable"
-
Francisco Aguirre authored
The `PayFees` instruction should only ever be used once. If it's used more than once, it's just a noop. --------- Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by:
Adrian Catangiu <adrian@parity.io>
-
CrabGopher authored
`sc-cli` brings rocksdb dependency into frame-benchmarking-cli when used with `default-features = false`. This PR makes rocksdb deps optional that sc-cli brings in some of the crates. I think I covered all the crates that depend on sc-cli but please let me know if I missed any. Fixes: https://github.com/paritytech/polkadot-sdk/issues/3793
-
Daniel Shiposha authored
# Description Fixes #7413 ## Integration This PR updates the `DryRunApi`. The signature of the `dry_run_call` is changed, and the XCM version of the return values of `dry_run_xcm` now follows the version of the input XCM program. ## Review Notes * **The `DryRunApi` is modified** * **Added the `Router::clear_messages` to `dry_run_xcm` common implementation** * **Fixed the xcmp-queue's Router's clear_messages: channels details' first_index and last_index are reset when clearing** * **The MIN_XCM_VERSION is added** * The common implementation in the `pallet-xcm` is modified accordingly * The `DryRunApi` tests are modified to account for testing old XCM versions * The implementation from the `pallet-xcm` is used where it was not used (including the `DryRunApi` tests) * All the runtime implementations are modified according to the Runtime API change --------- Co-authored-by:
Adrian Catangiu <adrian@parity.io>
-
Raymond Cheung authored
# Description This PR introduces a lightweight log-capturing mechanism for XCM unit tests, simplifying debugging by enabling structured log assertions. It partially addresses #6119 and #6125, offering an optional way to verify logs in tests while remaining unobtrusive in normal execution. # Key Changes * [x] Introduces a log capture utility in `sp_tracing`. * [x] Adds XCM test examples demonstrating how and when to use log capturing. # Review Notes: * The log capture mechanism is opt-in and does not affect existing tests unless explicitly used. * The implementation is minimal and does not add complexity to existing test setups. * It provides a structured alternative to [`sp_tracing::init_for_tests()`](https://paritytech.github.io/polkadot-sdk/master/sp_tracing/fn.init_for_tests.html) for log verification in automated tests. --------- Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
paritytech-cmd-bot-polkadot-sdk[bot] authored
Auto-update of all weights for 2025-02-21-1740149841. Subweight results: - [now vs master](https://weights.tasty.limo/compare?repo=polkadot-sdk&threshold=5&path_pattern=.%2F**%2Fweights%2F**%2F*.rs%2C.%2F**%2Fweights.rs&method=asymptotic&ignore_errors=true&unit=time&old=master&new=update-weights-weekly-2025-02-21-1740149841) - [now vs polkadot-v1.15.6 (2025-01-16)](https://weights.tasty.limo/compare?repo=polkadot-sdk&threshold=5&path_pattern=.%2F**%2Fweights%2F**%2F*.rs%2C.%2F**%2Fweights.rs&method=asymptotic&ignore_errors=true&unit=time&old=polkadot-v1.15.6&new=update-weights-weekly-2025-02-21-1740149841) - [now vs polkadot-v1.16.2 (2024-11-14)](https://weights.tasty.limo/compare?repo=polkadot-sdk&threshold=5&path_pattern=.%2F**%2Fweights%2F**%2F*.rs%2C.%2F**%2Fweights.rs&method=asymptotic&ignore_errors=true&unit=time&old=polkadot-v1.16.2&new=update-weights-weekly-2025-02-21-1740149841) Co-authored-by: github-actions[bot] <41898282+github-act...
-
- Feb 22, 2025
-
-
Al authored
# Description Creating this PR to changed Rotko Networks bootnode addresses to the new structure. Rotko bootnode addresses tested with this results: ``` { "asset-hub-kusama": { "bootnode": "/dns/asset-hub-kusama.boot.rotko.net/tcp/30435/wss/p2p/12D3KooWJUFnjR2PNbsJhudwPVaWCoZy1acPGKjM2cSuGj345BBu", "discovered_peers": 3, "error_details": null, "id": "rotko", "network": "asset-hub-kusama", "status": "success", "test_duration_ms": 19394, "valid": true }, "asset-hub-polkadot": { "bootnode": "/dns/asset-hub-polkadot.boot.rotko.net/tcp/30435/wss/p2p/12D3KooWKkzLjYF6M5eEs7nYiqEtRqY8SGVouoCwo3nCWsRnThDW", "discovered_peers": 5, "error_details": null, "id": "rotko", "network": "asset-hub-polkadot", "status": "success", "test_duration_ms": 5024, "valid": true }, "asset-hub-westend": { "bootnode": "/dns/asset-hub-westend.boot.rotko.net/tcp/30...
-
- Feb 21, 2025
-
-
Ayevbeosa Iyamu authored
# Description Added logs in pallet-xcm to help in debugging, fixes #2408, and in continuation of #4982 # Checklist - [x] https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-builder/src/ - [x] https://github.com/paritytech/polkadot-sdk/tree/master/cumulus/parachains/runtimes/assets/common/src - [x] runtime-defined XCM filters/converters (just [one example](https://github.com/paritytech/polkadot-sdk/blob/183b55aa /cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/xcm_config.rs#L284)) Polkadot Address: 1Gz5aLtEu2n4jsfA6XwtZnuaRymJrDDw4kEGdNHTdxrpzrc --------- Co-authored-by:
Ayevbeosa Iyamu <aiyamu@vatebra.com> Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by:
Adrian Catangiu <adrian@parity.io> Co-authored-by:
Raymond Cheung <178801527+raymondkfcheung@users.noreply.github.com> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.gi...>
-
Alexandru Gheorghe authored
The test was flaky and was disabled here https://github.com/paritytech/polkadot-sdk/issues/6345, looked at the flakiness https://github.com/paritytech/polkadot-sdk/issues/6345#issuecomment-2674063608 and it wasn't because of some bug in our production code, but because of the way the test interacts with the infrastructure. Since https://github.com/paritytech/polkadot-sdk/pull/7504 this test is now testing redundant things that other tests like 0009-approval-voting-coalescing.toml and 0006-parachains-max-tranche0 already cover, so instead of investing trying to fix it, just remove it. Fixes: https://github.com/paritytech/polkadot-sdk/issues/6345 Signed-off-by:
Alexandru Gheorghe <alexandru.gheorghe@parity.io>
-
- Feb 20, 2025
-
-
Utkarsh Bhardwaj authored
# Description * This PR adds a new extrinsic `reconsider` to `pallet-indices`. This extrinsic will be used to re-adjust the deposits made in the pallet. * Part of #5591 ## Review Notes * Added a new extrinsic `reconsider` in `pallet-indices`. * Added a new event `DepositReconsidered` to be emitted upon a successful call of the extrinsic. * Although the immediate use of the extrinsic will be to give back some of the deposit after the AH-migration, the extrinsic is written such that it can work if the deposit decreases or increases (both). * The call to the extrinsic would be `free` if an actual adjustment is made to the deposit and `paid` otherwise. * Added tests to test all scenarios. * Added a benchmark to test the "worst case" (maximum compute) flow of the extrinsic which is when the deposit amount is updated to a new value. ## TO-DOs * [x] Run CI cmd bot to benchmark --------- Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
Alexander Theißen authored
Ref https://github.com/paritytech/ci_cd/issues/1107 We mainly need that so that we can finally compile the `pallet_revive` fixtures on stable. I did my best to keep the commits focused on one thing to make review easier. All the changes are needed because rustc introduced more warnings or is more strict about existing ones. Most of the stuff could just be fixed and the commits should be pretty self explanatory. However, there are a few this that are notable: ## `non_local_definitions ` A lot of runtimes to write `impl` blocks inside functions. This makes sense to reduce the amount of conditional compilation. I guess I could have moved them into a module instead. But I think allowing it here makes sense to avoid the code churn. ## `unexpected_cfgs` The FRAME macros emit code that references various features like `std`, `runtime-benchmarks` or `try-runtime`. If a create that uses those macros does not have those features we get this warning. Those were mostly when ...
-
- Feb 19, 2025
-
-
Serban Iorga authored
Related to https://github.com/paritytech/polkadot-sdk/issues/7360 Derive `DecodeWithMemTracking` for the structures in the cumulus pallets and for the structures in the `polkadot-sdk` runtimes. The PR contains no functional changes and no manual implementation. Just deriving `DecodeWithMemTracking`.
-
Serban Iorga authored
Just deriving `DecodeWithMemTracking` for the types used by the bridge, snowbridge and xcm pallets
-
Branislav Kontur authored
XCM: Deny barrier checks for nested XCMs with specific instructions to be executed on the local chain (#7200) Resolves (partially): https://github.com/paritytech/polkadot-sdk/issues/7148 Depends on: https://github.com/paritytech/polkadot-sdk/pull/7169 # Description This PR addresses partially #7148 (Problem 2) and ensures the proper checking of nested local instructions. It introduces a new barrier - `DenyRecursively` - to provide more refined control over instruction denial. The main change is the replacement of `DenyThenTry<Deny, Allow>` with `DenyThenTry<DenyRecursively<Deny>, Allow>` which handles both top-level and nested local instructions by applying allow condition after denial. For context and additional information, please refer to [_Problem 2 - Barrier vs nested XCM validation_](https://github.com/paritytech/polkadot-sdk/issues/7148). # TODO - [x] Evaluate PoC, more details at #7351: - **DenyNestedXcmInstructions**: Keep it as it is and be explicit: 1. Name the Deny barriers for the top level. 2. Name the Deny barrier for nested with `DenyInstructionsWithXcm`. - **DenyThenTry<DenyInstructionsWithXcm<Deny>, Allow>**: Alternatively, hard-code those three instructions in `DenyThenTry`, so we wouldn’t need `DenyInstructionsWithXcm`. However, this approach wouldn’t be as general. - **DenyInstructionsWithXcmFor**: Another possibility is to check `DenyInstructionsWithXcm::Inner` for the actual `message`, so we don’t need duplication for top-level and nested (not sure, maybe be explicit is good thing) - see _Problem2 - example_. Instead of this: ``` DenyThenTry< ( // Deny for top level XCM program DenyReserveTransferToRelayChain, // Dedicated barrier for nested XCM programs DenyInstructionsWithXcmFor< // Repeat all Deny filters here DenyReserveTransferToRelayChain, > ), ``` we could just use: ``` DenyThenTry< ( // Dedicated barrier for XCM programs DenyInstructionsWithXcmFor< // Add all `Deny` filters here DenyReserveTransferToRelayChain, ... > ), ``` - [POC Evaluation](https://github.com/paritytech/polkadot-sdk/pull/7200#discussion_r1939288792) - [x] Consider better name `DenyInstructionsWithXcm` => `DenyRecursively`, more details at [here](https://github.com/paritytech/polkadot-sdk/pull/7200#discussion_r1958588973) - [x] Clean-up and docs - [x] Merge https://github.com/paritytech/polkadot-sdk/pull/7169 or rebase this branch on the top of `yrong:fix-for-deny-then-try` - [x] Set for the runtimes where we use `DenyThenTry<Deny, Allow>` => `DenyThenTry<DenyRecursively<Deny>, Allow>` - [ ] Schedule sec.audit --------- Co-authored-by:
Raymond Cheung <178801527+raymondkfcheung@users.noreply.github.com> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by:
ron <yrong1997@gmail.com> Co-authored-by:
Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by:
Clara van Staden <claravanstaden64@gmail.com> Co-authored-by:
Adrian Catangiu <adrian@parity.io>
-
- Feb 18, 2025
-
-
Francisco Aguirre authored
Fix issue where setting the `remote_fees` field of `InitiateTransfer` to `None` could lead to unintended bypassing of fees in certain conditions. Changes made to fix this: - `remote_fees: None` now results in the `UnpaidExecution` instruction being appended *after* the origin altering instruction, be it `AliasOrigin` or `ClearOrigin`. This means `preserve_origin: true` must be set if you want to have any chance of not paying for fees. - The `AliasOrigin` instruction is not appended if the executor is called with the root location (`Here`) since it would alias to itself. Although this self-aliasing could be done, it needs the ecosystem to add a new aliasing instruction, so we just skip it. - Tweaked the `AllowExplicitUnpaidExecutionFrom` barrier to allow receiving assets (via teleport or reserve asset transfer) and altering the origin before actually using `UnpaidExecution`. This is to allow unpaid teleports to work with `InitiateTransfer`. - For this, the barrier now executes origin altering instructions and keeps track of the modified origin. It then checks if this final origin has enough permissions to not pay for fees. In order to follow the `AliasOrigin` instruction it now takes a new generic `Aliasers` that should be set to the XCM config item of the same name. This new generic has a default value of `()`, effectively disallowing the use of `AliasOrigin`. --------- Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by:
Adrian Catangiu <adrian@parity.io>
-
Xavier Lau authored
Add a new extrinsic `dispatch_as_fallible`. It's almost the same as [`Pallet::dispatch_as`] but forwards any error of the inner call. Closes #219. And add more unit tests to cover `dispatch_as` and `dispatch_as_fallible`. --- Polkadot address: 156HGo9setPcU2qhFMVWLkcmtCEGySLwNqa3DaEiYSWtte4Y --------- Signed-off-by:
Xavier Lau <x@acg.box> Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by:
Bastian Köcher <info@kchr.de> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
Ankan authored
closes https://github.com/paritytech/polkadot-sdk/issues/6508. ## TODO - [x] Migrate storage `DisabledValidators` both in pallet-session and pallet-staking. - [ ] Test that disabled validator resets at era change. - [ ] Add always sorted try-runtime test for `DisabledValidators`. - [ ] More test coverage for the disabling logic. --------- Co-authored-by:
Gonçalo Pestana <g6pestana@gmail.com> Co-authored-by: command-bot <> Co-authored-by:
Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by:
Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by:
kianenigma <kian@parity.io> Co-authored-by:
Giuseppe Re <giuseppe.re@parity.io> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
- Feb 17, 2025
-
-
Ankan authored
closes https://github.com/paritytech/polkadot-sdk/issues/3610. helps https://github.com/paritytech/polkadot-sdk/issues/6344, but need to migrate storage `Offences::Reports` before we can remove exposure dependency in RC pallets. replaces https://github.com/paritytech/polkadot-sdk/issues/6788. ## Context Slashing in staking is unbounded currently, which is a major blocker until staking can move to a parachain (AH). ### Current Slashing Process (Unbounded) 1. **Offence Reported** - Offences include multiple validators, each with potentially large exposure pages. - Slashes are **computed immediately** and scheduled for application after **28 eras**. 2. **Slash Applied** - All unapplied slashes are executed in **one block** at the start of the **28th era**. This is an **unbounded operation**. ### Proposed Slashing Process (Bounded) 1. **Offence Queueing** - Offences are **queued** after basic sanity checks. 2. **Paged Offence Processing (Computing Slash)** - Slashes are **computed one validator exposure page at a time**. - **Unapplied slashes** are stored in a **double map**: - **Key 1 (k1):** `EraIndex` - **Key 2 (k2):** `(Validator, SlashFraction, PageIndex)` — a unique identifier for each slash page 3. **Paged Slash Application** - Slashes are **applied one page at a time** across multiple blocks. - Slash application starts at the **27th era** (one era earlier than before) to ensure all slashes are applied **before stakers can unbond** (which starts from era 28 onwards). --- ## Worst-Case Block Calculation for Slash Application ### Polkadot: - **1 era = 24 hours**, **1 block = 6s** → **14,400 blocks/era** - On parachains (**12s blocks**) → **7,200 blocks/era** ### Kusama: - **1 era = 6 hours**, **1 block = 6s** → **3,600 blocks/era** - On parachains (**12s blocks**) → **1,800 blocks/era** ### Worst-Case Assumptions: - **Total stakers:** 40,000 nominators, 1000 validators. (Polkadot currently has ~23k nominators and 500 validators) - **Max slashed:** 50% so 20k nominators, 250 validators. - **Page size:** Validators with multiple page: (512 + 1)/2 = 256 , Validators with single page: 1 ### Calculation: There might be a more accurate way to calculate this worst-case number, and this estimate could be significantly higher than necessary, but it shouldn’t exceed this value. Blocks needed: 250 + 20k/256 = ~330 blocks. ## *Potential Improvement:* - Consider adding an **Offchain Worker (OCW)** task to further optimize slash application in future updates. - Dynamically batch unapplied slashes based on number of nominators in the page, or process until reserved weight limit is exhausted. ---- ## Summary of Changes ### Storage - **New:** - `OffenceQueue` *(StorageDoubleMap)* - **K1:** Era - **K2:** Offending validator account - **V:** `OffenceRecord` - `OffenceQueueEras` *(StorageValue)* - **V:** `BoundedVec<EraIndex, BoundingDuration>` - `ProcessingOffence` *(StorageValue)* - **V:** `(Era, offending validator account, OffenceRecord)` - **Changed:** - `UnappliedSlashes`: - **Old:** `StorageMap<K -> Era, V -> Vec<UnappliedSlash>>` - **New:** `StorageDoubleMap<K1 -> Era, K2 -> (validator_acc, perbill, page_index), V -> UnappliedSlash>` ### Events - **New:** - `SlashComputed { offence_era, slash_era, offender, page }` - `SlashCancelled { slash_era, slash_key, payout }` ### Error - **Changed:** - `InvalidSlashIndex` → Renamed to `InvalidSlashRecord` - **Removed:** - `NotSortedAndUnique` - **Added:** - `EraNotStarted` ### Call - **Changed:** - `cancel_deferred_slash(era, slash_indices: Vec<u32>)` → Now takes `Vec<(validator_acc, slash_fraction, page_index)>` - **New:** - `apply_slash(slash_era, slash_key: (validator_acc, slash_fraction, page_index))` ### Runtime Config - `FullIdentification` is now set to a unit type (`()`) / null identity, replacing the previous exposure type for all runtimes using `pallet_session::historical`. ## TODO - [x] Fixed broken `CancelDeferredSlashes`. - [x] Ensure on_offence called only with validator account for identification everywhere. - [ ] Ensure we never need to read full exposure. - [x] Tests for multi block processing and application of slash. - [x] Migrate UnappliedSlashes - [x] Bench (crude, needs proper bench as followup) - [x] on_offence() - [x] process_offence() - [x] apply_slash() ## Followups (tracker [link](https://github.com/paritytech/polkadot-sdk/issues/7596)) - [ ] OCW task to process offence + apply slashes. - [ ] Minimum time for governance to cancel deferred slash. - [ ] Allow root or staking admin to add a custom slash. - [ ] Test HistoricalSession proof works fine with eras before removing exposure as full identity. - [ ] Properly bench offence processing and slashing. - [ ] Handle Offences::Reports migration when removing validator exposure as identity. --------- Co-authored-by:
Gonçalo Pestana <g6pestana@gmail.com> Co-authored-by: command-bot <> Co-authored-by:
Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by:
Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by:
kianenigma <kian@parity.io> Co-authored-by:
Giuseppe Re <giuseppe.re@parity.io> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
Oliver Tale-Yazdi authored
Preparation for AHM and making stuff public. --------- Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by:
Dónal Murray <donal.murray@parity.io>
-
Daniel Olano authored
Returning an iterator in `TracksInfo::tracks()` instead of a static slice allows for more flexible implementations of `TracksInfo` that can use the chain storage without compromising a lot on the performance/memory penalty if we were to return an owned `Vec` instead. --------- Co-authored-by:
Pablo Andrés Dorado Suárez <hola@pablodorado.com>
-
Pablo Andrés Dorado Suárez authored
Closes #4315 --------- Co-authored-by:
Guillaume Thiolliere <guillaume.thiolliere@parity.io>
-
rainb0w-pr0mise authored
# Utility Call Fallback This introduces a new extrinsic: **`if_else`** Which first attempts to dispatch the `main` call(s). If the `main` call(s) fail, the `fallback` call(s) is dispatched instead. Both calls are executed with the same origin. In the event of a fallback failure the whole call fails with the weights returned. ## Use Case Some use cases might involve submitting a `batch` type call in either main, fallback or both. Resolves #6000 Polkadot Address: 1HbdqutFR8M535LpbLFT41w3j7v9ptEYGEJKmc6PKpqthZ8 --------- Co-authored-by:
rainbow-promise <154476501+rainbow-promise@users.noreply.github.com> Co-authored-by:
Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
-
- Feb 14, 2025
-
-
Kian Paimani authored
## Multi Block Election Pallet This PR adds the first iteration of the multi-block staking pallet. From this point onwards, the staking and its election provider pallets are being customized to work in AssetHub. While usage in solo-chains is still possible, it is not longer the main focus of this pallet. For a safer usage, please fork and user an older version of this pallet. --- ## Replaces - [x] https://github.com/paritytech/polkadot-sdk/pull/6034 - [x] https://github.com/paritytech/polkadot-sdk/pull/5272 ## Related PRs: - [x] https://github.com/paritytech/polkadot-sdk/pull/7483 - [ ] https://github.com/paritytech/polkadot-sdk/pull/7357 - [ ] https://github.com/paritytech/polkadot-sdk/pull/7424 - [ ] https://github.com/paritytech/polkadot-staking-miner/pull/955 This branch can be periodically merged into https://github.com/paritytech/polkadot-sdk/pull/7358 -> https://github.com/paritytech/polkadot-sdk/pull/6996 ## TODOs: - [x] rebase to master - Benchmarking for staking critical path - [x] snapshot - [x] election result - Benchmarking for EPMB critical path - [x] snapshot - [x] verification - [x] submission - [x] unsigned submission - [ ] election results fetching - [ ] Fix deletion weights. Either of - [ ] Garbage collector + lazy removal of all paged storage items - [ ] Confirm that deletion is small PoV footprint. - [ ] Move election prediction to be push based. @tdimitrov - [ ] integrity checks for bounds - [ ] Properly benchmark this as a part of CI -- for now I will remove them as they are too slow - [x] add try-state to all pallets - [x] Staking to allow genesis dev accounts to be created internally - [x] Decouple miner config so @niklasad1 can work on the miner 72841b73 - [x] duplicate snapshot page reported by @niklasad1 - [ ] https://github.com/paritytech/polkadot-sdk/pull/6520 or equivalent -- during snapshot, `VoterList` must be locked - [ ] Move target snapshot to a separate block --------- Co-authored-by:
Gonçalo Pestana <g6pestana@gmail.com> Co-authored-by:
Ankan <10196091+Ank4n@users.noreply.github.com> Co-authored-by: command-bot <> Co-authored-by:
Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by:
Giuseppe Re <giuseppe.re@parity.io> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
Bastian Köcher authored
Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-