diff --git a/execution-core/src/transfer/data.rs b/execution-core/src/transfer/data.rs index 92da9f023..b15b2305b 100644 --- a/execution-core/src/transfer/data.rs +++ b/execution-core/src/transfer/data.rs @@ -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 { @@ -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() + } + } +} diff --git a/execution-core/src/transfer/phoenix.rs b/execution-core/src/transfer/phoenix.rs index 7f8ed4a9c..b4700b911 100644 --- a/execution-core/src/transfer/phoenix.rs +++ b/execution-core/src/transfer/phoenix.rs @@ -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, @@ -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