Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
🌱 Change SMT prefix for branch and leaf to avoid collision
Browse files Browse the repository at this point in the history
  • Loading branch information
matjazv committed Jul 3, 2023
1 parent b6b6cad commit 0140a0b
Show file tree
Hide file tree
Showing 13 changed files with 408,964 additions and 1,188,736 deletions.
6 changes: 3 additions & 3 deletions src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ pub const KEY_LENGTH: KeyLength = KeyLength(38);
pub const SUBTREE_HEIGHT: SubtreeHeight = SubtreeHeight(SubtreeHeightKind::Four);

/// PREFIX_LEAF_HASH is prefix for creating leaf node hash.
pub static PREFIX_LEAF_HASH: &[u8] = &[0];
/// PREFIX_LEAF_HASH is prefix for creating branch node hash.
pub static PREFIX_BRANCH_HASH: &[u8] = &[1];
pub static PREFIX_LEAF_HASH: &[u8] = "LSK_SMT_LEAF_".as_bytes();
/// PREFIX_BRANCH_HASH is prefix for creating branch node hash.
pub static PREFIX_BRANCH_HASH: &[u8] = "LSK_SMT_BRANCH_".as_bytes();
/// PREFIX_EMPTY is prefix for creating empty node hash.
pub static PREFIX_EMPTY: &[u8] = &[2];

Expand Down
146 changes: 73 additions & 73 deletions src/sparse_merkle_tree/smt.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ mod tests {
assert_eq!(
hash,
vec![
26, 55, 135, 4, 193, 125, 163, 30, 45, 5, 182, 209, 33, 194, 187, 44, 125, 118,
246, 238, 111, 168, 249, 131, 229, 150, 194, 208, 52, 150, 60, 87
13, 157, 251, 50, 147, 45, 246, 174, 239, 91, 126, 237, 131, 44, 249, 225, 119, 7,
82, 147, 24, 27, 96, 163, 25, 188, 216, 203, 38, 66, 203, 78
]
);
}
Expand Down
185,747 changes: 185,747 additions & 0 deletions test/fixtures/fixtures_delete_non_inclusion_proof.json

Large diffs are not rendered by default.

176,108 changes: 176,108 additions & 0 deletions test/fixtures/fixtures_no_delete_inclusion_proof.json

Large diffs are not rendered by default.

2,130 changes: 0 additions & 2,130 deletions test/fixtures/invalid_proof.json

This file was deleted.

44,729 changes: 0 additions & 44,729 deletions test/fixtures/remove_extra_tree.json

This file was deleted.

62,281 changes: 0 additions & 62,281 deletions test/fixtures/remove_tree.json

This file was deleted.

64,920 changes: 46,998 additions & 17,922 deletions test/fixtures/smt_fixtures.json

Large diffs are not rendered by default.

Loading

0 comments on commit 0140a0b

Please sign in to comment.