Skip to content

Commit

Permalink
fix: Use pedersen_hash for merkle tree (#3357)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
  • Loading branch information
guipublic and TomAFrench authored Oct 30, 2023
1 parent b9461cb commit 6b74d31
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions noir_stdlib/src/merkle.nr
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ pub fn compute_merkle_root<N>(leaf: Field, index: Field, hash_path: [Field; N])
} else {
(current, hash_path[i])
};
// TODO(Kev): This should be changed to use pedersen_hash
current = crate::hash::pedersen_commitment([hash_left, hash_right])[0];
current = crate::hash::pedersen_hash([hash_left, hash_right]);
};
current
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
old_root = "0x200fbe381993186866de8eb5a9cc33845de6b084be3ff67f6e34d35b8a786157"
old_leaf = "0x1cdcf02431ba623767fe389337d011df1048dcc24b98ed81cec97627bab454a0"
old_root = "0x2131c74af6250d1246797588ff075b672e3d2e6805f9c6b313ade8f6b9e12802"
old_leaf = "0x2df8b940e5890e4e1377e05373fae69a1d754f6935e6a780b666947431f2cdcd"
old_hash_path = [
"0x1cdcf02431ba623767fe389337d011df1048dcc24b98ed81cec97627bab454a0",
"0x0b5e9666e7323ce925c28201a97ddf4144ac9d148448ed6f49f9008719c1b85b",
"0x22ec636f8ad30ef78c42b7fe2be4a4cacf5a445cfb5948224539f59a11d70775",
"0x03542cb720369f19a74fd05b4edfbedb27a78514ad3283f1b3270a1656cced8e",
"0x1278272f6e617666b18c52349c4bbe94249a8ab59add2ee0a142168a92b7ffc2",
"0x2547cfd7699ad1f331fb77b30a3445c6043a4c62b5b1215356b2924607bf937b",
]
new_root = "0x029ead881a6684995190589a67874f188f33a433211df82f56c1351c96530387"
leaf = "0x085ca53be9c9d95b57e6e5fc91c5d531ad9e63e85dd71af7e35562991774b435"
new_root = "0x25e2a8ee5b85e5b546ae27832b9b53f5fae5b371e3e7f8cddda839f41669fc68"
leaf = "0x23fe6c8f2426b793f0f156f57efbecbea52e951af761634a85e80cc1a9fb5003"
index = "0"
mimc_input = [12, 45, 78, 41]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Random test key
priv_key = "0x000000000000000000000000000000000000000000000000000000616c696365"
note_root = "0x0f8cd7b45fbb4e08f63126f1673ce9e574cfbda70f36c2e5182f9e3dbe6524c0"
note_root = "0x02278fc806225cd696bd502049f7bb98624536de56d09343f8a26ac1876b23a0"
index = "0"
note_hash_path = [
"0x1cdcf02431ba623767fe389337d011df1048dcc24b98ed81cec97627bab454a0",
Expand Down

0 comments on commit 6b74d31

Please sign in to comment.