From 7333c8d304fe9d7d8725c22c64d1a5f4d06d1371 Mon Sep 17 00:00:00 2001 From: Artem Gureev Date: Tue, 7 Jul 2026 15:58:54 +0000 Subject: [PATCH] refactor(lee_core): expose ciphertext bytes and nullifier byte-array --- lee/state_machine/core/src/encoding.rs | 10 +++++----- lee/state_machine/core/src/nullifier.rs | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lee/state_machine/core/src/encoding.rs b/lee/state_machine/core/src/encoding.rs index 0fe3e08f..124aca8a 100644 --- a/lee/state_machine/core/src/encoding.rs +++ b/lee/state_machine/core/src/encoding.rs @@ -97,11 +97,6 @@ impl NullifierPublicKey { #[cfg(feature = "host")] impl Nullifier { - #[must_use] - pub const fn to_byte_array(&self) -> [u8; 32] { - self.0 - } - #[cfg(feature = "host")] #[must_use] pub const fn from_byte_array(bytes: [u8; 32]) -> Self { @@ -117,6 +112,11 @@ impl Nullifier { } impl Ciphertext { + #[must_use] + pub fn as_bytes(&self) -> &[u8] { + &self.0 + } + /// Serializes the ciphertext to bytes. #[must_use] pub fn to_bytes(&self) -> Vec { diff --git a/lee/state_machine/core/src/nullifier.rs b/lee/state_machine/core/src/nullifier.rs index b7f86289..cae73fd5 100644 --- a/lee/state_machine/core/src/nullifier.rs +++ b/lee/state_machine/core/src/nullifier.rs @@ -117,6 +117,11 @@ impl Nullifier { bytes.extend_from_slice(nullifier_seed); Self(Impl::hash_bytes(&bytes).as_bytes().try_into().unwrap()) } + + #[must_use] + pub const fn to_byte_array(&self) -> [u8; 32] { + self.0 + } } #[cfg(test)]