1. Nov 14, 2023
    • Marcin S.'s avatar
    • Adrian Catangiu's avatar
      xcm-emulator: add Rococo<>Westend bridge and add tests for assets transfers over the bridge (#2251) · 39cc9574
      Adrian Catangiu authored
      - switch from Rococo<>Wococo to Rococo<>Westend bridge
      - add bidirectional simple tests
      - remove Wococo chains from xcm-emulator
      - added tests for assets transfers over Rococo<>Westend bridge 
      
      fixes https://github.com/paritytech/parity-bridges-common/issues/2405
      39cc9574
    • Hugo Trentesaux's avatar
      Add details in `--dev` cli flag documentation (#2305) · a393cfcb
      Hugo Trentesaux authored
      add details in `--dev` flag to tell that it disables local peer
      discovery
      
      ### Context
      
      When adding automated end-to-end tests, we replaced `--dev` by 
      
      ```
      `--chain=dev`, `--force-authoring`, `--rpc-cors=all`, `--alice`, and `--tmp` flags
      ```
      
      as stated in the command line documentation. But the tests started
      failing due to the nodes connecting to each other.
      
      ### Fix
      
      This PR includes additional command line documentation to explain more
      in detail what `--dev` flag inludes.
      a393cfcb
    • Liam Aharon's avatar
      54ca4f13
    • Branislav Kontur's avatar
      Fix `expect_pallet` benchmarks not relaying on hard-coded `frame_system` dependency version (#2288) · ae1bdcfb
      Branislav Kontur authored
      ## Problem/Motivation
      The benchmark for the `ExpectPallet` XCM instruction uses a hard-coded
      version `4.0.0` for the `frame_system` pallet. Unfortunately, this
      doesn't work for the `polkadot-fellows/runtimes` repository, where we
      use dependencies from `crates.io`, e.g.,
      [frame-system::23.0.0.0](https://github.com/polkadot-fellows/runtimes/blob/dd7f86f0d50064481ed0b7c0218494a5cfad997e/relay/kusama/Cargo.toml#L83).
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/2284 
      
      ## Solution
      This PR fixes the benchmarks that require pallet information and enables
      the runtime to provide the correct/custom pallet information. The
      default implementation provides `frame_system::Pallet` with index `0`,
      where the version is not hard-coded but read from the runtime.
      
      
      ## Local testing
      
      Added log for `T::valid_pallet` to the benchmarks like:
      ```
      let valid_pallet = T::valid_pallet();
      log::info!(
      	target: "frame::benchmark::pallet",
      	"valid_pallet: {}::{}::{}::{}::{}",
      	valid_pallet.index,
      	valid_pallet.module_name,
      	valid_pallet.crate_version.major,
      	valid_pallet.crate_version.minor,
      	valid_pallet.crate_version.patch,
      );
      ```
      
      Run benchmarks for `westend`:
      ```
      cargo run --bin=polkadot --features=runtime-benchmarks -- benchmark pallet --steps=2 --repeat=1 --extrinsic=* --heap-pages=4096 --json-file=./bench.json --chain=westend-dev --template=./polkadot/xcm/pallet-xcm-benchmarks/template.hbs --pallet=pallet_xcm_benchmarks::generic --output=./polkadot/runtime/westend/src/weights/xcm
      ```
      
      ---
      
      For actual `frame_system` version:
      ```
      [package]
      name = "frame-system"
      version = "4.0.0-dev"
      ```
      
      Log dump:
      ```
      2023-11-13 12:56:45 Starting benchmark: pallet_xcm_benchmarks::generic::query_pallet    
      2023-11-13 12:56:45 valid_pallet: 0::frame_system::4::0::0    
      2023-11-13 12:56:45 valid_pallet: 0::frame_system::4::0::0    
      2023-11-13 12:56:45 valid_pallet: 0::frame_system::4::0::0    
      2023-11-13 12:56:45 Starting benchmark: pallet_xcm_benchmarks::generic::expect_pallet    
      2023-11-13 12:56:45 valid_pallet: 0::frame_system::4::0::0    
      2023-11-13 12:56:45 valid_pallet: 0::frame_system::4::0::0    
      2023-11-13 12:56:45 valid_pallet: 0::frame_system::4::0::0 
      ```
      
      
      For changed `frame_system` version:
      ```
      [package]
      name = "frame-system"
      version = "5.1.3-dev"
      ```
      
      Log dump:
      ```
      2023-11-13 12:51:51 Starting benchmark: pallet_xcm_benchmarks::generic::query_pallet    
      2023-11-13 12:51:51 valid_pallet: 0::frame_system::5::1::3    
      2023-11-13 12:51:51 valid_pallet: 0::frame_system::5::1::3    
      2023-11-13 12:51:51 valid_pallet: 0::frame_system::5::1::3    
      2023-11-13 12:51:51 Starting benchmark: pallet_xcm_benchmarks::generic::expect_pallet    
      2023-11-13 12:51:51 valid_pallet: 0::frame_system::5::1::3    
      2023-11-13 12:51:51 valid_pallet: 0::frame_system::5::1::3    
      2023-11-13 12:51:51 valid_pallet: 0::frame_system::5::1::3
      ```
      
      ## References
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/2284
      ae1bdcfb
    • drskalman's avatar
      Fix `ecdsa_bls` verify in BEEFY primitives (#2066) · b371c357
      drskalman authored
      
      
      BEEFY ECDSA signatures are on keccak has of the messages. As such we can
      not simply call
      
      `EcdsaBlsPair::verify(signature.as_inner_ref(), msg,
      self.as_inner_ref())`
      
      because that invokes ecdsa default verification which perfoms blake2
      hash which we don't want.
      
      This bring up the second issue makes: This makes `sign` and `verify`
      function in `pair_crypto` useless, at least for BEEFY use case.
      Moreover, there is no obvious clean way to generate the signature given
      that pair_crypto does not exposes `sign_prehashed`. You could in theory
      query the keystore for the pair (could you?), invoke `to_raw` and
      re-generate each sub-pair and sign using each. But that sounds extremely
      anticlimactic and will be frow upon by auditors . So I appreciate any
      alternative suggestion.
      
      ---------
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      Co-authored-by: default avatarRobert Hambrock <[email protected]>
      b371c357
    • Alin Dima's avatar
      cumulus-pov-recovery: check pov_hash instead of reencoding data (#2287) · 689b9d91
      Alin Dima authored
      Collators were previously reencoding the available data and checking the
      erasure root.
      Replace that with just checking the PoV hash, which consumes much less
      CPU and takes less time.
      
      We also don't need to check the `PersistedValidationData` hash, as
      collators don't use it.
      
      Reason:
      https://github.com/paritytech/polkadot-sdk/issues/575#issuecomment-1806572230
      
      
      
      After systematic chunks recovery is merged, collators will no longer do
      any reed-solomon encoding/decoding, which has proven to be a great CPU
      consumer.
      
      Signed-off-by: default avataralindima <[email protected]>
      689b9d91
  2. Nov 13, 2023
    • Javyer's avatar
      review-bot: trigger only on review approvals (#2289) · 8d263790
      Javyer authored
      Moved the review event of review-bot to only be triggered in approvals.
      
      Because we only update the required reviews when someone approves, this
      will stop the bot from immediately requesting a new review when someone
      comments or request changes as they should have been already notified in
      the first batch.
      8d263790
    • Assem's avatar
      f332d688
    • Lulu's avatar
      Add CI to claim crates (#2299) · c7bd8804
      Lulu authored
      c7bd8804
    • Adrian Catangiu's avatar
      pallet-xcm: enhance `reserve_transfer_assets` to support remote reserves (#1672) · 18257373
      Adrian Catangiu authored
      ## Motivation
      
      `pallet-xcm` is the main user-facing interface for XCM functionality,
      including assets manipulation functions like `teleportAssets()` and
      `reserve_transfer_assets()` calls.
      
      While `teleportAsset()` works both ways, `reserve_transfer_assets()`
      works only for sending reserve-based assets to a remote destination and
      beneficiary when the reserve is the _local chain_.
      
      ## Solution
      
      This PR enhances `pallet_xcm::(limited_)reserve_withdraw_assets` to
      support transfers when reserves are other chains.
      This will allow complete, **bi-directional** reserve-based asset
      transfers user stories using `pallet-xcm`.
      
      Enables following scenarios:
      - transferring assets with local reserve (was previously supported iff
      asset used as fee also had local reserve - now it works in all cases),
      - transferring assets with reserve on destination,
      - transferring assets with reserve on remote/third-party chain (iff
      assets and fees have same remote reserve),
      - transferring assets with reserve different than the reserve of the
      asset to be used as fees - meaning can be used to transfer random asset
      with local/dest reserve while using DOT for fees on all involved chains,
      even if DOT local/dest reserve doesn't match asset reserve,
      - transferring assets with any type of local/dest reserve while using
      fees which can be teleported between involved chains.
      
      All of the above is done by pallet inner logic without the user having
      to specify which scenario/reserves/teleports/etc. The correct scenario
      and corresponding XCM programs are identified, and respectively, built
      automatically based on runtime configuration of trusted teleporters and
      trusted reserves.
      
      #### Current limitations:
      - while `fees` and "non-fee" `assets` CAN have different reserves (or
      fees CAN be teleported), the remaining "non-fee" `assets` CANNOT, among
      themselves, have different reserve locations (this is also implicitly
      enforced by `MAX_ASSETS_FOR_TRANSFER=2`, but this can be safely
      increased in the future).
      - `fees` and "non-fee" `assets` CANNOT have **different remote**
      reserves (this could also be supported in the future, but adds even more
      complexity while possibly not being worth it - we'll see what the future
      holds).
      
      Fixes https://github.com/paritytech/polkadot-sdk/issues/1584
      Fixes https://github.com/paritytech/polkadot-sdk/issues/2055
      
      
      
      ---------
      
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      Co-authored-by: default avatarBranislav Kontur <[email protected]>
      18257373
    • gupnik's avatar
    • gupnik's avatar
      Adds syntax for marking calls feeless (#1926) · 60c77a2e
      gupnik authored
      Fixes https://github.com/paritytech/polkadot-sdk/issues/1725
      
      
      
      This PR adds the following changes:
      1. An attribute `pallet::feeless_if` that can be optionally attached to
      a call like so:
      ```rust
      #[pallet::feeless_if(|_origin: &OriginFor<T>, something: &u32| -> bool {
      	*something == 0
      })]
      pub fn do_something(origin: OriginFor<T>, something: u32) -> DispatchResult {
           ....
      }
      ```
      The closure passed accepts references to arguments as specified in the
      call fn. It returns a boolean that denotes the conditions required for
      this call to be "feeless".
      
      2. A signed extension `SkipCheckIfFeeless<T: SignedExtension>` that
      wraps a transaction payment processor such as
      `pallet_transaction_payment::ChargeTransactionPayment`. It checks for
      all calls annotated with `pallet::feeless_if` to see if the conditions
      are met. If so, the wrapped signed extension is not called, essentially
      making the call feeless.
      
      In order to use this, you can simply replace your existing signed
      extension that manages transaction payment like so:
      ```diff
      - pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
      + pallet_skip_feeless_payment::SkipCheckIfFeeless<
      +	Runtime,
      +	pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
      + >,
      ```
      
      ### Todo
      - [x] Tests
      - [x] Docs
      - [x] Prdoc
      
      ---------
      
      Co-authored-by: Nikhil Gupta <>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      60c77a2e
    • Bastian Köcher's avatar
      pallet-grandpa: Remove `GRANDPA_AUTHORITIES_KEY` (#2181) · ebcf0a0f
      Bastian Köcher authored
      
      
      Remove the `GRANDPA_AUTHORITIES_KEY` key and its usage. Apparently this
      was used in the early days to communicate the grandpa authorities to the
      node. However, we have now a runtime api that does this for us. So, this
      pull request is moving from the custom managed storage item to a FRAME
      managed storage item.
      
      This pr also includes a migration for doing the switch on a running
      chain.
      
      ---------
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      ebcf0a0f
    • Bastian Köcher's avatar
      wasm-builder: Optimize `rerun-if-changed` logic (#2282) · 604704a8
      Bastian Köcher authored
      Optimizes the `rerun-if-changed` logic by ignoring `dev-dependencies`
      and also not outputting paths. Because outputting paths could lead to
      include unwanted crates in the rerun checks.
      604704a8
    • Marcin S.'s avatar
    • Dmitry Markin's avatar
      Unify `ChainSync` actions under one enum (#2180) · 951bcceb
      Dmitry Markin authored
      All `ChainSync` actions that `SyncingEngine` should perform are unified
      under one `ChainSyncAction`. Processing of these actions put into a
      single place after `select!` in `SyncingEngine::run` instead of multiple
      places where calling `ChainSync` methods.
      951bcceb
  3. Nov 11, 2023
  4. Nov 10, 2023
    • PG Herveou's avatar
      Contracts: Add XCM traits to interface with contracts (#2086) · 6b7be115
      PG Herveou authored
      We are introducing a new set of `XcmController` traits (final name yet
      to be determined).
      These traits are implemented by `pallet-xcm` and allows other pallets,
      such as `pallet_contracts`, to rely on these traits instead of tight
      coupling them to `pallet-xcm`.
      
      Using only the existing Xcm traits would mean duplicating the logic from
      `pallet-xcm` in these other pallets, which we aim to avoid. Our
      objective is to ensure that when these APIs are called from
      `pallet-contracts`, they produce the exact same outcomes as if called
      directly from `pallet-xcm`.
      
      The other benefits is that we can also expose return values to
      `pallet-contracts` instead of just calling `pallet-xcm` dispatchable and
      getting a `DispatchResult` back.
      
      See traits integration in this PR
      https://github.com/paritytech/polkadot-sdk/pull/1248
      
      , where the traits
      are used as follow to define and implement `pallet-contracts` Config.
      ```rs
      // Contracts config:
      pub trait Config: frame_system::Config {
        // ...
      
        /// A type that exposes XCM APIs, allowing contracts to interact with other parachains, and
        /// execute XCM programs.
        type Xcm: xcm_executor::traits::Controller<
      	  OriginFor<Self>,
      	  <Self as frame_system::Config>::RuntimeCall,
      	  BlockNumberFor<Self>,
        >;
      }
      
      // implementation
      impl pallet_contracts::Config for Runtime {
              // ...
      
      	type Xcm = pallet_xcm::Pallet<Self>;
      }
      ```
      
      ---------
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      Co-authored-by: command-bot <>
      6b7be115
    • Liam Aharon's avatar
      Improve `VersionedMigration` naming conventions (#2264) · 84ddbaf6
      Liam Aharon authored
      As suggested by @ggwpez
      (https://github.com/paritytech/polkadot-sdk/pull/2142#discussion_r1388145872),
      remove the `VersionChecked` prefix from version checked migrations (but
      leave `VersionUnchecked` prefixes)
      
      ---------
      
      Co-authored-by: command-bot <>
      84ddbaf6
    • Vincent Geddes's avatar
      [pallet-message-queue] Implement impl_trait_for_tuples for QueuePausedQuery (#2227) · 3f0383a5
      Vincent Geddes authored
      These changes are required so that the bridgehub system runtimes can
      more easily be configured with multiple message processors
      
      Example usage:
      
      ```rust
      use frame_support::traits::QueuePausedQuery;
      
      impl pallet_message_queue::Config for Runtime {
          type QueuePausedQuery = (A, B, C)
      }
      3f0383a5
    • PG Herveou's avatar
      Contracts move fixtures to new crate (#2246) · 64effd0e
      PG Herveou authored
      Small PR that introduce a new crate that will host RISC-V & wasm
      fixtures for testing pallet-contracts
      64effd0e
  5. Nov 09, 2023
    • Lulu's avatar
      Add license to tracking-allocator and add staging-prefix (#2261) · 03ee44d9
      Lulu authored
      The staging- rename commit was missing from the last PR for some reason.
      03ee44d9
    • Bastian Köcher's avatar
      sc-state-db: Keep track of `LAST_PRUNED` after warp syncing (#2228) · b0d0fb31
      Bastian Köcher authored
      When warp syncing we import the target block with all its state.
      However, we didn't store the `LAST_PRUNED` block which would then lead
      to `pruning` to forget about the imported block after a restart of the
      node. We just set `LAST_PRUNED` to the parent block of the warp sync
      target block to fix this issue.
      b0d0fb31
    • Lulu's avatar
      Don't publish frame and deps (#2260) · e8029a77
      Lulu authored
      e8029a77
    • Lulu's avatar
    • Oliver Tale-Yazdi's avatar
      Add descriptions to all published crates (#2029) · 48ea86f0
      Oliver Tale-Yazdi authored
      
      
      Missing descriptions (47):  
      
      - [x] `cumulus/client/collator/Cargo.toml`
      - [x] `cumulus/client/relay-chain-inprocess-interface/Cargo.toml`
      - [x] `cumulus/client/cli/Cargo.toml`
      - [x] `cumulus/client/service/Cargo.toml`
      - [x] `cumulus/client/relay-chain-rpc-interface/Cargo.toml`
      - [x] `cumulus/client/relay-chain-interface/Cargo.toml`
      - [x] `cumulus/client/relay-chain-minimal-node/Cargo.toml`
      - [x] `cumulus/parachains/pallets/parachain-info/Cargo.toml`
      - [x] `cumulus/parachains/pallets/ping/Cargo.toml`
      - [x] `cumulus/primitives/utility/Cargo.toml`
      - [x] `cumulus/primitives/aura/Cargo.toml`
      - [x] `cumulus/primitives/core/Cargo.toml`
      - [x] `cumulus/primitives/parachain-inherent/Cargo.toml`
      - [x] `cumulus/test/relay-sproof-builder/Cargo.toml`
      - [x] `cumulus/pallets/xcmp-queue/Cargo.toml`
      - [x] `cumulus/pallets/dmp-queue/Cargo.toml`
      - [x] `cumulus/pallets/xcm/Cargo.toml`
      - [x] `polkadot/erasure-coding/Cargo.toml`
      - [x] `polkadot/statement-table/Cargo.toml`
      - [x] `polkadot/primitives/Cargo.toml`
      - [x] `polkadot/rpc/Cargo.toml`
      - [x] `polkadot/node/service/Cargo.toml`
      - [x] `polkadot/node/core/parachains-inherent/Cargo.toml`
      - [x] `polkadot/node/core/approval-voting/Cargo.toml`
      - [x] `polkadot/node/core/dispute-coordinator/Cargo.toml`
      - [x] `polkadot/node/core/av-store/Cargo.toml`
      - [x] `polkadot/node/core/chain-api/Cargo.toml`
      - [x] `polkadot/node/core/prospective-parachains/Cargo.toml`
      - [x] `polkadot/node/core/backing/Cargo.toml`
      - [x] `polkadot/node/core/provisioner/Cargo.toml`
      - [x] `polkadot/node/core/runtime-api/Cargo.toml`
      - [x] `polkadot/node/core/bitfield-signing/Cargo.toml`
      - [x] `polkadot/node/network/dispute-distribution/Cargo.toml`
      - [x] `polkadot/node/network/bridge/Cargo.toml`
      - [x] `polkadot/node/network/collator-protocol/Cargo.toml`
      - [x] `polkadot/node/network/approval-distribution/Cargo.toml`
      - [x] `polkadot/node/network/availability-distribution/Cargo.toml`
      - [x] `polkadot/node/network/bitfield-distribution/Cargo.toml`
      - [x] `polkadot/node/network/gossip-support/Cargo.toml`
      - [x] `polkadot/node/network/availability-recovery/Cargo.toml`
      - [x] `polkadot/node/collation-generation/Cargo.toml`
      - [x] `polkadot/node/overseer/Cargo.toml`
      - [x] `polkadot/runtime/parachains/Cargo.toml`
      - [x] `polkadot/runtime/common/slot_range_helper/Cargo.toml`
      - [x] `polkadot/runtime/metrics/Cargo.toml`
      - [x] `polkadot/xcm/pallet-xcm-benchmarks/Cargo.toml`
      - [x] `polkadot/utils/generate-bags/Cargo.toml`
      - [x]  `substrate/bin/minimal/runtime/Cargo.toml`
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      Signed-off-by: default avataralindima <[email protected]>
      Co-authored-by: default avatarordian <[email protected]>
      Co-authored-by: default avatarTsvetomir Dimitrov <[email protected]>
      Co-authored-by: default avatarMarcin S <[email protected]>
      Co-authored-by: default avataralindima <[email protected]>
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      Co-authored-by: default avatarDmitry Markin <[email protected]>
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      48ea86f0
    • Keith Yeung's avatar
      Remove unnecessary map_error (#2239) · d347d688
      Keith Yeung authored
      This was discovered during a debugging session, and it only served to
      mask the underlying error, which was not great.
      d347d688
  6. Nov 08, 2023