From f6a3d30039a054827c1ffac5abf8a63544f52d88 Mon Sep 17 00:00:00 2001 From: Giacomo Pasini Date: Mon, 23 Dec 2024 17:34:14 +0100 Subject: [PATCH] tmp --- emmarin/cl/cl/src/cl/sparse_merkle.rs | 2 +- emmarin/cl/cl/src/zone_layer/ledger.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/emmarin/cl/cl/src/cl/sparse_merkle.rs b/emmarin/cl/cl/src/cl/sparse_merkle.rs index 0341cbb..7b8bd5e 100644 --- a/emmarin/cl/cl/src/cl/sparse_merkle.rs +++ b/emmarin/cl/cl/src/cl/sparse_merkle.rs @@ -82,7 +82,7 @@ pub fn path_key(path: &[merkle::PathNode]) -> [u8; 32] { assert_eq!(path.len(), 64); let mut key = [0u8; 32]; - for byte_i in (0..32).rev() { + for byte_i in (0..8).rev() { let mut byte = 0u8; for bit_i in 0..8 { byte <<= 1; diff --git a/emmarin/cl/cl/src/zone_layer/ledger.rs b/emmarin/cl/cl/src/zone_layer/ledger.rs index 6ed1257..f9d10d5 100644 --- a/emmarin/cl/cl/src/zone_layer/ledger.rs +++ b/emmarin/cl/cl/src/zone_layer/ledger.rs @@ -37,7 +37,8 @@ impl LedgerWitness { pub fn assert_nf_update(&mut self, nf: &Nullifier, path: &[merkle::PathNode]) { // verify that the path corresponds to the nullifier - assert_eq!(sparse_merkle::path_key(path), nf.0); + let path_key = sparse_merkle::path_key(path); + assert_eq!(path_key[0], 0); // verify that the nullifier was not already present assert_eq!(merkle::path_root(sparse_merkle::ABSENT, path), self.nf_root);