Skip to content

Commit

Permalink
fmt and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
gianfra-t committed Nov 28, 2024
1 parent b86d117 commit f9a6d42
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 49 deletions.
2 changes: 1 addition & 1 deletion pallets/reward-distribution/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl frame_system::Config for Test {
type SS58Prefix = SS58Prefix;
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
type RuntimeTask= RuntimeTask;
type RuntimeTask = RuntimeTask;
}

parameter_types! {
Expand Down
78 changes: 38 additions & 40 deletions testchain/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ fn get_properties() -> Map<String, Value> {
}

pub fn mainnet_config() -> ChainSpec {
ChainSpec::builder(spacewalk_runtime_mainnet::WASM_BINARY.expect("WASM binary was not built, please build it!"), Default::default())
ChainSpec::builder(
spacewalk_runtime_mainnet::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
Default::default(),
)
.with_name("spacewalk")
.with_id("dev_mainnet")
.with_chain_type(ChainType::Development)
Expand Down Expand Up @@ -107,37 +111,39 @@ pub fn mainnet_config() -> ChainSpec {
.build()
}
pub fn testnet_config() -> ChainSpec {
ChainSpec::builder(spacewalk_runtime_mainnet::WASM_BINARY.expect("WASM binary was not built, please build it!"), Default::default())
.with_name("spacewalk")
.with_id("dev_mainnet")
.with_chain_type(ChainType::Development)
.with_properties(get_properties())
.with_genesis_config_patch(genesis(
ChainSpec::builder(
spacewalk_runtime_mainnet::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
Default::default(),
)
.with_name("spacewalk")
.with_id("dev_mainnet")
.with_chain_type(ChainType::Development)
.with_properties(get_properties())
.with_genesis_config_patch(genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![authority_keys_from_seed("Alice")],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![authority_keys_from_seed("Alice")],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
vec![get_account_id_from_seed::<sr25519::Public>("Bob")],
false,
false,
))
.build()
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
vec![get_account_id_from_seed::<sr25519::Public>("Bob")],
false,
false,
))
.build()
}



fn default_pair(currency_id: CurrencyId, is_public_network: bool) -> VaultCurrencyPair<CurrencyId> {
let wrapped = if is_public_network {
WRAPPED_CURRENCY_ID_STELLAR_MAINNET
Expand Down Expand Up @@ -171,12 +177,9 @@ fn genesis(
};

let genesis_config = RuntimeGenesisConfig {
system: SystemConfig {
_config: Default::default(),
},
system: SystemConfig { _config: Default::default() },
aura: AuraConfig {
authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
..Default::default()
},
grandpa: GrandpaConfig {
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(),
Expand Down Expand Up @@ -227,7 +230,7 @@ fn genesis(
},
security: SecurityConfig {
initial_status: if start_shutdown { StatusCode::Shutdown } else { StatusCode::Error },
_phantom: Default::default()
_phantom: Default::default(),
},
stellar_relay: if !is_public_network {
create_stellar_testnet_config()
Expand All @@ -243,7 +246,7 @@ fn genesis(
Key::ExchangeRate(default_wrapped_currency),
Key::ExchangeRate(MXN_CURRENCY_ID),
],
_phantom: Default::default()
_phantom: Default::default(),
},
vault_registry: VaultRegistryConfig {
minimum_collateral_vault: vec![
Expand Down Expand Up @@ -340,7 +343,6 @@ fn genesis(
60_000 * 10u128.pow(12),
),
],
..Default::default()
},
fee: FeeConfig {
issue_fee: FixedU128::checked_from_rational(1, 1000).unwrap(), // 0.1%
Expand All @@ -364,9 +366,7 @@ fn genesis(
],
batching_api: b"https://dia-00.pendulumchain.tech:8070/currencies".to_vec(),
coin_infos_map: vec![],
..Default::default()
},

};
//serde_json::to_value(genesis_config).expect("Serialization of genesis config should work")
serde_json::json!({
Expand Down Expand Up @@ -440,10 +440,8 @@ fn genesis(
"coinInfosMap": genesis_config.dia_oracle_module.coin_infos_map,
}
})

}


fn create_stellar_testnet_config() -> StellarRelayConfig {
let old_validators = Vec::new();
let old_organizations = Vec::new();
Expand Down
6 changes: 3 additions & 3 deletions testchain/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ pub fn new_full(config: Configuration) -> Result<(TaskManager, RpcHandlers), Ser
import_queue,
block_announce_validator_builder: None,
warp_sync_params: None,
block_relay: None
block_relay: None,
})?;

if config.offchain_worker.enabled {
Expand Down Expand Up @@ -515,7 +515,7 @@ pub fn new_full(config: Configuration) -> Result<(TaskManager, RpcHandlers), Ser
shared_voter_state: SharedVoterState::empty(),
telemetry: telemetry.as_ref().map(|x| x.handle()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(transaction_pool),
notification_service: grandpa_notification_service
notification_service: grandpa_notification_service,
};

// the GRANDPA voter task is considered infallible, i.e.
Expand Down Expand Up @@ -696,7 +696,7 @@ pub async fn start_instant_testnet(
import_queue,
block_announce_validator_builder: None,
warp_sync_params: None,
block_relay: None
block_relay: None,
})?;

if config.offchain_worker.enabled {
Expand Down
6 changes: 3 additions & 3 deletions testchain/runtime/mainnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ extern crate frame_benchmarking;
use codec::Encode;
pub use dia_oracle::dia::*;
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstU128, ConstU32, ConstU64, ConstU8, Contains},
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, IdentityFee, Weight},
PalletId,
genesis_builder_helper::{create_default_config, build_config},

};
pub use frame_system::Call as SystemCall;
use orml_currencies::BasicCurrencyAdapter;
Expand Down
5 changes: 3 additions & 2 deletions testchain/runtime/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ extern crate frame_benchmarking;
use codec::Encode;
pub use dia_oracle::dia::*;
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstU128, ConstU32, ConstU64, ConstU8, Contains},
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, IdentityFee, Weight},
PalletId,
genesis_builder_helper::{create_default_config, build_config},
};
pub use frame_system::Call as SystemCall;
use orml_currencies::BasicCurrencyAdapter;
Expand Down

0 comments on commit f9a6d42

Please sign in to comment.