Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden committed Sep 6, 2024
1 parent 97ff40a commit 9401677
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 49 deletions.
15 changes: 6 additions & 9 deletions chain-spec-generator/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,12 @@ pub fn from_json_file(filepath: &str, supported: String) -> Result<Box<dyn Chain
let chain_spec: EmptyChainSpecWithId = serde_json::from_reader(reader)
.expect("Failed to read 'json' file with ChainSpec configuration");
match &chain_spec.id {
x if x.starts_with("paseo") | x.starts_with("dot") => {
Ok(Box::new(PaseoChainSpec::from_json_file(path)?))
},
x if x.starts_with("asset-hub-paseo") => {
Ok(Box::new(AssetHubPaseoChainSpec::from_json_file(path)?))
},
x if x.starts_with("bridge-hub-paseo") => {
Ok(Box::new(BridgeHubPaseoChainSpec::from_json_file(path)?))
},
x if x.starts_with("paseo") | x.starts_with("dot") =>
Ok(Box::new(PaseoChainSpec::from_json_file(path)?)),
x if x.starts_with("asset-hub-paseo") =>
Ok(Box::new(AssetHubPaseoChainSpec::from_json_file(path)?)),
x if x.starts_with("bridge-hub-paseo") =>
Ok(Box::new(BridgeHubPaseoChainSpec::from_json_file(path)?)),
_ => Err(format!("Unknown chain 'id' in json file. Only supported: {supported}'")),
}
}
5 changes: 2 additions & 3 deletions chain-spec-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ fn main() -> Result<(), String> {
),
(
"people-paseo-local",
Box::new(|| system_parachains_specs::people_paseo_local_testnet_config())
as Box<_>,
Box::new(|| system_parachains_specs::people_paseo_local_testnet_config()) as Box<_>,
),
]);

Expand All @@ -70,7 +69,7 @@ fn main() -> Result<(), String> {
print!("{chain_spec}");
Ok(())
} else {
let supported = supported_chains.keys().enumerate().fold(String::new(), |c, (n, k)| {
let supported = supported_chains.keys().enumerate().fold(String::new(), |c, (n, k)| {
let extra = if n + 1 < supported_chains.len() { ", " } else { "" };
format!("{c}{k}{extra}")
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.

// Substrate
use sp_core::{storage::Storage};
use sp_core::storage::Storage;

// Cumulus
use emulated_integration_tests_common::{
Expand Down Expand Up @@ -46,8 +46,8 @@ pub fn genesis() -> Storage {
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
acc.clone(), // account id
acc, // validator id
bridge_hub_paseo_runtime::SessionKeys { aura }, // session keys
)
})
Expand All @@ -67,7 +67,6 @@ pub fn genesis() -> Storage {

build_genesis_storage(
&genesis_config,
bridge_hub_paseo_runtime::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
bridge_hub_paseo_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ pub fn genesis() -> Storage {
minimum_validator_count: 1,
stakers: validators::initial_authorities()
.iter()
.map(|x| {
(x.0.clone(), x.1.clone(), STASH, paseo_runtime::StakerStatus::Validator)
})
.map(|x| (x.0.clone(), x.1.clone(), STASH, paseo_runtime::StakerStatus::Validator))
.collect(),
invulnerables: validators::initial_authorities().iter().map(|x| x.0.clone()).collect(),
force_era: pallet_staking::Forcing::ForceNone,
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/emulated/networks/paseo-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

pub use asset_hub_paseo_emulated_chain;
pub use bridge_hub_paseo_emulated_chain;
pub use penpal_emulated_chain;
pub use paseo_emulated_chain;
pub use penpal_emulated_chain;

use asset_hub_paseo_emulated_chain::AssetHubPaseo;
use bridge_hub_paseo_emulated_chain::BridgeHubPaseo;
use penpal_emulated_chain::PenpalB;
use paseo_emulated_chain::Paseo;
use penpal_emulated_chain::PenpalB;

// Cumulus
use emulated_integration_tests_common::{
Expand Down
2 changes: 1 addition & 1 deletion relay/paseo/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ use frame_support::{
traits::{tokens::ConversionFromAssetBalance, Contains},
};
use frame_system::RawOrigin;
use paseo_runtime_constants::system_parachain::PEOPLE_ID;
use polkadot_primitives::Id as ParaId;
use polkadot_runtime_common::identity_migrator::{OnReapIdentity, WeightInfo};
use paseo_runtime_constants::system_parachain::PEOPLE_ID;
use xcm::{latest::prelude::*, VersionedXcm};
use xcm_builder::IsChildSystemParachain;
use xcm_executor::traits::TransactAsset;
Expand Down
9 changes: 5 additions & 4 deletions relay/paseo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ use polkadot_runtime_common::{
impls::{
DealWithFees, LocatableAssetConverter, VersionedLocatableAsset, VersionedLocationConverter,
},
paras_registrar, paras_sudo_wrapper, prod_or_fast, slots, BlockHashCount, BlockLength, CurrencyToVote,
SlowAdjustingFeeUpdate,
paras_registrar, paras_sudo_wrapper, prod_or_fast, slots, BlockHashCount, BlockLength,
CurrencyToVote, SlowAdjustingFeeUpdate,
};

use runtime_parachains::{
Expand Down Expand Up @@ -1252,7 +1252,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
matches!(
c,
RuntimeCall::Staking(..) |
RuntimeCall::Session(..) | RuntimeCall::Utility(..) |
RuntimeCall::Session(..) |
RuntimeCall::Utility(..) |
RuntimeCall::FastUnstake(..) |
RuntimeCall::VoterList(..) |
RuntimeCall::NominationPools(..)
Expand Down Expand Up @@ -1776,7 +1777,7 @@ construct_runtime! {
Mmr: pallet_mmr = 201,
BeefyMmrLeaf: pallet_beefy_mmr = 202,

// Sudo.
// Sudo.
ParaSudoWrapper: paras_sudo_wrapper = 250,
Sudo: pallet_sudo::{Pallet, Call, Storage, Event<T>, Config<T>} = 255,

Expand Down
6 changes: 3 additions & 3 deletions relay/paseo/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ use frame_support::{
};
use frame_system::EnsureRoot;
use pallet_xcm::XcmPassthrough;
use paseo_runtime_constants::{
currency::CENTS, system_parachain::*, xcm::body::FELLOWSHIP_ADMIN_INDEX,
};
use polkadot_runtime_common::{
xcm_sender::{ChildParachainRouter, ExponentialPrice},
ToAuthor,
};
use paseo_runtime_constants::{
currency::CENTS, system_parachain::*, xcm::body::FELLOWSHIP_ADMIN_INDEX,
};
use sp_core::ConstU32;
use xcm::latest::prelude::*;
use xcm_builder::{
Expand Down
7 changes: 4 additions & 3 deletions system-parachains/asset-hub-paseo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ use frame_system::{
};
use pallet_nfts::PalletFeatures;
use parachains_common::{
message_queue::*, AccountId, AuraId, AssetIdForTrustBackedAssets,
Balance, BlockNumber, Hash, Header, Nonce, Signature,
message_queue::*, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash,
Header, Nonce, Signature,
};

use sp_runtime::RuntimeDebug;
Expand Down Expand Up @@ -495,7 +495,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
RuntimeCall::Assets { .. } |
RuntimeCall::Utility { .. } |
RuntimeCall::Multisig { .. } |
RuntimeCall::Nfts { .. } | RuntimeCall::Uniques { .. }
RuntimeCall::Nfts { .. } |
RuntimeCall::Uniques { .. }
)
},
ProxyType::AssetOwner => matches!(
Expand Down
3 changes: 1 addition & 2 deletions system-parachains/asset-hub-paseo/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ parameter_types! {
pub XcmAssetFeesReceiver: Option<AccountId> = Authorship::author();
}


pub struct ParentOrParentsPlurality;
impl Contains<Location> for ParentOrParentsPlurality {
fn contains(location: &Location) -> bool {
Expand All @@ -253,7 +252,7 @@ pub type Barrier = TrailingSetTopicAsId<
AllowExplicitUnpaidExecutionFrom<(
ParentOrParentsPlurality,
Equals<RelayTreasuryLocation>,
Equals<bridging::SiblingBridgeHub>
Equals<bridging::SiblingBridgeHub>,
)>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
Expand Down
20 changes: 9 additions & 11 deletions system-parachains/bridge-hub-paseo/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ pub fn estimate_paseo_to_kusama_message_fee(
// 1) an approximate cost of XCM execution (`ExportMessage` and surroundings) at Paseo bridge
// Hub;
//
// 2) the approximate cost of Paseo -> Kusama message delivery transaction on Kusama Bridge
// Hub, converted into KSMs using 1:5 conversion rate;
// 2) the approximate cost of Paseo -> Kusama message delivery transaction on Kusama Bridge Hub,
// converted into KSMs using 1:5 conversion rate;
//
// 3) the approximate cost of Paseo -> Kusama message confirmation transaction on Paseo
// Bridge Hub.
// 3) the approximate cost of Paseo -> Kusama message confirmation transaction on Paseo Bridge
// Hub.
BridgeHubPaseoBaseXcmFeeInDots::get()
.saturating_add(convert_from_uksm_to_udot(bridge_hub_kusama_base_delivery_fee_in_uksms))
.saturating_add(BridgeHubPaseoBaseConfirmationFeeInDots::get())
Expand All @@ -124,8 +124,8 @@ pub fn estimate_paseo_to_kusama_message_fee(
/// message from Paseo Bridge Hub to Kusama Bridge Hub.
pub fn estimate_paseo_to_kusama_byte_fee() -> Balance {
// the sender pays for the same byte twice:
// 1) the first part comes from the HRMP, when message travels from Paseo Asset Hub to
// Paseo Bridge Hub;
// 1) the first part comes from the HRMP, when message travels from Paseo Asset Hub to Paseo
// Bridge Hub;
// 2) the second part is the payment for bytes of the message delivery transaction, which is
// "mined" at Kusama Bridge Hub. Hence, we need to use byte fees from that chain and convert
// it to PASs here.
Expand All @@ -138,7 +138,7 @@ fn convert_from_uksm_to_udot(price_in_uksm: Balance) -> Balance {
let dot_to_ksm_economic_rate = FixedU128::from_rational(5, 1);
// tokens have different nominals and we need to take that into account
let nominal_ratio = FixedU128::from_rational(
paseo_runtime_constants::currency::UNITS,
paseo_runtime_constants::currency::UNITS,
kusama_runtime_constants::currency::UNITS,
);

Expand Down Expand Up @@ -199,10 +199,8 @@ mod tests {

let price_in_ksm =
FixedU128::from_rational(price_in_uksm, kusama_runtime_constants::currency::UNITS);
let price_in_dot = FixedU128::from_rational(
same_price_in_udot,
paseo_runtime_constants::currency::UNITS,
);
let price_in_dot =
FixedU128::from_rational(same_price_in_udot, paseo_runtime_constants::currency::UNITS);
assert_eq!(price_in_dot / FixedU128::saturating_from_integer(5), price_in_ksm);
}
}
2 changes: 1 addition & 1 deletion system-parachains/bridge-hub-paseo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ use xcm_config::{
pub use sp_runtime::BuildStorage;

// Polkadot imports
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use paseo_runtime_constants::system_parachain::{ASSET_HUB_ID, BRIDGE_HUB_ID};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};

use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};

Expand Down
2 changes: 1 addition & 1 deletion system-parachains/bridge-hub-paseo/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ use parachains_common::xcm_config::{
AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains,
RelayOrOtherSystemParachains,
};
use polkadot_parachain_primitives::primitives::Sibling;
use paseo_runtime_constants::system_parachain;
use polkadot_parachain_primitives::primitives::Sibling;
use snowbridge_runtime_common::XcmExportFeeToSibling;
use sp_runtime::traits::AccountIdConversion;
use sp_std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion system-parachains/people-paseo/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ use parachains_common::{
},
TREASURY_PALLET_ID,
};
use polkadot_parachain_primitives::primitives::Sibling;
use paseo_runtime_constants::system_parachain;
use polkadot_parachain_primitives::primitives::Sibling;
use sp_runtime::traits::AccountIdConversion;
use xcm::latest::prelude::*;
use xcm_builder::{
Expand Down

0 comments on commit 9401677

Please sign in to comment.