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:
Chevdor
2021-09-16 16:57:52 +02:00
committed by GitHub
parent 035a576008
commit 1dd000a011
98 changed files with 1244 additions and 1872 deletions
+19 -41
View File
@@ -81,12 +81,7 @@ where
) -> Self {
let wait_to_announce = Arc::new(Mutex::new(WaitToAnnounce::new(spawner, announce_block)));
Self {
block_status,
wait_to_announce,
runtime_api,
parachain_consensus,
}
Self { block_status, wait_to_announce, runtime_api, parachain_consensus }
}
/// Checks the status of the given block hash in the Parachain.
@@ -101,7 +96,7 @@ where
"Skipping candidate production, because block is still queued for import.",
);
false
}
},
Ok(BlockStatus::InChainWithState) => true,
Ok(BlockStatus::InChainPruned) => {
tracing::error!(
@@ -110,7 +105,7 @@ where
hash,
);
false
}
},
Ok(BlockStatus::KnownBad) => {
tracing::error!(
target: LOG_TARGET,
@@ -118,7 +113,7 @@ where
"Block is tagged as known bad and is included in the relay chain! Skipping candidate production!",
);
false
}
},
Ok(BlockStatus::Unknown) => {
if header.number().is_zero() {
tracing::error!(
@@ -134,7 +129,7 @@ where
);
}
false
}
},
Err(e) => {
tracing::error!(
target: LOG_TARGET,
@@ -143,7 +138,7 @@ where
"Failed to get block status.",
);
false
}
},
}
}
@@ -168,8 +163,8 @@ where
error = ?e,
"Failed to collect collation info.",
);
return None;
}
return None
},
};
Some(Collation {
@@ -202,13 +197,13 @@ where
error = ?e,
"Could not decode the head data."
);
return None;
}
return None
},
};
let last_head_hash = last_head.hash();
if !self.check_block_status(last_head_hash, &last_head) {
return None;
return None
}
tracing::info!(
@@ -232,8 +227,8 @@ where
Ok(proof) => proof,
Err(e) => {
tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e);
return None;
}
return None
},
};
// Create the parachain block data for the validators.
@@ -252,20 +247,11 @@ where
let (result_sender, signed_stmt_recv) = oneshot::channel();
self.wait_to_announce
.lock()
.wait_to_announce(block_hash, signed_stmt_recv);
self.wait_to_announce.lock().wait_to_announce(block_hash, signed_stmt_recv);
tracing::info!(
target: LOG_TARGET,
?block_hash,
"Produced proof-of-validity candidate.",
);
tracing::info!(target: LOG_TARGET, ?block_hash, "Produced proof-of-validity candidate.",);
Some(CollationResult {
collation,
result_sender: Some(result_sender),
})
Some(CollationResult { collation, result_sender: Some(result_sender) })
}
}
@@ -322,10 +308,7 @@ pub async fn start_collator<Block, RA, BS, Spawner>(
};
overseer_handle
.send_msg(
CollationGenerationMessage::Initialize(config),
"StartCollator",
)
.send_msg(CollationGenerationMessage::Initialize(config), "StartCollator")
.await;
overseer_handle
@@ -384,10 +367,7 @@ mod tests {
.await
.expect("Imports the block");
Some(ParachainCandidate {
block,
proof: proof.expect("Proof is returned"),
})
Some(ParachainCandidate { block, proof: proof.expect("Proof is returned") })
}
}
@@ -424,9 +404,7 @@ mod tests {
spawner,
para_id,
key: CollatorPair::generate().0,
parachain_consensus: Box::new(DummyParachainConsensus {
client: client.clone(),
}),
parachain_consensus: Box::new(DummyParachainConsensus { client: client.clone() }),
});
block_on(collator_start);