From 94a8343be7ea3f936570568e4a65141c00d40f2a Mon Sep 17 00:00:00 2001 From: Tyler Beckman Date: Fri, 25 Oct 2024 22:04:17 -0600 Subject: [PATCH] Remove alloc for extensions --- src/merkle/types.rs | 4 ++-- src/parsing/leaf.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/merkle/types.rs b/src/merkle/types.rs index 30ec508..483a5c1 100644 --- a/src/merkle/types.rs +++ b/src/merkle/types.rs @@ -7,7 +7,7 @@ pub enum Version { V1 = 0 } -pub type CtExtensions = Vec; +pub type CtExtensions<'a> = &'a [u8]; #[repr(u8)] #[non_exhaustive] @@ -16,7 +16,7 @@ pub enum MerkleLeafType<'a> { TimeStampedEntry { timestamp: u64, entry_type: LogEntryType<'a>, - extensions: CtExtensions + extensions: CtExtensions<'a> } = 0 } diff --git a/src/parsing/leaf.rs b/src/parsing/leaf.rs index 535ea26..93c5a2c 100644 --- a/src/parsing/leaf.rs +++ b/src/parsing/leaf.rs @@ -95,14 +95,14 @@ pub fn parse_merkle_tree_leaf( let ( _, // no more to parse - ct_extensions // opaque CtExtensions<0..2^16-1> + extensions // opaque CtExtensions<0..2^16-1> ) = nom::multi::length_data(nom::number::complete::be_u16)(input) .map_err(|e| e.map(|e| LeafParsingError::Nom(e)))?; MerkleLeafType::TimeStampedEntry { timestamp, entry_type, - extensions: ct_extensions.to_vec() + extensions } } _ =>