mirror of https://github.com/zcash/orchard.git
Make `Debug` impl for `Proof` much less verbose
For the default `{:?}` debug formatting we now only print the length of the proof, while `{#?}` continues to print the full byte vector.
This commit is contained in:
parent
5b8690338e
commit
6941fe1109
|
@ -1,5 +1,7 @@
|
||||||
//! The Orchard Action circuit implementation.
|
//! The Orchard Action circuit implementation.
|
||||||
|
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
use group::{Curve, GroupEncoding};
|
use group::{Curve, GroupEncoding};
|
||||||
use halo2_proofs::{
|
use halo2_proofs::{
|
||||||
circuit::{floor_planner, AssignedCell, Layouter},
|
circuit::{floor_planner, AssignedCell, Layouter},
|
||||||
|
@ -818,9 +820,22 @@ impl Instance {
|
||||||
/// A proof of the validity of an Orchard [`Bundle`].
|
/// A proof of the validity of an Orchard [`Bundle`].
|
||||||
///
|
///
|
||||||
/// [`Bundle`]: crate::bundle::Bundle
|
/// [`Bundle`]: crate::bundle::Bundle
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Proof(Vec<u8>);
|
pub struct Proof(Vec<u8>);
|
||||||
|
|
||||||
|
impl fmt::Debug for Proof {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
if f.alternate() {
|
||||||
|
f.debug_tuple("Proof").field(&self.0).finish()
|
||||||
|
} else {
|
||||||
|
// By default, only show the proof length, not its contents.
|
||||||
|
f.debug_tuple("Proof")
|
||||||
|
.field(&format_args!("{} bytes", self.0.len()))
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AsRef<[u8]> for Proof {
|
impl AsRef<[u8]> for Proof {
|
||||||
fn as_ref(&self) -> &[u8] {
|
fn as_ref(&self) -> &[u8] {
|
||||||
&self.0
|
&self.0
|
||||||
|
|
Loading…
Reference in New Issue