Remove max_depth in native MerkleTree (#442)
This simplifies the MerkleTree (and container) API. Defer the max depth check when assigning the witness (merkle proof siblings) to the merkle tree circuit. In this implementation the native Merkle Tree branches grow as much as they needed. There are no checks of max depth in the merkle tree. All keys are 256 bits (I added a debug_assert for this); so in the worst case a path will have depth 256. It can't have a longer depth because the `insert` method calls `prove_nonexistence` which errors if the key already exists; another one may exist which must be different and thus require a path <= 256 depth. Resolve #436
This commit is contained in:
parent
32dc85471d
commit
813a86c670
18 changed files with 266 additions and 462 deletions
|
|
@ -524,13 +524,13 @@ mod tests {
|
|||
)?],
|
||||
);
|
||||
|
||||
let d0 = dict!(32, {
|
||||
let d0 = dict!({
|
||||
"a" => 10,
|
||||
})?;
|
||||
let d1 = dict!(32, {
|
||||
});
|
||||
let d1 = dict!({
|
||||
"b" => 15,
|
||||
"c" => 17,
|
||||
})?;
|
||||
});
|
||||
let custom_statement = Statement::Custom(
|
||||
CustomPredicateRef::new(cust_pred_batch.clone(), 0),
|
||||
vec![Value::from(d0.clone())],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue