-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Introduce XcmFeesToAccount fee manager #7005
base: master
Are you sure you want to change the base?
Changes from 10 commits
272c31d
13f5944
3d0cfde
c28700d
d5b760b
a2d3604
7e99987
04d4410
5d6e2c2
7e4cc0a
17c0f5c
12b816e
d22046f
6c9f3f9
424c903
7b140f0
a852957
e1b6af0
20b4f66
09828da
0e06f73
6a4fd76
6eccb05
2df8cbf
de0e397
8bb8fb9
3ea877f
4843e58
7c3bb1a
50a008e
76a4cd0
7d61d2e
18945f8
6f4a8bb
4fa5016
88b9582
2c7d14c
57b3a6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,14 +18,15 @@ | |
|
|
||
| use super::{ | ||
| parachains_origin, AccountId, AllPalletsWithSystem, Balances, Fellows, ParaId, Runtime, | ||
| RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin, WeightToFee, XcmPallet, | ||
| RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin, Treasury, WeightToFee, XcmPallet, | ||
| }; | ||
| use frame_support::{ | ||
| match_types, parameter_types, | ||
| traits::{Contains, Everything, Nothing}, | ||
| weights::Weight, | ||
| }; | ||
| use frame_system::EnsureRoot; | ||
| use kusama_runtime_constants::system_parachain::*; | ||
| use runtime_common::{crowdloan, paras_registrar, xcm_sender, ToAuthor}; | ||
| use sp_core::ConstU32; | ||
| use xcm::latest::prelude::*; | ||
|
|
@@ -36,7 +37,7 @@ use xcm_builder::{ | |
| CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete, | ||
| MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32, | ||
| SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds, | ||
| WithComputedOrigin, | ||
| WithComputedOrigin, XcmFeesToAccount, | ||
| }; | ||
| use xcm_executor::traits::WithOriginFilter; | ||
|
|
||
|
|
@@ -55,6 +56,8 @@ parameter_types! { | |
| pub CheckAccount: AccountId = XcmPallet::check_account(); | ||
| /// The check account that is allowed to mint assets locally. | ||
| pub LocalCheckAccount: (AccountId, MintLocation) = (CheckAccount::get(), MintLocation::Local); | ||
| /// The treasury account where XCM fees would be sent to. | ||
| pub TreasuryAccount: Option<AccountId> = Some(Treasury::account_id()); | ||
| } | ||
|
|
||
| /// The canonical means of converting a `MultiLocation` into an `AccountId`, used when we want to determine | ||
|
|
@@ -112,8 +115,8 @@ pub type XcmRouter = ( | |
|
|
||
| parameter_types! { | ||
| pub const Ksm: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(TokenLocation::get()) }); | ||
| pub const Statemine: MultiLocation = Parachain(1000).into_location(); | ||
| pub const Encointer: MultiLocation = Parachain(1001).into_location(); | ||
| pub const Statemine: MultiLocation = Parachain(STATEMINE_ID).into_location(); | ||
KiChjang marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| pub const Encointer: MultiLocation = Parachain(ENCOINTER_ID).into_location(); | ||
| pub const KsmForStatemine: (MultiAssetFilter, MultiLocation) = (Ksm::get(), Statemine::get()); | ||
| pub const KsmForEncointer: (MultiAssetFilter, MultiLocation) = (Ksm::get(), Encointer::get()); | ||
| pub const MaxAssetsIntoHolding: u32 = 64; | ||
|
|
@@ -125,6 +128,9 @@ match_types! { | |
| pub type OnlyParachains: impl Contains<MultiLocation> = { | ||
| MultiLocation { parents: 0, interior: X1(Parachain(_)) } | ||
| }; | ||
| pub type SystemParachains: impl Contains<MultiLocation> = { | ||
| MultiLocation { parents: 0, interior: X1(Parachain(STATEMINE_ID | ENCOINTER_ID)) } | ||
| }; | ||
| } | ||
|
|
||
| /// The barriers one of which must be passed for an XCM message to be executed. | ||
|
|
@@ -335,7 +341,7 @@ impl xcm_executor::Config for XcmConfig { | |
| type SubscriptionService = XcmPallet; | ||
| type PalletInstancesInfo = AllPalletsWithSystem; | ||
| type MaxAssetsIntoHolding = MaxAssetsIntoHolding; | ||
| type FeeManager = (); | ||
| type FeeManager = XcmFeesToAccount<Self, SystemParachains, AccountId, TreasuryAccount>; | ||
|
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. with this change 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. There shouldn't be -- with or without a 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. actual so I think this is the change, that origin needs to have some balance > ED + fees, but I dont know how much this is a really issue. I can imaging just some scenarios/calls from some non-system parachain that does not have sovereign account with balance on relay chain, so after this change they will need to drip some DOTs/KSMs to pass 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. Right, so I just took a look at where we collect fees in the XCM executor: it looks like any instruction where it creates and sends an XCM back to the origin would require the origin to pay for fees, and this includes the This isn't a huge deal, I think what we do need to do is to display delivery fees in the UI clearly so that users are informed about how much they need to pay, otherwise their XCM would fail to be sent. |
||
| // No bridges yet... | ||
| type MessageExporter = (); | ||
| type UniversalAliases = Nothing; | ||
|
|
@@ -352,7 +358,7 @@ parameter_types! { | |
|
|
||
| #[cfg(feature = "runtime-benchmarks")] | ||
| parameter_types! { | ||
| pub ReachableDest: Option<MultiLocation> = Some(Parachain(1000).into()); | ||
| pub ReachableDest: Option<MultiLocation> = Some(Parachain(STATEMINE_ID).into()); | ||
KiChjang marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| /// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.