mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 22:47:56 +00:00
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:
@@ -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;
|
||||
|
||||
|
||||
@@ -337,6 +337,14 @@ async fn handle_new_activations<Context: SubsystemContext>(
|
||||
},
|
||||
};
|
||||
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
candidate_hash = %ccr.hash(),
|
||||
?pov_hash,
|
||||
?relay_parent,
|
||||
para_id = %scheduled_core.para_id,
|
||||
"candidate is generated",
|
||||
);
|
||||
metrics.on_collation_generated();
|
||||
|
||||
if let Err(err) = task_sender.send(AllMessages::CollatorProtocol(
|
||||
|
||||
@@ -387,6 +387,9 @@ where
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
%request_id,
|
||||
?para_id,
|
||||
?relay_parent,
|
||||
candidate_hash = ?receipt.hash(),
|
||||
"Received collation",
|
||||
);
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ pub mod v1 {
|
||||
}
|
||||
|
||||
/// SCALE and Zstd encoded [`PoV`].
|
||||
#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq)]
|
||||
#[derive(Clone, Encode, Decode, PartialEq, Eq)]
|
||||
pub struct CompressedPoV(Vec<u8>);
|
||||
|
||||
impl CompressedPoV {
|
||||
@@ -374,6 +374,12 @@ pub mod v1 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for CompressedPoV {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "CompressedPoV({} bytes)", self.0.len())
|
||||
}
|
||||
}
|
||||
|
||||
/// Network messages used by the collator protocol subsystem
|
||||
#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq)]
|
||||
pub enum CollatorProtocolMessage {
|
||||
|
||||
Reference in New Issue
Block a user