mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 07:01:03 +00:00
ci: add quick-check with rustfmt (#615)
* ci: add quick-check with clippy and rustfmt * chore: rustfmt round * chore: set the same rustfmt config than substrate * chore: fix formatting * cI: remove clippy * ci: switch to nightly for the checks * ci: fix toolchains and naming * ci: Limit the check to formatting * chore: fix formatting * Update .rustfmt.toml * Update .rustfmt.toml Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -72,10 +72,7 @@ pub fn get_chain_spec(id: ParaId) -> ChainSpec {
|
||||
move || {
|
||||
testnet_genesis(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
vec![
|
||||
get_from_seed::<AuraId>("Alice"),
|
||||
get_from_seed::<AuraId>("Bob"),
|
||||
],
|
||||
vec![get_from_seed::<AuraId>("Alice"), get_from_seed::<AuraId>("Bob")],
|
||||
vec![
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
@@ -97,10 +94,7 @@ pub fn get_chain_spec(id: ParaId) -> ChainSpec {
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Extensions {
|
||||
relay_chain: "westend".into(),
|
||||
para_id: id.into(),
|
||||
},
|
||||
Extensions { relay_chain: "westend".into(), para_id: id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -114,10 +108,7 @@ pub fn get_shell_chain_spec(id: ParaId) -> ShellChainSpec {
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Extensions {
|
||||
relay_chain: "westend".into(),
|
||||
para_id: id.into(),
|
||||
},
|
||||
Extensions { relay_chain: "westend".into(), para_id: id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -138,7 +129,7 @@ pub fn staging_test_net(id: ParaId) -> ChainSpec {
|
||||
.unchecked_into(),
|
||||
],
|
||||
vec![
|
||||
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into(),
|
||||
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into()
|
||||
],
|
||||
id,
|
||||
)
|
||||
@@ -147,10 +138,7 @@ pub fn staging_test_net(id: ParaId) -> ChainSpec {
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Extensions {
|
||||
relay_chain: "westend".into(),
|
||||
para_id: id.into(),
|
||||
},
|
||||
Extensions { relay_chain: "westend".into(), para_id: id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -168,17 +156,11 @@ fn testnet_genesis(
|
||||
changes_trie_config: Default::default(),
|
||||
},
|
||||
balances: rococo_parachain_runtime::BalancesConfig {
|
||||
balances: endowed_accounts
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|k| (k, 1 << 60))
|
||||
.collect(),
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
|
||||
},
|
||||
sudo: rococo_parachain_runtime::SudoConfig { key: root_key },
|
||||
parachain_info: rococo_parachain_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
aura: rococo_parachain_runtime::AuraConfig {
|
||||
authorities: initial_authorities,
|
||||
},
|
||||
aura: rococo_parachain_runtime::AuraConfig { authorities: initial_authorities },
|
||||
aura_ext: Default::default(),
|
||||
parachain_system: Default::default(),
|
||||
}
|
||||
@@ -277,10 +259,7 @@ pub fn statemint_development_config(id: ParaId) -> StatemintChainSpec {
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
Extensions {
|
||||
relay_chain: "polkadot-dev".into(),
|
||||
para_id: id.into(),
|
||||
},
|
||||
Extensions { relay_chain: "polkadot-dev".into(), para_id: id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -329,10 +308,7 @@ pub fn statemint_local_config(id: ParaId) -> StatemintChainSpec {
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
Extensions {
|
||||
relay_chain: "polkadot-local".into(),
|
||||
para_id: id.into(),
|
||||
},
|
||||
Extensions { relay_chain: "polkadot-local".into(), para_id: id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -349,11 +325,7 @@ fn statemint_genesis(
|
||||
changes_trie_config: Default::default(),
|
||||
},
|
||||
balances: statemint_runtime::BalancesConfig {
|
||||
balances: endowed_accounts
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|k| (k, STATEMINT_ED * 4096))
|
||||
.collect(),
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, STATEMINT_ED * 4096)).collect(),
|
||||
},
|
||||
parachain_info: statemint_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
collator_selection: statemint_runtime::CollatorSelectionConfig {
|
||||
@@ -413,10 +385,7 @@ pub fn statemine_development_config(id: ParaId) -> StatemineChainSpec {
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
Extensions {
|
||||
relay_chain: "kusama-dev".into(),
|
||||
para_id: id.into(),
|
||||
},
|
||||
Extensions { relay_chain: "kusama-dev".into(), para_id: id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -465,10 +434,7 @@ pub fn statemine_local_config(id: ParaId) -> StatemineChainSpec {
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
Extensions {
|
||||
relay_chain: "kusama-local".into(),
|
||||
para_id: id.into(),
|
||||
},
|
||||
Extensions { relay_chain: "kusama-local".into(), para_id: id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -520,10 +486,7 @@ pub fn statemine_config(id: ParaId) -> StatemineChainSpec {
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
Extensions {
|
||||
relay_chain: "kusama".into(),
|
||||
para_id: id.into(),
|
||||
},
|
||||
Extensions { relay_chain: "kusama".into(), para_id: id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -540,11 +503,7 @@ fn statemine_genesis(
|
||||
changes_trie_config: Default::default(),
|
||||
},
|
||||
balances: statemine_runtime::BalancesConfig {
|
||||
balances: endowed_accounts
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|k| (k, STATEMINE_ED * 4096))
|
||||
.collect(),
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, STATEMINE_ED * 4096)).collect(),
|
||||
},
|
||||
parachain_info: statemine_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
collator_selection: statemine_runtime::CollatorSelectionConfig {
|
||||
@@ -603,10 +562,7 @@ pub fn westmint_development_config(id: ParaId) -> WestmintChainSpec {
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
Extensions {
|
||||
relay_chain: "westend".into(),
|
||||
para_id: id.into(),
|
||||
},
|
||||
Extensions { relay_chain: "westend".into(), para_id: id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -656,10 +612,7 @@ pub fn westmint_local_config(id: ParaId) -> WestmintChainSpec {
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
Extensions {
|
||||
relay_chain: "westend-local".into(),
|
||||
para_id: id.into(),
|
||||
},
|
||||
Extensions { relay_chain: "westend-local".into(), para_id: id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -713,10 +666,7 @@ pub fn westmint_config(id: ParaId) -> WestmintChainSpec {
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
Extensions {
|
||||
relay_chain: "westend".into(),
|
||||
para_id: id.into(),
|
||||
},
|
||||
Extensions { relay_chain: "westend".into(), para_id: id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -734,11 +684,7 @@ fn westmint_genesis(
|
||||
changes_trie_config: Default::default(),
|
||||
},
|
||||
balances: westmint_runtime::BalancesConfig {
|
||||
balances: endowed_accounts
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|k| (k, WESTMINT_ED * 4096))
|
||||
.collect(),
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, WESTMINT_ED * 4096)).collect(),
|
||||
},
|
||||
sudo: westmint_runtime::SudoConfig { key: root_key },
|
||||
parachain_info: westmint_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
|
||||
@@ -132,14 +132,7 @@ impl RelayChainCli {
|
||||
) -> Self {
|
||||
let extension = chain_spec::Extensions::try_get(&*para_config.chain_spec);
|
||||
let chain_id = extension.map(|e| e.relay_chain.clone());
|
||||
let base_path = para_config
|
||||
.base_path
|
||||
.as_ref()
|
||||
.map(|x| x.path().join("polkadot"));
|
||||
Self {
|
||||
base_path,
|
||||
chain_id,
|
||||
base: polkadot_cli::RunCmd::from_iter(relay_chain_args),
|
||||
}
|
||||
let base_path = para_config.base_path.as_ref().map(|x| x.path().join("polkadot"));
|
||||
Self { base_path, chain_id, base: polkadot_cli::RunCmd::from_iter(relay_chain_args) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ fn load_spec(
|
||||
} else {
|
||||
Box::new(chain_spec)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -292,27 +292,27 @@ pub fn run() -> Result<()> {
|
||||
Some(Subcommand::BuildSpec(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
|
||||
}
|
||||
},
|
||||
Some(Subcommand::CheckBlock(cmd)) => {
|
||||
construct_async_run!(|components, cli, cmd, config| {
|
||||
Ok(cmd.run(components.client, components.import_queue))
|
||||
})
|
||||
}
|
||||
},
|
||||
Some(Subcommand::ExportBlocks(cmd)) => {
|
||||
construct_async_run!(|components, cli, cmd, config| {
|
||||
Ok(cmd.run(components.client, config.database))
|
||||
})
|
||||
}
|
||||
},
|
||||
Some(Subcommand::ExportState(cmd)) => {
|
||||
construct_async_run!(|components, cli, cmd, config| {
|
||||
Ok(cmd.run(components.client, config.chain_spec))
|
||||
})
|
||||
}
|
||||
},
|
||||
Some(Subcommand::ImportBlocks(cmd)) => {
|
||||
construct_async_run!(|components, cli, cmd, config| {
|
||||
Ok(cmd.run(components.client, components.import_queue))
|
||||
})
|
||||
}
|
||||
},
|
||||
Some(Subcommand::PurgeChain(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
|
||||
@@ -333,7 +333,7 @@ pub fn run() -> Result<()> {
|
||||
|
||||
cmd.run(config, polkadot_config)
|
||||
})
|
||||
}
|
||||
},
|
||||
Some(Subcommand::Revert(cmd)) => construct_async_run!(|components, cli, cmd, config| {
|
||||
Ok(cmd.run(components.client, components.backend))
|
||||
}),
|
||||
@@ -360,7 +360,7 @@ pub fn run() -> Result<()> {
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
},
|
||||
Some(Subcommand::ExportGenesisWasm(params)) => {
|
||||
let mut builder = sc_cli::LoggerBuilder::new("");
|
||||
builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
|
||||
@@ -381,8 +381,8 @@ pub fn run() -> Result<()> {
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Some(Subcommand::Benchmark(cmd)) => {
|
||||
},
|
||||
Some(Subcommand::Benchmark(cmd)) =>
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
if runner.config().chain_spec.is_statemine() {
|
||||
@@ -398,8 +398,7 @@ pub fn run() -> Result<()> {
|
||||
Err("Benchmarking wasn't enabled when building the node. \
|
||||
You can enable it with `--features runtime-benchmarks`."
|
||||
.into())
|
||||
}
|
||||
}
|
||||
},
|
||||
None => {
|
||||
let runner = cli.create_runner(&cli.run.normalize())?;
|
||||
|
||||
@@ -431,14 +430,7 @@ pub fn run() -> Result<()> {
|
||||
info!("Parachain id: {:?}", id);
|
||||
info!("Parachain Account: {}", parachain_account);
|
||||
info!("Parachain genesis state: {}", genesis_state);
|
||||
info!(
|
||||
"Is collating: {}",
|
||||
if config.role.is_authority() {
|
||||
"yes"
|
||||
} else {
|
||||
"no"
|
||||
}
|
||||
);
|
||||
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
||||
|
||||
if config.chain_spec.is_statemint() {
|
||||
crate::service::start_statemint_node::<
|
||||
@@ -476,7 +468,7 @@ pub fn run() -> Result<()> {
|
||||
.map_err(Into::into)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,11 +537,7 @@ impl CliConfiguration<Self> for RelayChainCli {
|
||||
fn chain_id(&self, is_dev: bool) -> Result<String> {
|
||||
let chain_id = self.base.base.chain_id(is_dev)?;
|
||||
|
||||
Ok(if chain_id.is_empty() {
|
||||
self.chain_id.clone().unwrap_or_default()
|
||||
} else {
|
||||
chain_id
|
||||
})
|
||||
Ok(if chain_id.is_empty() { self.chain_id.clone().unwrap_or_default() } else { chain_id })
|
||||
}
|
||||
|
||||
fn role(&self, is_dev: bool) -> Result<sc_service::Role> {
|
||||
|
||||
@@ -61,20 +61,10 @@ where
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||
|
||||
let mut io = jsonrpc_core::IoHandler::default();
|
||||
let FullDeps {
|
||||
client,
|
||||
pool,
|
||||
deny_unsafe,
|
||||
} = deps;
|
||||
let FullDeps { client, pool, deny_unsafe } = deps;
|
||||
|
||||
io.extend_with(SystemApi::to_delegate(FullSystem::new(
|
||||
client.clone(),
|
||||
pool,
|
||||
deny_unsafe,
|
||||
)));
|
||||
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(
|
||||
client.clone(),
|
||||
)));
|
||||
io.extend_with(SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe)));
|
||||
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client.clone())));
|
||||
|
||||
io
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ where
|
||||
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
|
||||
{
|
||||
if matches!(parachain_config.role, Role::Light) {
|
||||
return Err("Light client not supported!".into());
|
||||
return Err("Light client not supported!".into())
|
||||
}
|
||||
|
||||
let parachain_config = prepare_node_config(parachain_config);
|
||||
@@ -486,7 +486,7 @@ where
|
||||
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
|
||||
{
|
||||
if matches!(parachain_config.role, Role::Light) {
|
||||
return Err("Light client not supported!".into());
|
||||
return Err("Light client not supported!".into())
|
||||
}
|
||||
|
||||
let parachain_config = prepare_node_config(parachain_config);
|
||||
@@ -800,13 +800,7 @@ pub async fn start_shell_node(
|
||||
TFullClient<Block, shell_runtime::RuntimeApi, NativeElseWasmExecutor<ShellRuntimeExecutor>>,
|
||||
>,
|
||||
)> {
|
||||
start_shell_node_impl::<
|
||||
shell_runtime::RuntimeApi,
|
||||
ShellRuntimeExecutor,
|
||||
_,
|
||||
_,
|
||||
_,
|
||||
>(
|
||||
start_shell_node_impl::<shell_runtime::RuntimeApi, ShellRuntimeExecutor, _, _, _>(
|
||||
parachain_config,
|
||||
polkadot_config,
|
||||
id,
|
||||
@@ -832,17 +826,15 @@ pub async fn start_shell_node(
|
||||
let relay_chain_backend = relay_chain_node.backend.clone();
|
||||
let relay_chain_client = relay_chain_node.client.clone();
|
||||
|
||||
Ok(
|
||||
cumulus_client_consensus_relay_chain::build_relay_chain_consensus(
|
||||
cumulus_client_consensus_relay_chain::BuildRelayChainConsensusParams {
|
||||
para_id: id,
|
||||
proposer_factory,
|
||||
block_import: client.clone(),
|
||||
relay_chain_client: relay_chain_node.client.clone(),
|
||||
relay_chain_backend: relay_chain_node.backend.clone(),
|
||||
create_inherent_data_providers:
|
||||
move |_, (relay_parent, validation_data)| {
|
||||
let parachain_inherent =
|
||||
Ok(cumulus_client_consensus_relay_chain::build_relay_chain_consensus(
|
||||
cumulus_client_consensus_relay_chain::BuildRelayChainConsensusParams {
|
||||
para_id: id,
|
||||
proposer_factory,
|
||||
block_import: client.clone(),
|
||||
relay_chain_client: relay_chain_node.client.clone(),
|
||||
relay_chain_backend: relay_chain_node.backend.clone(),
|
||||
create_inherent_data_providers: move |_, (relay_parent, validation_data)| {
|
||||
let parachain_inherent =
|
||||
cumulus_primitives_parachain_inherent::ParachainInherentData::create_at_with_client(
|
||||
relay_parent,
|
||||
&relay_chain_client,
|
||||
@@ -850,19 +842,17 @@ pub async fn start_shell_node(
|
||||
&validation_data,
|
||||
id,
|
||||
);
|
||||
async move {
|
||||
let parachain_inherent =
|
||||
parachain_inherent.ok_or_else(|| {
|
||||
Box::<dyn std::error::Error + Send + Sync>::from(
|
||||
"Failed to create parachain inherent",
|
||||
)
|
||||
})?;
|
||||
Ok(parachain_inherent)
|
||||
}
|
||||
},
|
||||
async move {
|
||||
let parachain_inherent = parachain_inherent.ok_or_else(|| {
|
||||
Box::<dyn std::error::Error + Send + Sync>::from(
|
||||
"Failed to create parachain inherent",
|
||||
)
|
||||
})?;
|
||||
Ok(parachain_inherent)
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
},
|
||||
))
|
||||
},
|
||||
)
|
||||
.await
|
||||
@@ -879,7 +869,7 @@ impl<R> BuildOnAccess<R> {
|
||||
match self {
|
||||
Self::Uninitialized(f) => {
|
||||
*self = Self::Initialized((f.take().unwrap())());
|
||||
}
|
||||
},
|
||||
Self::Initialized(ref mut r) => return r,
|
||||
}
|
||||
}
|
||||
@@ -954,13 +944,7 @@ where
|
||||
async fn verify(
|
||||
&mut self,
|
||||
block_import: BlockImportParams<Block, ()>,
|
||||
) -> Result<
|
||||
(
|
||||
BlockImportParams<Block, ()>,
|
||||
Option<Vec<(CacheKeyId, Vec<u8>)>>,
|
||||
),
|
||||
String,
|
||||
> {
|
||||
) -> Result<(BlockImportParams<Block, ()>, Option<Vec<(CacheKeyId, Vec<u8>)>>), String> {
|
||||
let block_id = BlockId::hash(*block_import.header.parent_hash());
|
||||
|
||||
if self
|
||||
@@ -1036,9 +1020,8 @@ where
|
||||
})) as Box<_>
|
||||
};
|
||||
|
||||
let relay_chain_verifier = Box::new(RelayChainVerifier::new(client.clone(), |_, _| async {
|
||||
Ok(())
|
||||
})) as Box<_>;
|
||||
let relay_chain_verifier =
|
||||
Box::new(RelayChainVerifier::new(client.clone(), |_, _| async { Ok(()) })) as Box<_>;
|
||||
|
||||
let verifier = Verifier {
|
||||
client: client.clone(),
|
||||
|
||||
Reference in New Issue
Block a user