Skip to content
  1. Apr 17, 2024
    • Sergej Sakac's avatar
      XCM coretime region transfers (#3455) · e6f3106d
      Sergej Sakac authored
      
      
      This PR introduces changes enabling the transfer of coretime regions via
      XCM.
      
      TL;DR: There are two primary issues that are resolved in this PR:
      
      1. The `mint` and `burn` functions were not implemented for coretime
      regions. These operations are essential for moving assets to and from
      the XCM holding register.
      2. The transfer of non-fungible assets through XCM was previously
      disallowed. This was due to incorrectly benchmarking non-fungible asset
      transfers via XCM, which led to assigning it a weight of `Weight::Max`,
      effectively preventing its execution.
      
      ### `mint_into` and `burn` implementation
      
      This PR addresses the issue with cross-chain transferring regions back
      to the Coretime chain. Remote reserve transfers are performed by
      withdrawing and depositing the asset to and from the holding registry.
      This requires the asset to support burning and minting functionality.
      
      This PR adds burning and minting; however, they work a bit differently
      than usual so that the associated region record is not lost when
      burning. Instead of removing all the data, burning will set the owner of
      the region to `None`, and when minting it back, it will set it to an
      actual value. So, when cross-chain transferring, withdrawing into the
      registry will remove the region from its original owner, and when
      depositing it from the registry, it will set its owner to another
      account
      
      This was originally implemented in this PR: #3455, however we decided to
      move all of it to this single PR
      (https://github.com/paritytech/polkadot-sdk/pull/3455#discussion_r1547324892)
      
      ### Fixes made in this PR
      
      - Update the `XcmReserveTransferFilter` on coretime chain since it is
      meant as a reserve chain for coretime regions.
      - Update the XCM benchmark to use `AssetTransactor` instead of assuming
      `pallet-balances` for fungible transfers.
      - Update the XCM benchmark to properly measure weight consumption for
      nonfungible reserve asset transfers. ATM reserve transfers via the
      extrinsic do not work since the weight for it is set to `Weight::max()`.
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/865
      
      ---------
      
      Co-authored-by: default avatarBranislav Kontur <[email protected]>
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      Co-authored-by: default avatarDónal Murray <[email protected]>
      e6f3106d
  2. Apr 16, 2024
  3. Apr 15, 2024
    • thiolliere's avatar
      pallet assets: Fix errors (#4118) · a8f4f4f0
      thiolliere authored
      `LiveAsset` is an error to be returned when an asset is not supposed to
      be live.
      And `AssetNotLive` is an error to be returned when an asset is supposed
      to be live, I don't think frozen qualifies as live.
      a8f4f4f0
    • Dónal Murray's avatar
      [pallet-broker] add tests for renewing leases (#4099) · 0c9ad530
      Dónal Murray authored
      The first test proves that parachains who were migrated over on a legacy
      lease can renew without downtime.
      
      The exception is if their lease expires in period 0 - aka within
      `region_length` timeslices after `start_sales` is called. The second
      test is designed such that it passes if the issue exists and should be
      fixed.
      This will require an intervention on Kusama to add these renewals to
      storage as it is too tight to schedule a runtime upgrade before the
      start_sales call. All leases will still have at least two full regions
      of coretime.
      0c9ad530
    • Bastian Köcher's avatar
      pallet_broker: Support renewing leases expired in a previous period (#4089) · 6f73b746
      Bastian Köcher authored
      Part of: https://github.com/paritytech/polkadot-sdk/issues/4107
      6f73b746
  4. Apr 13, 2024
  5. Apr 12, 2024
  6. Apr 10, 2024
    • PG Herveou's avatar
      Contracts: Remove ED from base deposit (#3536) · 643aa2be
      PG Herveou authored
      
      
      - Update internal logic so that the storage_base_deposit does not
      include ED
      - add v16 migration to update ContractInfo struct with this change
      
      Before:
      <img width="820" alt="Screenshot 2024-03-21 at 11 23 29"
      src="https://github.com/paritytech/polkadot-sdk/assets/521091/a0a8df0d-e743-42c5-9e16-cf2ec1aa949c">
      
      After:
      ![Screenshot 2024-03-21 at 11 23
      42](https://github.com/paritytech/polkadot-sdk/assets/521091/593235b0-b866-4915-b653-2071d793228b)
      
      ---------
      
      Co-authored-by: default avatarCyrill Leutwiler <[email protected]>
      Co-authored-by: command-bot <>
      643aa2be
    • PG Herveou's avatar
      Contracts: Reuse module when validating (#3789) · 1da8d12d
      PG Herveou authored
      Reuse wasmi Module when validating.
      Prepare the code for 0.32 and the addition of Module::new_unchecked
      1da8d12d
    • PG Herveou's avatar
      Contracts: Only exec parsed code in benchmarks (#3915) · 0d71753e
      PG Herveou authored
      [Weights
      compare](https://weights.tasty.limo/compare?unit=weight&ignore_errors=true&threshold=10&method=asymptotic&repo=polkadot-sdk&old=master&new=pg%2Fbench_tweaks&path_pattern=substrate%2Fframe%2F**%2Fsrc%2Fweights.rs%2Cpolkadot%2Fruntime%2F*%2Fsrc%2Fweights%2F**%2F*.rs%2Cpolkadot%2Fbridges%2Fmodules%2F*%2Fsrc%2Fweights.rs%2Ccumulus%2F**%2Fweights%2F*.rs%2Ccumulus%2F**%2Fweights%2Fxcm%2F*.rs%2Ccumulus%2F**%2Fsrc%2Fweights.rs)
      
      Note: Raw weights change does not mean much here, as this PR reduce the
      scope of what is benchmarked, they are therefore decreased by a good
      margin. One should instead print the Schedule using
      
      cargo test --features runtime-benchmarks bench_print_schedule --
      --nocapture
      or following the instructions from the
      [README](https://github.com/paritytech/polkadot-sdk/tree/pg/bench_tweaks/substrate/frame/contracts#schedule)
      for looking at the Schedule of a specific runtime
      
      ---------
      
      Co-authored-by: command-bot <>
      0d71753e
    • PG Herveou's avatar
      Update benchmarking macros (#3934) · d38f6e67
      PG Herveou authored
      
      
      Current benchmarking macro returns a closure with the captured
      benchmarked code.
      This can cause issues when the benchmarked code has complex lifetime
      requirements.
      
      This PR updates the existing macro by injecting the recording parameter
      and invoking the start / stop method around the benchmarked block
      instead of returning a closure
      
      One other added benefit is that you can write this kind of code now as
      well:
      
      ```rust
      let v;
      #[block]
      { v = func.call(); }
      dbg!(v); // or assert something on v
      ```
      
      
      [Weights compare
      link](https://weights.tasty.limo/compare?unit=weight&ignore_errors=true&threshold=10&method=asymptotic&repo=polkadot-sdk&old=pg/fix-weights&new=pg/bench_update&path_pattern=substrate/frame/**/src/weights.rs,polkadot/runtime/*/src/weights/**/*.rs,polkadot/bridges/modules/*/src/weights.rs,cumulus/**/weights/*.rs,cumulus/**/weights/xcm/*.rs,cumulus/**/src/weights.rs)
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      d38f6e67
    • PG Herveou's avatar
      Contracts: Fix legacy uapi (#3994) · 2d927b07
      PG Herveou authored
      Fix some broken legacy definitions of pallet_contracts_uapi storage host
      functions
      2d927b07
  7. Apr 09, 2024
    • Sebastian Kunert's avatar
      Move cumulus zombienet tests to aura & async backing (#3568) · df818d29
      Sebastian Kunert authored
      Cumulus test-parachain node and test runtime were still using relay
      chain consensus and 12s blocktimes. With async backing around the corner
      on the major chains we should switch our tests too.
      
      Also needed to nicely test the changes coming to collators in #3168.
      
      ### Changes Overview
      - Followed the [migration
      guide](https://wiki.polkadot.network/docs/maintain-guides-async-backing)
      for async backing for the cumulus-test-runtime
      - Adjusted the cumulus-test-service to use the correct import-queue,
      lookahead collator etc.
      - The block validation function now uses the Aura Ext Executor so that
      the seal of the block is validated
      - Previous point requires that we seal block before calling into
      `validate_block`, I introduced a helper function for that
      - Test client adjusted to provide a slot to the relay chain proof and
      the aura pre-digest
      df818d29
    • PG Herveou's avatar
      Contracts: Refactor API to use WeightMeter (#2943) · b6231c79
      PG Herveou authored
      
      
      Update the Contracts API to use `WeightMeter`, as it simplifies the code
      and makes it easier to reason about, rather than taking a mutable weight
      or returning a tuple with the weight consumed
      
      ---------
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      b6231c79
    • Ankan's avatar
      Nomination pool configurations can be managed by custom origin (#3959) · 10ed7643
      Ankan authored
      
      
      closes https://github.com/paritytech/polkadot-sdk/issues/3894
      
      Allows Nomination Pool configuration to be set by a custom origin
      instead of root.
      
      In runtimes, we would set this to be `StakingAdmin`, same as for
      pallet-staking.
      
      ---------
      
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      10ed7643
    • gupnik's avatar
      Fixes validation for `SkipCheckIfFeeless` extension (#3993) · 0e27b881
      gupnik authored
      During validation, `SkipCheckIfFeeless` should check if the call is
      `feeless` and delegate to the wrapped extension if not.
      0e27b881
  8. Apr 08, 2024
    • Léa Narzis's avatar
      Adapt `RemoteExternalities` and its related types to be used with generic hash parameters (#3953) · d733c77e
      Léa Narzis authored
      
      
      Closes  https://github.com/paritytech/polkadot-sdk/issues/3737
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      d733c77e
    • Oliver Tale-Yazdi's avatar
      [FRAME] Runtime Omni Bencher (#3512) · 9543d314
      Oliver Tale-Yazdi authored
      This MR contains two major changes and some maintenance cleanup.  
      
      ## 1. Free Standing Pallet Benchmark Runner
      
      Closes https://github.com/paritytech/polkadot-sdk/issues/3045, depends
      on your runtime exposing the `GenesisBuilderApi` (like
      https://github.com/paritytech/polkadot-sdk/pull/1492).
      
      Introduces a new binary crate: `frame-omni-bencher`.  
      It allows to directly benchmark a WASM blob - without needing a node or
      chain spec.
      
      This makes it much easier to generate pallet weights and should allow us
      to remove bloaty code from the node.
      It should work for all FRAME runtimes that dont use 3rd party host calls
      or non `BlakeTwo256` block hashing (basically all polkadot parachains
      should work).
      
      It is 100% backwards compatible with the old CLI args, when the `v1`
      compatibility command is used. This is done to allow for forwards
      compatible addition of new commands.
      
      ### Example (full example in the Rust docs)
      
      Installing the CLI:
      ```sh
      cargo install --locked --path subs...
      9543d314
    • HongKuang's avatar
      Fix some typos (#4018) · bd4471b4
      HongKuang authored
      
      
      Signed-off-by: default avatarhongkuang <[email protected]>
      bd4471b4
  9. Apr 06, 2024
    • Liam Aharon's avatar
      Improve frame umbrella crate doc experience (#4007) · 74d6309c
      Liam Aharon authored
      
      
      1. Add `#[doc(no_inline)]` to frame umbrella crate re-exports that
      eventually resolve to `frame_support_procedural` so docs don't look like
      the screenshot below and instead link to the proper `frame-support`
      docs.
      <img width="1512" alt="Screenshot 2024-04-05 at 20 05 01"
      src="https://github.com/paritytech/polkadot-sdk/assets/16665596/a41daa4c-ebca-44a4-9fea-f9f336314e13">
      
      
      2. Remove `"Rust-Analyzer Users: "` prefix from
      `frame_support_procedural` doc comments, since these doc comments are
      visible in the web documentation and possible to stumble upon especially
      when navigating from the frame umbrella crate.
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      74d6309c
    • Liam Aharon's avatar
      `pallet-uniques`: decrement `total_deposit` when clearing collection metadata (#3976) · 9d626189
      Liam Aharon authored
      Decrements `total_deposit` when collection metadata is cleared in
      `pallet-nfts` and `pallet-uniques`.
      9d626189
  10. Apr 05, 2024
  11. Apr 04, 2024
    • Michal Kucharczyk's avatar
      `GenesisConfig` presets for runtime (#2714) · f910a15c
      Michal Kucharczyk authored
      The runtime now can provide a number of predefined presets of
      `RuntimeGenesisConfig` struct. This presets are intended to be used in
      different deployments, e.g.: `local`, `staging`, etc, and should be
      included into the corresponding chain-specs.
      
      Having `GenesisConfig` presets in runtime allows to fully decouple node
      from runtime types (the problem is described in #1984).
      
      **Summary of changes:**
      - The `GenesisBuilder` API was adjusted to enable this functionality
      (and provide better naming - #150):
         ```rust
          fn preset_names() -> Vec<PresetId>;
      fn get_preset(id: Option<PresetId>) -> Option<serde_json::Value>;
      //`None` means default
          fn build_state(value: serde_json::Value);
          pub struct PresetId(Vec<u8>);
         ```
      
      - **Breaking change**: Old `create_default_config` method was removed,
      `build_config` was renamed to `build_state`. As a consequence a node
      won't be able to interact with genesis config for older runtimes. The
      cleanup was made for sake of API simplicity. Also IMO maintaining
      compatibility with old API is not so crucial.
      - Reference implementation was provided for `substrate-test-runtime` and
      `rococo` runtimes. For rococo new
      [`genesis_configs_presets`](https://github.com/paritytech/polkadot-sdk/blob/3b41d66b/polkadot/runtime/rococo/src/genesis_config_presets.rs#L530)
      module was added and is used in `GenesisBuilder`
      [_presets-related_](https://github.com/paritytech/polkadot-sdk/blob/3b41d66b/polkadot/runtime/rococo/src/lib.rs#L2462-L2485)
      methods.
      
      - The `chain-spec-builder` util was also improved and allows to
      ([_doc_](https://github.com/paritytech/polkadot-sdk/blob/3b41d66b/substrate/bin/utils/chain-spec-builder/src/lib.rs#L19)):
         - list presets provided by given runtime (`list-presets`),
      - display preset or default config provided by the runtime
      (`display-preset`),
         - build chain-spec using named preset (`create ... named-preset`),
      
      
      - The `ChainSpecBuilder` is extended with
      [`with_genesis_config_preset_name`](https://github.com/paritytech/polkadot-sdk/blob/3b41d66b/substrate/client/chain-spec/src/chain_spec.rs#L447)
      method which allows to build chain-spec using named preset provided by
      the runtime. Sample usage on the node side
      [here](https://github.com/paritytech/polkadot-sdk/blob/2caffaae
      
      /polkadot/node/service/src/chain_spec.rs#L404).
      
      Implementation of #1984.
      fixes: #150
      part of: #25
      
      ---------
      
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      Co-authored-by: default avatarKian Paimani <[email protected]>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      f910a15c
    • Liam Aharon's avatar
      Migrate fee payment from `Currency` to `fungible` (#2292) · bda4e75a
      Liam Aharon authored
      Part of https://github.com/paritytech/polkadot-sdk/issues/226 
      Related https://github.com/paritytech/polkadot-sdk/issues/1833
      
      - Deprecate `CurrencyAdapter` and introduce `FungibleAdapter`
      - Deprecate `ToStakingPot` and replace usage with `ResolveTo`
      - Required creating a new `StakingPotAccountId` struct that implements
      `TypedGet` for the staking pot account ID
      - Update parachain common utils `DealWithFees`, `ToAuthor` and
      `AssetsToBlockAuthor` implementations to use `fungible`
      - Update runtime XCM Weight Traders to use `ResolveTo` instead of
      `ToStakingPot`
      - Update runtime Transaction Payment pallets to use `FungibleAdapter`
      instead of `CurrencyAdapter`
      - [x] Blocked by https://github.com/paritytech/polkadot-sdk/pull/1296,
      needs the `Unbalanced::decrease_balance` fix
      bda4e75a
    • juangirini's avatar
      [doc] Example MBM pallet (#2119) · bcb4d137
      juangirini authored
      
      
      ## Basic example showcasing a migration using the MBM framework
      
      This PR has been built on top of
      https://github.com/paritytech/polkadot-sdk/pull/1781 and adds two new
      example crates to the `examples` pallet
      
      ### Changes Made:
      
      Added the `pallet-example-mbm` crate: This crate provides a minimal
      example of a pallet that uses MBM. It showcases a storage migration
      where values are migrated from a `u32` to a `u64`.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      bcb4d137
    • Liam Aharon's avatar
      Fix Mermaid diagram rendering (#3875) · 0ef37c75
      Liam Aharon authored
      
      
      Closes https://github.com/paritytech/polkadot-sdk/issues/2977
      
      The issue appears to stem from the `aquamarine` crate failing to render
      diagrams in re-exported crates.
      
      e.g. as raised
      [here](https://github.com/paritytech/polkadot-sdk/issues/2977), diagrams
      would render at `frame_support::traits::Hooks` but not the re-exported
      doc `frame::traits::Hooks`, even if I added `aquamarine` as a `frame`
      crate dependency.
      
      To resolve this, I followed advice in
      https://github.com/mersinvald/aquamarine/issues/20 to instead render
      mermaid diagrams directly using JS by adding an `after-content.js`.
      
      ---
      
      Also fixes compile warnings, enables `--all-features` and disallows
      future warnings in CI.
      
      ---------
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      0ef37c75
    • Lulu's avatar
      Use 0.1.0 as minimum version for crates (#3941) · 0bbda78d
      Lulu authored
      CI will be enforcing this with next parity-publish release
      0bbda78d
    • gupnik's avatar
      Renames `frame` crate to `polkadot-sdk-frame` (#3813) · 38363769
      gupnik authored
      
      
      Step in https://github.com/paritytech/polkadot-sdk/issues/3155
      
      Needed for https://github.com/paritytech/eng-automation/issues/6
      
      This PR renames `frame` crate to `polkadot-sdk-frame` as `frame` is not
      available on crates.io
      
      ---------
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      38363769
  12. Apr 02, 2024
  13. Apr 01, 2024