Diagnostics quality of life improvements (#2375)

* Implement `Debug` manually for CandidateHash

This will make candidate hashes printed consistently without the
`CandidateHash(` and `)` decorations.

* Do not print CompressedPov's guts

It can be overwhelming. Better just use the size.

* Log when candidate is generated

* Print para_id and candidate_hash upon receiving a collation
This commit is contained in:
Sergei Shulepov
2021-02-04 10:02:20 +01:00
committed by GitHub
parent 0cb1ccd122
commit 82a20778fd
4 changed files with 25 additions and 2 deletions
+7 -1
View File
@@ -60,7 +60,7 @@ pub type Hash = sp_core::H256;
/// This type is produced by [`CandidateReceipt::hash`].
///
/// This type makes it easy to enforce that a hash is a candidate hash on the type level.
#[derive(Clone, Copy, Encode, Decode, Hash, Eq, PartialEq, Debug, Default)]
#[derive(Clone, Copy, Encode, Decode, Hash, Eq, PartialEq, Default)]
#[cfg_attr(feature = "std", derive(MallocSizeOf))]
pub struct CandidateHash(pub Hash);
@@ -71,6 +71,12 @@ impl std::fmt::Display for CandidateHash {
}
}
impl sp_std::fmt::Debug for CandidateHash {
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
/// Index of a transaction in the relay chain. 32-bit should be plenty.
pub type Nonce = u32;