Skip to content

Commit 3ab158f

Browse files
authored
Revamp xcm for v2 (#366)
* Add salp-lite pallet * Revamp xcm for v2
1 parent 163426d commit 3ab158f

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

pallets/salp-lite/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,19 @@ pub mod pallet {
373373
}
374374

375375
/// Unlock the reserved vsToken/vsBond after fund success
376-
#[pallet::weight(T::WeightInfo::batch_unlock(T::BatchKeysLimit::get()))]
376+
#[pallet::weight((
377+
0,
378+
DispatchClass::Normal,
379+
Pays::No
380+
))]
377381
#[transactional]
378382
pub fn batch_migrate(
379383
origin: OriginFor<T>,
380384
#[pallet::compact] index: ParaId,
381385
first_slot: LeasePeriod,
382386
last_slot: LeasePeriod,
383387
) -> DispatchResult {
384-
ensure_signed(origin)?;
388+
T::EnsureConfirmAsMultiSig::ensure_origin(origin)?;
385389

386390
let fund = Self::funds(index).ok_or(Error::<T>::InvalidParaId)?;
387391
ensure!(

runtime/asgard/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -844,20 +844,20 @@ pub type Trader = (
844844

845845
pub struct XcmConfig;
846846
impl Config for XcmConfig {
847-
type AssetClaims = (); // don't claim for now
847+
type AssetClaims = PolkadotXcm;
848848
type AssetTransactor = BifrostAssetTransactor;
849-
type AssetTrap = (); // don't trap for now
849+
type AssetTrap = PolkadotXcm;
850850
type Barrier = Barrier;
851851
type Call = Call;
852852
type IsReserve = BifrostFilteredAssets;
853853
type IsTeleporter = BifrostFilteredAssets;
854854
type LocationInverter = LocationInverter<Ancestry>;
855855
type OriginConverter = XcmOriginToTransactDispatchOrigin;
856-
type ResponseHandler = ();
856+
type ResponseHandler = PolkadotXcm;
857857
type SubscriptionService = PolkadotXcm;
858858
type Trader = Trader;
859859
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
860-
type XcmSender = XcmRouter; // Don't handle responses for now.
860+
type XcmSender = XcmRouter;
861861
}
862862

863863
/// No local origins on this chain are allowed to dispatch XCM sends/executions.

runtime/bifrost/src/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub mod currency {
3131
pub const BNCS: Balance = 1_000_000_000_000;
3232
pub const DOLLARS: Balance = BNCS;
3333
pub const CENTS: Balance = DOLLARS / 100; // assume this is worth about a cent.
34-
pub const RELAY_CENTS: Balance = DOLLARS / 30_000;
34+
pub const RELAY_CENTS: Balance = DOLLARS / 10_000;
3535
pub const MILLICENTS: Balance = CENTS / 1_000;
3636
pub const MILLIBNC: Balance = 1_000_000_000;
3737
pub const MICROBNC: Balance = 1_000_000;

runtime/bifrost/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -763,20 +763,20 @@ pub fn create_x2_parachain_multilocation(index: u16) -> MultiLocation {
763763

764764
pub struct XcmConfig;
765765
impl Config for XcmConfig {
766-
type AssetClaims = (); // don't claim for now
766+
type AssetClaims = PolkadotXcm;
767767
type AssetTransactor = BifrostAssetTransactor;
768-
type AssetTrap = (); // don't trap for now
768+
type AssetTrap = PolkadotXcm;
769769
type Barrier = Barrier;
770770
type Call = Call;
771771
type IsReserve = BifrostFilteredAssets;
772772
type IsTeleporter = BifrostFilteredAssets;
773773
type LocationInverter = LocationInverter<Ancestry>;
774774
type OriginConverter = XcmOriginToTransactDispatchOrigin;
775-
type ResponseHandler = ();
775+
type ResponseHandler = PolkadotXcm;
776776
type SubscriptionService = PolkadotXcm;
777777
type Trader = Trader;
778778
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
779-
type XcmSender = XcmRouter; // Don't handle responses for now.
779+
type XcmSender = XcmRouter;
780780
}
781781

782782
/// No local origins on this chain are allowed to dispatch XCM sends/executions.
@@ -1092,7 +1092,7 @@ parameter_types! {
10921092
pub const SlotLength: BlockNumber = 8u32 as BlockNumber;
10931093
pub const XcmTransferOrigin: TransferOriginType = TransferOriginType::FromRelayChain;
10941094
pub XcmWeight: XcmBaseWeight = XCM_WEIGHT.into();
1095-
pub ContributionWeight:XcmBaseWeight = 893125000.into();
1095+
pub ContributionWeight:XcmBaseWeight = XCM_WEIGHT.into();
10961096
pub AddProxyWeight:XcmBaseWeight = XCM_WEIGHT.into();
10971097
pub ConfirmMuitiSigAccount: AccountId = hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into();
10981098
pub RelaychainSovereignSubAccount: MultiLocation = create_x2_multilocation(ParachainDerivedProxyAccountType::Salp as u16);

xcm-support/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ impl<
103103
WithdrawAsset(asset.clone().into()),
104104
BuyExecution {
105105
fees: asset,
106-
weight_limit: Some(weight + 1 * BaseXcmWeight::get() + nonce as u64).into(),
106+
weight_limit: WeightLimit::Limited(Self::transact_weight(weight, nonce)),
107107
},
108108
Instruction::Transact {
109109
origin_type: OriginKind::SovereignAccount,
110-
require_weight_at_most: 100_000_000_000,
110+
require_weight_at_most: weight,
111111
call,
112112
},
113113
DepositAsset {

0 commit comments

Comments
 (0)