-
Notifications
You must be signed in to change notification settings - Fork 1
Update Polkadot-SDK #18
Changes from all commits
026a779
4465c65
2392dd9
67daafe
88b3024
513e15a
19eec17
1687c53
abf029d
576c770
280c4b1
bab8fc2
f7a4a2e
f88de5e
f7abb0a
7b920ec
3130566
1b17e84
84e213a
ce00c28
1dfcd01
24f9b72
022ef71
9827c3b
23588a8
931e093
bf39726
8ac30aa
09badd6
648ba8a
f8e8b4a
71bd4b3
4ab90f7
3070994
f045c73
fe93ef4
d1a9709
955fe40
00d2756
e39beb1
3c16e0f
a315789
4d012bf
2aec192
546274a
50d844f
0bf64e6
c711961
67929a5
dd46f23
e8cbcb9
ea3aaad
22cc658
9e941d3
d725103
3d97f19
ac3773e
cb6f53a
560d788
3bc2d73
1217723
f838cd5
5e480dd
bd60203
533538f
7b658d6
bae3b62
4f5d693
2e71447
371ac2d
9b58ff0
942977e
3b9965b
adcd688
eca0c3e
b648df2
da7d8ff
8d85faa
fd8f5f3
506b6b1
ea063f7
404fbd8
0356361
37552fd
6714d39
a79ed78
7a61129
f0e267a
95f3c78
c90619c
0f76530
9d3f2dd
9feb4b0
0a38b70
02447d0
84e3e29
0f1377e
6372d2d
13fd5ac
6c3462b
0652d74
2f7d49e
f2d8350
5ddb798
546d452
b60eab6
79197a3
302d2f5
b67cb0f
ec87ce6
da3c12e
ac9bf49
e85e339
9f7538d
45279cc
59cf104
d68524b
ebe8baf
2dd39ad
9687d23
f45b839
fb88d91
f101028
e9c7205
6ba36f8
7728527
a4089c8
4f3bf79
44e1918
528f646
8c9dc76
55305d2
989fb0f
c2ee3b4
7e49752
7414de6
1341a73
f79073b
dba7cff
0ee181e
dab8646
e907a6f
c1394ee
a59ccf3
27c7cea
582c616
94aaffd
fe2cb6a
b1a66d4
7119760
928a658
2ebefc0
578d15b
8e1cb1e
839af41
56c52f1
669e109
e8eccd5
ba91cd6
bfedcf1
905ff5a
360caa2
8951238
dd2a06f
f879297
a1ff98b
589033b
2edb0e6
ce31f30
0378a75
0b22697
6d67ea1
db1e826
54d7465
39e7b66
19f9318
ed481c9
4bd0bdb
ea1c147
0fbb063
d6bafcb
1adaaee
69c4b1c
ceddec5
7f78c73
45131b1
27da032
cb8226d
cc24f53
d0c8944
138892d
c5522e4
f7fbba7
f5dee8e
724bf59
42577ef
0c5da74
937d51b
364fe96
10461cc
61cbf82
38754ed
224c859
464bf57
8b74008
69fab33
f68398c
3270200
351b71a
e254d6a
5db326e
69d9991
d9fed1c
20a41ae
42c0e88
f3bfe27
1622650
0c142db
b971a09
8bfa0c1
114f552
9e2bef3
3c9d59a
2afe5bb
3dbb586
f56aaf9
0cfbc39
06dd2f9
655ecdf
702ed2e
d7b9a49
6236cad
53eb94e
5e361f4
72b1428
fe7199c
4c43186
bca9914
758f7c5
b6f6160
cd3fe50
483488f
5fec1d3
702e37a
e1326b4
3714bb9
9067034
018e50a
1134f3d
9846b37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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>; | ||
} | ||
|
@@ -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. | ||
|
@@ -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] | ||
|
@@ -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( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should move this to the Can create a pallet for it somewhere under |
||
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(()) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ pub mod kusama; | |
pub mod message_queue; | ||
pub mod polkadot; | ||
pub mod rococo; | ||
pub mod snowbridge_config; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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; | ||
|
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; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ | |
// limitations under the License. | ||
|
||
mod example; | ||
mod snowbridge; | ||
mod teleport; |
There was a problem hiding this comment.
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:polkadot-sdk/cumulus/parachains/runtimes/testing/penpal/src/lib.rs
Line 21 in a7f55a8
Apparently we can configure it with arbitrary parachain IDs