1. Dec 08, 2023
  2. Dec 07, 2023
  3. Dec 06, 2023
    • Adrian Catangiu's avatar
      pallet-xcm: add new flexible `transfer_assets()` call/extrinsic (#2388) · e7651cf4
      Adrian Catangiu authored
      # Motivation (+testing)
      
      ### Enable easy `ForeignAssets` transfers using `pallet-xcm` 
      
      We had just previously added capabilities to teleport fees during
      reserve-based transfers, but what about reserve-transferring fees when
      needing to teleport some non-fee asset?
      
      This PR aligns everything under either explicit reserve-transfer,
      explicit teleport, or this new flexible `transfer_assets()` which can
      mix and match as needed with fewer artificial constraints imposed to the
      user.
      
      This will enable, for example, a (non-system) parachain to teleport
      their `ForeignAssets` assets to AssetHub while using DOT to pay fees.
      (the assets are teleported - as foreign assets should from their owner
      chain - while DOT used for fees can only be reserve-based transferred
      between said parachain and AssetHub).
      
      Added `xcm-emulator` tests for this scenario ^.
      
      # Description
      
      Reverts `(limited_)reserve_transfer_assets` to only allow reserve-based
      transfers for all `assets` including fees.
      
      Similarly `(limited_)teleport_assets` only allows teleports for all
      `assets` including fees.
          
      For complex combinations of asset transfers where assets and fees may
      have different reserves or different reserve/teleport trust
      configurations, users can use the newly added `transfer_assets()`
      extrinsic which is more flexible in allowing more complex scenarios.
      
      `assets` (excluding `fees`) must have same reserve location or otherwise
      be teleportable to `dest`.
      No limitations imposed on `fees`.
      
      - for local reserve: transfer assets to sovereign account of destination
      chain and forward a notification XCM to `dest` to mint and deposit
      reserve-based assets to `beneficiary`.
      - for destination reserve: burn local assets and forward a notification
      to `dest` chain to withdraw the reserve assets from this chain's
      sovereign account and deposit them to `beneficiary`.
      - for remote reserve: burn local assets, forward XCM to reserve chain to
      move reserves from this chain's SA to `dest` chain's SA, and forward
      another XCM to `dest` to mint and deposit reserve-based assets to
      `beneficiary`.
      - for teleports: burn local assets and forward XCM to `dest` chain to
      mint/teleport assets and deposit them to `beneficiary`.
      
      ## Review notes
      
      Only around 500 lines are prod code (see `pallet_xcm/src/lib.rs`), the
      rest of the PR is new tests and improving existing tests.
      
      ---------
      
      Co-authored-by: command-bot <>
      e7651cf4
    • André Silva's avatar
      sp-core: Rename VrfOutput to VrfPreOutput (#2534) · 1f023dea
      André Silva authored
      This will make more sense after
      https://github.com/paritytech/polkadot-sdk/pull/2524 since the
      schnorrkel type for VRF outputs is also renamed in the latest version.
      Can be reviewed independently though.
      
      Can be merged after https://github.com/paritytech/polkadot-sdk/pull/1577
      so that there is less pain for @davxy
      
      .
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      1f023dea
  4. Dec 05, 2023
  5. Dec 04, 2023
  6. Dec 01, 2023
  7. Nov 30, 2023
  8. Nov 29, 2023
    • PG Herveou's avatar
      Contracts: use compiled rust tests (#2347) · 2135fa87
      PG Herveou authored
      see #2189
      
      This PR does the following:
      - Bring the user api functions into a new pallet-contracts-uapi (They
      are currently defined in ink!
      [here])(https://github.com/paritytech/ink/blob/master/crates/env/src/engine/on_chain/ext.rs
      
      )
      - Add older api versions and unstable to the user api trait.
      - Remove pallet-contracts-primitives and bring the types it defined in
      uapi / pallet-contracts
      - Add the infrastructure to build fixtures from Rust files and test it
      works by replacing `dummy.wat` and `call.wat`
      - Move all the doc from wasm/runtime.rs to pallet-contracts-uapi.
      
      This will be done in a follow up:
      - convert the rest of the test from .wat to rust
      - bring risc-v uapi up to date with wasm
      - finalize the uapi host fns, making sure everything is codegen from the
      source host fns in pallet-contracts
      
      ---------
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      2135fa87
  9. Nov 28, 2023
    • Sebastian Kunert's avatar
      Remove long deprecated `AllPalletsWithoutSystemReversed` (#2509) · 82017934
      Sebastian Kunert authored
      Remove deprecated `AllPalletsXY` types.
      
      They have been deprecated for nearly 1.5 years now, I think its fine to
      remove them.
      If anyone feels like we should first put a date on the deprecation as
      stated in the deprecation guideline, feel free to speak up. To me it
      looks like this has been forgotten and can be directly removed.
      82017934
    • Aaro Altonen's avatar
      Rework the event system of `sc-network` (#1370) · e71c484d
      Aaro Altonen authored
      This commit introduces a new concept called `NotificationService` which
      allows Polkadot protocols to communicate with the underlying
      notification protocol implementation directly, without routing events
      through `NetworkWorker`. This implies that each protocol has its own
      service which it uses to communicate with remote peers and that each
      `NotificationService` is unique with respect to the underlying
      notification protocol, meaning `NotificationService` for the transaction
      protocol can only be used to send and receive transaction-related
      notifications.
      
      The `NotificationService` concept introduces two additional benefits:
        * allow protocols to start using custom handshakes
        * allow protocols to accept/reject inbound peers
      
      Previously the validation of inbound connections was solely the
      responsibility of `ProtocolController`. This caused issues with light
      peers and `SyncingEngine` as `ProtocolController` would accept more
      peers than `SyncingEngine` could accept which caused peers to have
      differing views of their own states. `SyncingEngine` would reject excess
      peers but these rejections were not properly communicated to those peers
      causing them to assume that they were accepted.
      
      With `NotificationService`, the local handshake is not sent to remote
      peer if peer is rejected which allows it to detect that it was rejected.
      
      This commit also deprecates the use of `NetworkEventStream` for all
      notification-related events and going forward only DHT events are
      provided through `NetworkEventStream`. If protocols wish to follow each
      other's events, they must introduce additional abtractions, as is done
      for GRANDPA and transactions protocols by following the syncing protocol
      through `SyncEventStream`.
      
      Fixes https://github.com/paritytech/polkadot-sdk/issues/512
      Fixes https://github.com/paritytech/polkadot-sdk/issues/514
      Fixes https://github.com/paritytech/polkadot-sdk/issues/515
      Fixes https://github.com/paritytech/polkadot-sdk/issues/554
      Fixes https://github.com/paritytech/polkadot-sdk/issues/556
      
      ---
      These changes are transferred from
      https://github.com/paritytech/substrate/pull/14197
      
       but there are no
      functional changes compared to that PR
      
      ---------
      
      Co-authored-by: default avatarDmitry Markin <[email protected]>
      Co-authored-by: default avatarAlexandru Vasile <[email protected]>
      e71c484d
    • s0me0ne-unkn0wn's avatar
    • gupnik's avatar
      Moves all test runtimes to use `derive_impl` (#2409) · cd8741c8
      gupnik authored
      Step in https://github.com/paritytech/polkadot-sdk/issues/171
      
      
      
      This PR adds `derive_impl` on all `frame_system` config impls for mock
      runtimes. The overridden configs are maintained as of now to ensure
      minimal changes.
      
      ---------
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      cd8741c8
    • Liam Aharon's avatar
      Set `frame_system::LastRuntimeUpgrade` after running `try-runtime` migrations (#2515) · 6dc3e6c9
      Liam Aharon authored
      Sets `frame_system::LastRuntimeUpgrade` after running try-runtime
      migrations to better emulate real behavior.
      
      This fixes an issue where migrations using the spec version to determine
      whether to execute can incorrectly fail idempotency checks.
      
      @s0me0ne-unkn0wn noticed this issue with the session key migration
      introduced in https://github.com/paritytech/polkadot-sdk/pull/2265.
      6dc3e6c9
    • Ross Bulat's avatar
      Pools: Add ability to configure commission claiming permissions (#2474) · 75062717
      Ross Bulat authored
      Addresses #409.
      
      This request has been raised by multiple community members - the ability
      for the nomination pool root role to configure permissionless commission
      claiming:
      
      > Would it be possible to have a claim_commission_other extrinsic for
      claiming commission of nomination pools permissionless?
      
      This PR does not quite introduce this additional call, but amends
      `do_claim_commission` to check a new `claim_permission` field in the
      `Commission` struct, configured by an enum:
      
      ```
      enum CommissionClaimPermission {
         Permissionless,
         Account(AccountId),
      }
      ```
      This can be optionally set in a bonded pool's
      `commission.claim_permission` field:
      
      ```
      struct BondedPool {
         commission: {
            <snip>
            claim_permission: Option<CommissionClaimPermission<T::AccountId>>,
         },
         <snip>
      }
      ```
      
      This is a new field and requires a migration to add it to existing
      pools. This will be `None` on pool creation, falling back to the `root`
      role having sole access to claim commission if it is not set; this is
      the behaviour as it is today. Once set, the field _can_ be set to `None`
      again.
      
      #### Changes
      - [x] Add `commision.claim_permission` field.
      - [x] Add `can_claim_commission` and amend `do_claim_commission`.
      - [x] Add `set_commission_claim_permission` call.
      - [x] Test to cover new configs and call.
      - [x] Add and amend benchmarks.
      - [x] Generate new weights + slot into call
      `set_commission_claim_permission`.
      - [x] Add migration to introduce `commission.claim_permission`, bump
      storage version.
      - [x] Update Westend weights.
      - [x] Migration working.
      
      ---------
      
      Co-authored-by: command-bot <>
      75062717
  10. Nov 27, 2023
  11. Nov 25, 2023
  12. Nov 24, 2023
  13. Nov 23, 2023
  14. Nov 22, 2023
    • James Wilson's avatar
      Make TypeInfo for SkipCheckIfFeeless transparent, too (#2449) · 0d6dcb3f
      James Wilson authored
      
      
      The `SkipCheckifFeeless::IDENTIFIER` became transparent (ie was whatever
      the inner signed ext was). This PR just makes the `TypeInfo` transparent
      too, so that libraries that use said info to decode the data (ie subxt)
      can behave identically whether or not the `SkipCheckifFeeless` wrapper
      is used or not.
      
      ---------
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      0d6dcb3f
    • gupnik's avatar
      Fixes import path in benchmark macro (#2437) · 98f9e2ea
      gupnik authored
      Fully-qualified path was not being used in benchmark macro for one of
      the cases. This PR fixes this and removes the unnecessary import in a
      couple of files, which I believe was done to fix this issue.
      98f9e2ea
    • Ross Bulat's avatar
      Deprecate `RewardDestination::Controller` (#2380) · 7a32f4be
      Ross Bulat authored
      
      
      Deprecates `RewardDestination::Controller` variant.
      
      - [x] `RewardDestination::Controller` annotated with `#[deprecated]`.
      - [x] `Controller` variant is now handled the same way as `Stash` in
      `payout_stakers`.
      - [x] `set_payee` errors if `RewardDestination::Controller` is provided.
      - [x] Added `update_payee` call to lazily migrate
      `RewardDestination::Controller` `Payee` storage entries to
      `RewardDestination::Account(controller)` .
      - [x] `payout_stakers_dead_controller` has been removed from benches &
      weights - was not used.
      - [x] Tests no longer use `RewardDestination::Controller`.
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarGonçalo Pestana <[email protected]>
      Co-authored-by: default avatargeorgepisaltu <[email protected]>
      7a32f4be
  15. Nov 21, 2023
  16. Nov 20, 2023
  17. Nov 17, 2023
    • Michal Kucharczyk's avatar
      crypto: `lazy_static` removed, light parser for address URI added (#2250) · 5007e2dd
      Michal Kucharczyk authored
      
      
      The `lazy_static` package does not work well in `no-std`: it requires
      `spin_no_std` feature, which also will propagate into `std` if enabled.
      This is not what we want.
      
      This PR provides simple address uri parser which allows to get rid of
      _regex_ which was used to parse the address uri, what in turns allows to
      remove lazy_static.
      
      Three regular expressions
      (`SS58_REGEX`,`SECRET_PHRASE_REGEX`,`JUNCTION_REGEX`) were replaced with
      the parser which unifies all of them.
      
      The new parser does not support Unicode, it is ASCII only.
      
      Related to: #2044
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      Co-authored-by: default avatarKoute <[email protected]>
      Co-authored-by: command-bot <>
      5007e2dd