mirror of
https://github.com/logos-co/nomos-pocs.git
synced 2025-01-27 17:44:58 +00:00
imt test
This commit is contained in:
parent
f5af878540
commit
720a7f458e
@ -28,9 +28,9 @@ pub fn sparse_root(elems: &BTreeSet<[u8; 32]>) -> [u8; 32] {
|
|||||||
|
|
||||||
fn sparse_root_rec(prefix: u64, elems: &BTreeSet<[u8; 32]>) -> [u8; 32] {
|
fn sparse_root_rec(prefix: u64, elems: &BTreeSet<[u8; 32]>) -> [u8; 32] {
|
||||||
if elems.is_empty() {
|
if elems.is_empty() {
|
||||||
return empty_tree_root(256 - prefix);
|
return empty_tree_root(64 - prefix);
|
||||||
}
|
}
|
||||||
if prefix == 256 {
|
if prefix == 64 {
|
||||||
assert_eq!(elems.len(), 1);
|
assert_eq!(elems.len(), 1);
|
||||||
return PRESENT;
|
return PRESENT;
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ pub fn sparse_path(elem: [u8; 32], elems: &BTreeSet<[u8; 32]>) -> Vec<merkle::Pa
|
|||||||
elem: [u8; 32],
|
elem: [u8; 32],
|
||||||
elems: &BTreeSet<[u8; 32]>,
|
elems: &BTreeSet<[u8; 32]>,
|
||||||
) -> Vec<merkle::PathNode> {
|
) -> Vec<merkle::PathNode> {
|
||||||
if prefix == 256 {
|
if prefix == 64 {
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
}
|
}
|
||||||
// partition the elements
|
// partition the elements
|
||||||
@ -79,7 +79,7 @@ pub fn sparse_path(elem: [u8; 32], elems: &BTreeSet<[u8; 32]>) -> Vec<merkle::Pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn path_key(path: &[merkle::PathNode]) -> [u8; 32] {
|
pub fn path_key(path: &[merkle::PathNode]) -> [u8; 32] {
|
||||||
assert_eq!(path.len(), 256);
|
assert_eq!(path.len(), 64);
|
||||||
|
|
||||||
let mut key = [0u8; 32];
|
let mut key = [0u8; 32];
|
||||||
for byte_i in (0..32).rev() {
|
for byte_i in (0..32).rev() {
|
||||||
|
@ -51,7 +51,7 @@ impl CompactNullifierProofs {
|
|||||||
|
|
||||||
for path in input {
|
for path in input {
|
||||||
let mut path_bits = [0u8; 32];
|
let mut path_bits = [0u8; 32];
|
||||||
assert_eq!(path.len(), 256);
|
assert_eq!(path.len(), 64);
|
||||||
|
|
||||||
for (i, node) in path.iter().enumerate().rev() {
|
for (i, node) in path.iter().enumerate().rev() {
|
||||||
match node {
|
match node {
|
||||||
@ -102,9 +102,9 @@ impl<'a> Iterator for CompactNfIterator {
|
|||||||
|
|
||||||
let path = self.paths.pop().unwrap();
|
let path = self.paths.pop().unwrap();
|
||||||
|
|
||||||
let mut res = Vec::with_capacity(256);
|
let mut res = Vec::with_capacity(64);
|
||||||
|
|
||||||
for i in 0..=255 {
|
for i in 0..=63 {
|
||||||
if get_bit(i, path) {
|
if get_bit(i, path) {
|
||||||
res.push(merkle::PathNode::Right(
|
res.push(merkle::PathNode::Right(
|
||||||
self.siblings[self.siblings.len() - 32..]
|
self.siblings[self.siblings.len() - 32..]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user