1. Nov 04, 2023
  2. Nov 03, 2023
    • Bastian Köcher's avatar
      `sc-block-builder`: Remove `BlockBuilderProvider` (#2099) · ca5f1056
      Bastian Köcher authored
      The `BlockBuilderProvider` was a trait that was defined in
      `sc-block-builder`. The trait was implemented for `Client`. This
      basically meant that you needed to import `sc-block-builder` any way to
      have access to the block builder. So, this trait was not providing any
      real value. This pull request is removing the said trait. Instead of the
      trait it introduces a builder for creating a `BlockBuilder`. The builder
      currently has the quite fabulous name `BlockBuilderBuilder` (I'm open to
      any better name 😅
      
      ). The rest of the pull request is about
      replacing the old trait with the new builder.
      
      # Downstream code changes
      
      If you used `new_block` or `new_block_at` before you now need to switch
      it over to the new `BlockBuilderBuilder` pattern:
      
      ```rust
      // `new` requires a type that implements `CallApiAt`. 
      let mut block_builder = BlockBuilderBuilder::new(client)
                      // Then you need to specify the hash of the parent block the block will be build on top of
      		.on_parent_block(at)
                      // The block builder also needs the block number of the parent block. 
                      // Here it is fetched from the given `client` using the `HeaderBackend`
                      // However, there also exists `with_parent_block_number` for directly passing the number
      		.fetch_parent_block_number(client)
      		.unwrap()
                      // Enable proof recording if required. This call is optional.
      		.enable_proof_recording()
                      // Pass the digests. This call is optional.
                      .with_inherent_digests(digests)
      		.build()
      		.expect("Creates new block builder");
      ```
      
      ---------
      
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      Co-authored-by: command-bot <>
      ca5f1056
    • Anthony Lazam's avatar
      Update Kusama Parachains Bootnode (#2148) · f6f4c5aa
      Anthony Lazam authored
      # Description
      
      Update the bootnode of kusama parachains before decommissioning the
      nodes. This will avoid connecting to non-existing bootnodes.
      f6f4c5aa
    • Alexandru Gheorghe's avatar
      substrate: sysinfo: Expose failed hardware requirements (#2144) · dca14239
      Alexandru Gheorghe authored
      
      
      The check_hardware functions does not give us too much information as to
      what is failing, so let's return the list of failed metrics, so that callers can print 
      it.
      
      This would make debugging easier, rather than try to guess which
      dimension is actually failing.
      
      Signed-off-by: default avatarAlexandru Gheorghe <[email protected]>
      dca14239
    • Svyatoslav Nikolsky's avatar
      [testnet] Allow governance to control fees for Rococo <> Westend bridge (#2139) · 0d3c67d9
      Svyatoslav Nikolsky authored
      Right now governance could only control byte-fee component of Rococo <>
      Westend message fees (paid at Asset Hubs). This PR changes it a bit:
      1) governance now allowed to control both fee components - byte fee and
      base fee;
      2) base fee now includes cost of "default" delivery and confirmation
      transactions, in addition to `ExportMessage` instruction cost.
      0d3c67d9
  3. Nov 02, 2023
    • Oliver Tale-Yazdi's avatar
      Use `Message Queue` as DMP and XCMP dispatch queue (#1246) · e1c033eb
      Oliver Tale-Yazdi authored
      (imported from https://github.com/paritytech/cumulus/pull/2157)
      
      ## Changes
      
      This MR refactores the XCMP, Parachains System and DMP pallets to use
      the [MessageQueue](https://github.com/paritytech/substrate/pull/12485)
      for delayed execution of incoming messages. The DMP pallet is entirely
      replaced by the MQ and thereby removed. This allows for PoV-bounded
      execution and resolves a number of issues that stem from the current
      work-around.
      
      All System Parachains adopt this change.  
      The most important changes are in `primitives/core/src/lib.rs`,
      `parachains/common/src/process_xcm_message.rs`,
      `pallets/parachain-system/src/lib.rs`, `pallets/xcmp-queue/src/lib.rs`
      and the runtime configs.
      
      ### DMP Queue Pallet
      
      The pallet got removed and its logic refactored into parachain-system.
      Overweight message management can be done directly through the MQ
      pallet.
      
      Final undeployment migrations are provided by
      `cumulus_pallet_dmp_queue::UndeployDmpQueue` and `DeleteDmpQueue` that
      can be configured with an aux config trait like:
      
      ```rust
      parameter_types! {
      	pub const DmpQueuePalletName: &'static str = \"DmpQueue\" < CHANGE ME;
      	pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
      }
      
      impl cumulus_pallet_dmp_queue::MigrationConfig for Runtime {
      	type PalletName = DmpQueuePalletName;
      	type DmpHandler = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
      	type DbWeight = <Runtime as frame_system::Config>::DbWeight;
      }
      
      // And adding them to your Migrations tuple:
      pub type Migrations = (
      	...
      	cumulus_pallet_dmp_queue::UndeployDmpQueue<Runtime>,
      	cumulus_pallet_dmp_queue::DeleteDmpQueue<Runtime>,
      );
      ```
      
      ### XCMP Queue pallet
      
      Removed all dispatch queue functionality. Incoming XCMP messages are now
      either: Immediately handled if they are Signals, enqueued into the MQ
      pallet otherwise.
      
      New config items for the XCMP queue pallet:
      ```rust
      /// The actual queue implementation that retains the messages for later processing.
      type XcmpQueue: EnqueueMessage<ParaId>;
      
      /// How a XCM over HRMP from a sibling parachain should be processed.
      type XcmpProcessor: ProcessMessage<Origin = ParaId>;
      
      /// The maximal number of suspended XCMP channels at the same time.
      #[pallet::constant]
      type MaxInboundSuspended: Get<u32>;
      ```
      
      How to configure those:
      
      ```rust
      // Use the MessageQueue pallet to store messages for later processing. The `TransformOrigin` is needed since
      // the MQ pallet itself operators on `AggregateMessageOrigin` but we want to enqueue `ParaId`s.
      type XcmpQueue = TransformOrigin<MessageQueue, AggregateMessageOrigin, ParaId, ParaIdToSibling>;
      
      // Process XCMP messages from siblings. This is type-safe to only accept `ParaId`s. They will be dispatched
      // with origin `Junction::Sibling(…)`.
      type XcmpProcessor = ProcessFromSibling<
      	ProcessXcmMessage<
      		AggregateMessageOrigin,
      		xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
      		RuntimeCall,
      	>,
      >;
      
      // Not really important what to choose here. Just something larger than the maximal number of channels.
      type MaxInboundSuspended = sp_core::ConstU32<1_000>;
      ```
      
      The `InboundXcmpStatus` storage item was replaced by
      `InboundXcmpSuspended` since it now only tracks inbound queue suspension
      and no message indices anymore.
      
      Now only sends the most recent channel `Signals`, as all prio ones are
      out-dated anyway.
      
      ### Parachain System pallet
      
      For `DMP` messages instead of forwarding them to the `DMP` pallet, it
      now pushes them to the configured `DmpQueue`. The message processing
      which was triggered in `set_validation_data` is now being done by the MQ
      pallet `on_initialize`.
      
      XCMP messages are still handed off to the `XcmpMessageHandler`
      (XCMP-Queue pallet) - no change here.
      
      New config items for the parachain system pallet:
      ```rust
      /// Queues inbound downward messages for delayed processing. 
      ///
      /// Analogous to the `XcmpQueue` of the XCMP queue pallet.
      type DmpQueue: EnqueueMessage<AggregateMessageOrigin>;
      ``` 
      
      How to configure:
      ```rust
      /// Use the MQ pallet to store DMP messages for delayed processing.
      type DmpQueue = MessageQueue;
      ``` 
      
      ## Message Flow
      
      The flow of messages on the parachain side. Messages come in from the
      left via the `Validation Data` and finally end up at the `Xcm Executor`
      on the right.
      
      ![Untitled
      (1)](https://github.com/paritytech/cumulus/assets/10380170/6cf8b377-88c9-4aed-96df-baace266e04d)
      
      ## Further changes
      
      - Bumped the default suspension, drop and resume thresholds in
      `QueueConfigData::default()`.
      - `XcmpQueue::{suspend_xcm_execution, resume_xcm_execution}` errors when
      they would be a noop.
      - Properly validate the `QueueConfigData` before setting it.
      - Marked weight files as auto-generated so they wont auto-expand in the
      MR files view.
      - Move the `hypothetical` asserts to `frame_support` under the name
      `experimental_hypothetically`
      
      Questions:
      - [ ] What about the ugly `#[cfg(feature = \"runtime-benchmarks\")]` in
      the runtimes? Not sure how to best fix. Just having them like this makes
      tests fail that rely on the real message processor when the feature is
      enabled.
      - [ ] Need a good weight for `MessageQueueServiceWeight`. The scheduler
      already takes 80% so I put it to 10% but that is quite low.
      
      TODO:
      - [x] Remove c&p code after
      https://github.com/paritytech/polkadot/pull/6271
      - [x] Use `HandleMessage` once it is public in Substrate
      - [x] fix `runtime-benchmarks` feature
      https://github.com/paritytech/polkadot/pull/6966
      
      
      - [x] Benchmarks
      - [x] Tests
      - [ ] Migrate `InboundXcmpStatus` to `InboundXcmpSuspended`
      - [x] Possibly cleanup Migrations (DMP+XCMP)
      - [x] optional: create `TransformProcessMessageOrigin` in Substrate and
      replace `ProcessFromSibling`
      - [ ] Rerun weights on ref HW
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      Co-authored-by: default avatarKian Paimani <[email protected]>
      Co-authored-by: command-bot <>
      e1c033eb
  4. Nov 01, 2023
  5. Oct 31, 2023
  6. Oct 30, 2023
  7. Oct 27, 2023
  8. Oct 26, 2023
    • Alin Dima's avatar
      cumulus: fix test runtimes panic (#2039) · 1b08bdd2
      Alin Dima authored
      the min slot duration should be 0 only if the `experimental` feature is
      enabled. otherwise, the runtime will panic on a division by 0.
      1b08bdd2
    • Branislav Kontur's avatar
    • Dastan's avatar
      Expose collection attributes from `Inspect` trait (#1914) · 0bcebac4
      Dastan authored
      # Description
      
      - What does this PR do?
      
      While working with `pallet_nfts` through `nonfungibles_v2` traits
      `Inspect, Mutate`, I found out that once you have set the collection
      attribute with `<Nfts as Mutate>::set_collection_attribute()`, it's not
      possible to read it with `<Nfts as Inspect>::collection_attribute()`
      since they use different `namespace` values. When setting the attribute,
      `AttributeNamespace::Pallet` is used, while
      `AttributeNamespace::CollectionOwner` is used when reading.
      
      more context:
      https://github.com/freeverseio/laos/issues/7#issuecomment-1766137370
      
      This PR makes `item` an optional parameter in
      `Inspect::system_attribute()`, to be able to read collection attributes.
      
      - Why are these changes needed?
      
      To be able to read collection level attributes when reading attributes
      of the collection. It will be possible to read collection attributes by
      passing `None` for `item`
      
      - How were these changes implemented and what do they affect?
      
      `NftsApi` is also affected and `NftsApi::system_attribute()` now accepts
      optional `item` parameter.
      
      ## Breaking change
      
      Because of the change in the `NftsApi::system_attribute()` method's
      `item` param, parachains who integrated the `NftsApi` need to update
      their API code and frontend integrations accordingly. AssetHubs are
      unaffected since the NftsApi wasn't released on those parachains yet.
      0bcebac4
  9. Oct 25, 2023
    • Branislav Kontur's avatar
      [testnet] Align testnet system parachain runtimes using... · f6560c2b
      Branislav Kontur authored
      [testnet] Align testnet system parachain runtimes using `RelayTreasuryLocation` and `SystemParachains` in the same way (#2023)
      
      This PR addresses several issues:
      - simplify referencing `RelayTreasuryLocation` without needing
      additional `RelayTreasury` struct
      - fix for referencing `SystemParachains` from parachain with `parents:
      1` instead of `parents: 0`
      - removed hard-coded constants and fix tests for `asset-hub-rococo`
      which was merged to master after
      https://github.com/paritytech/polkadot-sdk/pull/1726
      
      ---------
      
      Co-authored-by: command-bot <>
      f6560c2b
  10. Oct 24, 2023
    • Oliver Tale-Yazdi's avatar
      Improve features dev-ex (#1831) · 4a443567
      Oliver Tale-Yazdi authored
      Adds a config file that allows to run `zepter` without any arguments in
      the workspace to address all issues.
      A secondary workflow for the CI is provided as `zepter run check`. Both
      the formatting and linting are now in one check for efficiancy.
      
      The latest version also detects some more things that `featalign` was
      already showing.
      
      Error message [in the
      CI](https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3916205)
      now looks like this:
      ```pre
      ...
      crate 'test-parachains' (/Users/vados/Documents/work/polkadot-sdk/polkadot/parachain/test-parachains/Cargo.toml)
        feature 'std'
          must propagate to:
            parity-scale-codec
      Found 55 issues (run with --fix to fix).
      Error: Command 'lint propagate-feature' failed with exit code 1
      
      Polkadot-SDK uses the Zepter CLI to detect abnormalities in the feature configuration.
      It looks like one more more checks failed; please check the console output. You can try to automatically address them by running `zepter`.
      Otherwise please ask directly in the Merge Request, GitHub Discussions or on Matrix Chat, thank you.
      
      For more information, see:
        - https://github.com/paritytech/polkadot-sdk/issues/1831
        - https://github.com/ggwpez/zepter
      
      
      ```
      
      TODO:
      - [x] Check that CI fails correctly
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      4a443567
    • Kian Paimani's avatar
      Ensure correct variant count in `Runtime[Hold/Freeze]Reason` (#1900) · 35eb133b
      Kian Paimani authored
      closes https://github.com/paritytech/polkadot-sdk/issues/1882
      
      
      
      ## Breaking Changes
      
      This PR introduces a new item to `pallet_balances::Config`:
      
      ```diff
      trait Config {
      ++    type RuntimeFreezeReasons;
      }
      ```
      
      This value is only used to check it against `type MaxFreeze`. A similar
      check has been added for `MaxHolds` against `RuntimeHoldReasons`, which
      is already given to `pallet_balances`.
      
      In all contexts, you should pass the real `RuntimeFreezeReasons`
      generated by `construct_runtime` to `type RuntimeFreezeReasons`. Passing
      `()` would also work, but it would imply that the runtime uses no
      freezes at all.
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      35eb133b
  11. Oct 23, 2023
  12. Oct 20, 2023
    • Branislav Kontur's avatar
      [testnet] AssetHubRococo nits (#1954) · 76994356
      Branislav Kontur authored
      This PR addresses several minor issues:
      - Fixes the symlink for `asset-hub-rococo.json` chainspec.
      - Corrects the `asset-hub-rococo-genesis` invulnerables setup.
      - Relocates common bash functions for bridge testing to a separate file
      `bridges_common.sh`.
      76994356
    • Bastian Köcher's avatar
      `xcm`: Change `TypeInfo::path` to not include `staging` (#1948) · f3bf5c1a
      Bastian Köcher authored
      The `xcm` crate was renamed to `staging-xcm` to be able to publish it to
      crates.io as someone as squatted `xcm`. The problem with this rename is
      that the `TypeInfo` includes the crate name which ultimately lands in
      the metadata. The metadata is consumed by downstream users like
      `polkadot-js` or people building on top of `polkadot-js`. These people
      are using the entire `path` to find the type in the type registry. Thus,
      their code would break as the type path would now be [`staging_xcm`,
      `VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request
      fixes this by renaming the path segment `staging_xcm` to `xcm`.
      
      This requires: https://github.com/paritytech/scale-info/pull/197
      
      
      
      ---------
      
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      f3bf5c1a
    • Francisco Aguirre's avatar
      Remove some dbgs (#1949) · f0d443a0
      Francisco Aguirre authored
      Removed some debug logs
      f0d443a0
  13. Oct 19, 2023
  14. Oct 18, 2023
    • Keith Yeung's avatar
      Introduce XcmFeesToAccount fee manager (#1234) · 3dece311
      Keith Yeung authored
      
      
      Combination of paritytech/polkadot#7005, its addon PR
      paritytech/polkadot#7585 and its companion paritytech/cumulus#2433.
      
      This PR introduces a new XcmFeesToAccount struct which implements the
      `FeeManager` trait, and assigns this struct as the `FeeManager` in the
      XCM config for all runtimes.
      
      The struct simply deposits all fees handled by the XCM executor to a
      specified account. In all runtimes, the specified account is configured
      as the treasury account.
      
      XCM __delivery__ fees are now being introduced (unless the root origin
      is sending a message to a system parachain on behalf of the originating
      chain).
      
      # Note for reviewers
      
      Most file changes are tests that had to be modified to account for the
      new fees.
      Main changes are in:
      - cumulus/pallets/xcmp-queue/src/lib.rs <- To make it track the delivery
      fees exponential factor
      - polkadot/xcm/xcm-builder/src/fee_handling.rs <- Added. Has the
      FeeManager implementation
      - All runtime xcm_config files <- To add the FeeManager to the XCM
      configuration
      
      # Important note
      
      After this change, instructions that create and send a new XCM (Query*,
      Report*, ExportMessage, InitiateReserveWithdraw, InitiateTeleport,
      DepositReserveAsset, TransferReserveAsset, LockAsset and RequestUnlock)
      will require the corresponding origin account in the origin register to
      pay for transport delivery fees, and the onward message will fail to be
      sent if the origin account does not have the required amount. This
      delivery fee is on top of what we already collect as tx fees in
      pallet-xcm and XCM BuyExecution fees!
      
      Wallet UIs that want to expose the new delivery fee can do so using the
      formula:
      
      ```
      delivery_fee_factor * (base_fee + encoded_msg_len * per_byte_fee)
      ```
      
      where the delivery fee factor can be obtained from the corresponding
      pallet based on which transport you are using (UMP, HRMP or bridges),
      the base fee is a constant, the encoded message length from the message
      itself and the per byte fee is the same as the configured per byte fee
      for txs (i.e. `TransactionByteFee`).
      
      ---------
      
      Co-authored-by: default avatarBranislav Kontur <[email protected]>
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      Co-authored-by: default avatarGiles Cope <[email protected]>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      Co-authored-by: default avatarKian Paimani <[email protected]>
      3dece311
    • joe petrowski's avatar
      Add Runtime Missing Crate Descriptions (#1909) · d3ea69b7
      joe petrowski authored
      Adds descriptions needed for publishing to crates.io.
      d3ea69b7
    • Adrian Catangiu's avatar
      cumulus: add asset-hub-rococo runtime based on asset-hub-kusama and add... · 8b3905d2
      Adrian Catangiu authored
      
      cumulus: add asset-hub-rococo runtime based on asset-hub-kusama and add asset-bridging support to it (#1215)
      
      This commit adds Rococo Asset Hub dedicated runtime so we can test new
      features here, before merging them in Kusama Asset Hub.
      Also adds one such feature: asset transfer over bridge (Rococo AssetHub
      <> Wococo AssetHub)
      
      - clone `asset-hub-kusama-runtime` -> `asset-hub-rococo-runtime`
      - make it use Rococo primitives, names, assets, constants, etc
      - add asset-transfer-over-bridge support to Rococo AssetHub <> Wococo
      AssetHub
      
      Fixes #1128
      
      ---------
      
      Co-authored-by: default avatarBranislav Kontur <[email protected]>
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      8b3905d2
    • Ignacio Palacios's avatar
      Publish `penpal-runtime` crate (#1904) · e73729b1
      Ignacio Palacios authored
      Remove `publish = false` to publish the crate
      e73729b1
  15. Oct 17, 2023
  16. Oct 16, 2023
  17. Oct 12, 2023
  18. Oct 11, 2023
    • Branislav Kontur's avatar
      Xcm emulator nits (#1649) · cfb29254
      Branislav Kontur authored
      # Desription
      
      ## Summary 
      
      This PR introduces several nits and tweaks to xcm emulator tests for
      system parachains.
      
      ## Explanation
      
      **Deduplicate `XcmPallet::send(` with root origin code**
      - Introduced `send_transact_to_parachain` which could be easily reuse
      for scenarios like _governance call from relay chain to parachain_.
      
      **Refactor `send_transact_sudo_from_relay_to_system_para_works`**
      - Test covered just one use-case which was moved to the
      `do_force_create_asset_from_relay_to_system_para`, so now we can extend
      this test with more _governance-like_ senarios.
      - Renamed to
      `send_transact_as_superuser_from_relay_to_system_para_works`.
      
      **Remove `send_transact_native_from_relay_to_system_para_fails` test**
      - This test and/or description is kind of misleading, because system
      paras support Native from relay chain by `RelayChainAsNative` with
      correct xcm origin.
      - It tested only sending on relay chain which should go directly to the
      relay chain unit-tests (does not even need to be in xcm emulator level).
      
      ## Future directions
      
      Check restructure parachains integration tests
      [issue](https://github.com/paritytech/polkadot-sdk/issues/1389) and [PR
      with more TODOs](https://github.com/paritytech/polkadot-sdk/pull/1693
      
      ).
      
      ---------
      
      Co-authored-by: default avatarIgnacio Palacios <[email protected]>
      cfb29254
  19. Oct 10, 2023