Skip to content

Commit

Permalink
feat: add (de)serialize to BalancedBinaryMerkleTree (#5744)
Browse files Browse the repository at this point in the history
Description
---
Add (de)serialize traits to `BalancedBinaryMerkleTree`

Motivation and Context
---
This is needed for caching the `BalancedBinaryMerkleTree` per epoch.

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->
  • Loading branch information
Cifko authored Sep 7, 2023
1 parent a8f6eb5 commit c53ec06
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion base_layer/mmr/src/balanced_binary_merkle_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use std::{convert::TryFrom, marker::PhantomData};

use digest::Digest;
use serde::{Deserialize, Serialize};
use tari_common::DomainDigest;
use thiserror::Error;

Expand All @@ -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<D> {
hashes: Vec<Hash>,
_phantom: PhantomData<D>,
Expand Down

0 comments on commit c53ec06

Please sign in to comment.