Skip to content
Snippets Groups Projects
  1. Feb 27, 2025
    • Utkarsh Bhardwaj's avatar
      [AHM] Poke deposits: Multisig pallet (#7700) · cc83fba1
      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: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
      Co-authored-by: default avatarGiuseppe Re <giuseppe.re@parity.io>
  2. Feb 26, 2025
    • Ankan's avatar
      [Nomination Pool] Make staking restrictions configurable (#7685) · f7e98b40
      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 granular control, you can define a custom filter:
      ```rust
      struct MyCustomFilter<T: Config>(core::marker::PhantomData<T>);
      
      impl<T: Config> Contains<T::AccountId> for MyCustomFilter<T> {
          fn contains(account: &T::AccountId) -> bool {
              todo!("Implement custom logic. Return `false` to allow the account to join a pool.")
          }
      }
      ```
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <info@kchr.de>
    • xermicus's avatar
      [pallet-revive] allow delegate calls to non-contract accounts (#7729) · c29e72a8
      xermicus authored
      
      This PR changes the behavior of delegate calls when the callee is not a
      contract account: Instead of returning a `CodeNotFound` error, this is
      allowed and the caller observes a successful call with empty output.
      
      The change makes for example the following contract behave the same as
      on EVM:
      
      ```Solidity
      contract DelegateCall {
          function delegateToLibrary() external returns (bool) {
              address testAddress = 0x0000000000000000000000000000000000000000;
              (bool success, ) = testAddress.delegatecall(
                  abi.encodeWithSignature("test()")
              );
              return success;
          }
      }
      ```
      
      Closes https://github.com/paritytech/revive/issues/235
      
      ---------
      
      Signed-off-by: default avatarxermicus <cyrill@parity.io>
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    • PG Herveou's avatar
      [pallet-revive] ecrecover (#7652) · 86019edb
      PG Herveou authored
      
      Add ECrecover 0x1 precompile and remove the unstable equivalent host
      function.
      
      - depend on https://github.com/paritytech/polkadot-sdk/pull/7676
      
      ---------
      
      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>
  3. Feb 25, 2025
    • Giuseppe Re's avatar
      Add Runtime Api version to metadata (#7607) · 3dc3a11c
      Giuseppe Re authored
      
      The runtime API implemented version is not explicitly shown in metadata,
      so here we add it to improve developer experience.
      We need to bump `frame-metadata` and `merkleized-metadata` to allow this
      new feature.
      
      This closes #7352 .
      
      _Refactor_: also changing all the occurrences of `ViewFunctionMethod` to
      just `ViewFunction` for metadata types.
      
      ---------
      
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    • CrabGopher's avatar
      Expose extension weights (#7637) · dd005c48
      CrabGopher authored
      # Description
      Seems like SubstrateWeights that used T::DBWeights was not public unlike
      the frame_system's Call weights. PR just made those weights public
      
      ## Integration
      Instead of using `()` impl which used RockDB weights, ExtensionWeights
      can be used to to use the provided DBWeights to System config
  4. Feb 24, 2025
  5. Feb 23, 2025
    • Davide Galassi's avatar
      Bandersnatch hot fix (#7670) · 21f6f070
      Davide Galassi authored
      
      Essentially, this locks `bandersnatch_vrfs` to a specific branch of a
      repository I control. This is a temporary workaround to avoid issues
      like https://github.com/paritytech/polkadot-sdk/issues/7653 until
      https://github.com/paritytech/polkadot-sdk/pull/7669 is ready.
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/7653 
      
      @drskalman
      
      ---------
      
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  6. Feb 21, 2025
  7. 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.com>
    • 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.
  8. Feb 19, 2025
  9. Feb 18, 2025
  10. 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>
    • nprt's avatar
      implement web3_clientVersion (#7580) · d61032b9
      nprt authored
      
      Implements the `web3_clientVersion` method. This is a common requirement
      for external Ethereum libraries when querying a client.
      
      Fixes paritytech/contract-issues#26.
      
      ---------
      
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    • Oliver Tale-Yazdi's avatar
      [AHM] Make pallet types public (#7579) · ca91d4b5
      Oliver Tale-Yazdi authored
      
      Preparation for AHM and making stuff public.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
      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>
    • Daniel Olano's avatar
      Change pallet referenda TracksInfo::tracks to return an iterator (#2072) · c078d2f4
      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: default avatarPablo Andrés Dorado Suárez <hola@pablodorado.com>
    • PG Herveou's avatar
      [pallet-revive] rpc add --earliest-receipt-block (#7589) · 8cca727f
      PG Herveou authored
      
      Add a cli option to skip searching receipts for blocks older than the
      specified limit
      
      ---------
      
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    • Pablo Andrés Dorado Suárez's avatar
    • rainb0w-pr0mise's avatar
      `pallet-utility: if_else` (#6321) · ead8fbdf
      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: default avatarrainbow-promise <154476501+rainbow-promise@users.noreply.github.com>
      Co-authored-by: default avatarGuillaume Thiolliere <gui.thiolliere@gmail.com>
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  11. Feb 15, 2025
  12. Feb 14, 2025
    • Kian Paimani's avatar
      [AHM] Multi-block staking election pallet (#7282) · a025562b
      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: default avatarGonçalo Pestana <g6pestana@gmail.com>
      Co-authored-by: default avatarAnkan <10196091+Ank4n@users.noreply.github.com>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarGuillaume Thiolliere <gui.thiolliere@gmail.com>
      Co-authored-by: default avatarGiuseppe Re <giuseppe.re@parity.io>
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    • Alexandre R. Baldé's avatar
      Add minor improvements to `chill_other` test (#7553) · c1915afc
      Alexandre R. Baldé authored
      
      # Description
      
      https://github.com/open-web3-stack/polkadot-ecosystem-tests/pull/174
      showed the test for the `pallet_staking::chill_other` extrinsic could be
      more exhaustive.
      
      This PR adds those checks, and also a few more to another test related
      to `chill_other`,
      `pallet_staking::tests::change_of_absolute_max_nominations`.
      
      ## Integration
      
      N/A
      
      ## Review Notes
      
      N/A
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
    • Alexander Theißen's avatar
      pallet-revive: Fix the contract size related benchmarks (#7568) · 60146ba5
      Alexander Theißen authored
      
      Partly addresses https://github.com/paritytech/polkadot-sdk/issues/6157
      
      The benchmarks measuring the impact of contract sizes on calling or
      instantiating a contract were bogus because they needed to be written in
      assembly in order to tightly control the basic block size.
      
      This fixes the benchmarks for:
      - call_with_code_per_byte
      - upload_code
      - instantiate_with_code
      
      And adds a new benchmark that accounts for the fact that the interpreter
      will always compile whole basic blocks:
      - basic_block_compilation
      
      After this PR only the weight we assign to instructions need to be
      addressed.
      
      ---------
      
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
      Co-authored-by: default avatarPG Herveou <pgherveou@gmail.com>
    • Tomás Senovilla Polo's avatar
      refactor: Move `T:Config` into where clause in `#[benchmarks]` macro if needed (#7418) · 4b2ca118
      Tomás Senovilla Polo authored
      # Description
      
      Currently, the `#[benchmarks]` macro always add `<T:Config>` to the
      expanded code even if a where clause is used. Using a where clause which
      also includes a trait bound for the generic `T` is triggering [this
      clippy
      warning](https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations)
      from Rust 1.78 onwards. We've found that
      [here](https://github.com/freeverseio/laos/blob/main/pallets/precompiles-benchmark/src/precompiles/vesting/benchmarking.rs#L126-L132)
      in LAOS, as we need to include `T: pallet_vesting::Config` in the where
      clause, here's the outcome:
      
      ```rust
      error: bound is defined in more than one place
         --> pallets/precompiles-benchmark/src/precompiles/vesting/benchmarking.rs:130:1
          |
      130 | / #[benchmarks(
      131 | |     where
      132 | |         T: Config + pallet_vesting::Config,
          | |         ^
      133 | |         T::AccountIdToH160: ConvertBack<T::AccountId, H160>,
      134 | |         BalanceOf<T>: Into<U256>,
      135 | |         BlockNumberFor<T>: Into<U256>
      136 | | )]
          | |__^
          |
          = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations
          = note: `-D clippy::multiple-bound-locations` implied by `-D warnings`
          = help: to override `-D warnings` add `#[allow(clippy::multiple_bound_locations)]`
          = note: this error originates in the attribute macro `benchmarks` (in Nightly builds, run with -Z macro-backtrace for more info)
      ```
      
      While this is a harmless warning, only thrown due to a trait bound for T
      is being defined twice in an expanded code that nobody will see, and
      while annotating the benchmarks module with
      `#[allow(clippy::multiple_bound_locations)]` is enough to get rid of it,
      it might cause unnecessary concerns.
      
      Hence, I think it's worth slightly modifying the macro to avoid this.
      
      ## Review Notes
      
      What I propose is to include `<T: Config>` (or its instance version) in
      the expanded code only if no where clause was specified, and include
      that trait bound in the where clause if one is present.
      
      I considered always creating a where clause which includes `<T: Config>`
      even if the macro doesn't specify a where clause and totally getting rid
      of `<T: Config>`, but discarded the idea for simplicity.
      
      I also considered checking if `T:Config` is present in the provided
      where clause (as it's the case in the LAOS example I provided) before
      adding it, but discarded the idea as well due to it implies a bit more
      computation and having `T:Config` defined twice in the where clause is
      harmless: the compiler will ignore the second occurrence and nobody will
      see it's there.
      
      If you think this change is worth it and one of the discarded ideas
      would be a better approach, I'm happy to push that code instead.
    • Bastian Köcher's avatar
    • Alexander Theißen's avatar
      pallet-revive: Add env var to allow skipping of validation for testing (#7562) · b44dc3a5
      Alexander Theißen authored
      
      When trying to reproduce bugs we sometimes need to deploy code that
      wouldn't pass validation. This PR adds a new environment variable
      `REVIVE_SKIP_VALIDATION` that when set will skip all validation except
      the contract blob size limit.
      
      Please note that this only applies to when the pallet is compiled for
      `std` and hence will never be part of on-chain.
      
      ---------
      
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    • Oliver Tale-Yazdi's avatar
      [mq pallet] Custom next queue selectors (#6059) · 7aac8861
      Oliver Tale-Yazdi authored
      
      Changes:
      - Expose a `force_set_head` function from the `MessageQueue` pallet via
      a new trait: `ForceSetHead`. This can be used to force the MQ pallet to
      process this queue next.
      - The change only exposes an internal function through a trait, no audit
      is required.
      
      ## Context
      
      For the Asset Hub Migration (AHM) we need a mechanism to prioritize the
      inbound upward messages and the inbound downward messages on the AH. To
      achieve this, a minimal (and no breaking) change is done to the MQ
      pallet in the form of adding the `force_set_head` function.
      
      An example use of how to achieve prioritization is then demonstrated in
      `integration_test.rs::AhmPrioritizer`. Normally, all queues are
      scheduled round-robin like this:
      
      `| Relay | Para(1) | Para(2) | ... | Relay | ... `
      
      The prioritizer listens to changes to its queue and triggers if either:
      - The queue processed in the last block (to keep the general round-robin
      scheduling)
      - The queue did not process since `n` blocks (to prevent starvation if
      there are too many other queues)
      
      In either situation, it schedules the queue for a streak of three
      consecutive blocks, such that it would become:
      
      `| Relay | Relay | Relay | Para(1) | Para(2) | ... | Relay | Relay |
      Relay | ... `
      
      It basically transforms the round-robin into an elongated round robin.
      Although different strategies can be injected into the pallet at
      runtime, this one seems to strike a good balance between general service
      level and prioritization.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
      Co-authored-by: default avatarmuharem <ismailov.m.h@gmail.com>
  13. Feb 13, 2025