Skip to content

Commit

Permalink
execution-core: truncate trace logs of ContractBytecode and the Pho…
Browse files Browse the repository at this point in the history
…enix `Transaction::proof` field to remove noise
  • Loading branch information
d-sonuga committed Nov 19, 2024
1 parent e98c343 commit 0f52b5a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
15 changes: 14 additions & 1 deletion execution-core/src/transfer/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl ContractCall {
}
}

#[derive(Debug, Clone, PartialEq, Eq, Archive, Serialize, Deserialize)]
#[derive(Clone, PartialEq, Eq, Archive, Serialize, Deserialize)]
#[archive_attr(derive(CheckBytes))]
/// Holds bytes of bytecode and its hash.
pub struct ContractBytecode {
Expand Down Expand Up @@ -233,3 +233,16 @@ impl ContractBytecode {
Ok(Self { hash, bytes })
}
}

impl core::fmt::Debug for ContractBytecode {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
if f.alternate() {
write!(f, "ContractBytecode {{ ... }}")
} else {
f.debug_struct("ContractBytecode")
.field("hash", &self.hash)
.field("bytes", &self.bytes)
.finish()
}
}
}
19 changes: 18 additions & 1 deletion execution-core/src/transfer/phoenix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl cmp::PartialOrd for NoteLeaf {
pub const TRANSCRIPT_LABEL: &[u8] = b"dusk-network";

/// Phoenix transaction.
#[derive(Debug, Clone, Archive, Serialize, Deserialize)]
#[derive(Clone, Archive, Serialize, Deserialize)]
#[archive_attr(derive(CheckBytes))]
pub struct Transaction {
payload: Payload,
Expand All @@ -93,6 +93,23 @@ impl PartialEq for Transaction {

impl Eq for Transaction {}

impl Debug for Transaction {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
if f.alternate() {
write!(
f,
"Transaction {{ payload: {:#?}, proof: [ ... ] }}",
self.payload
)
} else {
f.debug_struct("Transaction")
.field("payload", &self.payload)
.field("proof", &self.proof)
.finish()
}
}
}

impl Transaction {
/// Create a new phoenix transaction given the sender secret-key, receiver
/// public-key, the input note positions in the transaction tree and the
Expand Down

0 comments on commit 0f52b5a

Please sign in to comment.