Skip to content
Snippets Groups Projects
  1. Feb 21, 2025
  2. Feb 20, 2025
    • Utkarsh Bhardwaj's avatar
      [AHM] Poke deposits: Indices pallet (#7587) · b9b73eb2
      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: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github...>
    • Alexandru Vasile's avatar
      net/litep2p: Bring the latest compatibility fixes via v0.9.1 (#7640) · 42e9de7f
      Alexandru Vasile authored
      This PR updates litep2p to version 0.9.1. The yamux config is entirely
      removed to mirror the libp2p yamux upstream version.
      While at it, I had to bump indexmap and URL as well. 
      
      
      ## [0.9.1] - 2025-01-19
      
      This release enhances compatibility between litep2p and libp2p by using
      the latest Yamux upstream version. Additionally, it includes various
      improvements and fixes to boost the stability and performance of the
      WebSocket stream and the multistream-select protocol.
      
      ### Changed
      
      - yamux: Switch to upstream implementation while keeping the controller
      API ([#320](https://github.com/paritytech/litep2p/pull/320))
      - req-resp: Replace SubstreamSet with FuturesStream
      ([#321](https://github.com/paritytech/litep2p/pull/321))
      - cargo: Bring up to date multiple dependencies
      ([#324](https://github.com/paritytech/litep2p/pull/324))
      - build(deps): bump hickory-proto from 0.24.1 to 0.24.3
      ([#323](https://github.com/paritytech/litep2p/pull/323))
      - build(...
    • PG Herveou's avatar
      [pallet-revive] tracing improvements (#7614) · 9e75647c
      PG Herveou authored
      
      Various pallet-revive improvements
      
      - add check for precompiles addresses,
      So we can easily identify which one are being called and not supported
      yet
      
      - fixes debug_call for revert call
      If a call revert we still want to get the traces for that call, that
      matches geth behaviors, diff tests will be added to the test suite for
      this
      
      - fixes traces for staticcall
      The call type was not always being reported properly.
      
      ---------
      
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
      Co-authored-by: default avatarAlexander Theißen <alex.theissen@me.com>
    • Alexander Theißen's avatar
      Update to Rust stable 1.84.1 (#7625) · e2d3da61
      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 ...
    • Serban Iorga's avatar
      derive `DecodeWithMemTracking` for `RuntimeCall` (#7634) · e8d17cbe
      Serban Iorga authored
      Related to https://github.com/paritytech/polkadot-sdk/issues/7360
    • Francisco Aguirre's avatar
      Update dispatchables doc link in pallet-revive's README (#7624) · f2414398
      Francisco Aguirre authored
      Pallet-revive's README has an outdated link for dispatchables
      documentation in its README. It was giving 404. Put the up-to-date one.
    • Egor_P's avatar
      Add stable2503 branch (#7617) · ff9b8987
      Egor_P authored
      This PR adds a new stable branch `stable2503` to the backport CI
  3. Feb 19, 2025
    • Dónal Murray's avatar
      Add sudo pallet to coretime-westend (#6960) · ececb4cb
      Dónal Murray authored
      
      Add the sudo pallet to coretime-westend, allowing use in
      development/testing. Previously the coretime-rococo runtime was used in
      situations like this, but since Rococo is now gone this can be used
      instead.
      
      No sudo key is added to Westend storage with this PR, since it's likely
      that any updates will continue to be done over XCM. If this is something
      that is wanted the key can be set via XCM.
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarMaksym H <1177472+mordamax@users.noreply.github.com>
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    • Jonathan Brown's avatar
      [pallet-broker] add extrinsic to remove an assignment (#7080) · bd418487
      Jonathan Brown authored
      
      # Description
      
      #6929 requests more extrinsics for "managing the network's coretime
      allocations without needing to dabble with migration+runtime upgrade or
      set/kill storage patterns"
      
      This pull request implements the remove_assignment() extrinsic.
      
      
      ## Integration
      
      Downstream projects need to benchmark the weight for the
      remove_assignment() extrinsic.
      
      ---------
      
      Co-authored-by: default avatarJonathan Brown <jbrown@acuity.network>
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
      Co-authored-by: default avatarDónal Murray <donal.murray@parity.io>
    • Jonathan Brown's avatar
      [pallet-broker] add extrinsic to remove a lease (#7026) · 959d9187
      Jonathan Brown authored
      
      # Description
      
      #6929 requests more extrinsics for "managing the network's coretime
      allocations without needing to dabble with migration+runtime upgrade or
      set/kill storage patterns"
      
      This pull request implements the remove_lease() extrinsic.
      
      
      ## Integration
      
      Downstream projects need to benchmark the weight for the remove_lease()
      extrinsic.
      
      ## Review Notes
      
      Mentorship is requested to ensure this is implemented correctly.
      
      The lease is removed from state using the TaskId as a key. Is this
      sufficient. Does the extrinsic need to do anything else?
      
      ---------
      
      Co-authored-by: default avatarJonathan Brown <jbrown@acuity.network>
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarDónal Murray <donalm@seadanda.dev>
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
      Co-authored-by: default avatarDónal Murray <donal.murray@parity.io>
    • Alexander Samusev's avatar
      ci: change gcs bucket for forklift (#7621) · ecca5826
      Alexander Samusev authored
      cc https://github.com/paritytech/ci_cd/issues/1095
    • Serban Iorga's avatar
      Derive `DecodeWithMemTracking` for cumulus pallets and for `polkadot-sdk` runtimes (#7627) · d60afc9f
      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`.
    • clangenb's avatar
      add genesis presets for coretime parachains (#7476) · e9b745a7
      clangenb authored
      
      Extracted from #7473.
      
      Part of: https://github.com/paritytech/polkadot-sdk/issues/5704.
      
      ---------
      
      Co-authored-by: default avatarGuillaume Thiolliere <guillaume.thiolliere@parity.io>
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    • Michal Kucharczyk's avatar
      `fatxpool`: event streams moved to view domain (#7545) · 8507e70f
      Michal Kucharczyk authored
      #### Overview
      
      This pull request refactors the transaction pool `graph` module by
      renaming components for better clarity. The `EventHandler` trait was
      introduced to enhance flexibility in handling transaction lifecycle
      events. Changes include renaming `graph::Listener` to
      `graph::EventDispatcher` and moving certain functionalities from `graph`
      to `view` module in order to decouple `graph` from `view`-related
      specifics.
      
      This PR does not introduce changes in the logic.
      
      #### Notes for Reviewers
      All the changes looks dense at first, but in fact following was done:
      - The `graph::Listener` was renamed to
      [`graph::EventDispatcher`](https://github.com/paritytech/polkadot-sdk/blob/515cb404/substrate/client/transaction-pool/src/graph/listener.rs#L74C12-L74C27),
      to better reflect its role in dispatching transaction-related events
      from `ValidatedPool`. The `EventDispatcher` now utilizes the `L:
      EventHandler` generic type to handl...
    • Branislav Kontur's avatar
      Make `pallet-bridge-rewards` generic over `RewardKind` (#7492) · ba7cb484
      Branislav Kontur authored
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/7272
      Relates to: https://github.com/paritytech/polkadot-sdk/pull/6578
      Relates to: https://github.com/paritytech/polkadot-sdk/issues/7274
      
      ## Description
      
      The PR enhances the `pallet-bridge-rewards` by making it generic over
      the `RewardKind` type (previously hardcoded as `RewardsAccountParams`).
      This modification allows the pallet to support multiple reward types
      (e.g., P/K bridge, Snowbridge), increasing its flexibility and
      applicability across various bridge scenarios.
      
      Other pallets can register rewards using `bp_relayers::RewardLedger`,
      which is implemented by the rewards pallet. The runtime can then be
      configured with different mechanisms for paying/claiming rewards via
      `bp_relayers::PaymentProcedure` (e.g., see the `pub struct
      BridgeRewardPayer;` implementation for BridgeHubWestend).
      
      ## Follow-up  
      The removed balances/rewards statistics from the complex relay (no
      longer used) will eventually be reintroduced or fixed in the standalone
      relayers via
      https://github.com/paritytech/parity-bridges-common/issues/3004#issuecomment-2401634589.
      
      ---------
      
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
      Co-authored-by: default avatarFrancisco Aguirre <franciscoaguirreperez@gmail.com>
      Co-authored-by: default avatarSerban Iorga <serban@parity.io>
    • Serban Iorga's avatar
      Derive `DecodeWithMemTracking` for bridge and xcm pallets (#7620) · 0c258c66
      Serban Iorga authored
      Just deriving `DecodeWithMemTracking` for the types used by the bridge,
      snowbridge and xcm pallets
    • Branislav Kontur's avatar
      XCM: Deny barrier checks for nested XCMs with specific instructions to be... · bd7cf119
      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: default avatarRaymond Cheung <178801527+raymondkfcheung@users.noreply.github.com>
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
      Co-authored-by: default avatarron <yrong1997@gmail.com>
      Co-authored-by: default avatarFrancisco Aguirre <franciscoaguirreperez@gmail.com>
      Co-authored-by: default avatarClara van Staden <claravanstaden64@gmail.com>
      Co-authored-by: default avatarAdrian Catangiu <adrian@parity.io>
    • castillax's avatar
      Add note for organization contributors about creating branches directly (#7611) · a48b3894
      castillax authored
      # Description
      
      * This PR adds a note to the CONTRIBUTING.md file to inform contributors
      who are part of the organization that they do not need to fork the
      repository. Instead, they can create a branch directly in the repository
      to send a pull request.
      
      ## Changes
      
      Added a note under the "What?" section in CONTRIBUTING.md to clarify
      that organization contributors can create branches directly in the
      repository.
  4. Feb 18, 2025
  5. Feb 17, 2025
    • Ankan's avatar
      [Staking] Bounded Slashing: Paginated Offence Processing & Slash Application (#7424) · dda2cb59
      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: default avatarGonçalo Pestana <g6pestana@gmail.com>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarKian Paimani <5588131+kianenigma@users.noreply.github.com>
      Co-authored-by: default avatarGuillaume Thiolliere <gui.thiolliere@gmail.com>
      Co-authored-by: default avatarkianenigma <kian@parity.io>
      Co-authored-by: default avatarGiuseppe Re <giuseppe.re@parity.io>
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>