orchard: Better Debug impls for some keys
This commit is contained in:
parent
eb68caf14c
commit
db8f9cb81a
|
@ -1523,9 +1523,9 @@ source = "git+https://github.com/zcash/halo2.git?branch=main#b079624ea78b4a07d44
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blake2b_simd",
|
"blake2b_simd",
|
||||||
"crossbeam-utils 0.8.0",
|
"crossbeam-utils 0.8.0",
|
||||||
"ff 0.9.0",
|
"ff",
|
||||||
"funty",
|
"funty",
|
||||||
"group 0.9.0",
|
"group",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
"pasta_curves",
|
"pasta_curves",
|
||||||
"rand 0.8.1",
|
"rand 0.8.1",
|
||||||
|
@ -4448,7 +4448,7 @@ dependencies = [
|
||||||
"fpe",
|
"fpe",
|
||||||
"funty",
|
"funty",
|
||||||
"futures 0.3.14",
|
"futures 0.3.14",
|
||||||
"group 0.9.0",
|
"group",
|
||||||
"halo2",
|
"halo2",
|
||||||
"hex",
|
"hex",
|
||||||
"itertools 0.10.0",
|
"itertools 0.10.0",
|
||||||
|
|
|
@ -862,14 +862,18 @@ pub struct TransmissionKey(pub pallas::Affine);
|
||||||
|
|
||||||
impl fmt::Debug for TransmissionKey {
|
impl fmt::Debug for TransmissionKey {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
// This will panic if the public key is the identity, which is bad news
|
let mut d = f.debug_struct("TransmissionKey");
|
||||||
// bears.
|
|
||||||
let (x, y) = self.0.get_xy().unwrap();
|
|
||||||
|
|
||||||
f.debug_struct("TransmissionKey")
|
match self.0.get_xy().into() {
|
||||||
.field("x", &hex::encode(x.to_bytes()))
|
Some((x, y)) => d
|
||||||
.field("y", &hex::encode(y.to_bytes()))
|
.field("x", &hex::encode(x.to_bytes()))
|
||||||
.finish()
|
.field("y", &hex::encode(y.to_bytes()))
|
||||||
|
.finish(),
|
||||||
|
None => d
|
||||||
|
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
.field("y", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
.finish(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -921,14 +925,18 @@ pub struct EphemeralPublicKey(#[serde(with = "serde_helpers::Affine")] pub palla
|
||||||
|
|
||||||
impl fmt::Debug for EphemeralPublicKey {
|
impl fmt::Debug for EphemeralPublicKey {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
// This will panic if the public key is the identity, which is bad news
|
let mut d = f.debug_struct("EphemeralPublicKey");
|
||||||
// bears.
|
|
||||||
let (x, y) = self.0.get_xy().unwrap();
|
|
||||||
|
|
||||||
f.debug_struct("EphemeralPublicKey")
|
match self.0.get_xy().into() {
|
||||||
.field("x", &hex::encode(x.to_bytes()))
|
Some((x, y)) => d
|
||||||
.field("y", &hex::encode(y.to_bytes()))
|
.field("x", &hex::encode(x.to_bytes()))
|
||||||
.finish()
|
.field("y", &hex::encode(y.to_bytes()))
|
||||||
|
.finish(),
|
||||||
|
None => d
|
||||||
|
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
.field("y", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
.finish(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue