Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Transfer asset via bridge #2013

Closed
wants to merge 341 commits into from
Closed
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
341 commits
Select commit Hold shift + click to select a range
b8ed7e7
fmt
joepetrowski Nov 18, 2022
e196377
Fix for missing weight for `fn unpaid_execution()`
bkontur Nov 8, 2022
aea33d1
Fix - usage of `messages_processed`
bkontur Nov 19, 2022
633366b
(pallet-assets/pallet-asset-tx-payment) pathched with `sv-locked-for-…
bkontur Nov 21, 2022
6d534f0
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Nov 22, 2022
196ad14
Fixes
KiChjang Nov 22, 2022
331b21e
Fixes
KiChjang Nov 22, 2022
b613a35
Fixes
KiChjang Nov 22, 2022
930b988
cargo fmt
KiChjang Nov 22, 2022
cd1452b
Fixes
KiChjang Nov 22, 2022
a0865d8
Fixes
KiChjang Nov 22, 2022
d953b60
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Nov 22, 2022
e80d39b
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Nov 22, 2022
3fdf078
Fixes
KiChjang Nov 22, 2022
d6d1a7d
Fixes
KiChjang Nov 22, 2022
5f7f8c2
statemine progress
joepetrowski Nov 22, 2022
e8afde4
ForeignCreators :tada:
joepetrowski Nov 22, 2022
2d4603d
Remove unused import
KiChjang Nov 28, 2022
3647b74
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Nov 28, 2022
c6f8c3d
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Nov 29, 2022
db18833
Fixes for gav-xcm-v3 (#1835)
bkontur Nov 29, 2022
61c1cdf
Fixes
KiChjang Nov 29, 2022
d30d218
Fixes
KiChjang Nov 29, 2022
2a8678d
Fixes
KiChjang Nov 29, 2022
b1e8b37
Fixes
KiChjang Nov 29, 2022
fad4c13
Fixes
KiChjang Nov 29, 2022
f1e7e18
Fix tests
KiChjang Nov 29, 2022
4829edb
Fixes
KiChjang Nov 29, 2022
e569b68
fix AssetFeeAsExistentialDepositMultiplier
joepetrowski Nov 30, 2022
c487586
no default instance
joepetrowski Nov 30, 2022
4191a4d
instantiate statemint
joepetrowski Dec 1, 2022
8afc224
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Dec 3, 2022
6057952
Add SafeCallFilter
KiChjang Dec 3, 2022
33404f2
Add missing config items
KiChjang Dec 3, 2022
ff25026
Add TODO
KiChjang Dec 3, 2022
080c7f0
Use () as the PriceForParentDelivery
KiChjang Dec 6, 2022
a9a359b
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Dec 6, 2022
9bad64e
Fixes
KiChjang Dec 6, 2022
9ad8152
Fixes
KiChjang Dec 6, 2022
f366c7f
Fixes
KiChjang Dec 6, 2022
92ace05
Fixes
KiChjang Dec 6, 2022
d2684b2
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Dec 7, 2022
ffc7926
Update transact_origin to transact_origin_and_runtime_call
KiChjang Dec 8, 2022
cb1dd01
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Dec 8, 2022
7c25f95
Add ReachableDest config item to XCM pallet
KiChjang Dec 8, 2022
b144b78
Update SafeCallFilter to allow remark_with_event in runtime benchmarks
KiChjang Dec 9, 2022
2719c7a
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Dec 9, 2022
06c43f5
cargo fmt
KiChjang Dec 9, 2022
7f0e710
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Dec 10, 2022
fef449a
Update substrate
KiChjang Dec 10, 2022
e3a6bc6
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
bkontur Dec 11, 2022
1fcb5d5
Fix worst_case_holding
KiChjang Dec 12, 2022
dd74806
Fix DMQ queue unit tests
KiChjang Dec 12, 2022
97d8c80
Remove unused label
KiChjang Dec 12, 2022
36a767c
cargo fmt
KiChjang Dec 12, 2022
1d6f7ae
Actually process incoming XCMs
KiChjang Dec 12, 2022
90b7e77
Fixes
KiChjang Dec 12, 2022
838656a
Fixes
KiChjang Dec 12, 2022
a50aed6
Fixes
KiChjang Dec 12, 2022
2b2d90e
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
bkontur Dec 13, 2022
ccb74d9
Fixes - return back Weightless
bkontur Dec 13, 2022
221d6be
Added measured benchmarks for `pallet_xcm` (#1968)
bkontur Dec 13, 2022
27f9798
cargo fmt
bkontur Dec 13, 2022
bb821eb
Fix benchmarks
KiChjang Dec 14, 2022
c70a11f
Bko gav xcm v3 (#1993)
bkontur Dec 14, 2022
5cf2a72
Change AllowUnpaidExecutionFrom to be explicit
KiChjang Dec 15, 2022
1d53b51
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Dec 21, 2022
d9d5a9d
compile tests
bkontur Dec 22, 2022
4a9dec9
Init of pallet with `transfer_asset_via_bridge` call
bkontur Nov 11, 2022
39ba564
Init of pallet with `transfer_asset_via_bridge` call
bkontur Dec 14, 2022
c675531
Box wrap inputs
bkontur Dec 19, 2022
e127426
Added withdraw/deposit to bridge's reserve account
bkontur Dec 19, 2022
a7dd1fc
TODO: temporary hack pipelines because of https://github.com/parityte…
bkontur Dec 21, 2022
2f39d75
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Dec 22, 2022
5cdc48a
xcm-v3 benchmarks, weights, fixes for bridge-hubs (#2035)
bkontur Dec 23, 2022
7f3727f
Merge branch 'master' into gav-xcm-v3
KiChjang Dec 29, 2022
e2a3354
Add event for showing the hash of an UMP sent message (#1228)
girazoki Jan 3, 2023
b7970c3
Merge branch 'master' into gav-xcm-v3
KiChjang Jan 3, 2023
63a18c2
Fixes
KiChjang Jan 3, 2023
f9a0390
Fixes
KiChjang Jan 3, 2023
893bc5c
Fixes
KiChjang Jan 3, 2023
e303fb2
Fixes
KiChjang Jan 3, 2023
2ff5c4f
Allow receive bridged Xcm::Trap on Westmint
bkontur Jan 4, 2023
18ad58b
Allow (temporary) Statemine send xcm messages
bkontur Jan 4, 2023
fe7817e
refactor TrustedBridgedNetworks
bkontur Jan 4, 2023
a80781e
Allow (hacky) xcm::transact for remark/remark_with_event
bkontur Jan 4, 2023
0985898
Unit-test for Statemine - send_xcm_transact_with_remark_with_event_works
bkontur Jan 5, 2023
c3195d2
Fix for BridgedSignedAccountId32AsNative
bkontur Jan 5, 2023
8fe432b
Allow explicit unpaid executions from the relay chains for system par…
KiChjang Jan 7, 2023
e28ef3c
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Jan 7, 2023
87e0ea1
Allow receiving XCMs from any relay chain plurality
KiChjang Jan 10, 2023
146c742
Fixes
KiChjang Jan 10, 2023
3353263
don't rename pallet in runtime
joepetrowski Jan 11, 2023
9e211b8
don't rename and fix tests
joepetrowski Jan 11, 2023
31bc1c6
Added `allowed_target_location` + reanchored assets/destination + tests
bkontur Jan 12, 2023
25c2fc5
fix benchmark helper
joepetrowski Jan 12, 2023
a4a581b
fix benchmark build
joepetrowski Jan 12, 2023
7fbfeb3
Merge remote-tracking branch 'origin/joe-bridge-hub-westmint-assets' …
bkontur Jan 12, 2023
9cd2708
more benchmark fixes
joepetrowski Jan 12, 2023
23f9e4d
Merge remote-tracking branch 'origin/joe-bridge-hub-westmint-assets' …
bkontur Jan 12, 2023
81e9703
fix penpal and rococo
joepetrowski Jan 12, 2023
d5787aa
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
bkontur Jan 13, 2023
71b357b
Merge remote-tracking branch 'origin/gav-xcm-v3' into bridge-hub-base
bkontur Jan 15, 2023
f6e1b01
Patched dependencies (polkadot, substrate) for xcm-v3 (compiles + tes…
bkontur Jan 15, 2023
4365baa
Merge branch 'bridge-hub-base' into joe-bridge-hub-westmint-assets
bkontur Jan 15, 2023
f2c3569
Merge remote-tracking branch 'origin/joe-bridge-hub-westmint-assets' …
bkontur Jan 15, 2023
0c3f3b7
update BenchmarkHelper interface
joepetrowski Jan 17, 2023
c3d2108
fmt
joepetrowski Jan 17, 2023
0d75123
Merge remote-tracking branch 'origin/master' into joe-bridge-hub-west…
bkontur Jan 21, 2023
1d6fff4
Merge branch 'joe-bridge-hub-westmint-assets' into bko-transfer-asset…
bkontur Jan 21, 2023
8d809e4
Added weight `export_message` to statemint because of `pallet_xcm.send`
bkontur Jan 22, 2023
81abe45
add foreign assets to westmint
joepetrowski Jan 24, 2023
0da76e0
add foreign assets to statemine
joepetrowski Jan 24, 2023
57a2f00
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Jan 25, 2023
1ae22a7
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Jan 30, 2023
af4fe56
Governance can call `xcm:Transact` with bridges configuration management
bkontur Jan 30, 2023
063fef0
Merge remote-tracking branch 'origin/master' into joe-foreign-assets
Jan 30, 2023
bf2e4d3
Merge remote-tracking branch 'origin/joe-foreign-assets' into bko-tra…
bkontur Jan 30, 2023
78175ba
Revert temporary disabled `scripts/ci/gitlab/pipeline/test.yml`
bkontur Jan 30, 2023
761a500
Unit-test for handling `ReserveAssetDeposited` on Westmint for Foreig…
bkontur Feb 1, 2023
bc4664b
Merge remote-tracking branch 'origin/master' into joe-foreign-assets
Feb 9, 2023
b534445
Merge remote-tracking branch 'origin/master' into joe-foreign-assets
Feb 10, 2023
0590241
use updated api for ensure origin trait
muharem Feb 13, 2023
a1ce9b8
Merge remote-tracking branch 'origin/master' into joe-foreign-assets
Feb 23, 2023
0f80e76
Merge remote-tracking branch 'origin/master' into joe-foreign-assets
Feb 28, 2023
ae8cac6
Merge remote-tracking branch 'origin/master' into joe-foreign-assets
bkontur Mar 3, 2023
1b21403
Merge remote-tracking branch 'origin/master' into joe-foreign-assets
Mar 3, 2023
5cb396f
Merge remote-tracking branch 'origin/master' into joe-foreign-assets
Mar 8, 2023
56abaf5
Merge remote-tracking branch 'origin/master' into joe-foreign-assets
Mar 10, 2023
d5b71a7
Benchmarks for pallet-bridge-assets-transfer (#2316)
svyatonik Mar 15, 2023
4f70058
Merge remote-tracking branch 'origin/master' into joe-foreign-assets
Mar 15, 2023
60a6089
Assets/ForeignAssets tests and fixes (#2167)
bkontur Mar 16, 2023
018b800
Added `StartsWithExplicitGlobalConsensus` to ignores (#2338)
bkontur Mar 16, 2023
08bfe99
Merge remote-tracking branch 'origin/joe-foreign-assets' into bko-tra…
bkontur Mar 16, 2023
48b6877
Change to correct weight file for pallet_bridge_assets_transfer
bkontur Mar 17, 2023
c16f96d
Renamed `pallet-bridge-assets-transfer` to `pallet-bridge-transfer`
bkontur Mar 17, 2023
32a09c7
from_ref_time to from_parts
bkontur Mar 17, 2023
137ee81
".git/.scripts/commands/bench/bench.sh" pallet statemine assets palle…
Mar 17, 2023
36751ae
Added `ping_via_bridge`
bkontur Mar 19, 2023
b550a8e
".git/.scripts/commands/bench/bench.sh" pallet statemine assets palle…
Mar 19, 2023
47e0283
Merge remote-tracking branch 'origin/master' into joe-foreign-assets
Mar 20, 2023
a4e2b93
Fix test
bkontur Mar 20, 2023
ad13281
Merge remote-tracking branch 'origin/joe-foreign-assets' into bko-tra…
Mar 20, 2023
eff26cd
Revert not needed stuff
bkontur Mar 20, 2023
65fe38b
Added test-case `can_governance_change_bridge_transfer_configuration`
bkontur Mar 20, 2023
bc5a3ed
Added test `initiate_transfer_asset_via_bridge_for_native_asset_works`
bkontur Mar 21, 2023
ec44e0d
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Mar 23, 2023
abe9ad2
Fix compilation
bkontur Mar 24, 2023
98c09fa
Small fixes
bkontur Mar 24, 2023
d712d42
Added support for paid or unpaid execution by configuration
bkontur Mar 24, 2023
8dfe3b6
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Mar 24, 2023
a757c38
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
Mar 27, 2023
a3eb549
Removed stuff
bkontur Mar 27, 2023
e0a27e6
Added `receive_reserve_asset_deposited_from_different_consensus_works`
bkontur Mar 27, 2023
72d4010
Renamed Bridges -> AllowedExporters
bkontur Mar 28, 2023
99fca26
Added `IsReserve` handling for `ReserveAssetDeposited` + benchmarks
bkontur Mar 29, 2023
bfaa974
Fix compile
bkontur Mar 29, 2023
1c459ed
Merge branch 'master' of https://github.com/paritytech/cumulus into HEAD
Mar 29, 2023
3bf39cf
".git/.scripts/commands/bench/bench.sh" pallet statemine assets palle…
Mar 29, 2023
f76ba2b
Fix conditional benchmarking
bkontur Mar 30, 2023
8bcceb6
Merge branch 'master' of https://github.com/paritytech/cumulus into HEAD
Mar 30, 2023
45ca89b
".git/.scripts/commands/bench/bench.sh" pallet statemine assets palle…
Mar 30, 2023
727b348
".git/.scripts/commands/bench/bench.sh" pallet westmint assets pallet…
Mar 30, 2023
a92aeb3
Change test weights
bkontur Mar 31, 2023
b82d6b1
Fix SafeCallFilter for westmint
bkontur Mar 31, 2023
7fd80c7
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Apr 4, 2023
e25e1ef
Use send_xcm and add cost to event
bkontur Apr 4, 2023
77ad776
Refactor to support multiple MultiAsset + cleaning
bkontur Apr 5, 2023
b3edf24
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
Apr 5, 2023
e6bd54a
".git/.scripts/commands/bench/bench.sh" xcm westmint assets pallet_xc…
Apr 5, 2023
71d427f
Updated doc
bkontur Apr 13, 2023
73bdbdc
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
Apr 13, 2023
56644eb
Address review comments
serban300 Apr 20, 2023
5170168
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
Apr 24, 2023
5c479b7
Extract runtime_para_id for test
bkontur Apr 19, 2023
ad2fa5c
Typos
bkontur Apr 19, 2023
7bba7f0
Added helper for `execute_as_governance`
bkontur Apr 20, 2023
e58b442
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Apr 24, 2023
2e33b87
Fix test because `UnpaidRemoteExporter` adds now `UnpaidExecution` in…
bkontur Apr 24, 2023
43ee627
Use `execute_as_governance` function
bkontur Apr 24, 2023
bc8da2d
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur May 22, 2023
7c6d11a
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur May 22, 2023
469fe9c
Used `GlobalConsensusParachainConvertsFor` from `xcm-builder`
bkontur May 22, 2023
c167add
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur May 23, 2023
b1e9103
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur May 23, 2023
61ac4b7
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur May 24, 2023
2a9cd81
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur May 25, 2023
e2101a5
Fix target
bkontur May 25, 2023
4280239
Fixed AssetTrapped issue
bkontur May 25, 2023
79adea5
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur May 26, 2023
b2199fc
Fix xcm `SetTopic` vs message_hash vs message_id stuff
bkontur May 26, 2023
0ad1c23
Sovereign account as target destination instead of bridge-hub
bkontur May 26, 2023
7838a2a
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur May 26, 2023
b16b00e
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur May 29, 2023
322fdc6
Allow both sides
bkontur May 30, 2023
5218d82
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur May 30, 2023
b873588
".git/.scripts/commands/bench/bench.sh" xcm statemine assets pallet_x…
May 30, 2023
4bac3e7
".git/.scripts/commands/bench/bench.sh" xcm westmint assets pallet_xc…
May 30, 2023
80c77ad
".git/.scripts/commands/bench/bench.sh" pallet statemine assets palle…
May 30, 2023
faae320
".git/.scripts/commands/bench/bench.sh" pallet westmint assets pallet…
May 30, 2023
8d024e6
Introduced AssetTransferKind + heavy refactor
bkontur Jun 8, 2023
bb65750
One more refactor
bkontur Jun 8, 2023
9f52511
Merge remote-tracking branch 'origin/bko-transfer-asset-via-bridge' i…
bkontur Jun 8, 2023
3b6c1e5
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Jun 8, 2023
8a07286
Test compilation after rebase
bkontur Jun 8, 2023
850fac5
Small nits
bkontur Jun 8, 2023
9563e47
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Jun 8, 2023
e6c4ec1
Reworked benchmarks
bkontur Jun 9, 2023
ed9d63f
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Jun 9, 2023
8519a76
".git/.scripts/commands/bench/bench.sh" xcm statemine assets pallet_x…
Jun 9, 2023
50b7778
Merge branch 'master' of https://github.com/paritytech/cumulus into HEAD
Jun 9, 2023
c4b1e6e
".git/.scripts/commands/bench/bench.sh" xcm westmint assets pallet_xc…
Jun 9, 2023
0fade80
".git/.scripts/commands/bench/bench.sh" pallet statemine assets palle…
Jun 9, 2023
8013e38
".git/.scripts/commands/bench/bench.sh" pallet westmint assets pallet…
Jun 9, 2023
ed57ede
".git/.scripts/commands/bench/bench.sh" xcm asset-hub-kusama assets p…
Jun 9, 2023
9a833b1
Introduced `primitives` sub module
bkontur Jun 9, 2023
a5c14ea
Renamed const
bkontur Jun 9, 2023
00d16b5
".git/.scripts/commands/bench/bench.sh" xcm asset-hub-westend assets …
Jun 9, 2023
e67f9f5
Merge branch 'master' of https://github.com/paritytech/cumulus into HEAD
Jun 9, 2023
c3e150a
".git/.scripts/commands/bench/bench.sh" pallet asset-hub-kusama asset…
Jun 9, 2023
36f5c1b
Moved cfg stuff to `pallet-bridge-transfer-onchain-config`
bkontur Jun 10, 2023
916fe2e
More refactoring
bkontur Jun 12, 2023
3f2a3ba
Another refactor
bkontur Jun 12, 2023
8bef5e7
Temporary removed pallet for on-chain bridge config (will come in oth…
bkontur Jun 12, 2023
2f5ea0c
Removed line
bkontur Jun 12, 2023
be9d74f
Merge remote-tracking branch 'origin/bko-transfer-asset-via-bridge' i…
bkontur Jun 12, 2023
2ccce59
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Jun 12, 2023
0962356
Added cfg to asset-hub-polkadot
bkontur Jun 12, 2023
c96d3d8
Fix test - ED for staking_pot
bkontur Jun 12, 2023
78b4077
Allow set_storage for max fee constant
bkontur Jun 12, 2023
f4db99d
trivial: remove redundant method implementations
svyatonik Jun 13, 2023
4b6d142
Fix benchmarks
bkontur Jun 13, 2023
5adee69
Merge remote-tracking branch 'origin/bko-transfer-asset-via-bridge' i…
bkontur Jun 13, 2023
49898b7
Nits
bkontur Jun 13, 2023
6996284
Clippy
bkontur Jun 13, 2023
9d7416f
Clippy
bkontur Jun 13, 2023
6f1fca8
Benchmarks
bkontur Jun 14, 2023
7460f08
Fix try-runtime
bkontur Jun 14, 2023
dd9d2ed
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Jun 14, 2023
27c048d
".git/.scripts/commands/bench/bench.sh" xcm asset-hub-kusama assets p…
Jun 14, 2023
23b0e06
Merge branch 'master' of https://github.com/paritytech/cumulus into HEAD
Jun 14, 2023
e7470ef
".git/.scripts/commands/bench/bench.sh" xcm asset-hub-westend assets …
Jun 14, 2023
40781e0
Merge branch 'master' of https://github.com/paritytech/cumulus into HEAD
Jun 14, 2023
26f86a3
".git/.scripts/commands/bench/bench.sh" xcm asset-hub-polkadot assets…
Jun 14, 2023
c58ba8e
".git/.scripts/commands/bench/bench.sh" pallet asset-hub-kusama asset…
Jun 14, 2023
a34bd0f
".git/.scripts/commands/bench/bench.sh" pallet asset-hub-westend asse…
Jun 14, 2023
6d3db81
".git/.scripts/commands/bench/bench.sh" pallet asset-hub-polkadot ass…
Jun 14, 2023
167fc06
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
Jun 16, 2023
62a1f2d
Fix README and local run scripts
bkontur Jun 19, 2023
d4ea7d5
Merge remote-tracking branch 'origin/master' into bko-transfer-asset-…
bkontur Jun 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 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 @@ -36,6 +36,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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that the UnpaidRemoteExporter throws an error if maybe_payment is not None: https://github.com/paritytech/polkadot/blob/df61c0bf0834f650e79ddd1a74dea34081ff2b46/xcm/xcm-builder/src/universal_exports.rs#L156

So bridge_config.bridge_location_fee seems misguiding. If someone sets it to Some(fee) if will (unexpectedly) actually lead to failure. Would it make sense to remove it ?

}
}

/// 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)
}
}
Loading