diff --git a/src/nodes/branch.rs b/src/nodes/branch.rs index 25139d3..96923c9 100644 --- a/src/nodes/branch.rs +++ b/src/nodes/branch.rs @@ -10,7 +10,7 @@ use alloc::vec::Vec; /// A branch node in an Merkle Patricia Trie is a 17-element array consisting of 16 slots that /// correspond to each hexadecimal character and an additional slot for a value. We do exclude /// the node value since all paths have a fixed size. -#[derive(PartialEq, Eq, Default)] +#[derive(PartialEq, Eq, Clone, Default)] pub struct BranchNode { /// The collection of RLP encoded children. pub stack: Vec>, diff --git a/src/nodes/extension.rs b/src/nodes/extension.rs index 0728f77..23df46b 100644 --- a/src/nodes/extension.rs +++ b/src/nodes/extension.rs @@ -13,7 +13,7 @@ use alloc::vec::Vec; /// The purpose of an extension node is to optimize the trie structure by collapsing multiple nodes /// with a single child into one node. This simplification reduces the space and computational /// complexity when performing operations on the trie. -#[derive(PartialEq, Eq)] +#[derive(PartialEq, Eq, Clone)] pub struct ExtensionNode { /// The key for this extension node. pub key: Nibbles, diff --git a/src/nodes/leaf.rs b/src/nodes/leaf.rs index 7fa7104..7510bd0 100644 --- a/src/nodes/leaf.rs +++ b/src/nodes/leaf.rs @@ -13,7 +13,7 @@ use alloc::vec::Vec; /// remaining portion of the key after following the path through the trie, and the value is the /// data associated with the full key. When searching the trie for a specific key, reaching a leaf /// node means that the search has successfully found the value associated with that key. -#[derive(PartialEq, Eq)] +#[derive(PartialEq, Eq, Clone)] pub struct LeafNode { /// The key for this leaf node. pub key: Nibbles, diff --git a/src/nodes/mod.rs b/src/nodes/mod.rs index 7bf29e5..43e45ab 100644 --- a/src/nodes/mod.rs +++ b/src/nodes/mod.rs @@ -22,7 +22,7 @@ pub use leaf::{LeafNode, LeafNodeRef}; pub const CHILD_INDEX_RANGE: Range = 0..16; /// Enum representing an MPT trie node. -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Clone, Debug)] pub enum TrieNode { /// Variant representing a [BranchNode]. Branch(BranchNode),