Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeanmichel7 committed Sep 15, 2024
1 parent 540abe2 commit dffa071
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/consensus/src/types/utreexo.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ pub impl UtreexoAccumulatorImpl of UtreexoAccumulator {

// loop until an empty root and compute new root
while r.is_some() {
n = parent_hash(r.unwrap(), n, 0x1_u256.into());
n = parent_hash(r.unwrap(), n, 0x0_u256.into());
new_roots.append(Option::None);
h += 1;
r = *self.roots[h];
};

// add new root to height h
// add new root to height h (first value of type None)
new_roots.append(Option::Some(n));

// add None, which represents the end of the array if we add leaf to the highest one
Expand Down
17 changes: 12 additions & 5 deletions packages/consensus/src/types/utxo_set.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,18 @@ mod tests {

let roots_expected: Span<Option<felt252>> = array![
Option::None,
Option::Some(0x182CC7952C3A9FFC569132479DEA1353B61A3F1727FA391D21AE202BEEC5031),
Option::Some(0x3A3A05E57766C4C828AD2BAA9B072C4CBF679F06486D050F1FB8F2BA16D639D),
Option::Some(0x61FCDD49D86CFF9555F060DA467AB666A965DA7638E3F7FBC38646B93048517),
Option::Some(0x19AC187E0BA46D9CDB30E071F9C4740C1B8D62B5B0AEEFAB0FADEB9EB9C192A),
Option::Some(
3266291267285812862985876738720444888597243351252267460156425855590832498422
),
Option::Some(
1171743829093724370821530169249181419618299705515118573270516601812047158635
),
Option::Some(
1218403717987692271467639051564487079750538922419423154710015035891523073386
),
Option::Some(
3345958802648658086459285943219017599999785567200041442411834865409060453412
),
Option::None,
]
.span();
Expand All @@ -133,4 +141,3 @@ mod tests {
assert_eq!(utxo_set.utreexo_state.num_leaves, 30);
}
}

0 comments on commit dffa071

Please sign in to comment.