Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden authored and claravanstaden committed Feb 5, 2024
1 parent 21d7835 commit b4f8d77
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 58 deletions.
4 changes: 2 additions & 2 deletions relay/kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ use xcm_builder::{
DescribeFamily, FrameTransactionalProcessor, HashedDescription, IsChildSystemParachain,
IsConcrete, MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
XcmFeesToAccount,
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents, XcmFeesToAccount,
};

parameter_types! {
Expand Down
5 changes: 2 additions & 3 deletions system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ use parachains_common::{
use sp_runtime::RuntimeDebug;
use system_parachains_constants::{
kusama::{consensus::*, currency::*, fee::WeightToFee, snowbridge::EthereumNetwork},
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO,
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
SLOT_DURATION,
};
use xcm::opaque::v3::MultiLocation;
Expand Down Expand Up @@ -384,7 +383,7 @@ impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
type CreateOrigin = ForeignCreators<
(
FromSiblingParachain<parachain_info::Pallet<Runtime>>,
FromNetwork<xcm_config::UniversalLocation, EthereumNetwork>
FromNetwork<xcm_config::UniversalLocation, EthereumNetwork>,
),
ForeignCreatorsSovereignAccountOf,
AccountId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ pub mod bridging {
}

pub type IsTrustedBridgedReserveLocationForForeignAsset =
matching::IsForeignConcreteAsset<FromNetwork<UniversalLocation, EthereumNetwork>>;
matching::IsForeignConcreteAsset<FromNetwork<UniversalLocation, EthereumNetwork>>;

impl Contains<(MultiLocation, Junction)> for UniversalAliases {
fn contains(alias: &(MultiLocation, Junction)) -> bool {
Expand Down
5 changes: 3 additions & 2 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ mod weights;
pub mod xcm_config;

use assets_common::{
foreign_creators::ForeignCreators, matching::{FromNetwork, FromSiblingParachain},
foreign_creators::ForeignCreators,
matching::{FromNetwork, FromSiblingParachain},
MultiLocationForAssetId,
};
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
Expand Down Expand Up @@ -325,7 +326,7 @@ impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
type CreateOrigin = ForeignCreators<
(
FromSiblingParachain<parachain_info::Pallet<Runtime>>,
FromNetwork<xcm_config::UniversalLocation, EthereumNetwork>
FromNetwork<xcm_config::UniversalLocation, EthereumNetwork>,
),
ForeignCreatorsSovereignAccountOf,
AccountId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ pub mod bridging {
}

pub type IsTrustedBridgedReserveLocationForForeignAsset =
matching::IsForeignConcreteAsset<FromNetwork<UniversalLocation, EthereumNetwork>>;
matching::IsForeignConcreteAsset<FromNetwork<UniversalLocation, EthereumNetwork>>;

impl Contains<(MultiLocation, Junction)> for UniversalAliases {
fn contains(alias: &(MultiLocation, Junction)) -> bool {
Expand All @@ -810,7 +810,8 @@ pub mod bridging {
}
});
assert!(alias.is_some(), "we expect here BridgeHubPolkadot to Kusama mapping at least");
Some(alias.unwrap()) }
Some(alias.unwrap())
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

use crate::{
xcm_config::UniversalLocation,
Runtime,
};
use system_parachains_constants::kusama::snowbridge::EthereumNetwork;
use crate::{xcm_config::UniversalLocation, Runtime};
use snowbridge_router_primitives::outbound::EthereumBlobExporter;
use system_parachains_constants::kusama::snowbridge::EthereumNetwork;

/// Exports message to the Ethereum Gateway contract.
pub type SnowbridgeExporter = EthereumBlobExporter<
UniversalLocation,
EthereumNetwork,
snowbridge_outbound_queue::Pallet<Runtime>,
snowbridge_core::AgentIdOf,
UniversalLocation,
EthereumNetwork,
snowbridge_pallet_outbound_queue::Pallet<Runtime>,
snowbridge_core::AgentIdOf,
>;
2 changes: 0 additions & 2 deletions system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use snowbridge_core::{
gwei, meth, outbound::Message, AgentId, AllowSiblingsOnly, PricingParameters, Rewards,
};
use snowbridge_router_primitives::inbound::MessageToXcm;
use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160};
use sp_runtime::{
Expand All @@ -49,7 +48,6 @@ use sp_std::prelude::*;
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use cumulus_primitives_core::ParaId;
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
Expand Down
21 changes: 10 additions & 11 deletions system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ use super::{
bridge_to_polkadot_config::{
DeliveryRewardInBalance, RequiredStakeForStakeAndSlash, ToBridgeHubPolkadotHaulBlobExporter,
},
AccountId, AllPalletsWithSystem, Balances, EthereumGatewayAddress, ParachainInfo, ParachainSystem, PolkadotXcm,
PriceForParentDelivery, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee,
XcmpQueue,
AccountId, AllPalletsWithSystem, Balances, EthereumGatewayAddress, ParachainInfo,
ParachainSystem, PolkadotXcm, PriceForParentDelivery, Runtime, RuntimeCall, RuntimeEvent,
RuntimeOrigin, WeightToFee, XcmpQueue,
};
use crate::EthereumGatewayAddress;
use frame_support::{
match_types, parameter_types,
traits::{ConstU32, Contains, Equals, Everything, Nothing},
Expand Down Expand Up @@ -52,8 +51,10 @@ use xcm_builder::{
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeToAccount,
};
use xcm_executor::{traits::{FeeManager, FeeReason, FeeReason::Export, WithOriginFilter},
XcmExecutor};
use xcm_executor::{
traits::{FeeManager, FeeReason, FeeReason::Export, WithOriginFilter},
XcmExecutor,
};

parameter_types! {
pub const KsmRelayLocation: MultiLocation = MultiLocation::parent();
Expand Down Expand Up @@ -314,10 +315,8 @@ impl xcm_executor::Config for XcmConfig {
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
),
>;
type MessageExporter = (
ToBridgeHubPolkadotHaulBlobExporter,
crate::bridge_to_ethereum_config::SnowbridgeExporter,
);
type MessageExporter =
(ToBridgeHubPolkadotHaulBlobExporter, crate::bridge_to_ethereum_config::SnowbridgeExporter);
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
type SafeCallFilter = SafeCallFilter;
Expand Down Expand Up @@ -380,7 +379,7 @@ pub struct XcmFeeManagerFromComponentsBridgeHub<WaivedLocations, HandleFee>(
PhantomData<(WaivedLocations, HandleFee)>,
);
impl<WaivedLocations: Contains<MultiLocation>, FeeHandler: HandleFee> FeeManager
for XcmFeeManagerFromComponentsBridgeHub<WaivedLocations, FeeHandler>
for XcmFeeManagerFromComponentsBridgeHub<WaivedLocations, FeeHandler>
{
fn is_waived(origin: Option<&MultiLocation>, fee_reason: FeeReason) -> bool {
let Some(loc) = origin else { return false };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

use crate::{
xcm_config::UniversalLocation,
Runtime,
};
use system_parachains_constants::polkadot::snowbridge::EthereumNetwork;
use crate::{xcm_config::UniversalLocation, Runtime};
use snowbridge_router_primitives::outbound::EthereumBlobExporter;
use system_parachains_constants::polkadot::snowbridge::EthereumNetwork;

/// Exports message to the Ethereum Gateway contract.
pub type SnowbridgeExporter = EthereumBlobExporter<
UniversalLocation,
EthereumNetwork,
snowbridge_outbound_queue::Pallet<Runtime>,
snowbridge_core::AgentIdOf,
UniversalLocation,
EthereumNetwork,
snowbridge_pallet_outbound_queue::Pallet<Runtime>,
snowbridge_core::AgentIdOf,
>;
5 changes: 2 additions & 3 deletions system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ mod weights;
pub mod xcm_config;

use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use cumulus_primitives_core::ParaId;
use snowbridge_beacon_primitives::{Fork, ForkVersions};
use snowbridge_core::{
gwei, meth, outbound::Message, AgentId, AllowSiblingsOnly, PricingParameters, Rewards,
};
use snowbridge_router_primitives::inbound::MessageToXcm;
use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160};
use sp_runtime::{
Expand All @@ -48,7 +48,6 @@ use sp_std::prelude::*;
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use cumulus_primitives_core::ParaId;
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
Expand All @@ -68,7 +67,7 @@ use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm_config::{
FellowshipLocation, GovernanceLocation, XcmConfig, TreasuryAccount,
FellowshipLocation, GovernanceLocation, TreasuryAccount, XcmConfig,
XcmOriginToTransactDispatchOrigin,
};

Expand Down
23 changes: 11 additions & 12 deletions system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ use super::{
bridge_to_kusama_config::{
DeliveryRewardInBalance, RequiredStakeForStakeAndSlash, ToBridgeHubKusamaHaulBlobExporter,
},
AccountId, AllPalletsWithSystem, Balances, EthereumGatewayAddress, ParachainInfo, ParachainSystem, PolkadotXcm,
PriceForParentDelivery, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee,
XcmpQueue,
AccountId, AllPalletsWithSystem, Balances, EthereumGatewayAddress, ParachainInfo,
ParachainSystem, PolkadotXcm, PriceForParentDelivery, Runtime, RuntimeCall, RuntimeEvent,
RuntimeOrigin, WeightToFee, XcmpQueue,
};
use crate::EthereumGatewayAddress;
use frame_support::{
match_types, parameter_types,
traits::{ConstU32, Contains, Equals, Everything, Nothing},
Expand All @@ -39,8 +38,8 @@ use snowbridge_core::DescribeHere;
use snowbridge_runtime_common::XcmExportFeeToSibling;
use sp_core::{Get, H256};
use sp_runtime::traits::AccountIdConversion;
use system_parachains_constants::{polkadot::snowbridge::EthereumNetwork, TREASURY_PALLET_ID};
use sp_std::marker::PhantomData;
use system_parachains_constants::{polkadot::snowbridge::EthereumNetwork, TREASURY_PALLET_ID};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
Expand All @@ -52,8 +51,10 @@ use xcm_builder::{
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeToAccount,
};
use xcm_executor::{traits::{FeeManager, FeeReason, FeeReason::Export, WithOriginFilter},
XcmExecutor};
use xcm_executor::{
traits::{FeeManager, FeeReason, FeeReason::Export, WithOriginFilter},
XcmExecutor,
};

parameter_types! {
pub const DotRelayLocation: MultiLocation = MultiLocation::parent();
Expand Down Expand Up @@ -321,10 +322,8 @@ impl xcm_executor::Config for XcmConfig {
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
),
>;
type MessageExporter = (
ToBridgeHubKusamaHaulBlobExporter,
crate::bridge_to_ethereum_config::SnowbridgeExporter
);
type MessageExporter =
(ToBridgeHubKusamaHaulBlobExporter, crate::bridge_to_ethereum_config::SnowbridgeExporter);
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
type SafeCallFilter = SafeCallFilter;
Expand Down Expand Up @@ -387,7 +386,7 @@ pub struct XcmFeeManagerFromComponentsBridgeHub<WaivedLocations, HandleFee>(
PhantomData<(WaivedLocations, HandleFee)>,
);
impl<WaivedLocations: Contains<MultiLocation>, FeeHandler: HandleFee> FeeManager
for XcmFeeManagerFromComponentsBridgeHub<WaivedLocations, FeeHandler>
for XcmFeeManagerFromComponentsBridgeHub<WaivedLocations, FeeHandler>
{
fn is_waived(origin: Option<&MultiLocation>, fee_reason: FeeReason) -> bool {
let Some(loc) = origin else { return false };
Expand Down
1 change: 0 additions & 1 deletion system-parachains/constants/src/kusama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,3 @@ pub mod snowbridge {
pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 1 };
}
}

1 change: 0 additions & 1 deletion system-parachains/constants/src/polkadot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,3 @@ pub mod snowbridge {
pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 1 };
}
}

0 comments on commit b4f8d77

Please sign in to comment.