Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Update Polkadot-SDK #18

Closed
wants to merge 257 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
257 commits
Select commit Hold shift + click to select a range
026a779
add test cases plan
acatangiu Sep 26, 2023
4465c65
add pallet-assets to mock test runtime
acatangiu Sep 26, 2023
2392dd9
fix add assets to mock pallet-xcm runtime
acatangiu Sep 26, 2023
67daafe
add test for asset-reserve and fee-reserve both at destination
acatangiu Sep 27, 2023
88b3024
add test for asset-reserve and fee-reserve both at remote chain
acatangiu Sep 27, 2023
513e15a
add test for asset-reserve at destination while fee-reserve is local
acatangiu Sep 27, 2023
19eec17
add test for asset local-reserve while fee-reserve is destination
acatangiu Sep 27, 2023
1687c53
add test for asset local-reserve while fee-reserve is remote chain
acatangiu Sep 27, 2023
abf029d
refactor tests using better naming and conceptual examples
acatangiu Sep 27, 2023
576c770
add test for asset destination-reserve while fee-reserve is remote chain
acatangiu Sep 28, 2023
280c4b1
fix some typos
acatangiu Sep 28, 2023
bab8fc2
deduplicate code for do_teleport_assets()
acatangiu Sep 28, 2023
f7a4a2e
add test for asset local-reserve while teleporting fees
acatangiu Sep 28, 2023
f88de5e
add test for asset destination-reserve while teleporting fees
acatangiu Sep 28, 2023
f7abb0a
fix cases when asset reserve is remote, add test remote-asset and tel…
acatangiu Sep 28, 2023
7b920ec
add test for transfer asset remote reserve and fee local reserve
acatangiu Sep 28, 2023
3130566
add test for transfer asset remote reserve and fee destination reserve
acatangiu Sep 28, 2023
1b17e84
disallow teleportable assets in reserve-transfer, add regression test
acatangiu Sep 29, 2023
84e213a
asset-hubs: fix emulated tests and deduplicate code
acatangiu Sep 29, 2023
ce00c28
asset-hubs: use non-system para IDs in tests where non-system paras a…
acatangiu Sep 29, 2023
1dfcd01
pallet-xcm: refactor newly added tests
acatangiu Sep 29, 2023
24f9b72
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Oct 10, 2023
022ef71
pallet-xcm: fix benchmarks
acatangiu Oct 10, 2023
9827c3b
fix pallet-xcm benchmarks for all runtimes
acatangiu Oct 10, 2023
23588a8
address review comments
acatangiu Oct 11, 2023
931e093
expose TransferType through XcmExecutor::traits::AssetTransferSupport…
acatangiu Oct 11, 2023
bf39726
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Oct 11, 2023
8ac30aa
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Oct 13, 2023
09badd6
allow transfer for non-fungible assets too
acatangiu Oct 13, 2023
648ba8a
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Oct 19, 2023
f8e8b4a
fix merge damage
acatangiu Oct 20, 2023
71bd4b3
fmt
acatangiu Oct 23, 2023
4ab90f7
pallet-xcm: split asset transfer tests to own file
acatangiu Oct 23, 2023
3070994
address review comments
acatangiu Oct 23, 2023
f045c73
pallet-xcm: disallow combining remote reserves with other xfer types
acatangiu Oct 23, 2023
fe93ef4
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Oct 23, 2023
d1a9709
xcm-barriers: allow SetFeesMode in BuyExecution barrier and fix tests
acatangiu Oct 23, 2023
955fe40
adds message queue pallet
Oct 19, 2023
00d2756
adds outbound queue
Oct 19, 2023
e39beb1
fix compiler errors
Oct 19, 2023
3c16e0f
adds snowbridge to rococo bridgehub
Oct 19, 2023
a315789
asset hub rococo
Oct 20, 2023
4d012bf
asset hub rococo
Oct 20, 2023
2aec192
finishing up applying changes
Oct 20, 2023
546274a
fix incorrect pallet-xcm imports
Oct 20, 2023
50d844f
verify assets and beneficiary in over-bridge test
acatangiu Oct 24, 2023
0bf64e6
fix AHs tests
acatangiu Oct 24, 2023
c711961
AHs: fix emulated tests
acatangiu Oct 24, 2023
67929a5
AHs: include delivery-fee checking in tests
acatangiu Oct 24, 2023
dd46f23
fix runtime-benchmarks for AHRococo
acatangiu Oct 24, 2023
e8cbcb9
fix clippy
acatangiu Oct 24, 2023
ea3aaad
fixing tests
Oct 24, 2023
22cc658
adds upstream changes
Oct 25, 2023
9e941d3
cleanup comments, fix upgrade gateway test
Oct 25, 2023
d725103
withdraw fees before buyexecution - still broken because of executor …
acatangiu Oct 25, 2023
3d97f19
pallet-xcm: uses single custom XCM to send both fees and assets
acatangiu Oct 25, 2023
ac3773e
pallet-xcm: handle teleport checking account when custom burn+teleport
acatangiu Oct 25, 2023
cb6f53a
fixes plus tests
acatangiu Oct 25, 2023
560d788
fix pallet-xcm tests
acatangiu Oct 25, 2023
3bc2d73
fix AHs tests
acatangiu Oct 25, 2023
1217723
attempts to fix xcm config
Oct 26, 2023
f838cd5
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Oct 26, 2023
5e480dd
fixes send token
Oct 26, 2023
bd60203
remove unused SetFeesMode instruction
acatangiu Oct 26, 2023
533538f
Merge branch 'pallet-xcm-fully-support-reserve-transfers' into polkad…
Oct 27, 2023
7b658d6
add missing import
Oct 27, 2023
bae3b62
allows all networks
Oct 27, 2023
4f5d693
fmt
Oct 27, 2023
2e71447
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Oct 27, 2023
371ac2d
pallet-xcm: fix broken reserve_transfer_assets benchmark
acatangiu Oct 26, 2023
9b58ff0
try add pallet-assets for benchmarking to rococo
acatangiu Oct 27, 2023
942977e
Revert "try add pallet-assets for benchmarking to rococo"
acatangiu Oct 27, 2023
3b9965b
pallet-xcm benchmarking: most chains do not have pallet-assets, use p…
acatangiu Oct 27, 2023
adcd688
pallet-xcm: fix teleport_assets benchmark
acatangiu Oct 27, 2023
eca0c3e
fix runtimes benchmarks for pallet-xcm
acatangiu Oct 27, 2023
b648df2
AHs simplify test_cases_over_bridge
acatangiu Oct 27, 2023
da7d8ff
runtimes: add dedicated benchmarking config for pallet-xcm
acatangiu Oct 27, 2023
8d85faa
AHs benchmarks: fix transfer to sibling parachain
acatangiu Oct 28, 2023
fd8f5f3
fixed token transfer test
Oct 29, 2023
506b6b1
fixes after rebase
Oct 29, 2023
ea063f7
fixes after rebase
Oct 30, 2023
404fbd8
Merge branch 'polkadot-sdk-update-v2' into polkadot-sdk-update-v2-res…
Oct 30, 2023
0356361
fixes after rebase
Oct 30, 2023
37552fd
Update polkadot/xcm/xcm-executor/src/traits/asset_transfer.rs
acatangiu Oct 30, 2023
6714d39
Update polkadot/xcm/pallet-xcm/src/lib.rs
acatangiu Oct 30, 2023
a79ed78
Merge branch 'master' into pallet-xcm-fully-support-reserve-transfers
acatangiu Oct 30, 2023
7a61129
fmt
acatangiu Oct 30, 2023
f0e267a
Polkadot sdk update v2 (#3)
claravanstaden Oct 30, 2023
95f3c78
Runtime changes for refactored outbound-queue pallet
vgeddes Oct 30, 2023
c90619c
updates relay
Oct 30, 2023
0f76530
Update polkadot/xcm/xcm-builder/src/barriers.rs
acatangiu Oct 31, 2023
9d3f2dd
Update polkadot/xcm/pallet-xcm/src/lib.rs
acatangiu Oct 31, 2023
9feb4b0
Update polkadot/xcm/pallet-xcm/src/lib.rs
acatangiu Oct 31, 2023
0a38b70
Update polkadot/xcm/pallet-xcm/src/lib.rs
acatangiu Oct 31, 2023
02447d0
fmt
acatangiu Oct 31, 2023
84e3e29
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Oct 31, 2023
0f1377e
Update bridge
vgeddes Oct 31, 2023
6372d2d
Add WeightToFee to inbound queue config
yrong Nov 1, 2023
13fd5ac
Merge pull request #5 from Snowfork/refactor-outbound-queue
vgeddes Nov 1, 2023
6c3462b
Merge branch 'snowbridge' into alistair/merge-from-snowbridge
alistair-singh Nov 1, 2023
0652d74
remove comments
alistair-singh Nov 1, 2023
2f7d49e
Add back treasury account
alistair-singh Nov 1, 2023
f2d8350
fix warnings
alistair-singh Nov 1, 2023
5ddb798
Merge pull request #6 from Snowfork/alistair/merge-from-snowbridge
alistair-singh Nov 1, 2023
546d452
Merge remote-tracking branch 'adrian/pallet-xcm-fully-support-reserve…
alistair-singh Nov 1, 2023
b60eab6
Merge branch 'snowbridge' into ron/sno-426
yrong Nov 1, 2023
79197a3
Update for benchmark
yrong Nov 1, 2023
302d2f5
Update for benchmark
yrong Nov 1, 2023
b67cb0f
xcm-emulator: configure penpal for asset transfers and enhance existi…
acatangiu Nov 1, 2023
ec87ce6
xcm-emulator: add relay to penpal native transfer test
acatangiu Nov 1, 2023
da3c12e
xcm-emulator: add ah to penpal native asset transfer test
acatangiu Nov 1, 2023
ac9bf49
xcm: MultiLocation::chain_location() takes nonmut reference
acatangiu Nov 1, 2023
e85e339
pallet-xcm: benchmarks: enforce single asset transfer at the api level
acatangiu Nov 1, 2023
9f7538d
xcm-executor: rename AssetTransferSupport to XcmAssetTransfer
acatangiu Nov 1, 2023
45279cc
clippy
acatangiu Nov 1, 2023
59cf104
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Nov 1, 2023
d68524b
Merge remote-tracking branch 'adrian/pallet-xcm-fully-support-reserve…
alistair-singh Nov 1, 2023
ebe8baf
fixes
alistair-singh Nov 1, 2023
2dd39ad
remove duplicated trait
alistair-singh Nov 1, 2023
9687d23
Merge pull request #10 from Snowfork/ron/fix-runtime-benchmarks
yrong Nov 2, 2023
f45b839
Merge branch 'snowbridge' into ron/sno-426
yrong Nov 2, 2023
fb88d91
Merge pull request #11 from Snowfork/ron/sno-426
yrong Nov 2, 2023
f101028
Merge pull request #9 from Snowfork/alistair/merge-from-adrian
alistair-singh Nov 2, 2023
e9c7205
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Nov 2, 2023
6ba36f8
AssetHub tests: account for Westend higher delivery fees
acatangiu Nov 2, 2023
7728527
fix merge damage
acatangiu Nov 2, 2023
a4089c8
Added withdraw reserve to scripts
bkontur Nov 2, 2023
4f3bf79
remove feature
alistair-singh Nov 2, 2023
44e1918
bridge-hub-westend-runtime: fix benchmarks
acatangiu Nov 2, 2023
528f646
unknown import
alistair-singh Nov 2, 2023
8c9dc76
move AllowSiblingsOnly to core
alistair-singh Nov 2, 2023
55305d2
Adds transfer token user fee (#7)
claravanstaden Nov 2, 2023
989fb0f
Improve xcm integration test (#13)
yrong Nov 3, 2023
c2ee3b4
Add weight for update_fees
yrong Nov 3, 2023
7e49752
Merge branch 'snowbridge' into reserve-asset-transfer
alistair-singh Nov 3, 2023
7414de6
Merge pull request #14 from Snowfork/reserve-asset-transfer
alistair-singh Nov 3, 2023
1341a73
remove gateway contract location
alistair-singh Nov 1, 2023
f79073b
fmt
alistair-singh Nov 1, 2023
dba7cff
remove todos
alistair-singh Nov 2, 2023
0ee181e
use the correct bridge config
alistair-singh Nov 3, 2023
dab8646
Merge pull request #12 from Snowfork/alistair/remove-gateway-contract…
alistair-singh Nov 3, 2023
e907a6f
Enable utility calls
yrong Nov 3, 2023
c1394ee
Merge branch 'snowbridge' into ron/sno-738
yrong Nov 3, 2023
a59ccf3
xcm-emulator: add ah to penpal multiple mixed assets transfer test
acatangiu Nov 3, 2023
27c7cea
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Nov 3, 2023
582c616
fix merge damage
acatangiu Nov 3, 2023
94aaffd
remove limited from test names, all transfers use limited method now
acatangiu Nov 3, 2023
fe2cb6a
barriers: allow withdrawing multiple assets in AllowTopLevelPaidExecu…
acatangiu Nov 5, 2023
b1a66d4
Rename to set_token_transfer_fees
yrong Nov 5, 2023
7119760
Adds Ethereum router (#16)
claravanstaden Nov 6, 2023
928a658
fixed warning
alistair-singh Nov 6, 2023
2ebefc0
pallet-xcm: add trace logs
acatangiu Nov 6, 2023
578d15b
Merge branch 'pallet-xcm-fully-support-reserve-transfers' into update…
Nov 6, 2023
8e1cb1e
fixes after merge
Nov 6, 2023
839af41
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Nov 6, 2023
56c52f1
fix runtime-benchmarks
acatangiu Nov 6, 2023
669e109
Merge branch 'master' into pallet-xcm-fully-support-reserve-transfers
acatangiu Nov 6, 2023
e8eccd5
updated exporter
alistair-singh Nov 6, 2023
ba91cd6
pallet-xcm: fix tests
acatangiu Nov 6, 2023
bfedcf1
increase fee
alistair-singh Nov 7, 2023
905ff5a
tweaked fee
alistair-singh Nov 7, 2023
360caa2
Merge branch 'snowbridge' into ron/sno-738
yrong Nov 7, 2023
8951238
xcm-emulator: remove unused pallet import
acatangiu Nov 7, 2023
dd2a06f
xcm-barrier: enforce MAX_ASSETS_FOR_BUY_EXECUTION
acatangiu Nov 7, 2023
f879297
Change to Ethereum sovereign
yrong Nov 6, 2023
a1ff98b
chore
yrong Nov 6, 2023
589033b
Tests for token transfer
yrong Nov 6, 2023
2edb0e6
fix tests
alistair-singh Nov 7, 2023
ce31f30
Support for message ids
vgeddes Nov 7, 2023
0378a75
Merge pull request #19 from Snowfork/alistair/new-reserve-transfer
alistair-singh Nov 7, 2023
0b22697
Merge pull request #20 from Snowfork/ron/xcm-integration-test
alistair-singh Nov 7, 2023
6d67ea1
rename some variables and fns
acatangiu Nov 7, 2023
db1e826
add explicit incomplete local execution error
acatangiu Nov 7, 2023
54d7465
rename fns
acatangiu Nov 7, 2023
39e7b66
pallet-xcm: fix pallet extrinsic default weights
acatangiu Nov 7, 2023
19f9318
fix some errors
Nov 7, 2023
ed481c9
Update Cargo.lock
vgeddes Nov 7, 2023
4bd0bdb
Merge branch 'snowbridge' into ron/sno-738
yrong Nov 8, 2023
ea1c147
working on new bridge config
Nov 8, 2023
0fbb063
Fix assethub fee (#21)
claravanstaden Nov 8, 2023
d6bafcb
working on new bridge config
Nov 8, 2023
1adaaee
Merge branch 'snowbridge' into message-id
vgeddes Nov 8, 2023
69c4b1c
progress on config
Nov 8, 2023
ceddec5
pallet-xcm: also buy execution as part of custom fee handling
acatangiu Nov 8, 2023
7f78c73
pallet-xcm: fix lossy fees math
acatangiu Nov 8, 2023
45131b1
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Nov 8, 2023
27da032
Merge branch 'pallet-xcm-fully-support-reserve-transfers' into update…
Nov 8, 2023
cb8226d
fix merge damage
acatangiu Nov 8, 2023
cc24f53
Merge branch 'snowbridge' into ron/sno-738
yrong Nov 8, 2023
d0c8944
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pall…
acatangiu Nov 8, 2023
138892d
Add commons crate for BridgeHub runtime
vgeddes Nov 8, 2023
c5522e4
fix merge damage
acatangiu Nov 8, 2023
f7fbba7
Fix emulated tests
vgeddes Nov 8, 2023
f5dee8e
fixes
Nov 9, 2023
724bf59
Merge branch 'bridge-hub-runtime-common-crate' into update-from-adrian
Nov 9, 2023
42577ef
attempting to fix message queue things
Nov 9, 2023
0c5da74
fix message queue things
Nov 9, 2023
937d51b
Merge pull request #15 from Snowfork/ron/sno-738
yrong Nov 9, 2023
364fe96
fixes
Nov 9, 2023
10461cc
Merge branch 'snowbridge' into update-from-adrian
Nov 9, 2023
61cbf82
Update Cargo.lock
vgeddes Nov 9, 2023
38754ed
Merge branch 'snowbridge' into message-id
vgeddes Nov 9, 2023
224c859
Merge branch 'message-id' into message-log
vgeddes Nov 9, 2023
464bf57
Merge pull request #24 from Snowfork/message-id
vgeddes Nov 9, 2023
8b74008
Merge branch 'snowbridge' into message-log
vgeddes Nov 9, 2023
69fab33
re-use pallet
alistair-singh Nov 8, 2023
f68398c
added fee handler trait
alistair-singh Nov 8, 2023
3270200
whitespace
alistair-singh Nov 8, 2023
351b71a
move to treasury to snowbridge sovereign
alistair-singh Nov 8, 2023
e254d6a
remove treasury
alistair-singh Nov 8, 2023
5db326e
remove TREASURY_PALLET_ID
alistair-singh Nov 8, 2023
69d9991
remove unused imports
alistair-singh Nov 8, 2023
d9fed1c
add fee trait
alistair-singh Nov 9, 2023
20a41ae
fix error
alistair-singh Nov 9, 2023
42c0e88
added full logic
alistair-singh Nov 9, 2023
f3bfe27
adds tests
alistair-singh Nov 9, 2023
1622650
renamed trait
alistair-singh Nov 9, 2023
0c142db
use siblings
alistair-singh Nov 9, 2023
b971a09
address feedback
alistair-singh Nov 9, 2023
8bfa0c1
add snowbridge-runtime-common
alistair-singh Nov 9, 2023
114f552
fix build
alistair-singh Nov 9, 2023
9e2bef3
cleanup
Nov 9, 2023
3c9d59a
Merge branch 'snowbridge' into update-from-adrian
Nov 9, 2023
2afe5bb
cleaner implementation
alistair-singh Nov 9, 2023
3dbb586
cargo lock
alistair-singh Nov 9, 2023
f56aaf9
update cargo lock
alistair-singh Nov 9, 2023
0cfbc39
latest updates and fmt
Nov 10, 2023
06dd2f9
increases message queue sizes for beacon checkpoint
Nov 10, 2023
655ecdf
Merge branch 'pallet-xcm-fully-support-reserve-transfers' into update…
Nov 10, 2023
702ed2e
updates pallet indices
Nov 10, 2023
d7b9a49
fixes
alistair-singh Nov 10, 2023
6236cad
move to runtime folder
alistair-singh Nov 10, 2023
53eb94e
remove uneeded code
alistair-singh Nov 10, 2023
5e361f4
Merge pull request #23 from Snowfork/alistair/fee-manager
alistair-singh Nov 10, 2023
72b1428
Merge branch 'snowbridge' into message-log
vgeddes Nov 10, 2023
fe7199c
remove snowbridge sovereign from tests
alistair-singh Nov 11, 2023
4c43186
use Balance
alistair-singh Nov 11, 2023
bca9914
added refund
alistair-singh Nov 11, 2023
758f7c5
increased fee
alistair-singh Nov 11, 2023
b6f6160
Not going to refund treasuries
vgeddes Nov 12, 2023
cd3fe50
Merge pull request #25 from Snowfork/alistair/send-fees-with-xcm
vgeddes Nov 12, 2023
483488f
Merge branch 'snowbridge' into message-log
vgeddes Nov 12, 2023
5fec1d3
Merge pull request #26 from Snowfork/message-log
vgeddes Nov 12, 2023
702e37a
revert MessageQueueServiceWeight
Nov 13, 2023
e1326b4
Merge branch 'master' into update-from-adrian
Nov 13, 2023
3714bb9
update from polkadot upstream
Nov 13, 2023
9067034
Merge branch 'snowbridge' into update-from-adrian
Nov 13, 2023
018e50a
update from polkadot and snowbridge upstream
Nov 13, 2023
1134f3d
fix merge damage
Nov 13, 2023
9846b37
adds test back and fmt
Nov 13, 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
794 changes: 722 additions & 72 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ members = [
"cumulus/parachains/runtimes/bridge-hubs/bridge-hub-polkadot",
"cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo",
"cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend",
"cumulus/parachains/runtimes/bridge-hubs/common",
"cumulus/parachains/runtimes/bridge-hubs/test-utils",
"cumulus/parachains/runtimes/collectives/collectives-polkadot",
"cumulus/parachains/runtimes/contracts/contracts-rococo",
Expand Down
6 changes: 3 additions & 3 deletions cumulus/parachain-template/node/src/chain_spec.rs
Copy link

Choose a reason for hiding this comment

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

I think we are going to get pushback on making these changes to the template parachain, especially when this parachain isn't really meant for testing.

Instead, we should use the PenPal test parachain. See the description here:

//! The PenPal runtime's primary use is for testing interactions between System parachains and

Apparently we can configure it with arbitrary parachain IDs

Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub fn development_config() -> ChainSpec {
Extensions {
relay_chain: "rococo-local".into(),
// You MUST set this to the correct network!
para_id: 1000,
para_id: 1001,
},
)
.with_name("Development")
Expand Down Expand Up @@ -106,7 +106,7 @@ pub fn development_config() -> ChainSpec {
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
1000.into(),
1001.into(),
))
.build()
}
Expand All @@ -125,7 +125,7 @@ pub fn local_testnet_config() -> ChainSpec {
Extensions {
relay_chain: "rococo-local".into(),
// You MUST set this to the correct network!
para_id: 1000,
para_id: 1001,
},
)
.with_name("Local Testnet")
Expand Down
7 changes: 7 additions & 0 deletions cumulus/parachain-template/pallets/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ scale-info = { version = "2.10.0", default-features = false, features = ["derive
frame-benchmarking = { path = "../../../../substrate/frame/benchmarking", default-features = false, optional = true}
frame-support = { path = "../../../../substrate/frame/support", default-features = false}
frame-system = { path = "../../../../substrate/frame/system", default-features = false}
sp-std = { path = "../../../../substrate/primitives/std", default-features = false}

pallet-xcm = { path = "../../../../polkadot/xcm/pallet-xcm", default-features = false}
xcm = { package = "staging-xcm", path = "../../../../polkadot/xcm", default-features = false}

[dev-dependencies]
serde = { version = "1.0.188" }
Expand All @@ -45,6 +49,9 @@ std = [
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"pallet-xcm/std",
"xcm/std",
]
try-runtime = [
"frame-support/try-runtime",
Expand Down
37 changes: 36 additions & 1 deletion cumulus/parachain-template/pallets/template/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ mod benchmarking;
pub mod pallet {
use frame_support::{dispatch::DispatchResultWithPostInfo, pallet_prelude::*};
use frame_system::pallet_prelude::*;
use sp_std::boxed::Box;
use xcm::{v3::prelude::*, VersionedMultiLocation, VersionedXcm};

/// Configure the pallet by specifying the parameters and types on which it depends.
#[pallet::config]
pub trait Config: frame_system::Config {
pub trait Config: frame_system::Config + pallet_xcm::Config {
/// Because this pallet emits events, it depends on the runtime's definition of an event.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
}
Expand All @@ -45,6 +47,8 @@ pub mod pallet {
/// Event documentation should end with an array that provides descriptive names for event
/// parameters. [something, who]
SomethingStored(u32, T::AccountId),
/// XCM message sent. \[to, message\]
Sent { from: T::AccountId, to: MultiLocation, message: Xcm<()> },
}

// Errors inform users that something went wrong.
Expand All @@ -54,6 +58,15 @@ pub mod pallet {
NoneValue,
/// Errors should have helpful documentation associated with them.
StorageOverflow,
/// The message and destination combination was not recognized as being
/// reachable.
Unreachable,
/// The message and destination was recognized as being reachable but
/// the operation could not be completed.
SendFailure,
/// The version of the `Versioned` value used is not able to be
/// interpreted.
BadVersion,
}

#[pallet::hooks]
Expand Down Expand Up @@ -102,5 +115,27 @@ pub mod pallet {
},
}
}

/// Send an XCM message as parachain sovereign.
#[pallet::call_index(2)]
#[pallet::weight(Weight::from_parts(100_000_000, 0))]
pub fn send_xcm(
Copy link

Choose a reason for hiding this comment

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

We should move this to the PenPal test parachain.

Can create a pallet for it somewhere under cumulus/parachains/runtimes/testing/penpal/

origin: OriginFor<T>,
dest: Box<VersionedMultiLocation>,
message: Box<VersionedXcm<()>>,
) -> DispatchResult {
let who = ensure_signed(origin)?;
let dest = MultiLocation::try_from(*dest).map_err(|()| Error::<T>::BadVersion)?;
let message: Xcm<()> = (*message).try_into().map_err(|()| Error::<T>::BadVersion)?;

pallet_xcm::Pallet::<T>::send_xcm(Here, dest, message.clone()).map_err(
|e| match e {
SendError::Unroutable => Error::<T>::Unreachable,
_ => Error::<T>::SendFailure,
},
)?;
Self::deposit_event(Event::Sent { from: who, to: dest, message });
Ok(())
}
}
}
1 change: 1 addition & 0 deletions cumulus/parachains/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub mod kusama;
pub mod message_queue;
pub mod polkadot;
pub mod rococo;
pub mod snowbridge_config;
Copy link

Choose a reason for hiding this comment

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

We can't really put these configs in this crate - Its too specific to Snowbridge.

Can I suggest that we rather add this to each AssetHub runtime lib.rs:

parameter_types! {
      BridgeHubEthereumBaseFee = ...
}

Then I'm sure after submitting the PR we'll get more feedback about an appropriate place to put this config.

pub mod westend;
pub mod wococo;
pub mod xcm_config;
Expand Down
9 changes: 9 additions & 0 deletions cumulus/parachains/common/src/snowbridge_config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
frame_support::parameter_types! {
/// User fee for ERC20 token transfer back to Ethereum.
/// (initially was calculated by test `OutboundQueue::calculate_fees` - ETH/ROC 1/400 and fee_per_gas 20 GWEI = 2200698000000 + *25%)
/// Needs to be more than fee calculated from DefaultFeeConfig FeeConfigRecord in snowbridge:parachain/pallets/outbound-queue/src/lib.rs
/// Polkadot uses 12 decimals, Kusama and Rococo 10 decimals.
pub const BridgeHubEthereumBaseFeeInDOT: u128 = 27_508_725_000;
pub const BridgeHubEthereumBaseFeeInKSM: u128 = 2_750_872_500_000;
pub const BridgeHubEthereumBaseFeeInRocs: u128 = 2_750_872_500_000;
Copy link

Choose a reason for hiding this comment

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

Suggested change
pub const BridgeHubEthereumBaseFeeInRocs: u128 = 2_750_872_500_000;
pub const BridgeHubEthereumBaseFeeInROC: u128 = 2_750_872_500_000;

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
// limitations under the License.

mod example;
mod snowbridge;
mod teleport;
Loading
Loading