Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: post 1.14.4 release #751

Merged
merged 5 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions pallets/attestation/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

use frame_benchmarking::{account, benchmarks};
use frame_support::traits::{fungible::Mutate, Get};
use frame_system::pallet_prelude::BlockNumberFor;
use frame_system::RawOrigin;
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
use sp_runtime::traits::Hash;

use ctype::CtypeEntryOf;
Expand Down
2 changes: 1 addition & 1 deletion pallets/pallet-asset-switch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,11 @@ pub mod pallet {
weight_limit: WeightLimit::Unlimited,
fees: remote_asset_fee_v4.clone(),
},
SetAppendix(appendix),
TransferAsset {
assets: (asset_id_v4, remote_asset_amount_as_u128).into(),
beneficiary: beneficiary_v4,
},
SetAppendix(appendix),
]
.into();
let xcm_ticket =
Expand Down
2 changes: 1 addition & 1 deletion runtimes/spiritnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kilt-spiritnet"),
impl_name: create_runtime_str!("kilt-spiritnet"),
authoring_version: 1,
spec_version: 11401,
spec_version: 11402,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 9,
Expand Down
60 changes: 51 additions & 9 deletions runtimes/spiritnet/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
// If you feel like getting in touch with us, you can do so at info@botlabs.org

use crate::{
AccountId, AllPalletsWithSystem, Balances, MessageQueue, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime,
RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
AccountId, AllPalletsWithSystem, Balances, CheckingAccount, Fungibles, KiltToEKiltSwitchPallet, MessageQueue,
ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, Treasury,
WeightToFee, XcmpQueue,
};

use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
Expand All @@ -27,6 +28,10 @@ use frame_support::{
traits::{Contains, EnqueueWithOrigin, Everything, Nothing, TransformOrigin},
};
use frame_system::EnsureRoot;
use pallet_asset_switch::xcm::{
IsSwitchPairRemoteAsset, IsSwitchPairXcmFeeAsset, MatchesSwitchPairXcmFeeFungibleAsset,
SwitchPairRemoteAssetTransactor, UsingComponentsForSwitchPairRemoteAsset, UsingComponentsForXcmFeeAsset,
};
use pallet_xcm::XcmPassthrough;
use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
Expand All @@ -35,9 +40,9 @@ use sp_std::prelude::ToOwned;
use xcm::v4::prelude::*;
use xcm_builder::{
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom,
EnsureXcmOrigin, FixedWeightBounds, FrameTransactionalProcessor, NativeAsset, RelayChainAsNative,
SiblingParachainAsNative, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WithComputedOrigin,
EnsureXcmOrigin, FixedWeightBounds, FrameTransactionalProcessor, FungiblesAdapter, NativeAsset, NoChecking,
RelayChainAsNative, SiblingParachainAsNative, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WithComputedOrigin,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};

Expand Down Expand Up @@ -163,15 +168,40 @@ impl Contains<RuntimeCall> for SafeCallFilter {
}
}

parameter_types! {
pub TreasuryAccountId: AccountId = Treasury::account_id();
}

pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
type RuntimeCall = RuntimeCall;
// How we send Xcm messages.
type XcmSender = XcmRouter;
// How to withdraw and deposit an asset.
type AssetTransactor = LocalAssetTransactor<Balances, RelayNetworkId>;
// Until fixed, `LocalAssetTransactor` must be last since it returns an error if
// the operation does not go through, i.e., it cannot be chained with other
// transactors.
type AssetTransactor = (
// Allow the asset from the other side of the pool to be "deposited" into the current system.
SwitchPairRemoteAssetTransactor<LocationToAccountIdConverter, Runtime, KiltToEKiltSwitchPallet>,
// Allow the asset to pay for remote XCM fees to be deposited into the current system.
FungiblesAdapter<
Fungibles,
MatchesSwitchPairXcmFeeFungibleAsset<Runtime, KiltToEKiltSwitchPallet>,
LocationToAccountIdConverter,
AccountId,
NoChecking,
CheckingAccount,
>,
// Transactor for fungibles matching the "Here" location.
LocalAssetTransactor<Balances, RelayNetworkId>,
);
type OriginConverter = XcmOriginToTransactDispatchOrigin;
type IsReserve = NativeAsset;
type IsReserve = (
NativeAsset,
IsSwitchPairRemoteAsset<Runtime, KiltToEKiltSwitchPallet>,
IsSwitchPairXcmFeeAsset<Runtime, KiltToEKiltSwitchPallet>,
);
// Teleporting is disabled.
type IsTeleporter = ();
type UniversalLocation = UniversalLocation;
Expand All @@ -183,8 +213,20 @@ impl xcm_executor::Config for XcmConfig {
// How weight is transformed into fees. The fees are not taken out of the
// Balances pallet here. Balances is only used if fees are dropped without being
// used. In that case they are put into the treasury.
type Trader =
UsingComponents<WeightToFee<Runtime>, HereLocation, AccountId, Balances, SendDustAndFeesToTreasury<Runtime>>;

type Trader = (
// Can pay for fees with the remote XCM asset fee (when sending it into this system).
UsingComponentsForXcmFeeAsset<Runtime, KiltToEKiltSwitchPallet, WeightToFee<Runtime>>,
// Can pay for the remote asset of the switch pair (when "depositing" it into this system).
UsingComponentsForSwitchPairRemoteAsset<
Runtime,
KiltToEKiltSwitchPallet,
WeightToFee<Runtime>,
TreasuryAccountId,
>,
// Can pay with the fungible that matches the "Here" location.
UsingComponents<WeightToFee<Runtime>, HereLocation, AccountId, Balances, SendDustAndFeesToTreasury<Runtime>>,
);
type ResponseHandler = PolkadotXcm;
// What happens with assets that are left in the register after the XCM message
// was processed. PolkadotXcm has an AssetTrap that stores a hash of the asset
Expand Down
Loading