Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
rust fmt
  • Loading branch information
Valentin Fernandez committed May 10, 2023
commit 0f49b900762b7a7c51be1bc0e8be394a7e69556f
14 changes: 7 additions & 7 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ use cumulus_client_consensus_common::{
ParachainBlockImport as TParachainBlockImport, ParachainConsensus,
};
use cumulus_client_network::BlockAnnounceValidator;
use sc_consensus::ImportQueue;
use cumulus_client_service::{
build_relay_chain_interface, prepare_node_config, start_collator, start_full_node, BuildNetworkParams, build_network,
StartCollatorParams, StartFullNodeParams,
build_network, build_relay_chain_interface, prepare_node_config, start_collator,
start_full_node, BuildNetworkParams, StartCollatorParams, StartFullNodeParams,
};
use cumulus_primitives_core::ParaId;
use cumulus_relay_chain_interface::{RelayChainInterface};
use cumulus_relay_chain_interface::RelayChainInterface;
use sc_consensus::ImportQueue;

use sc_executor::NativeElseWasmExecutor;
use sc_network::{NetworkBlock, NetworkService};
Expand Down Expand Up @@ -259,7 +259,7 @@ async fn start_node_impl(
system_rpc_tx,
tx_handler_controller,
telemetry: telemetry.as_mut(),
sync_service: sync_service.clone()
sync_service: sync_service.clone(),
})?;

if let Some(hwbench) = hwbench {
Expand Down Expand Up @@ -314,7 +314,7 @@ async fn start_node_impl(
import_queue: import_queue_service,
collator_key: collator_key.expect("Command line arguments do not allow this. qed"),
relay_chain_slot_duration,
recovery_handle: Box::new(overseer_handle)
recovery_handle: Box::new(overseer_handle),
};

start_collator(params).await?;
Expand All @@ -327,7 +327,7 @@ async fn start_node_impl(
relay_chain_interface,
relay_chain_slot_duration,
import_queue: import_queue_service,
recovery_handle: Box::new(overseer_handle)
recovery_handle: Box::new(overseer_handle),
};

start_full_node(params)?;
Expand Down
10 changes: 7 additions & 3 deletions primitives/xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ use frame_support::{
traits::{fungibles::Inspect, Currency},
};
use sp_std::{borrow::Borrow, marker::PhantomData, vec::Vec};
use xcm::{latest::{
AssetId::Concrete, Fungibility::Fungible, Junctions::Here, MultiAsset, MultiLocation, Weight
}, v3::XcmContext};
use xcm::{
latest::{
AssetId::Concrete, Fungibility::Fungible, Junctions::Here, MultiAsset, MultiLocation,
Weight,
},
v3::XcmContext,
};
use xcm_executor::{
traits::{Convert, DropAssets, Error as MatchError, MatchesFungibles},
Assets,
Expand Down
2 changes: 1 addition & 1 deletion runtime/stout/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub use sp_runtime::BuildStorage;
// Polkadot imports
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use xcm::{latest::prelude::BodyId};
use xcm::latest::prelude::BodyId;

pub const MICROUNIT: Balance = 1_000_000;

Expand Down
24 changes: 13 additions & 11 deletions runtime/stout/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,40 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::{constants::fee::{default_fee_per_second}, AllPalletsWithSystem};
use crate::{constants::fee::default_fee_per_second, AllPalletsWithSystem};

use super::{
AccountId, Assets, Balance, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime,
RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
};
use frame_support::{
match_types, parameter_types,
traits::{EitherOfDiverse, Everything, Get, Nothing, ContainsPair},weights::Weight
traits::{ContainsPair, EitherOfDiverse, Everything, Get, Nothing},
weights::Weight,
};
use frame_system::EnsureRoot;
use sp_std::marker::PhantomData;

use parachains_common::{
impls::DealWithFees,
xcm_config::{DenyReserveTransferToRelayChain, DenyThenTry}, AssetIdForTrustBackedAssets,
xcm_config::{DenyReserveTransferToRelayChain, DenyThenTry},
AssetIdForTrustBackedAssets,
};

use xcm_executor::traits::JustTry;

use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough};
use polkadot_parachain::primitives::Sibling;
use xcm::{latest::{prelude::*, Fungibility::Fungible, MultiAsset, MultiLocation}};
use xcm::latest::{prelude::*, Fungibility::Fungible, MultiAsset, MultiLocation};

use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FixedRateOfFungible,
FixedWeightBounds, FungiblesAdapter, IsConcrete, NativeAsset,
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, NoChecking,
ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds,
FungiblesAdapter, IsConcrete, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents,
};
use xcm_executor::XcmExecutor;

Expand Down Expand Up @@ -308,8 +310,8 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type VersionWrapper = PolkadotXcm;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type ControllerOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsMajorityOfBody<RelayLocation, ExecutiveBody>>,
EnsureRoot<AccountId>,
EnsureXcm<IsMajorityOfBody<RelayLocation, ExecutiveBody>>,
>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type WeightInfo = cumulus_pallet_xcmp_queue::weights::SubstrateWeight<Runtime>;
Expand Down
4 changes: 3 additions & 1 deletion runtime/trappist/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ pub mod fee {
/// The block saturation level. Fees will be updates based on this value.
pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25);

//TODO: Update WeightToFee functionality to match cummulus implementation (Should be done in a
// separated issue)

/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
/// node's balance type.
///
Expand Down Expand Up @@ -81,5 +84,4 @@ pub mod fee {
let base_tx_per_second = (WEIGHT_REF_TIME_PER_SECOND as u128) / base_weight;
base_tx_per_second * base_tx_fee()
}

}
8 changes: 3 additions & 5 deletions runtime/trappist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ use frame_system::{

pub use parachains_common as common;
pub use parachains_common::{
impls::AssetsToBlockAuthor, opaque, AccountId, AuraId, Balance, BlockNumber, Hash,
Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
MINUTES, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
impls::AssetsToBlockAuthor, opaque, AccountId, AuraId, Balance, BlockNumber, Hash, Header,
Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};

use impls::DealWithFees;
Expand Down Expand Up @@ -567,8 +567,6 @@ impl pallet_asset_registry::Config for Runtime {
type WeightInfo = pallet_asset_registry::weights::SubstrateWeight<Runtime>;
}



type TreasuryApproveCancelOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 6>,
Expand Down
34 changes: 20 additions & 14 deletions runtime/trappist/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::{constants::fee::{default_fee_per_second}, impls::ToAuthor, AllPalletsWithSystem};
use crate::{constants::fee::default_fee_per_second, impls::ToAuthor, AllPalletsWithSystem};

use super::{
AccountId, AssetRegistry, Assets, Balance, Balances, ParachainInfo, ParachainSystem,
PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
};
use frame_support::{
match_types, parameter_types,
traits::{EitherOfDiverse, Everything, Get, Nothing, PalletInfoAccess, ContainsPair}, weights::Weight,
traits::{ContainsPair, EitherOfDiverse, Everything, Get, Nothing, PalletInfoAccess},
weights::Weight,
};
use frame_system::EnsureRoot;
use sp_std::marker::PhantomData;

use parachains_common::{
xcm_config::{DenyReserveTransferToRelayChain, DenyThenTry}, AssetIdForTrustBackedAssets
xcm_config::{DenyReserveTransferToRelayChain, DenyThenTry},
AssetIdForTrustBackedAssets,
};
use xcm_executor::traits::JustTry;
use xcm_primitives::{AsAssetMultiLocation, ConvertedRegisteredAssetId, TrappistDropAssets};
Expand All @@ -40,11 +42,11 @@ use xcm::latest::{prelude::*, Fungibility::Fungible, MultiAsset, MultiLocation};
use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
CurrencyAdapter, EnsureXcmOrigin, FixedRateOfFungible,
FixedWeightBounds, FungiblesAdapter, IsConcrete, NativeAsset,
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, ConvertedConcreteId, NoChecking,
ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds,
FungiblesAdapter, IsConcrete, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents,
};
use xcm_executor::XcmExecutor;

Expand Down Expand Up @@ -211,7 +213,6 @@ parameter_types! {
// Statemine's Assets pallet index
pub StatemineAssetsPalletLocation: MultiLocation =
MultiLocation::new(1, X2(Parachain(1000), PalletInstance(50)));

pub XUsdPerSecond: (xcm::v3::AssetId, u128, u128) = (
MultiLocation::new(1, X3(Parachain(1000), PalletInstance(50), GeneralIndex(1))).into(),
default_fee_per_second() * 10,
Expand All @@ -230,7 +231,7 @@ fn matches_prefix(prefix: &MultiLocation, loc: &MultiLocation) -> bool {
.all(|(prefix_junction, junction)| prefix_junction == junction)
}
pub struct ReserveAssetsFrom<T>(PhantomData<T>);
impl<T: Get<MultiLocation>> ContainsPair<MultiAsset,MultiLocation> for ReserveAssetsFrom<T> {
impl<T: Get<MultiLocation>> ContainsPair<MultiAsset, MultiLocation> for ReserveAssetsFrom<T> {
fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool {
let prefix = T::get();
log::trace!(target: "xcm::AssetsFrom", "prefix: {:?}, origin: {:?}", prefix, origin);
Expand All @@ -257,14 +258,20 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = (); // Teleporting is disabled.
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
//TODO: Modify current config of Trader removing XUsdPerSecond Inplementation
//TODO: Modify current config of Trader removing XUsdPerSecond Implementation
type Trader = (
FixedRateOfFungible<XUsdPerSecond, ()>,
UsingComponents<WeightToFee, SelfReserve, AccountId, Balances, ToAuthor<Runtime>>,
);
type ResponseHandler = PolkadotXcm;
type AssetTrap =
TrappistDropAssets<AssetIdForTrustBackedAssets, AssetRegistry, Assets, Balances, PolkadotXcm, AccountId>;
type AssetTrap = TrappistDropAssets<
AssetIdForTrustBackedAssets,
AssetRegistry,
Assets,
Balances,
PolkadotXcm,
AccountId,
>;
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
type AssetExchanger = ();
Expand Down Expand Up @@ -340,7 +347,6 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type WeightInfo = cumulus_pallet_xcmp_queue::weights::SubstrateWeight<Runtime>;
//TODO:
type PriceForSiblingDelivery = ();
}

Expand Down