Skip to content

Commit

Permalink
Add statemine (#24)
Browse files Browse the repository at this point in the history
* rustc grumbles

* add second instance

* leave some todos

* fix AssetsToBlockAuthor

* make it almost compile

* make it actually compile

* fix logical error

* cargo fmt to resolve duplicate imports on merge

* fix deps to make compile

* fmt

* (pallet-assets/pallet-asset-tx-payment) pathched with `sv-locked-for-gav-xcm-v3-and-bridges-plus-assets`

* statemine progress

* ForeignCreators 🎉

* fix AssetFeeAsExistentialDepositMultiplier

* no default instance

* instantiate statemint

* compile tests

* Init of pallet with `transfer_asset_via_bridge` call

Init of pallet with `transfer_asset_via_bridge` call

Init of pallet with `transfer_asset_via_bridge` call - setup basic tests

* Init of pallet with `transfer_asset_via_bridge` call

* Box wrap inputs

* Added withdraw/deposit to bridge's reserve account

* TODO: temporary hack pipelines because of https://github.com/paritytech/devops/issues/2190

* Allow receive bridged Xcm::Trap on Westmint

* Allow (temporary) Statemine send xcm messages

* refactor TrustedBridgedNetworks

* Allow (hacky) xcm::transact for remark/remark_with_event

* Unit-test for Statemine - send_xcm_transact_with_remark_with_event_works

* Fix for BridgedSignedAccountId32AsNative

* don't rename pallet in runtime

* don't rename and fix tests

* Added `allowed_target_location` + reanchored assets/destination + tests

* fix benchmark helper

* fix benchmark build

* more benchmark fixes

* fix penpal and rococo

* update BenchmarkHelper interface

* fmt

* Added weight `export_message` to statemint because of `pallet_xcm.send`

* add foreign assets to westmint

* add foreign assets to statemine

* Governance can call `xcm:Transact` with bridges configuration management

* Revert temporary disabled `scripts/ci/gitlab/pipeline/test.yml`

* Unit-test for handling `ReserveAssetDeposited` on Westmint for ForeignAssets

* use updated api for ensure origin trait

* Benchmarks for pallet-bridge-assets-transfer (paritytech#2316)

* benchmarks for pallet-bridge-asset-transfer

* use proper template for pallet weights

* fix test

* fixing compialtion

* fix (?) compilation warn/error in westmint

* weight limits in can_governance_call_xcm_transact_with_bridge_assets_transfer_configuration

* ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_assets_transfer

* ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_assets_transfer

* add prototype for multiple assets benchmarking

---------

Co-authored-by: command-bot <>

* Assets/ForeignAssets tests and fixes (paritytech#2167)

* Test for create and transfer `TrustBackedAssets` with AssetTransactor

* Test for transfer `local Currency` with AssetTransactor

* Test for create foreign assets (covers foreign relaychain currency)

* Added `ForeignFungiblesTransactor` and test for transfer `ForeignAssets` with AssetTransactor

* Removed unused `pub const Local: MultiLocation`

* Changed `ParaId -> Sibling` for `SiblingParachainConvertsVia`

* Test for create foreign assets (covers local sibling parachain assets)

* Reverted stuff for ForeignCreators from different global consensus (moved to transfer asset branch)

* Refactor `weight_limit` for `execute_xcm`

* Added test for `set_metadata` by ForeignCreator with `xcm::Transact(set_metadata)`

* Renamed `receive_teleported_asset_works` -> `receive_teleported_asset_for_native_asset_works`

* Allow `ForeignCreators` only for sibling parachains

* Unify ReservedDmpWeight/ReservedXcmpWeight usage

* Removed hack - replaced with `MatchedConvertedConcreteId`

* Refactor `ForeignCreators` to assets-common

* Add `ReceiveTeleportedAsset` test

* Change test - `Utility::batch` -> Multiple `xcm::Transact`

* Reusing the same deposits as for TrustBackedAssets

* missing `try_successful_origin` ?

* Finished `ForeignAssets` for westmint (converter, FungiblesApi, tests)

* Refactoring tests - receive_teleported_asset_for_native_asset_works

* ForeignAssets for statemine + refactored `receive_teleported_asset_from_foreign_creator_works`

* Add `ForeignAssets` to statemine `FungiblesApi`

* Add `asset_transactor_transfer_with_local_consensus_currency_works` to all runtimes

* Added `asset_transactor_transfer_with_trust_backed_assets_works` test

* Added `asset_transactor_transfer_with_foreign_assets_works`

* Fix `missing `try_successful_origin` in implementation`

* Added `create_and_manage_foreign_assets_for_local_consensus_parachain_assets_works`

* Added `ExpectTransactStatus` check

* Small rename

* Extended `test_assets_balances_api_works` with ForeignAssets for `statemine`

* PR fixes

* Update parachains/runtimes/assets/test-utils/src/test_cases.rs

---------

Co-authored-by: parity-processbot <>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Added `StartsWithExplicitGlobalConsensus` to ignores (paritytech#2338)

* Change to correct weight file for pallet_bridge_assets_transfer

* Renamed `pallet-bridge-assets-transfer` to `pallet-bridge-transfer`

* from_ref_time to from_parts

* ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_transfer

* Added `ping_via_bridge`

* ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_transfer

* Fix test

* Revert not needed stuff

* Added test-case `can_governance_change_bridge_transfer_configuration`

* Added test `initiate_transfer_asset_via_bridge_for_native_asset_works`

* Fix compilation

* Small fixes

* Added support for paid or unpaid execution by configuration

* Removed stuff

* Bump futures from 0.3.26 to 0.3.27 (paritytech#2359)

Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.26 to 0.3.27.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](rust-lang/futures-rs@0.3.26...0.3.27)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>

* Bump clap from 4.1.11 to 4.1.13 (paritytech#2388)

Bumps [clap](https://github.com/clap-rs/clap) from 4.1.11 to 4.1.13.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](clap-rs/clap@v4.1.11...v4.1.13)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Remove HeaderBackend from RelayChainRPCClient (paritytech#2385)

* Remove HeaderBackend from RelayChainRPCClient

* update lockfile for {"substrate", "polkadot"}

---------

Co-authored-by: parity-processbot <>

* Added `receive_reserve_asset_deposited_from_different_consensus_works`

* Bump scale-info from 2.3.1 to 2.4.0 (paritytech#2386)

Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.3.1 to 2.4.0.
- [Release notes](https://github.com/paritytech/scale-info/releases)
- [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md)
- [Commits](paritytech/scale-info@v2.3.1...v2.4.0)

---
updated-dependencies:
- dependency-name: scale-info
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Renamed Bridges -> AllowedExporters

* Bump serde_json from 1.0.94 to 1.0.95 (paritytech#2387)

Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.94 to 1.0.95.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@v1.0.94...v1.0.95)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Companion: wasm-builder support stable Rust (paritytech#2393)

* Companion: wasm-builder support stable Rust

* update lockfile for {"polkadot", "substrate"}

---------

Co-authored-by: parity-processbot <>

* Added `IsReserve` handling for `ReserveAssetDeposited` + benchmarks

* Bump thiserror from 1.0.38 to 1.0.40 (paritytech#2396)

Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.38 to 1.0.40.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](dtolnay/thiserror@1.0.38...1.0.40)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix compile

* ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_transfer

* Bump syn from 1.0.109 to 2.0.9 (paritytech#2397)

Bumps [syn](https://github.com/dtolnay/syn) from 1.0.109 to 2.0.9.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](dtolnay/syn@1.0.109...2.0.9)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump serde from 1.0.156 to 1.0.159 (paritytech#2395)

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.156 to 1.0.159.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.156...v1.0.159)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Companion for paritytech/substrate#13725 (paritytech#2401)

* Companion for paritytech/substrate#13725

* Add comment

* update lockfile for {"substrate", "polkadot"}

---------

Co-authored-by: parity-processbot <>

* Bump syn from 2.0.9 to 2.0.11 (paritytech#2405)

Bumps [syn](https://github.com/dtolnay/syn) from 2.0.9 to 2.0.11.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](dtolnay/syn@2.0.9...2.0.11)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump scale-info from 2.4.0 to 2.5.0 (paritytech#2404)

Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.4.0 to 2.5.0.
- [Release notes](https://github.com/paritytech/scale-info/releases)
- [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md)
- [Commits](paritytech/scale-info@v2.4.0...v2.5.0)

---
updated-dependencies:
- dependency-name: scale-info
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump tempfile from 3.4.0 to 3.5.0 (paritytech#2406)

Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/Stebalien/tempfile/releases)
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/NEWS)
- [Commits](https://github.com/Stebalien/tempfile/commits)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: parity-processbot <>

* bump zombienet version (paritytech#2411)

* Fix conditional benchmarking

* ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_transfer

* ".git/.scripts/commands/bench/bench.sh" pallet westmint assets pallet_bridge_transfer

* Bump tokio from 1.26.0 to 1.27.0 (paritytech#2413)

Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.26.0 to 1.27.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](tokio-rs/tokio@tokio-1.26.0...tokio-1.27.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Change test weights

* Bump syn from 2.0.11 to 2.0.12 (paritytech#2414)

Bumps [syn](https://github.com/dtolnay/syn) from 2.0.11 to 2.0.12.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](dtolnay/syn@2.0.11...2.0.12)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump proc-macro2 from 1.0.52 to 1.0.54 (paritytech#2415)

Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.52 to 1.0.54.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](dtolnay/proc-macro2@1.0.52...1.0.54)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Companion PR for contract deletion updates (paritytech#2409)

* Companion PR for contract deletion updates

see paritytech/substrate#13702

* Revert "Companion PR for contract deletion updates"

This reverts commit 4fb2ca5.

* fix lint

* update lockfile for {"polkadot", "substrate"}

---------

Co-authored-by: parity-processbot <>

* Fix SafeCallFilter for westmint

* Allow arbitrary key-values in RelayStateSproofBuilder (paritytech#2407)

* help text examples + clean up (paritytech#2418)

* Bump futures from 0.3.27 to 0.3.28 (paritytech#2420)

Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.27 to 0.3.28.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](rust-lang/futures-rs@0.3.27...0.3.28)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump clap from 4.1.13 to 4.1.14 (paritytech#2421)

Bumps [clap](https://github.com/clap-rs/clap) from 4.1.13 to 4.1.14.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](clap-rs/clap@v4.1.13...v4.1.14)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update Substrate & Polkadot (paritytech#2422)

* Bump syn from 2.0.12 to 2.0.13 (paritytech#2428)

Bumps [syn](https://github.com/dtolnay/syn) from 2.0.12 to 2.0.13.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](dtolnay/syn@2.0.12...2.0.13)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump hex-literal from 0.3.4 to 0.4.0 (paritytech#2426)

Bumps [hex-literal](https://github.com/RustCrypto/utils) from 0.3.4 to 0.4.0.
- [Release notes](https://github.com/RustCrypto/utils/releases)
- [Commits](RustCrypto/utils@hex-literal-v0.3.4...hex-literal-v0.4.0)

---
updated-dependencies:
- dependency-name: hex-literal
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Companion for #6986 (paritytech#2416)

* refactor: apply substrate/pull/13610

* Added `origin` to config for `universal_origin` benchmark

* update lockfile for {"polkadot", "substrate"}

* Update

---------

Co-authored-by: William Freudenberger <w.freude@icloud.com>
Co-authored-by: parity-processbot <>
Co-authored-by: Bastian Köcher <info@kchr.de>

* [backport] weights 9400 (paritytech#2425)

* [benchmarks] pr with weights (paritytech#2373)

Co-authored-by: paritytech-ci <paritytech-ci@parity.io>

* [benchmarks] pr with weights (paritytech#2374)

Co-authored-by: paritytech-ci <paritytech-ci@parity.io>

* [benchmarks] pr with weights (paritytech#2375)

Co-authored-by: paritytech-ci <paritytech-ci@parity.io>

* Proof size in test wasn't sufficient

(due to updated weights.)

---------

Co-authored-by: Paritytech CI <52199148+paritytech-ci@users.noreply.github.com>
Co-authored-by: paritytech-ci <paritytech-ci@parity.io>
Co-authored-by: Giles Cope <gilescope@gmail.com>

* Use send_xcm and add cost to event

* Cleanup: Remove polkadot-service dependency from minimal node (paritytech#2430)

* Remove polkadot-service dependency from minimal-node

* Clean up error handline

* Remove unwanted changes

* Unused deps

* Co #13699: Remove old calls (paritytech#2431)

* Remove old calls

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* update lockfile for {"substrate", "polkadot"}

* Ignore warning in pallet ping

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Ignore more warnings...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* ...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: parity-processbot <>

* [Backport] version bumps 9400 (paritytech#2424)

* Bump crate versions

* Bump spec_version to 9400

* bump transaction versions (paritytech#2364)

* Refactor to support multiple MultiAsset + cleaning

* ".git/.scripts/commands/bench/bench.sh" xcm westmint assets pallet_xcm_benchmarks::generic

* Bump hex-literal from 0.4.0 to 0.4.1 (paritytech#2434)

Bumps [hex-literal](https://github.com/RustCrypto/utils) from 0.4.0 to 0.4.1.
- [Release notes](https://github.com/RustCrypto/utils/releases)
- [Commits](RustCrypto/utils@hex-literal-v0.4.0...hex-literal-v0.4.1)

---
updated-dependencies:
- dependency-name: hex-literal
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Updated bridge-hub-polkadot.json (paritytech#2435)

* The Polkadot Fellowship import (paritytech#2236)

* Fellowship into Collectives

* cargo.lock

* tracks alias

* allow to send Fellows origin over XCM

* update todos, remove duplication of type

* use Collectives location for Fellows body

* alias for ranks constants

* benchmarks

* proxy for Fellowship

* docs

* correct copyright date

* Apply suggestions from code review

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* rustfmt

* remove council, update origins

* renames

* remove tech committee from promote origin

* renames

* Fellowship import

* test

* rename mod

* fix import

* updated addresses (only ss58 version)

* update addresses

* doc nits

* weights with new api

* update addresses

* fix try runtime

* update addresses

* use pallet api to import the members

* merge fix

* hex-literal version

* add Bradley to the 1 rank

---------

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: parity-processbot <>

* Companion for  #13302 (paritytech#2357)

* primitives/core: Derive scale_info::TypeInfo for runtime APIs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* parachains: Derive scale_info::TypeInfo for FungiblesAccessError

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* parachains: Fix `TypeInfo` import path

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* update lockfile for {"polkadot", "substrate"}

* Adjust testing for the new API

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust deprecated methods

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: parity-processbot <>

* use stable rust toolchain in ci

* Bump syn from 2.0.13 to 2.0.14 (paritytech#2446)

Bumps [syn](https://github.com/dtolnay/syn) from 2.0.13 to 2.0.14.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](dtolnay/syn@2.0.13...2.0.14)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump serde from 1.0.159 to 1.0.160 (paritytech#2445)

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.159 to 1.0.160.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.159...v1.0.160)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Invoke cargo build commands with `--locked` (paritytech#2444)

* Bump actions/checkout from 3.1.0 to 3.5.1 (paritytech#2448)

* Bump actions/checkout from 3.1.0 to 3.5.1

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.1.0 to 3.5.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3.1.0...83b7061)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* align version with hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sergejs Kostjucenko <sergejs@parity.io>

* Updated doc

* Bump serde_json from 1.0.95 to 1.0.96 (paritytech#2453)

Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.95 to 1.0.96.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@v1.0.95...v1.0.96)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/checkout from 3.5.1 to 3.5.2 (paritytech#2452)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.1 to 3.5.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@83b7061...8e5e7e5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump syn from 2.0.14 to 2.0.15 (paritytech#2454)

Bumps [syn](https://github.com/dtolnay/syn) from 2.0.14 to 2.0.15.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](dtolnay/syn@2.0.14...2.0.15)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump assert_cmd from 2.0.10 to 2.0.11 (paritytech#2457)

Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 2.0.10 to 2.0.11.
- [Release notes](https://github.com/assert-rs/assert_cmd/releases)
- [Changelog](https://github.com/assert-rs/assert_cmd/blob/master/CHANGELOG.md)
- [Commits](assert-rs/assert_cmd@v2.0.10...v2.0.11)

---
updated-dependencies:
- dependency-name: assert_cmd
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Changed `query_account_balances` return type (paritytech#2455)

* Companion for substrate#13883 (paritytech#2460)

* update substrate

* update lockfile for {"polkadot", "substrate"}

---------

Co-authored-by: parity-processbot <>

* Optimize level monitor reconstruction (paritytech#2461)

* Optimize level monitor reconstruction

* Fix counter increment and test

* Struct comments as doc comments

* Bump clap from 4.1.14 to 4.2.3 (paritytech#2465)

* Bump Swatinem/rust-cache from 2.2.0 to 2.2.1 (paritytech#2456)

Bumps [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/Swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](Swatinem/rust-cache@359a70e...6fd3edf)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Companion for substrate#13771 (paritytech#2410)

* max proposal weight config

* update deps

---------

Co-authored-by: parity-processbot <>

* Parachain node should not recover blocks while syncing (paritytech#2462)

* Address review comments

* [Polkadot Companion] for 7101 (paritytech#2470)

* [Polkadot Companion] for 7101

PR: paritytech/polkadot#7101

* update lockfile for {"polkadot", "substrate"}

---------

Co-authored-by: parity-processbot <>

* Align BridgeHub runtimes with other SP runtimes + reused test for teleport native tokens + some nits (paritytech#2449)

* Align BridgeHub runtimes with other SP runtimes

* Reused `teleports_for_native_asset_works` test to all bridge-hub runtime

* Fix import vs doc

* Removed unnecessery deps

* DealWithFees + ToAuthor->ToStakingPot for BH according to the other runtimes

* Update parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Update parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Update parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Align all desc

* Extract runtime_para_id for test

* Fix test

---------

Co-authored-by: parity-processbot <>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Extract runtime_para_id for test

* Typos

* Added helper for `execute_as_governance`

* Fix test because `UnpaidRemoteExporter` adds now `UnpaidExecution` instruction

* Use `execute_as_governance` function

* typos

* modified lock

* revert to parity/master

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: joepetrowski <joe@parity.io>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: parity-processbot <>
Co-authored-by: muharem <ismailov.m.h@gmail.com>
Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com>
Co-authored-by: Javier Viola <javier@parity.io>
Co-authored-by: PG Herveou <pgherveou@gmail.com>
Co-authored-by: tmpolaczyk <44604217+tmpolaczyk@users.noreply.github.com>
Co-authored-by: William Freudenberger <w.freude@icloud.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
Co-authored-by: Egor_P <egor@parity.io>
Co-authored-by: Paritytech CI <52199148+paritytech-ci@users.noreply.github.com>
Co-authored-by: paritytech-ci <paritytech-ci@parity.io>
Co-authored-by: Giles Cope <gilescope@gmail.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
Co-authored-by: Mira Ressel <mira@parity.io>
Co-authored-by: Sergejs Kostjucenko <sergejs@parity.io>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Davide Galassi <davxy@datawok.net>
Co-authored-by: Serban Iorga <serban@parity.io>
Co-authored-by: Marcin S <marcin@bytedude.com>
  • Loading branch information
1 parent d80db53 commit c2ca46e
Show file tree
Hide file tree
Showing 31 changed files with 3,805 additions and 109 deletions.
26 changes: 26 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ members = [
"primitives/utility",
"polkadot-parachain",
"parachains/common",
"parachains/pallets/bridge-transfer",
"parachains/pallets/parachain-info",
"parachains/pallets/ping",
"parachains/runtimes/testing/rococo-parachain",
Expand Down
58 changes: 58 additions & 0 deletions parachains/pallets/bridge-transfer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[package]
name = "pallet-bridge-transfer"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "Apache-2.0"
homepage = "https://docs.substrate.io/"
repository = "https://github.com/paritytech/cumulus/"
description = "Pallet for message transfer through bridges"
readme = "README.md"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.3.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false }

# Substrate
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }

# Polkadot
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }

[dev-dependencies]
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
cumulus-pallet-xcmp-queue = { path = "../../../pallets/xcmp-queue" }

[features]
default = ["std"]
std = [
"codec/std",
"log/std",
"scale-info/std",
"sp-std/std",
"sp-runtime/std",
"frame-support/std",
"frame-system/std",
"xcm/std",
"xcm-builder/std",
"xcm-executor/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
]
try-runtime = ["frame-support/try-runtime"]
199 changes: 199 additions & 0 deletions parachains/pallets/bridge-transfer/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
// This file is part of Substrate.

// Copyright (C) 2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! `BridgeTransfer` pallet benchmarks.

use crate::{
AllowedExporters, AllowedReserveLocations, AllowedUniversalAliases, BenchmarkHelper, Call,
Config, Event, Pallet, PingMessageBuilder,
};

use frame_benchmarking::{benchmarks, BenchmarkError};
use frame_support::{
ensure,
traits::{EnsureOrigin, Get},
};
use sp_std::prelude::*;
use xcm::prelude::*;

#[cfg(feature = "runtime-benchmarks")]
impl<T: Config> Pallet<T> {
#[cfg(feature = "runtime-benchmarks")]
pub fn insert_universal_alias_for_benchmarks((location, junction): (MultiLocation, Junction)) {
assert!(matches!(
AllowedUniversalAliases::<T>::try_mutate(location, |junctions| junctions
.try_insert(junction)),
Ok(true)
));
}
}

benchmarks! {
transfer_asset_via_bridge {
let _ = T::TransferAssetOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
// every asset has its own configuration and ledger, so there's a performance dependency
// (be sure to use "worst" of assets)
let max_assets_limit = T::MaxAssetsLimit::get();
ensure!(max_assets_limit > 0, "MaxAssetsLimit not set up correctly.");
let (bridged_network, bridge_config) = T::BenchmarkHelper::bridge_config()
.ok_or(BenchmarkError::Stop("missing `bridge_config` data"))?;
let (origin, assets, destination) = T::BenchmarkHelper::prepare_asset_transfer()
.ok_or(BenchmarkError::Stop("missing `prepare_asset_transfer` data"))?;
let assets_count = match &assets {
VersionedMultiAssets::V2(assets) => assets.len(),
VersionedMultiAssets::V3(assets) => assets.len(),
};
ensure!(assets_count == max_assets_limit as usize, "`assets` not set up correctly for worst case.");
AllowedExporters::<T>::insert(bridged_network, bridge_config);
}: _<T::RuntimeOrigin>(origin, Box::new(assets), Box::new(destination))
verify {
// we don't care about message hash or sender cost here, just check that the transfer has been initiated
let actual_event = frame_system::Pallet::<T>::events().pop().map(|r| r.event);
let expected_event: <T as Config>::RuntimeEvent = Event::TransferInitiated {
message_hash: Default::default(),
sender_cost: Default::default(),
}.into();
assert!(matches!(actual_event, Some(expected_event)));
}

ping_via_bridge {
let _ = T::TransferPingOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;

let (bridged_network, bridge_config) = T::BenchmarkHelper::bridge_config()
.ok_or(BenchmarkError::Stop("missing `bridge_config` data"))?;
AllowedExporters::<T>::insert(bridged_network, bridge_config);

let (origin, destination) = T::BenchmarkHelper::prepare_ping_transfer()
.ok_or(BenchmarkError::Stop("missing `prepare_ping_transfer` data"))?;

let origin_location = T::TransferPingOrigin::ensure_origin(origin.clone()).map_err(|_| BenchmarkError::Stop("invalid `origin`"),
)?;
let (_, _, destination_location) = Pallet::<T>::ensure_remote_destination(destination.clone()).map_err(|_|
BenchmarkError::Stop("invalid `destination_location`"),
)?;
let _ = T::PingMessageBuilder::try_build(&origin_location, &bridged_network, &destination_location).ok_or(
BenchmarkError::Stop("invalid `PingMessageBuilder`"),
)?;
}: _<T::RuntimeOrigin>(origin, Box::new(destination))
verify {
// we don't care about message hash or sender cost here, just check that the transfer has been initiated
let actual_event = frame_system::Pallet::<T>::events().pop().map(|r| r.event);
let expected_event: <T as Config>::RuntimeEvent = Event::TransferInitiated {
message_hash: Default::default(),
sender_cost: Default::default(),
}.into();
assert!(matches!(actual_event, Some(expected_event)));
}

add_exporter_config {
let origin = T::AdminOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let (bridged_network, bridge_config) = T::BenchmarkHelper::bridge_config()
.ok_or(BenchmarkError::Stop("missing `bridge_config` data"))?;
}: _<T::RuntimeOrigin>(origin, bridged_network, Box::new(bridge_config.clone()))
verify {
assert_eq!(AllowedExporters::<T>::get(bridged_network), Some(bridge_config));
}

remove_exporter_config {
let origin = T::AdminOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let (bridged_network, bridge_config) = T::BenchmarkHelper::bridge_config()
.ok_or(BenchmarkError::Stop("missing `bridge_config` data"))?;
AllowedExporters::<T>::insert(bridged_network, bridge_config);
}: _<T::RuntimeOrigin>(origin, bridged_network)
verify {
assert_eq!(AllowedExporters::<T>::get(bridged_network), None);
}

update_exporter_config {
let origin = T::AdminOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let (bridged_network, bridge_config) = T::BenchmarkHelper::bridge_config()
.ok_or(BenchmarkError::Stop("missing `bridge_config` data"))?;
AllowedExporters::<T>::insert(bridged_network, bridge_config);

let bridge_location_fee = None;
let target_location_fee = Some(xcm::VersionedMultiAsset::V3(MultiAsset {
id: Concrete(MultiLocation::parent()),
fun: Fungible(1_000_0000),
}));
}: _<T::RuntimeOrigin>(origin, bridged_network, bridge_location_fee.clone().map(Box::new), target_location_fee.clone().map(Box::new))
verify {
let exporter = AllowedExporters::<T>::get(bridged_network).unwrap();
assert_eq!(exporter.bridge_location_fee, bridge_location_fee.map(|fee| MultiAsset::try_from(fee).unwrap()));
assert_eq!(exporter.max_target_location_fee, target_location_fee.map(|fee| MultiAsset::try_from(fee).unwrap()));
}

add_universal_alias {
let origin = T::AdminOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let (location, junction) = match T::BenchmarkHelper::universal_alias() {
Some(alias) => alias,
None => match T::UniversalAliasesLimit::get() > 0_u32 {
true => return Err(BenchmarkError::Stop("missing `universal_alias` data")),
false => return Err(BenchmarkError::Weightless),
}
};
}: _<T::RuntimeOrigin>(origin, Box::new(location.clone()), junction)
verify {
assert!(AllowedUniversalAliases::<T>::get(&location.try_as().unwrap()).contains(&junction));
}

remove_universal_alias {
let origin = T::AdminOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let (location, junction) = match T::BenchmarkHelper::universal_alias() {
Some(alias) => alias,
None => match T::UniversalAliasesLimit::get() > 0_u32 {
true => return Err(BenchmarkError::Stop("missing `universal_alias` data")),
false => return Err(BenchmarkError::Weightless),
}
};
Pallet::<T>::insert_universal_alias_for_benchmarks((location.clone().try_into().unwrap(), junction));
}: _<T::RuntimeOrigin>(origin, Box::new(location.clone()), vec![junction.clone()])
verify {
assert!(!AllowedUniversalAliases::<T>::get(&location.try_as().unwrap()).contains(&junction));
}

add_reserve_location {
let origin = T::AdminOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let location = match T::BenchmarkHelper::reserve_location() {
Some(location) => location,
None => match T::ReserveLocationsLimit::get() > 0_u32 {
true => return Err(BenchmarkError::Stop("missing `reserve_location` data")),
false => return Err(BenchmarkError::Weightless),
}
};
}: _<T::RuntimeOrigin>(origin, Box::new(location.clone()))
verify {
assert!(AllowedReserveLocations::<T>::get().contains(&location.try_as().unwrap()));
}

remove_reserve_location {
let origin = T::AdminOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let location = match T::BenchmarkHelper::reserve_location() {
Some(location) => location,
None => match T::ReserveLocationsLimit::get() > 0_u32 {
true => return Err(BenchmarkError::Stop("missing `reserve_location` data")),
false => return Err(BenchmarkError::Weightless),
}
};
let multilocation: MultiLocation = location.clone().try_into().unwrap();
assert!(AllowedReserveLocations::<T>::try_mutate(|locations| locations.try_insert(multilocation)).unwrap());
}: _<T::RuntimeOrigin>(origin, vec![location.clone()])
verify {
assert!(!AllowedReserveLocations::<T>::get().contains(&location.try_as().unwrap()));
}

impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::tests::TestRuntime);
}
56 changes: 56 additions & 0 deletions parachains/pallets/bridge-transfer/src/impls.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (C) 2023 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::{Config, Pallet};
use frame_support::traits::{Contains, ContainsPair};
use xcm::prelude::*;
use xcm_builder::ExporterFor;

/// `ExporterFor` implementation to check if we can transfer anything to `NetworkId`
impl<T: Config> ExporterFor for Pallet<T> {
fn exporter_for(
network: &NetworkId,
_remote_location: &InteriorMultiLocation,
_message: &Xcm<()>,
) -> Option<(MultiLocation, Option<MultiAsset>)> {
Self::allowed_exporters(network)
.map(|bridge_config| (bridge_config.bridge_location, bridge_config.bridge_location_fee))
}
}

/// Verifies if we have `(MultiLocation, Junction)` in allowed universal aliases.
pub struct AllowedUniversalAliasesOf<T>(sp_std::marker::PhantomData<T>);
impl<T: Config> Contains<(MultiLocation, Junction)> for AllowedUniversalAliasesOf<T> {
fn contains((location, junction): &(MultiLocation, Junction)) -> bool {
log::trace!(target: "xcm::contains", "AllowedUniversalAliasesOf location: {:?}, junction: {:?}", location, junction);
Pallet::<T>::allowed_universal_aliases(location).contains(junction)
}
}

/// Verifies if we can allow `(MultiAsset, MultiLocation)` as trusted reserve.
pub struct IsAllowedReserveOf<T, F>(sp_std::marker::PhantomData<(T, F)>);
impl<T: Config, F: ContainsPair<MultiAsset, MultiLocation>> ContainsPair<MultiAsset, MultiLocation>
for IsAllowedReserveOf<T, F>
{
fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool {
log::trace!(target: "xcm::contains", "IsAllowedReserveOf asset: {:?}, origin: {:?}", asset, origin);
// first check - if we have configured origin as trusted reserve location
if !Pallet::<T>::allowed_reserve_locations().contains(origin) {
return false
}
// second check - we need to pass additional `(asset, origin)` filter
F::contains(asset, origin)
}
}

0 comments on commit c2ca46e

Please sign in to comment.