Skip to content

Commit 17f95d6

Browse files
authored
fix(storage-proofs): ensure direct parent is first parent input to KDF (#725)
BREAKING CHANGE: The parent order is now inverted in reversed layers.
1 parent 76a7669 commit 17f95d6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

storage-proofs/src/zigzag_graph.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,12 @@ impl<Z: ZigZag> Graph<Z::BaseHasher> for Z {
240240
}
241241
});
242242
assert!(parents.len() == self.degree());
243-
parents.sort();
243+
if self.forward() {
244+
parents.sort();
245+
} else {
246+
// Sort in reverse order.
247+
parents.sort_by(|a, b| a.cmp(b).reverse());
248+
}
244249

245250
assert!(parents.iter().all(|p| if self.forward() {
246251
*p <= raw_node

0 commit comments

Comments
 (0)