feat(rln): improve the PmTreeConfig initialization process with builder pattern (#334)

This commit is contained in:
Vinh Trịnh
2025-09-03 18:54:08 +07:00
committed by GitHub
parent 7c801a804e
commit 0b00c639a0
10 changed files with 250 additions and 97 deletions

View File

@@ -26,6 +26,8 @@ pub enum ZerokitMerkleTreeError {
pub enum FromConfigError {
#[error("Error while reading pmtree config: {0}")]
JsonError(#[from] serde_json::Error),
#[error("Error while creating pmtree config: missing path")]
MissingPath,
#[error("Error while creating pmtree config: path already exists")]
PathExists,
}

View File

@@ -296,7 +296,7 @@ where
*self
.nodes
.get(&(depth, index))
.unwrap_or_else(|| &self.cached_nodes[depth])
.unwrap_or(&self.cached_nodes[depth])
}
/// Computes the hash of a nodes two children at the given depth.