rustfmt the ghost-networks pallet

Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
Uncle Stinky 2025-06-25 18:17:55 +03:00
parent 40a8152f69
commit f7ba592d50
Signed by: st1nky
GPG Key ID: 016064BD97603B40
5 changed files with 1282 additions and 959 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-networks" name = "ghost-networks"
version = "0.1.10" version = "0.1.11"
license.workspace = true license.workspace = true
authors.workspace = true authors.workspace = true
edition.workspace = true edition.workspace = true

View File

@ -13,17 +13,19 @@ fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into()); frame_system::Pallet::<T>::assert_last_event(generic_event.into());
} }
fn prepare_network<T: Config>( fn prepare_network<T: Config>(n: u32, m: u32) -> (<T as module::Config>::NetworkId, NetworkData) {
n: u32, m: u32,
) -> (<T as module::Config>::NetworkId, NetworkData) {
let chain_id: <T as module::Config>::NetworkId = Default::default(); let chain_id: <T as module::Config>::NetworkId = Default::default();
let chain_id = chain_id.saturating_add((n + m).into()); let chain_id = chain_id.saturating_add((n + m).into());
let mut gatekeeper = b"0x".to_vec(); let mut gatekeeper = b"0x".to_vec();
for i in 0..40 { gatekeeper.push(i); } for i in 0..40 {
gatekeeper.push(i);
}
let mut topic_name = b"0x".to_vec(); let mut topic_name = b"0x".to_vec();
for i in 0..64 { topic_name.push(i); } for i in 0..64 {
topic_name.push(i);
}
let network = NetworkData { let network = NetworkData {
chain_name: sp_std::vec![0x69; n as usize], chain_name: sp_std::vec![0x69; n as usize],
@ -51,8 +53,11 @@ fn create_network<T: Config>(
let authority = T::RegisterOrigin::try_successful_origin() let authority = T::RegisterOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?; .map_err(|_| BenchmarkError::Weightless)?;
GhostNetworks::<T>::register_network( GhostNetworks::<T>::register_network(
authority.clone(), chain_id.clone(), network.clone() authority.clone(),
).map_err(|_| BenchmarkError::Weightless)?; chain_id.clone(),
network.clone(),
)
.map_err(|_| BenchmarkError::Weightless)?;
network network
} }
}; };

View File

@ -4,27 +4,27 @@
use frame_support::{ use frame_support::{
pallet_prelude::*, pallet_prelude::*,
storage::PrefixIterator, traits::{tokens::fungible::Inspect, EnsureOrigin}, storage::PrefixIterator,
traits::{tokens::fungible::Inspect, EnsureOrigin},
}; };
use frame_system::pallet_prelude::*; use frame_system::pallet_prelude::*;
use scale_info::TypeInfo; use scale_info::TypeInfo;
use sp_runtime::{ use sp_runtime::{
traits::{CheckedSub, CheckedAdd, AtLeast32BitUnsigned, Member},
curve::PiecewiseLinear, curve::PiecewiseLinear,
traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedSub, Member},
DispatchResult, DispatchResult,
}; };
use sp_std::{prelude::*, convert::TryInto}; use sp_std::{convert::TryInto, prelude::*};
pub use ghost_traits::networks::{ pub use ghost_traits::networks::{
NetworkDataBasicHandler, NetworkDataInspectHandler, NetworkDataBasicHandler, NetworkDataInspectHandler, NetworkDataMutateHandler,
NetworkDataMutateHandler,
}; };
mod weights; mod weights;
pub use module::*;
pub use crate::weights::WeightInfo; pub use crate::weights::WeightInfo;
pub use module::*;
#[cfg(any(feature = "runtime-benchmarks", test))] #[cfg(any(feature = "runtime-benchmarks", test))]
mod benchmarking; mod benchmarking;
@ -33,9 +33,8 @@ mod mock;
#[cfg(all(feature = "std", test))] #[cfg(all(feature = "std", test))]
mod tests; mod tests;
pub type BalanceOf<T> = <<T as Config>::Currency as Inspect< pub type BalanceOf<T> =
<T as frame_system::Config>::AccountId, <<T as Config>::Currency as Inspect<<T as frame_system::Config>::AccountId>>::Balance;
>>::Balance;
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub enum NetworkType { pub enum NetworkType {
@ -45,7 +44,9 @@ pub enum NetworkType {
} }
impl Default for NetworkType { impl Default for NetworkType {
fn default() -> Self { NetworkType::Evm } fn default() -> Self {
NetworkType::Evm
}
} }
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
@ -69,7 +70,8 @@ pub struct BridgeAdjustment<Balance> {
} }
pub struct BridgedInflationCurve<RewardCurve, T>(core::marker::PhantomData<(RewardCurve, T)>); pub struct BridgedInflationCurve<RewardCurve, T>(core::marker::PhantomData<(RewardCurve, T)>);
impl<Balance, RewardCurve, T> pallet_staking::EraPayout<Balance> for BridgedInflationCurve<RewardCurve, T> impl<Balance, RewardCurve, T> pallet_staking::EraPayout<Balance>
for BridgedInflationCurve<RewardCurve, T>
where where
Balance: Default + AtLeast32BitUnsigned + Clone + Copy + From<u128>, Balance: Default + AtLeast32BitUnsigned + Clone + Copy + From<u128>,
RewardCurve: Get<&'static PiecewiseLinear<'static>>, RewardCurve: Get<&'static PiecewiseLinear<'static>>,
@ -99,10 +101,11 @@ where
match piecewise_linear match piecewise_linear
.calculate_for_fraction_times_denominator(total_staked, adjusted_issuance) .calculate_for_fraction_times_denominator(total_staked, adjusted_issuance)
.checked_mul(&accumulated_balance) .checked_mul(&accumulated_balance)
.and_then(|product| product.checked_div(&adjusted_issuance)) { .and_then(|product| product.checked_div(&adjusted_issuance))
Some(payout) => (payout, accumulated_balance.saturating_sub(payout)), {
None => (Balance::default(), Balance::default()), Some(payout) => (payout, accumulated_balance.saturating_sub(payout)),
} None => (Balance::default(), Balance::default()),
}
} }
} }
@ -155,18 +158,53 @@ pub mod module {
#[pallet::event] #[pallet::event]
#[pallet::generate_deposit(pub(crate) fn deposit_event)] #[pallet::generate_deposit(pub(crate) fn deposit_event)]
pub enum Event<T: Config> { pub enum Event<T: Config> {
NetworkRegistered { chain_id: T::NetworkId, network: NetworkData }, NetworkRegistered {
NetworkNameUpdated { chain_id: T::NetworkId, chain_name: Vec<u8> }, chain_id: T::NetworkId,
NetworkEndpointUpdated { chain_id: T::NetworkId, default_endpoint: Vec<u8> }, network: NetworkData,
NetworkFinalityDelayUpdated { chain_id: T::NetworkId, finality_delay: u64 }, },
NetworkRateLimitDelayUpdated { chain_id: T::NetworkId, rate_limit_delay: u64 }, NetworkNameUpdated {
NetworkBlockDistanceUpdated { chain_id: T::NetworkId, block_distance: u64 }, chain_id: T::NetworkId,
NetworkTypeUpdated { chain_id: T::NetworkId, network_type: NetworkType }, chain_name: Vec<u8>,
NetworkGatekeeperUpdated { chain_id: T::NetworkId, gatekeeper: Vec<u8> }, },
NetworkTopicNameUpdated { chain_id: T::NetworkId, topic_name: Vec<u8> }, NetworkEndpointUpdated {
NetworkIncomingFeeUpdated { chain_id: T::NetworkId, incoming_fee: u32 }, chain_id: T::NetworkId,
NetworkOutgoingFeeUpdated { chain_id: T::NetworkId, outgoing_fee: u32 }, default_endpoint: Vec<u8>,
NetworkRemoved { chain_id: T::NetworkId }, },
NetworkFinalityDelayUpdated {
chain_id: T::NetworkId,
finality_delay: u64,
},
NetworkRateLimitDelayUpdated {
chain_id: T::NetworkId,
rate_limit_delay: u64,
},
NetworkBlockDistanceUpdated {
chain_id: T::NetworkId,
block_distance: u64,
},
NetworkTypeUpdated {
chain_id: T::NetworkId,
network_type: NetworkType,
},
NetworkGatekeeperUpdated {
chain_id: T::NetworkId,
gatekeeper: Vec<u8>,
},
NetworkTopicNameUpdated {
chain_id: T::NetworkId,
topic_name: Vec<u8>,
},
NetworkIncomingFeeUpdated {
chain_id: T::NetworkId,
incoming_fee: u32,
},
NetworkOutgoingFeeUpdated {
chain_id: T::NetworkId,
outgoing_fee: u32,
},
NetworkRemoved {
chain_id: T::NetworkId,
},
} }
#[pallet::storage] #[pallet::storage]
@ -180,8 +218,7 @@ pub mod module {
#[pallet::storage] #[pallet::storage]
#[pallet::getter(fn accumulated_commission)] #[pallet::getter(fn accumulated_commission)]
pub type AccumulatedCommission<T: Config> = pub type AccumulatedCommission<T: Config> = StorageValue<_, BalanceOf<T>, ValueQuery>;
StorageValue<_, BalanceOf<T>, ValueQuery>;
#[pallet::storage] #[pallet::storage]
#[pallet::getter(fn networks)] #[pallet::getter(fn networks)]
@ -190,13 +227,8 @@ pub mod module {
#[pallet::storage] #[pallet::storage]
#[pallet::getter(fn gatekeeper_amount)] #[pallet::getter(fn gatekeeper_amount)]
pub type GatekeeperAmount<T: Config> = StorageMap< pub type GatekeeperAmount<T: Config> =
_, StorageMap<_, Twox64Concat, T::NetworkId, BalanceOf<T>, ValueQuery>;
Twox64Concat,
T::NetworkId,
BalanceOf<T>,
ValueQuery,
>;
#[pallet::genesis_config] #[pallet::genesis_config]
pub struct GenesisConfig<T: Config> { pub struct GenesisConfig<T: Config> {
@ -213,12 +245,13 @@ pub mod module {
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> { impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) { fn build(&self) {
if !self.networks.is_empty() { if !self.networks.is_empty() {
self.networks.iter().for_each(|(chain_id, network_metadata)| { self.networks
let network = .iter()
NetworkData::decode(&mut &network_metadata[..]) .for_each(|(chain_id, network_metadata)| {
.expect("Error decoding NetworkData"); let network = NetworkData::decode(&mut &network_metadata[..])
Pallet::<T>::do_register_network(chain_id.clone(), network) .expect("Error decoding NetworkData");
.expect("Error registering network"); Pallet::<T>::do_register_network(chain_id.clone(), network)
.expect("Error registering network");
}); });
} }
} }
@ -268,10 +301,7 @@ pub mod module {
chain_name: Vec<u8>, chain_name: Vec<u8>,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_name( Self::do_update_network_name(chain_id, chain_name)
chain_id,
chain_name,
)
} }
#[pallet::call_index(2)] #[pallet::call_index(2)]
@ -284,10 +314,7 @@ pub mod module {
default_endpoint: Vec<u8>, default_endpoint: Vec<u8>,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_endpoint( Self::do_update_network_endpoint(chain_id, default_endpoint)
chain_id,
default_endpoint,
)
} }
#[pallet::call_index(3)] #[pallet::call_index(3)]
@ -298,10 +325,7 @@ pub mod module {
finality_delay: u64, finality_delay: u64,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_finality_delay( Self::do_update_network_finality_delay(chain_id, finality_delay)
chain_id,
finality_delay,
)
} }
#[pallet::call_index(4)] #[pallet::call_index(4)]
@ -312,10 +336,7 @@ pub mod module {
rate_limit_delay: u64, rate_limit_delay: u64,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_rate_limit_delay( Self::do_update_network_rate_limit_delay(chain_id, rate_limit_delay)
chain_id,
rate_limit_delay,
)
} }
#[pallet::call_index(5)] #[pallet::call_index(5)]
@ -326,10 +347,7 @@ pub mod module {
block_distance: u64, block_distance: u64,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_block_distance( Self::do_update_network_block_distance(chain_id, block_distance)
chain_id,
block_distance,
)
} }
#[pallet::call_index(6)] #[pallet::call_index(6)]
@ -340,10 +358,7 @@ pub mod module {
network_type: NetworkType, network_type: NetworkType,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_type( Self::do_update_network_type(chain_id, network_type)
chain_id,
network_type,
)
} }
#[pallet::call_index(7)] #[pallet::call_index(7)]
@ -354,10 +369,7 @@ pub mod module {
gatekeeper: Vec<u8>, gatekeeper: Vec<u8>,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_gatekeeper( Self::do_update_network_gatekeeper(chain_id, gatekeeper)
chain_id,
gatekeeper,
)
} }
#[pallet::call_index(8)] #[pallet::call_index(8)]
@ -368,10 +380,7 @@ pub mod module {
topic_name: Vec<u8>, topic_name: Vec<u8>,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_topic_name( Self::do_update_network_topic_name(chain_id, topic_name)
chain_id,
topic_name,
)
} }
#[pallet::call_index(9)] #[pallet::call_index(9)]
@ -382,10 +391,7 @@ pub mod module {
incoming_fee: u32, incoming_fee: u32,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_incoming_network_fee( Self::do_update_incoming_network_fee(chain_id, incoming_fee)
chain_id,
incoming_fee,
)
} }
#[pallet::call_index(10)] #[pallet::call_index(10)]
@ -396,18 +402,12 @@ pub mod module {
outgoing_fee: u32, outgoing_fee: u32,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_outgoing_network_fee( Self::do_update_outgoing_network_fee(chain_id, outgoing_fee)
chain_id,
outgoing_fee,
)
} }
#[pallet::call_index(11)] #[pallet::call_index(11)]
#[pallet::weight(T::WeightInfo::remove_network())] #[pallet::weight(T::WeightInfo::remove_network())]
pub fn remove_network( pub fn remove_network(origin: OriginFor<T>, chain_id: T::NetworkId) -> DispatchResult {
origin: OriginFor<T>,
chain_id: T::NetworkId,
) -> DispatchResult {
T::RemoveOrigin::ensure_origin_or_root(origin)?; T::RemoveOrigin::ensure_origin_or_root(origin)?;
Self::do_remove_network(chain_id) Self::do_remove_network(chain_id)
} }
@ -416,12 +416,12 @@ pub mod module {
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
/// Register a new network. /// Register a new network.
pub fn do_register_network( pub fn do_register_network(chain_id: T::NetworkId, network: NetworkData) -> DispatchResult {
chain_id: T::NetworkId,
network: NetworkData,
) -> DispatchResult {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult { Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_none(), Error::<T>::NetworkAlreadyRegistered); ensure!(
maybe_network.is_none(),
Error::<T>::NetworkAlreadyRegistered
);
*maybe_network = Some(network.clone()); *maybe_network = Some(network.clone());
Ok(()) Ok(())
})?; })?;
@ -443,10 +443,7 @@ impl<T: Config> Pallet<T> {
} }
/// Update existent network name. /// Update existent network name.
pub fn do_update_network_name( pub fn do_update_network_name(chain_id: T::NetworkId, chain_name: Vec<u8>) -> DispatchResult {
chain_id: T::NetworkId,
chain_name: Vec<u8>,
) -> DispatchResult {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult { Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist); ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap(); let net = maybe_network.as_mut().unwrap();
@ -562,8 +559,10 @@ impl<T: Config> Pallet<T> {
chain_id: T::NetworkId, chain_id: T::NetworkId,
gatekeeper: Vec<u8>, gatekeeper: Vec<u8>,
) -> DispatchResult { ) -> DispatchResult {
ensure!(gatekeeper.len() == 42 && gatekeeper[0] == 48 && gatekeeper[1] == 120, ensure!(
Error::<T>::WrongGatekeeperAddress); gatekeeper.len() == 42 && gatekeeper[0] == 48 && gatekeeper[1] == 120,
Error::<T>::WrongGatekeeperAddress
);
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult { Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist); ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap(); let net = maybe_network.as_mut().unwrap();
@ -583,8 +582,10 @@ impl<T: Config> Pallet<T> {
chain_id: T::NetworkId, chain_id: T::NetworkId,
topic_name: Vec<u8>, topic_name: Vec<u8>,
) -> DispatchResult { ) -> DispatchResult {
ensure!(topic_name.len() == 66 && topic_name[0] == 48 && topic_name[1] == 120, ensure!(
Error::<T>::WrongTopicName); topic_name.len() == 66 && topic_name[0] == 48 && topic_name[1] == 120,
Error::<T>::WrongTopicName
);
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult { Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist); ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap(); let net = maybe_network.as_mut().unwrap();
@ -667,15 +668,16 @@ impl<T: Config> NetworkDataMutateHandler<NetworkData, BalanceOf<T>> for Pallet<T
network_id: &T::NetworkId, network_id: &T::NetworkId,
amount: &BalanceOf<T>, amount: &BalanceOf<T>,
) -> Result<BalanceOf<T>, ()> { ) -> Result<BalanceOf<T>, ()> {
let new_gatekeeper_amount = GatekeeperAmount::<T>::mutate(network_id, |gatekeeper_amount| { let new_gatekeeper_amount =
match gatekeeper_amount.checked_add(amount) { GatekeeperAmount::<T>::mutate(network_id, |gatekeeper_amount| match gatekeeper_amount
.checked_add(amount)
{
Some(value) => { Some(value) => {
*gatekeeper_amount = value; *gatekeeper_amount = value;
Ok(value) Ok(value)
}, }
None => Err(()) None => Err(()),
} })?;
})?;
Ok(new_gatekeeper_amount) Ok(new_gatekeeper_amount)
} }
@ -684,28 +686,29 @@ impl<T: Config> NetworkDataMutateHandler<NetworkData, BalanceOf<T>> for Pallet<T
network_id: &T::NetworkId, network_id: &T::NetworkId,
amount: &BalanceOf<T>, amount: &BalanceOf<T>,
) -> Result<BalanceOf<T>, ()> { ) -> Result<BalanceOf<T>, ()> {
let new_gatekeeper_amount = GatekeeperAmount::<T>::mutate(network_id, |gatekeeper_amount| { let new_gatekeeper_amount =
match gatekeeper_amount.checked_sub(amount) { GatekeeperAmount::<T>::mutate(network_id, |gatekeeper_amount| match gatekeeper_amount
.checked_sub(amount)
{
Some(value) => { Some(value) => {
*gatekeeper_amount = value; *gatekeeper_amount = value;
Ok(value) Ok(value)
}, }
None => Err(()) None => Err(()),
} })?;
})?;
Ok(new_gatekeeper_amount) Ok(new_gatekeeper_amount)
} }
fn accumulate_outgoing_imbalance(amount: &BalanceOf<T>) -> Result<BalanceOf<T>, ()> { fn accumulate_outgoing_imbalance(amount: &BalanceOf<T>) -> Result<BalanceOf<T>, ()> {
let new_bridged_out_amount = BridgedImbalance::<T>::mutate(|bridged_imbalance| { let new_bridged_out_amount = BridgedImbalance::<T>::mutate(|bridged_imbalance| {
match bridged_imbalance.bridged_out.checked_add(amount) { match bridged_imbalance.bridged_out.checked_add(amount) {
Some(value) => { Some(value) => {
(*bridged_imbalance).bridged_out = value; (*bridged_imbalance).bridged_out = value;
Ok(value) Ok(value)
}, }
None => Err(()) None => Err(()),
} }
})?; })?;
Ok(new_bridged_out_amount) Ok(new_bridged_out_amount)
@ -717,8 +720,8 @@ impl<T: Config> NetworkDataMutateHandler<NetworkData, BalanceOf<T>> for Pallet<T
Some(value) => { Some(value) => {
(*bridged_imbalance).bridged_in = value; (*bridged_imbalance).bridged_in = value;
Ok(value) Ok(value)
}, }
None => Err(()) None => Err(()),
} }
})?; })?;
@ -731,7 +734,7 @@ impl<T: Config> NetworkDataMutateHandler<NetworkData, BalanceOf<T>> for Pallet<T
Some(value) => { Some(value) => {
*accumulated = value; *accumulated = value;
Ok(value) Ok(value)
}, }
None => Err(()), None => Err(()),
} }
}) })

View File

@ -1,17 +1,16 @@
use crate::{self as ghost_networks}; use crate::{self as ghost_networks};
use frame_system::EnsureSignedBy;
use frame_support::{ use frame_support::{
construct_runtime, ord_parameter_types, parameter_types, construct_runtime, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, Everything}, traits::{ConstU128, ConstU32, Everything},
}; };
use frame_system::EnsureSignedBy;
pub use primitives::{ pub use primitives::{
AccountId, Balance, Nonce, BlockNumber, Hash, AccountId, Balance, BlockNumber, FreezeIdentifier, Hash, Nonce, ReserveIdentifier,
ReserveIdentifier, FreezeIdentifier,
}; };
use sp_runtime::{ use sp_runtime::{
curve::PiecewiseLinear, curve::PiecewiseLinear,
traits::{AccountIdLookup, BlakeTwo256}, traits::{AccountIdLookup, BlakeTwo256},
BuildStorage BuildStorage,
}; };
parameter_types! { parameter_types! {
@ -96,9 +95,9 @@ impl ghost_networks::Config for Test {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type NetworkId = u32; type NetworkId = u32;
type RegisterOrigin = EnsureSignedBy::<RegistererAccount, AccountId>; type RegisterOrigin = EnsureSignedBy<RegistererAccount, AccountId>;
type UpdateOrigin = EnsureSignedBy::<UpdaterAccount, AccountId>; type UpdateOrigin = EnsureSignedBy<UpdaterAccount, AccountId>;
type RemoveOrigin = EnsureSignedBy::<RemoverAccount, AccountId>; type RemoveOrigin = EnsureSignedBy<RemoverAccount, AccountId>;
type WeightInfo = crate::weights::SubstrateWeight<Test>; type WeightInfo = crate::weights::SubstrateWeight<Test>;
} }

File diff suppressed because it is too large Load Diff