diff --git a/.changelog/unreleased/bug-fixes/1272-ed25519-debug.md b/.changelog/unreleased/bug-fixes/1272-ed25519-debug.md new file mode 100644 index 000000000..af8ed5239 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/1272-ed25519-debug.md @@ -0,0 +1,2 @@ +- `[tendermint]` Restore hex-formatting in debug output of Ed25519 keys. + ([#1272](https://github.com/informalsystems/tendermint-rs/pull/1272)) diff --git a/tendermint/src/crypto/ed25519/verification_key.rs b/tendermint/src/crypto/ed25519/verification_key.rs index 52cc49dd2..305614f07 100644 --- a/tendermint/src/crypto/ed25519/verification_key.rs +++ b/tendermint/src/crypto/ed25519/verification_key.rs @@ -1,8 +1,23 @@ use crate::Error; -#[derive(Copy, Clone, Debug, Eq, PartialEq)] +#[derive(Copy, Clone, Eq, PartialEq)] pub struct VerificationKey([u8; 32]); +impl core::fmt::Display for VerificationKey { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + for byte in &self.0 { + write!(f, "{byte:02x}")?; + } + Ok(()) + } +} + +impl core::fmt::Debug for VerificationKey { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + ::fmt(self, f) + } +} + impl VerificationKey { #[allow(dead_code)] pub(super) fn new(bytes: [u8; 32]) -> Self {