Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
nullifier_memory_tree.test.cpp File Reference
#include "nullifier_memory_tree.hpp"
#include <gtest/gtest.h>

Go to the source code of this file.

Typedefs

using HashPolicy = PedersenHashPolicy
 
using WrappedLeaf = WrappedNullifierLeaf< HashPolicy >
 

Functions

void print_tree (const size_t depth, std::vector< fr > hashes, std::string const &msg)
 
bool check_hash_path (const fr &root, const fr_hash_path &path, const indexed_nullifier_leaf &leaf_value, const size_t idx)
 
 TEST (crypto_nullifier_tree, test_nullifier_memory)
 
 TEST (crypto_nullifier_tree, test_nullifier_memory_appending_zero)
 
 TEST (crypto_nullifier_tree, test_nullifier_tree)
 

Typedef Documentation

◆ HashPolicy

Definition at line 7 of file nullifier_memory_tree.test.cpp.

◆ WrappedLeaf

Function Documentation

◆ check_hash_path()

bool check_hash_path ( const fr root,
const fr_hash_path path,
const indexed_nullifier_leaf leaf_value,
const size_t  idx 
)

Definition at line 24 of file nullifier_memory_tree.test.cpp.

◆ print_tree()

void print_tree ( const size_t  depth,
std::vector< fr hashes,
std::string const &  msg 
)

Definition at line 10 of file nullifier_memory_tree.test.cpp.

◆ TEST() [1/3]

TEST ( crypto_nullifier_tree  ,
test_nullifier_memory   
)

Intial state:

index 0 1 2 3 4 5 6 7

val 0 0 0 0 0 0 0 0 nextIdx 0 0 0 0 0 0 0 0 nextVal 0 0 0 0 0 0 0 0

Add new value 30:

index 0 1 2 3 4 5 6 7

val 0 30 0 0 0 0 0 0 nextIdx 1 0 0 0 0 0 0 0 nextVal 30 0 0 0 0 0 0 0

Add new value 10:

index 0 1 2 3 4 5 6 7

val 0 30 10 0 0 0 0 0 nextIdx 2 0 1 0 0 0 0 0 nextVal 10 0 30 0 0 0 0 0

Add new value 20:

index 0 1 2 3 4 5 6 7

val 0 30 10 20 0 0 0 0 nextIdx 2 0 3 1 0 0 0 0 nextVal 10 0 20 30 0 0 0 0

Add new value 50:

index 0 1 2 3 4 5 6 7

val 0 30 10 20 50 0 0 0 nextIdx 2 4 3 1 0 0 0 0 nextVal 10 50 20 30 0 0 0 0

Definition at line 41 of file nullifier_memory_tree.test.cpp.

◆ TEST() [2/3]

TEST ( crypto_nullifier_tree  ,
test_nullifier_memory_appending_zero   
)

Intial state:

index 0 1 2 3 4 5 6 7

val 0 0 0 0 0 0 0 0 nextIdx 0 0 0 0 0 0 0 0 nextVal 0 0 0 0 0 0 0 0

Add new value 30:

index 0 1 2 3 4 5 6 7

val 0 30 0 0 0 0 0 0 nextIdx 1 0 0 0 0 0 0 0 nextVal 30 0 0 0 0 0 0 0

Add new value 10:

index 0 1 2 3 4 5 6 7

val 0 30 10 0 0 0 0 0 nextIdx 2 0 1 0 0 0 0 0 nextVal 10 0 30 0 0 0 0 0

Add new value 20:

index 0 1 2 3 4 5 6 7

val 0 30 10 20 0 0 0 0 nextIdx 2 0 3 1 0 0 0 0 nextVal 10 0 20 30 0 0 0 0

Add new value 0:

index 0 1 2 3 4 5 6 7

val 0 30 10 20 0 0 0 0 nextIdx 2 0 3 1 0 0 0 0 nextVal 10 0 20 30 0 0 0 0

Add new value 50:

index 0 1 2 3 4 5 6 7

val 0 30 10 20 0 0 50 0 nextIdx 2 6 3 1 0 0 0 0 nextVal 10 50 20 30 0 0 0 0

Definition at line 175 of file nullifier_memory_tree.test.cpp.

◆ TEST() [3/3]

TEST ( crypto_nullifier_tree  ,
test_nullifier_tree   
)

Definition at line 356 of file nullifier_memory_tree.test.cpp.