Skip to content

Commit

Permalink
refactor(pop-node): runtime pallet configs (#76)
Browse files Browse the repository at this point in the history
Co-authored-by: Frank Bell <frank@r0gue.io>
  • Loading branch information
al3mart and evilrobot-01 authored Apr 25, 2024
1 parent 2229bae commit f8dc410
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion integration-tests/src/chains/pop_network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ decl_test_parachains! {
runtime = pop_runtime_devnet,
core = {
XcmpMessageHandler: pop_runtime_devnet::XcmpQueue,
LocationToAccountId: pop_runtime_devnet::xcm_config::LocationToAccountId,
LocationToAccountId: pop_runtime_devnet::config::xcm::LocationToAccountId,
ParachainInfo: pop_runtime_devnet::ParachainInfo,
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
},
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use frame_support::{
use polkadot_runtime_parachains::assigner_on_demand;
use pop_runtime_common::Balance;
use pop_runtime_devnet as pop_runtime;
use pop_runtime_devnet::xcm_config::XcmConfig as PopNetworkXcmConfig;
use pop_runtime_devnet::config::xcm::XcmConfig as PopNetworkXcmConfig;
use rococo_runtime::xcm_config::XcmConfig as RococoXcmConfig;
use sp_core::Encode;
use xcm::prelude::*;
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions runtime/devnet/src/config/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mod assets;
mod contracts;
mod proxy;
// Public due to integration tests crate.
pub mod xcm;
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::{assets_config::TrustBackedAssetsCall, Balances, Runtime, RuntimeCall, RuntimeEvent};
use sp_runtime::traits::BlakeTwo256;

use super::assets::TrustBackedAssetsCall;
use crate::{Balances, Runtime, RuntimeCall, RuntimeEvent};
use frame_support::traits::InstanceFilter;
use pop_runtime_common::proxy::{
AnnouncementDepositBase, AnnouncementDepositFactor, MaxPending, MaxProxies, ProxyDepositBase,
ProxyDepositFactor, ProxyType,
};
use sp_runtime::traits::BlakeTwo256;

impl InstanceFilter<RuntimeCall> for ProxyType {
fn filter(&self, c: &RuntimeCall) -> bool {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{
use crate::{
AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm,
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
};
Expand Down
10 changes: 4 additions & 6 deletions runtime/devnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

mod assets_config;
mod contracts_config;
mod extensions;
mod proxy_config;
mod weights;
pub mod xcm_config;
// Public due to integration tests crate.
pub mod config;

use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
Expand All @@ -30,6 +28,7 @@ use sp_std::prelude::*;
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use config::xcm::{RelayLocation, XcmOriginToTransactDispatchOrigin};
use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
use frame_support::{
construct_runtime, derive_impl,
Expand Down Expand Up @@ -60,7 +59,6 @@ pub use pop_runtime_common::{
RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION, UNINCLUDED_SEGMENT_CAPACITY, UNIT,
};
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm_config::{RelayLocation, XcmOriginToTransactDispatchOrigin};

#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
Expand Down Expand Up @@ -433,7 +431,7 @@ impl pallet_message_queue::Config for Runtime {
#[cfg(not(feature = "runtime-benchmarks"))]
type MessageProcessor = xcm_builder::ProcessXcmMessage<
AggregateMessageOrigin,
xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
xcm_executor::XcmExecutor<config::xcm::XcmConfig>,
RuntimeCall,
>;
type Size = u32;
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions runtime/testnet/src/config/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mod assets;
mod contracts;
mod proxy;
// Public due to integration tests crate.
pub mod xcm;
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::{assets_config::TrustBackedAssetsCall, Balances, Runtime, RuntimeCall, RuntimeEvent};
use sp_runtime::traits::BlakeTwo256;

use super::assets::TrustBackedAssetsCall;
use crate::{Balances, Runtime, RuntimeCall, RuntimeEvent};
use frame_support::traits::InstanceFilter;
use pop_runtime_common::proxy::{
AnnouncementDepositBase, AnnouncementDepositFactor, MaxPending, MaxProxies, ProxyDepositBase,
ProxyDepositFactor, ProxyType,
};
use sp_runtime::traits::BlakeTwo256;

impl InstanceFilter<RuntimeCall> for ProxyType {
fn filter(&self, c: &RuntimeCall) -> bool {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{
use crate::{
AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm,
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
};
Expand Down
9 changes: 3 additions & 6 deletions runtime/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

mod assets_config;
mod contracts_config;
mod config;
mod extensions;
mod proxy_config;
mod weights;
pub mod xcm_config;

use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
Expand All @@ -30,6 +27,7 @@ use sp_std::prelude::*;
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use config::xcm::{RelayLocation, XcmOriginToTransactDispatchOrigin};
use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
use frame_support::{
construct_runtime, derive_impl,
Expand Down Expand Up @@ -60,7 +58,6 @@ pub use pop_runtime_common::{
RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION, UNINCLUDED_SEGMENT_CAPACITY, UNIT,
};
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm_config::{RelayLocation, XcmOriginToTransactDispatchOrigin};

#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
Expand Down Expand Up @@ -433,7 +430,7 @@ impl pallet_message_queue::Config for Runtime {
#[cfg(not(feature = "runtime-benchmarks"))]
type MessageProcessor = xcm_builder::ProcessXcmMessage<
AggregateMessageOrigin,
xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
xcm_executor::XcmExecutor<config::xcm::XcmConfig>,
RuntimeCall,
>;
type Size = u32;
Expand Down

0 comments on commit f8dc410

Please sign in to comment.