Skip to content
Snippets Groups Projects
  1. Feb 12, 2025
  2. Feb 10, 2025
  3. Jan 28, 2025
    • Andrew Jones's avatar
      Implement pallet view function queries (#4722) · 0b8d7441
      Andrew Jones authored
      Closes #216.
      
      This PR allows pallets to define a `view_functions` impl like so:
      
      ```rust
      #[pallet::view_functions]
      impl<T: Config> Pallet<T>
      where
      	T::AccountId: From<SomeType1> + SomeAssociation1,
      {
      	/// Query value no args.
      	pub fn get_value() -> Option<u32> {
      		SomeValue::<T>::get()
      	}
      
      	/// Query value with args.
      	pub fn get_value_with_arg(key: u32) -> Option<u32> {
      		SomeMap::<T>::get(key)
      	}
      }
      ```
      ### `QueryId`
      
      Each view function is uniquely identified by a `QueryId`, which for this
      implementation is generated by:
      
      ```twox_128(pallet_name) ++ twox_128("fn_name(fnarg_types) -> return_ty")```
      
      The prefix `twox_128(pallet_name)` is the same as the storage prefix for pallets and take into account multiple instances of the same pallet.
      
      The suffix is generated from the fn type signature so is guaranteed to be unique for that pallet impl. For one of the view fns in the example above it would be `twox_128("get_value_with_arg(u32) -> Option<u32>")`. It is a kn...
  4. Jan 17, 2025
    • thiolliere's avatar
      Make frame crate not use the feature experimental (#7177) · 4b2febe1
      thiolliere authored
      We already use it for lots of pallet.
      
      Keeping it feature gated by experimental means we lose the information
      of which pallet was using experimental before the migration to frame
      crate usage.
      
      We can consider `polkadot-sdk-frame` crate unstable but let's not use
      the feature `experimental`.
      
      ---------
      
      Co-authored-by: command-bot <>
  5. Jan 14, 2025
  6. Jan 13, 2025
  7. Jan 07, 2025
  8. Jan 05, 2025
    • thiolliere's avatar
      Implement cumulus StorageWeightReclaim as wrapping transaction extension +... · 63c73bf6
      thiolliere authored
      Implement cumulus StorageWeightReclaim as wrapping transaction extension + frame system ReclaimWeight (#6140)
      
      (rebasing of https://github.com/paritytech/polkadot-sdk/pull/5234)
      
      ## Issues:
      
      * Transaction extensions have weights and refund weight. So the
      reclaiming of unused weight must happen last in the transaction
      extension pipeline. Currently it is inside `CheckWeight`.
      * cumulus storage weight reclaim transaction extension misses the proof
      size of logic happening prior to itself.
      
      ## Done:
      
      * a new storage `ExtrinsicWeightReclaimed` in frame-system. Any logic
      which attempts to do some reclaim must use this storage to avoid double
      reclaim.
      * a new function `reclaim_weight` in frame-system pallet: info and post
      info in arguments, read the already reclaimed weight, calculate the new
      unused weight from info and post info. do the more accurate reclaim if
      higher.
      * `CheckWeight` is unchanged and still reclaim the weight in post
      dispatch
      * `ReclaimWeight` is a new transaction extension in frame system. For
      solo chains it must be used last in the transactino extension pipeline.
      It does the final most accurate reclaim
      * `StorageWeightReclaim` is moved from cumulus primitives into its own
      pallet (in order to define benchmark) and is changed into a wrapping
      transaction extension.
      It does the recording of proof size and does the reclaim using this
      recording and the info and post info. So parachains don't need to use
      `ReclaimWeight`. But also if they use it, there is no bug.
      
          ```rust
        /// The TransactionExtension to the basic transaction logic.
      pub type TxExtension =
      cumulus_pallet_weight_reclaim::StorageWeightReclaim<
               Runtime,
               (
                       frame_system::CheckNonZeroSender<Runtime>,
                       frame_system::CheckSpecVersion<Runtime>,
                       frame_system::CheckTxVersion<Runtime>,
                       frame_system::CheckGenesis<Runtime>,
                       frame_system::CheckEra<Runtime>,
                       frame_system::CheckNonce<Runtime>,
                       frame_system::CheckWeight<Runtime>,
      pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
                       BridgeRejectObsoleteHeadersAndMessages,
      
      (bridge_to_rococo_config::OnBridgeHubWestendRefundBridgeHubRococoMessages,),
      frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
               ),
        >;
        ```
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
      Co-authored-by: default avatargeorgepisaltu <52418509+georgepisaltu@users.noreply.github.com>
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
      Co-authored-by: default avatarSebastian Kunert <skunert49@gmail.com>
      Co-authored-by: command-bot <>
  9. Jan 03, 2025
  10. Jan 02, 2025
  11. Dec 20, 2024
    • Xavier Lau's avatar
      Reorder dependencies' keys (#6967) · a843d15e
      Xavier Lau authored
      
      It doesn't make sense to only reorder the features array.
      
      For example:
      
      This makes it hard for me to compare the dependencies and features,
      especially some crates have a really really long dependencies list.
      ```toml​
      [dependencies]
      c = "*"
      a = "*"
      b = "*"
      
      [features]
      std = [
        "a",
        "b",
        "c",
      ]
      ```
      
      This makes my life easier.
      ```toml​
      [dependencies]
      a = "*"
      b = "*"
      c = "*"
      
      [features]
      std = [
        "a",
        "b",
        "c",
      ]
      ```
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
      Co-authored-by: command-bot <>
  12. Dec 12, 2024
    • Iulian Barbu's avatar
      omni-node: add metadata checks for runtime/parachain compatibility (#6450) · 7cc5cdd0
      Iulian Barbu authored
      
      # Description
      
      Get runtime's metadata, parse it and verify pallets list for a pallet
      named `ParachainSystem` (for now), and block number to be the same for
      both node and runtime. Ideally we'll add other pallets checks too, at
      least a small set of pallets we think right away as mandatory for
      parachain compatibility.
      Closes: #5565 
      
      ## Integration
      
      Runtime devs must be made aware that to be fully compatible with Omni
      Node, certain naming conventions should be respected when defining
      pallets (e.g we verify parachain-system pallet existence by searching
      for a pallet with `name` `ParachainSystem` in runtime's metadata). Not
      finding such a pallet will not influence the functionality yet, but by
      doing these checks we could provide useful feedback for runtimes that
      are clearly not implementing what's required for full parachain
      compatibility with Omni Node.
      
      ## Review Notes
      
      - [x] parachain system check
      - [x] check frame_system's metadata to ensure the block number in there
      is the same as the one in the node side
      - [x] add tests for the previous checking logic
      - [x] update omni node polkadot-sdk docs to make these conventions
      visible.
      - [ ] add more pallets checks?
      
      ---------
      
      Signed-off-by: default avatarIulian Barbu <iulian.barbu@parity.io>
      Co-authored-by: default avatarAlexandru Vasile <60601340+lexnv@users.noreply.github.com>
      Co-authored-by: default avatarMichal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
  13. Dec 10, 2024
  14. Nov 29, 2024
  15. Nov 27, 2024
  16. Nov 08, 2024
  17. Nov 05, 2024
    • Nazar Mokrynskyi's avatar
      Remove `sp_runtime::RuntimeString` and replace with `Cow<'static, str>` or... · c5444f38
      Nazar Mokrynskyi authored
      Remove `sp_runtime::RuntimeString` and replace with `Cow<'static, str>` or `String` depending on use case (#5693)
      
      # Description
      
      As described in https://github.com/paritytech/polkadot-sdk/issues/4001
      `RuntimeVersion` was not encoded consistently using serde. Turned out it
      was a remnant of old times and no longer actually needed. As such I
      removed it completely in this PR and replaced with `Cow<'static, str>`
      for spec/impl names and `String` for error cases.
      
      Fixes https://github.com/paritytech/polkadot-sdk/issues/4001.
      
      ## Integration
      
      For downstream projects the upgrade will primarily consist of following
      two changes:
      ```diff
      #[sp_version::runtime_version]
      pub const VERSION: RuntimeVersion = RuntimeVersion {
      -	spec_name: create_runtime_str!("statemine"),
      -	impl_name: create_runtime_str!("statemine"),
      +	spec_name: alloc::borrow::Cow::Borrowed("statemine"),
      +	impl_name: alloc::borrow::Cow::Borrowed("statemine"),
      ```
      ```diff
      		fn dispatch_benchmark(
      			config: frame_benchmarking::BenchmarkConfig
      -		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
      +		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
      ```
      
      SCALE encoding/decoding remains the same as before, but serde encoding
      in runtime has changed from bytes to string (it was like this in `std`
      environment already), which most projects shouldn't have issues with. I
      consider the impact of serde encoding here low due to the type only
      being used in runtime version struct and mostly limited to runtime
      internals, where serde encoding/decoding of this data structure is quite
      unlikely (though we did hit exactly this edge-case ourselves
      :sweat_smile:
      
      ).
      
      ## Review Notes
      
      Most of the changes are trivial and mechanical, the only non-trivial
      change is in
      `substrate/primitives/version/proc-macro/src/decl_runtime_version.rs`
      where macro call expectation in `sp_version::runtime_version`
      implementation was replaced with function call expectation.
      
      # Checklist
      
      * [x] My PR includes a detailed description as outlined in the
      "Description" and its two subsections above.
      * [ ] My PR follows the [labeling requirements](
      
      https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process
      ) of this project (at minimum one label for `T` required)
      * External contributors: ask maintainers to put the right label on your
      PR.
      * [ ] I have made corresponding changes to the documentation (if
      applicable)
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
      Co-authored-by: default avatarGuillaume Thiolliere <guillaume.thiolliere@parity.io>
      Co-authored-by: default avatarBastian Köcher <info@kchr.de>
  18. Oct 25, 2024
  19. Oct 23, 2024
    • Kian Paimani's avatar
      Polkadot OmniNode Docs (#6094) · fc486e55
      Kian Paimani authored
      provides low-level documentation on how the omni-node is meant to work.
      This is meant to act as reusable material for other teams (e.g.
      Papermoon and W3F) to use and integrate into the high level Polkadot
      documentation.
      
      Broadly speaking, for omni-node to have great rust-docs, we need to
      focus on the following crates, all of which got a bit of love in this
      PR:
      
      1. `sp-genesis-builder`
      2. `polkadot-omni-node`
      3. `polkadot-omni-node-lib`
      4. `frame-omni-bencher`
      
      On top of this, we have now: 
      
      * `polkadot_sdk_docs::guides` contains two new steps demonstrating the
      most basic version of composing your pallet, putting it into a runtime,
      and putting that runtime into omni-node
      * `polkadot_sdk_docs::reference_docs::omni_node` to explain in more
      detail how omni-node differs from the old-school node.
      * `polkadot_sdk_docs::reference_docs::frame_weight_benchmarking` to
      finally have a minimal reference about weights and benchmarking.
      * It provides tests for some of the steps in
      https://github.com/paritytech/polkadot-sdk/issues/5568
      
      
      closes https://github.com/paritytech/polkadot-sdk/issues/5568
      closes https://github.com/paritytech/polkadot-sdk/issues/4781
      
      Next steps
      
      - [x] Ensure the README of the parachain template is up-to-date.
      @iulianbarbu
      
      
      - [ ] Readme for `polkadot-omni-node` and similar is updated. For now,
      use `cargo-readme` and copy over the rust-docs.
      
      To build the branch locally and run this:
      https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/meta_contributing/index.html#how-to-develop-locally
      
      ---------
      
      Co-authored-by: default avatarIulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
      Co-authored-by: default avatarSebastian Kunert <skunert49@gmail.com>
      Co-authored-by: default avatarMichal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
  20. Oct 21, 2024
  21. Oct 18, 2024
    • georgepisaltu's avatar
      FRAME: Reintroduce `TransactionExtension` as a replacement for `SignedExtension` (#3685) · b76e91ac
      georgepisaltu authored
      Original PR https://github.com/paritytech/polkadot-sdk/pull/2280
      reverted in https://github.com/paritytech/polkadot-sdk/pull/3665
      
      This PR reintroduces the reverted functionality with additional changes,
      related effort
      [here](https://github.com/paritytech/polkadot-sdk/pull/3623).
      Description is copied over from the original PR
      
      First part of [Extrinsic
      Horizon](https://github.com/paritytech/polkadot-sdk/issues/2415)
      
      Introduces a new trait `TransactionExtension` to replace
      `SignedExtension`. Introduce the idea of transactions which obey the
      runtime's extensions and have according Extension data (né Extra data)
      yet do not have hard-coded signatures.
      
      Deprecate the terminology of "Unsigned" when used for
      transactions/extrinsics owing to there now being "proper" unsigned
      transactions which obey the extension framework and "old-style" unsigned
      which do not. Instead we have __*General*__ for the former and
      __*Bare*__ for ...
  22. Oct 11, 2024
    • Maksym H's avatar
      /cmd: Improved devx of benching many pallets simultaneously (#6007) · c0b73433
      Maksym H authored
      
      ### Improved devx of running many pallets simultaneously
      
      Changes to /cmd:
      - Replace (flip) `--continue-on-fail` with `--fail-fast`, but only for
      `bench`. This makes all pallets/runtimes run non-stop by default, as it
      was primary use-case during tests
      - The list of successful/failed pallets was hard to find within tons of
      logs, so decided to write only needed logs in a file, and output as a
      summary in the workflow and in the comment
      - Side fix: updated `tasks_example` to `pallet_example_tasks` to make
      compliant with standard naming
      
      <img width="1006" alt="image"
      src="https://github.com/user-attachments/assets/14896041-7018-4a0d-92b7-4508e81913c2">
      
      + added command results to workflow summary:
      <img width="1275" alt="image"
      src="https://github.com/user-attachments/assets/b4a8afdb-dc9f-4ff9-9720-28a88956035f">
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
  23. Oct 08, 2024
    • Serban Iorga's avatar
      Omni-Node renamings (#5915) · a4dce869
      Serban Iorga authored
      - moved the omni-node lib from
        `cumulus/polkadot-parachain/polkadot-parachain-lib` to
        `cumulus/polkadot-omni-node/lib`
      - renamed `polkadot-parachain-lib` to `polkadot-omni-node-lib`
      - added `polkadot-omni-node` binary
      
      Related to https://github.com/paritytech/polkadot-sdk/issues/5566
    • Maksym H's avatar
      improve prdoc generation (#5931) · 4b40e762
      Maksym H authored
      Related to
      https://github.com/paritytech/polkadot-sdk/pull/5924#issuecomment-2393558697
      
      improve prdoc arguments validation & help:
      - convert audiences options to snake_case. Fixes
      https://github.com/paritytech/polkadot-sdk/issues/5927
        - support more than one audiences
        - define allowed bump options
      - infer --pr from the actual PR (now it's optional, can still be
      overwritten)
      
      
      ![image](https://github.com/user-attachments/assets/24e18fe2-2f67-4ce0-90e4-34f6c2f860c9)
      
      Test evidence:
      https://github.com/paritytech-stg/polkadot-sdk/pull/52/commits/6dd274e3678d287c163cfa6cb696acee9852767d
  24. Oct 07, 2024
  25. Oct 02, 2024
    • Serban Iorga's avatar
      `polkadot-parachain`: add manual seal support (#5586) · 3cf83ca8
      Serban Iorga authored
      Resolves https://github.com/paritytech/polkadot-sdk/issues/5026
      
      This PR adds support for starting a dev node with manual seal consensus.
      This can be done by using the `--dev-block-time` argument . For example:
      ```
      polkadot-parachain --chain asset-hub-rococo-dev --dev-block-time 5000 --tmp
      ```
  26. Sep 23, 2024
    • Alin Dima's avatar
      elastic scaling: add core selector to cumulus (#5372) · b9eb68bc
      Alin Dima authored
      Partially implements
      https://github.com/paritytech/polkadot-sdk/issues/5048
      
      - adds a core selection runtime API to cumulus and a generic way of
      configuring it for a parachain
      - modifies the slot based collator to utilise the claim queue and the
      generic core selection
      
      What's left to be implemented (in a follow-up PR):
      - add the UMP signal for core selection into the parachain-system pallet
      
      View the RFC for more context:
      https://github.com/polkadot-fellows/RFCs/pull/103
      
      ---------
      
      Co-authored-by: command-bot <>
  27. Sep 10, 2024
  28. Sep 09, 2024
  29. Sep 05, 2024
    • Przemek Rzad's avatar
      Make the docs logo readable on light backgrounds (#5389) · f6fd5bc5
      Przemek Rzad authored
      
      Currently, the logo on the docs site blends into the background on the
      light theme:
      
      <img width="320px"
      src="https://github.com/user-attachments/assets/4cded445-d3af-4100-bd11-6a33da836cb1">
      
      
      [Here](https://internals.rust-lang.org/t/feedback-on-new-rust-documentation-logo-background/12787)
      is a discussion related to this. There doesn't seem to be a perfect way
      to handle this situation.
      
      ---
      
      Silent because the docs crate is not part of the regular release
      process.
      
      ---------
      
      Co-authored-by: default avatarordian <write@reusable.software>
  30. Sep 04, 2024
  31. Sep 03, 2024
  32. Aug 30, 2024
  33. Aug 28, 2024
    • Oliver Tale-Yazdi's avatar
      CI: Add backporting bot (#4795) · 56201964
      Oliver Tale-Yazdi authored
      
      Adds a bot that automatically opens MRs into the `stable2407` branch
      when the `A4-needs-backport` label is applied to a merged MR.
      
      TODO:
      - [x] ~~Settle on label vs error message trade-off~~ (resolved)
      
      docs:
      
      # Backporting
      
      This document explains how to backport a merged PR from `master` to one
      of the `stable*` branches. Backports should only be used to fix bugs or
      security issues - never to introduce new features.
      
      ## Steps
      
      1. Fix a bug through a PR that targets `master`.
      2. Add label `A4-needs-backport` to the PR.
      4. Merge the PR into `master`.
      5. Wait for the bot to open the backport PR.
      6. Ensure the change is audited or does not need audit.
      7. Merge the backport PR. 
      
      The label can also be added after the PR is merged.
      
      ## Example
      
      For example here where the dev triggered the process by adding the label
      after merging:
      
      
      ![backport-ex2](https://github.com/user-attachments/assets/c7b686db-a0fe-41f1-9d6f-959a5a7097b1)
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
    • Maksym H's avatar
      Command bot GHA v2 - /cmd <cmd> (#5457) · 8e0cefc8
      Maksym H authored
      Closes https://github.com/paritytech/product-engineering/issues/93
      
      - Deprecates old command bot bash scripts. New cmd implementation is
      re-written on Python
      - Deprecates `sync` command, which was never used
      - Benchmarks:
      - Uses new
      [frame-omni-bencher](https://crates.io/crates/frame-omni-bencher)
      - Simplifies usage to only providing a runtime and/or pallet name (even
      multiple runtimes or pallets)
      - Supports sub-modules (like `/cmd bench --runtime dev --pallet
      pallet_asset_conversion_ops`)
      - Can regenerate all weights with one command (substrate, polkadot,
      cumulus) for provided pallet(s) name
      - Adds [subweight](https://crates.io/crates/subweight-core) diff as a
      result of bench command
    • PG Herveou's avatar
  34. Aug 27, 2024
    • Przemek Rzad's avatar
      Make the PR template a default for new PRs (#5462) · 5a84374f
      Przemek Rzad authored
      A follow-up to https://github.com/paritytech/polkadot-sdk/pull/5447
      
      Instead of having an option to select a PR template (like is the case
      with issues), this change will make the one PR template we have the
      default, it will show up for every new PR.
      
      Also updated one link so it works properly in the PR body.