Skip to content
Snippets Groups Projects
  1. Aug 15, 2024
    • Kian Paimani's avatar
      allow for `u8` to be used as hold/freeze reason (#5348) · 90c91b1e
      Kian Paimani authored
      ..without needing to provide your own `newtype` around it.  
      
      This will allow `type Reason = u8` to be used as `FreezeReason` and
      `HoldReason`, which I think is a nice simplification if one doens't want
      to deal with the complications.
      
      At the same time, it is a bit of an anti-pattern.
      
      Putting it out there to check people's vibes.
  2. Aug 14, 2024
    • Muharem Ismailov's avatar
      Make ticket non-optional and add ensure_successful method to Consideration trait (#5359) · 00946b10
      Muharem Ismailov authored
      Make ticket non-optional and add ensure_successful method to
      Consideration trait.
      
      Reverts the optional return ticket type for the new function introduced
      in
      [polkadot-sdk/4596](https://github.com/paritytech/polkadot-sdk/pull/4596)
      and adds a helper `ensure_successful` function for the runtime
      benchmarks.
      Since the existing FRAME pallet represents zero cost with a zero balance
      rather than `None` in an option, maintaining the ticket type as a
      non-optional balance is beneficial for backward compatibility and helps
      avoid unnecessary migrations.
  3. Aug 06, 2024
  4. Jul 29, 2024
    • Przemek Rzad's avatar
      Various corrections in the documentation (#5154) · de73c77c
      Przemek Rzad authored
      An attempt to improve [the
      docs](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/index.html)
      by applying various corrections:
      
      - grammar/stylistics,
      - formatting,
      - broken links,
      - broken markdown table,
      - outdated vscode setting name,
      - typos,
      - consistency,
      - etc.
      
      Part of https://github.com/paritytech/eng-automation/issues/10
  5. Jul 26, 2024
    • Kian Paimani's avatar
      Replace homepage in all TOML files (#5118) · d3d1542c
      Kian Paimani authored
      A bit of a controversial move, but a good preparation for even further
      reducing the traffic on outdated content of `substrate.io`. Current
      status:
      
      <img width="728" alt="Screenshot 2024-07-15 at 11 32 48"
      src="https://github.com/user-attachments/assets/df33b164-0ce7-4ac4-bc97-a64485f12571">
      
      Previously, I was in favor of changing the domain of the rust-docs to
      something like `polkadot-sdk.parity.io` or similar, but I think the
      current format is pretty standard and has a higher chance of staying put
      over the course of time:
      
      `<org-name>.github.io/<repo-name>` ->
      `https://paritytech.github.io/polkadot-sdk/`
      
      part of https://github.com/paritytech/eng-automation/issues/10
    • thiolliere's avatar
      Fix warnings for rust 1.80 (#5150) · 72509375
      thiolliere authored
      Fix warnings for rust 1.80
    • Shawn Tabrizi's avatar
      Add `from_mel` for `Footprint` with a Test (#5132) · 90b55337
      Shawn Tabrizi authored
      
      We may want to construct a `Footprint` by taking the `max_encoded_len`
      of a type, without having to construct the type.
      
      This impl allows easy access to that.
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
      Co-authored-by: command-bot <>
  6. Jul 24, 2024
  7. Jul 23, 2024
    • Muharem Ismailov's avatar
      Make `on_unbalanceds` work with `fungibles` `imbalances` (#4564) · 6d0926e2
      Muharem Ismailov authored
      Make `on_unbalanceds` work with `fungibles` `imbalances`.
      
      The `fungibles` `imbalances` cannot be handled by the default
      implementation of `on_unbalanceds` from the `OnUnbalanced` trait. This
      is because the `fungibles` `imbalances` types do not implement the
      `Imbalance` trait (and cannot with its current semantics). The
      `on_unbalanceds` function requires only the `merge` function for the
      imbalance type. In this PR, we provide the `TryMerge` trait, which can
      be implemented by all imbalance types and make `OnUnbalanced` require it
      instead `Imbalance`.
      
      ### Migration for `OnUnbalanced` trait implementations:
      In case if you have a custom implementation of `on_unbalanceds` trait
      function, remove it's `<B>` type argument.
      
      ### Migration for custom imbalance types:
      If you have your own imbalance types implementations, implement the
      `TryMerge` trait for it introduced with this update.
              
      The applicability of the `on_unbalanceds` function to fungibles
      imbalances is useful in cases like -
      [link](https://github.com/paritytech/polkadot-sdk/blob/3a8e675e
      
      /substrate/frame/transaction-payment/asset-conversion-tx-payment/src/payment.rs#L267)
      from https://github.com/paritytech/polkadot-sdk/pull/4488.
      
      ---------
      
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  8. Jul 22, 2024
  9. Jul 15, 2024
    • Jun Jiang's avatar
      Remove most all usage of `sp-std` (#5010) · 7ecf3f75
      Jun Jiang authored
      
      This should remove nearly all usage of `sp-std` except:
      - bridge and bridge-hubs
      - a few of frames re-export `sp-std`, keep them for now
      - there is a usage of `sp_std::Writer`, I don't have an idea how to move
      it
      
      Please review proc-macro carefully. I'm not sure I'm doing it the right
      way.
      
      Note: need `/bot fmt`
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
      Co-authored-by: command-bot <>
  10. Jul 12, 2024
  11. Jul 10, 2024
  12. Jul 06, 2024
    • Tomás Senovilla Polo's avatar
      Fix small typo in fungible token freeze docs (#4943) · 515a9f7a
      Tomás Senovilla Polo authored
      Hi!
      
      In the course of a talk with @shawntabrizi
      
       in Singapore, we realized the
      documentation related to freeze balances' a little bit confusing. It
      stated that a frozen amount is released at some specified block number,
      which isn't true in general.
      
      This PR fixes that typo and further specifies that the frozen balance
      may exceed the available balance, according to what we learned at the
      PBA. This feature was not specified in the documentation AFAIK.
      
      This is the first time I submit something to the polkadot SDK repo, so
      please feel free to rephrase the docs I added in case I messed up!
      
      ---------
      
      Co-authored-by: default avatarShawn Tabrizi <shawntabrizi@gmail.com>
      Co-authored-by: command-bot <>
  13. Jul 03, 2024
  14. Jun 26, 2024
  15. Jun 25, 2024
    • gupnik's avatar
      Use real rust type for pallet alias in `runtime` macro (#4769) · 2f3a1bf8
      gupnik authored
      Fixes https://github.com/paritytech/polkadot-sdk/issues/4723. Also,
      closes https://github.com/paritytech/polkadot-sdk/issues/4622
      
      As stated in the linked issue, this PR adds the ability to use a real
      rust type for pallet alias in the new `runtime` macro:
      ```rust
      #[runtime::pallet_index(0)]
      pub type System = frame_system::Pallet<Runtime>;
      ```
      
      Please note that the current syntax still continues to be supported.
      
      CC: @shawntabrizi @Kianenigma
      
      
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
  16. Jun 24, 2024
    • Oliver Tale-Yazdi's avatar
      Lift all dependencies (the big one) (#4716) · 8efa0544
      Oliver Tale-Yazdi authored
      
      After preparing in https://github.com/paritytech/polkadot-sdk/pull/4633,
      we can lift also all internal dependencies up to the workspace.
      
      This does not actually change anything, but uses `workspace = true` for
      all dependencies. You can check it with:
      ```bash
      git checkout -q $(git merge-base oty-lift-all-deps origin/master)
      cargo tree -e features > master.out
      
      git checkout -q oty-lift-all-deps
      cargo tree -e features > new.out
      diff master.out new.out
      ```
      
      It did not yet lift 100% of dependencies, some inside of `target.*` or
      some that had conflicting aliases introduced recently. But i will do
      these together in a follow-up with CI checks.
      
      Can be reproduced with [zepter](https://github.com/ggwpez/zepter/):
      `zepter transpose d lift-to-workspace "regex:.*" --version-resolver
      highest --skip-package "polkadot-sdk" --ignore-errors --fix`.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  17. Jun 22, 2024
    • Muharem Ismailov's avatar
      Frame: `Consideration` trait generic over `Footprint` and indicates zero cost (#4596) · 812dbff1
      Muharem Ismailov authored
      `Consideration` trait generic over `Footprint` and indicates zero cost
      for a give footprint.
      
      `Consideration` trait is generic over `Footprint` (currently defined
      over the type with the same name). This makes it possible to setup a
      custom footprint (e.g. current number of proposals in the storage).
      
      `Consideration::new` and `Consideration::update` return an
      `Option<Self>` instead `Self`, this make it possible to indicate a no
      cost for a specific footprint (e.g. if current number of proposals in
      the storage < max_proposal_count / 2 then no cost).
      
      These cases need to be handled for
      https://github.com/paritytech/polkadot-sdk/pull/3151
  18. Jun 21, 2024
  19. Jun 13, 2024
    • Branislav Kontur's avatar
      Use aggregated types for `RuntimeFreezeReason` and better examples of `MaxFreezes` (#4615) · 988103d7
      Branislav Kontur authored
      This PR aligns the settings for `MaxFreezes`, `RuntimeFreezeReason`, and
      `FreezeIdentifier`.
      
      #### Future work and improvements
      https://github.com/paritytech/polkadot-sdk/issues/2997 (remove
      `MaxFreezes` and `FreezeIdentifier`)
    • Kian Paimani's avatar
      Update the pallet guide in `sdk-docs` (#4735) · eca1052e
      Kian Paimani authored
      After using this tutorial in PBA, there was a few areas to improve it.
      Moreover, I have:
      
      - Improve `your_first_pallet`, link it in README, improve the parent
      `guide` section.
      - Updated the templates page, in light of recent efforts related to in
      https://github.com/paritytech/polkadot-sdk/issues/3155
      - Added small ref docs about metadata, completed the one about native
      runtime, added one about host functions.
      - Remove a lot of unfinished stuff from sdk-docs
      - update diagram for `Hooks`
  20. Jun 08, 2024
  21. Jun 05, 2024
    • Oliver Tale-Yazdi's avatar
      Unify dependency aliases (#4633) · d2fd5364
      Oliver Tale-Yazdi authored
      
      Inherited workspace dependencies cannot be renamed by the crate using
      them (see [1](https://github.com/rust-lang/cargo/issues/12546),
      [2](https://stackoverflow.com/questions/76792343/can-inherited-dependencies-in-rust-be-aliased-in-the-cargo-toml-file)).
      Since we want to use inherited workspace dependencies everywhere, we
      first need to unify all aliases that we use for a dependency throughout
      the workspace.
      The umbrella crate is currently excluded from this procedure, since it
      should be able to export the crates by their original name without much
      hassle.
      
      For example: one crate may alias `parity-scale-codec` to `codec`, while
      another crate does not alias it at all. After this change, all crates
      have to use `codec` as name. The problematic combinations were:
      - conflicting aliases: most crates aliases as `A` but some use `B`.
      - missing alias: most of the crates alias a dep but some dont.
      - superfluous alias: most crates dont alias a dep but some do.
      
      The script that i used first determines whether most crates opted to
      alias a dependency or not. From that info it decides whether to use an
      alias or not. If it decided to use an alias, the most common one is used
      everywhere.
      
      To reproduce, i used
      [this](https://github.com/ggwpez/substrate-scripts/blob/master/uniform-crate-alias.py)
      python script in combination with
      [this](https://github.com/ggwpez/zepter/blob/38ad10585fe98a5a86c1d2369738bc763a77057b/renames.json)
      error output from Zepter.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
  22. Jun 02, 2024
  23. May 29, 2024
  24. May 24, 2024
    • Oliver Tale-Yazdi's avatar
      Polkadot-SDK Umbrella Crate (#3935) · 1c7a1a58
      Oliver Tale-Yazdi authored
      
      # Umbrella Crate
      
      The Polkadot-SDK "umbrella" is a crate that re-exports all other
      published crates. This makes it
      possible to have a very small `Cargo.toml` file that only has one
      dependency, the umbrella
      crate. This helps with selecting the right combination of crate
      versions, since otherwise 3rd
      party tools are needed to select a compatible set of versions.
      
      ## Features
      
      The umbrella crate supports no-std builds and can therefore be used in
      the runtime and node.
      There are two main features: `runtime` and `node`. The `runtime` feature
      enables all `no-std`
      crates, while the `node` feature enables all `std` crates. It should be
      used like any other
      crate in the repo, with `default-features = false`.
      
      For more fine-grained control, additionally, each crate can be enabled
      selectively. The umbrella
      exposes one feature per dependency. For example, if you only want to use
      the `frame-support`
      crate, you can enable the `frame-support` feature.
      
      The umbrella exposes a few more general features:
      - `tuples-96`: Needs to be enabled for runtimes that have more than 64
      pallets.
      - `serde`: Specifically enable `serde` en/decoding support.
      - `experimental`: Experimental enable experimental features - should not
      yet used in production.
      - `with-tracing`: Enable tracing support.
      - `try-runtime`, `runtime-benchmarks` and `std`: These follow the
      standard conventions.
      - `runtime`: As described above, enable all `no-std` crates.
      - `node`: As described above, enable all `std` crates.
      - There does *not* exist a dedicated docs feature. To generate docs,
      enable the `runtime` and
      `node` feature. For docs.rs the manifest contains specific configuration
      to make it show up
        all re-exports.
      
      There is a specific `zepter` check in place to ensure that the features
      of the umbrella are
      correctly configured. This check is run in CI and locally when running
      `zepter`.
      
      ## Generation
      
      The umbrella crate needs to be updated every time when a new crate is
      added or removed from the
      workspace. It is checked in CI by calling its generation script. The
      generation script is
      located in `./scripts/generate-umbrella.py` and needs dependency
      `cargo_workspace`.
      
      Example: `python3 scripts/generate-umbrella.py --sdk . --version 1.9.0`
      
      ## Usage
      
      > Note: You can see a live example in the `staging-node-cli` and
      `kitchensink-runtime` crates.
      
      The umbrella crate can be added to your runtime crate like this:
      
      `polkadot-sdk = { path = "../../../../umbrella", features = ["runtime"],
      default-features =
      false}`
      
      or for a node:
      
      `polkadot-sdk = { path = "../../../../umbrella", features = ["node"],
      default-features = false
      }`
      
      In the code, it is then possible to bring all dependencies into scope
      via:
      
      `use polkadot_sdk::*;`
      
      ### Known Issues
      
      The only known issue so far is the fact that the `use` statement brings
      the dependencies only
      into the outer module scope - not the global crate scope. For example,
      the following code would
      need to be adjusted:
      
      ```rust
      use polkadot_sdk::*;
      
      mod foo {
         // This does sadly not compile:
         frame_support::parameter_types! { }
      
         // Instead, we need to do this (or add an equivalent `use` statement):
         polkadot_sdk::frame_support::parameter_types! { }
      }
      ```
      
      Apart from this, no issues are known. There could be some bugs with how
      macros locate their own
      re-exports. Please compile issues that arise from using this crate.
      
      ## Dependencies
      
      The umbrella crate re-exports all published crates, with a few
      exceptions:
      - Runtime crates like `rococo-runtime` etc are not exported. This
      otherwise leads to very weird
        compile errors and should not be needed anyway.
      - Example and fuzzing crates are not exported. This is currently
      detected by checking the name
      of the crate for these magic words. In the future, it will utilize
      custom metadata, as it is
        done in the `rococo-runtime` crate.
      - The umbrella crate itself. Should be obvious :)
      
      ## Follow Ups
      - [ ] Re-writing the generator in Rust - the python script is at its
      limit.
      - [ ] Using custom metadata to exclude some crates instead of filtering
      by names.
      - [ ] Finding a way to setting the version properly. Currently its
      locked in the CI script.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
    • Branislav Kontur's avatar
      Attempt to avoid specifying `BlockHashCount` for different... · ef144b1a
      Branislav Kontur authored
      Attempt to avoid specifying `BlockHashCount` for different `mocking::{MockBlock, MockBlockU32, MockBlockU128}` (#4543)
      
      While doing some migration/rebase I came in to the situation, where I
      needed to change `mocking::MockBlock` to `mocking::MockBlockU32`:
      ```
      #[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
      impl frame_system::Config for TestRuntime {
      	type Block = frame_system::mocking::MockBlockU32<TestRuntime>;
      	type AccountData = pallet_balances::AccountData<ThisChainBalance>;
      }
      ```
      But actual `TestDefaultConfig` for `frame_system` is using `ConstU64`
      for `type BlockHashCount = frame_support::traits::ConstU64<10>;`
      [here](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/system/src/lib.rs#L303).
      Because of this, it force me to specify and add override for `type
      BlockHashCount = ConstU32<10>`.
      
      This PR tries to fix this with `TestBlockHashCount` implementation for
      `TestDefaultConfig` which supports `u32`, `u64` and `u128` as a
      `BlockNumber`.
      
      ### How to simulate error
      Just by removing `type BlockHashCount = ConstU32<250>;`
      [here](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/multisig/src/tests.rs#L44)
      ```
      :~/parity/olkadot-sdk$ cargo test -p pallet-multisig
         Compiling pallet-multisig v28.0.0 (/home/bparity/parity/aaa/polkadot-sdk/substrate/frame/multisig)
      error[E0277]: the trait bound `ConstU64<10>: frame_support::traits::Get<u32>` is not satisfied
         --> substrate/frame/multisig/src/tests.rs:41:1
          |
      41  | #[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
          | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `frame_support::traits::Get<u32>` is not implemented for `ConstU64<10>`
          |
          = help: the following other types implement trait `frame_support::traits::Get<T>`:
                    <ConstU64<T> as frame_support::traits::Get<u64>>
                    <ConstU64<T> as frame_support::traits::Get<std::option::Option<u64>>>
      note: required by a bound in `frame_system::Config::BlockHashCount`
         --> /home/bparity/parity/aaa/polkadot-sdk/substrate/frame/system/src/lib.rs:535:24
          |
      535 |         type BlockHashCount: Get<BlockNumberFor<Self>>;
          |                              ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Config::BlockHashCount`
          = note: this error originates in the attribute macro `derive_impl` which comes from the expansion of the macro `frame_support::macro_magic::forward_tokens_verbatim` (in Nightly builds, run with -Z macro-backtrace for more info)
      
      For more information about this error, try `rustc --explain E0277`.
      error: could not compile `pallet-multisig` (lib test) due to 1 previous error 
      ```
      
      
      
      
      ## For reviewers:
      
      (If there is a better solution, please let me know!)
      
      The first commit contains actual attempt to fix the problem:
      https://github.com/paritytech/polkadot-sdk/commit/3c5499e5
      
      .
      The second commit is just removal of `BlockHashCount` from all other
      places where not needed by default.
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/1657
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
  25. May 15, 2024
    • Alexandru Gheorghe's avatar
      Make vscode rustanalyzer fast again (#4470) · e31fcffb
      Alexandru Gheorghe authored
      
      This bump of versions:
      
      https://github.com/paritytech/polkadot-sdk/pull/4409/files#diff-13ee4b2252c9e516a0547f2891aa2105c3ca71c6d7a1e682c69be97998dfc87eR11936
      
      reintroduced a dependency to proc-macro-crate 2.0.0 which is suffering
      from: https://github.com/bkchr/proc-macro-crate/pull/42 this, so bump
      parity-scale-codec to a newer version to eliminate the bad
      proc-macro-crate 2.0.0 dependency.
      
      ---------
      
      Signed-off-by: default avatarAlexandru Gheorghe <alexandru.gheorghe@parity.io>
      Co-authored-by: command-bot <>
  26. May 13, 2024
    • Tsvetomir Dimitrov's avatar
      Bump `proc-macro-crate` to the latest version (#4409) · fb7362f6
      Tsvetomir Dimitrov authored
      This PR bumps `proc-macro-crate` to the latest version.
      
      In order to test a runtime from
      https://github.com/polkadot-fellows/runtimes/ with the latest version of
      polkadot-sdk one needs to use `cargo vendor` to extract all runtime
      dependencies, patch them by hand and then build the runtime.
      
      However at the moment 'vendored' builds fail due to
      https://github.com/bkchr/proc-macro-crate/issues/48. To fix this
      `proc-macro-crate` should be updated to version `3.0.1` or higher.
      
      ---------
      
      Co-authored-by: command-bot <>
  27. May 10, 2024
  28. May 08, 2024
    • Dino Pačandi's avatar
      [pallet-balances] `burn_allow_death` extrinsic (#3964) · c3e57c1b
      Dino Pačandi authored
      
      Adds an additional extrinsic call to the `pallet-balances` to _burn_
      tokens.
      Depending on the `keep_alive` flag, the call might or might not reap the
      account.
      
      Required modification of the _fungible's_ `Mutate` trait, `burn_from`
      function to allow the `Preservation` argument.
      
      **TODO**
      - [x] run benchmarks & update weights
      - [x] make sure prdoc is required & properly formatted
      
      Related issue: https://github.com/paritytech/polkadot-sdk/issues/3943
      
      ---------
      
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
      Co-authored-by: command-bot <>
  29. May 06, 2024
  30. Apr 30, 2024
  31. Apr 26, 2024
  32. Apr 25, 2024
  33. Apr 24, 2024
  34. Apr 20, 2024
  35. Apr 18, 2024
  36. Apr 17, 2024