From c53ec065b6f7893fe1a5d3a3ccde826fa09e438f Mon Sep 17 00:00:00 2001 From: Martin Stefcek <35243812+Cifko@users.noreply.github.com> Date: Thu, 7 Sep 2023 11:12:40 +0200 Subject: [PATCH] feat: add (de)serialize to BalancedBinaryMerkleTree (#5744) Description --- Add (de)serialize traits to `BalancedBinaryMerkleTree` Motivation and Context --- This is needed for caching the `BalancedBinaryMerkleTree` per epoch. Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify --- base_layer/mmr/src/balanced_binary_merkle_tree.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/base_layer/mmr/src/balanced_binary_merkle_tree.rs b/base_layer/mmr/src/balanced_binary_merkle_tree.rs index 1a0880a8d1..e534773189 100644 --- a/base_layer/mmr/src/balanced_binary_merkle_tree.rs +++ b/base_layer/mmr/src/balanced_binary_merkle_tree.rs @@ -23,6 +23,7 @@ use std::{convert::TryFrom, marker::PhantomData}; use digest::Digest; +use serde::{Deserialize, Serialize}; use tari_common::DomainDigest; use thiserror::Error; @@ -46,7 +47,7 @@ pub enum BalancedBinaryMerkleTreeError { // Because this implementation relies on the caller to hash leaf nodes, it is possible to instantiate a tree that is /// susceptible to second-preimage attacks. The caller _must_ ensure that the hashers used to pre-hash leaf nodes and /// instantiate the tree cannot produce collisions. -#[derive(Debug)] +#[derive(Debug, Serialize, Deserialize)] pub struct BalancedBinaryMerkleTree { hashes: Vec, _phantom: PhantomData,