Skip to content

Commit

Permalink
zkCert: more readable switch syntax in merkle proof evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
zwilling committed Oct 3, 2024
1 parent 79ef5b9 commit ab11b5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/Galactica-corp/galactica-snap.git"
},
"source": {
"shasum": "IO/CbcUgpiGpLwBqHmMv9wcKcKEYb0vU49++/y3lts4=",
"shasum": "0Ag1aW0b/3d1m5Y9uB8kkSxfiEIdP0scL5VNacsHobs=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
5 changes: 3 additions & 2 deletions packages/zk-certificates/lib/merkleTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ export function getMerkleRootFromProof(
// hash up the tree to the root
for (let i = 0; i < proof.pathElements.length; i++) {
const isNodeOnRight = (proof.leafIndex >> i) % 2 === 1;
const left = isNodeOnRight ? proof.pathElements[i] : currentNode;
const right = isNodeOnRight ? currentNode : proof.pathElements[i];
const [left, right] = isNodeOnRight
? [proof.pathElements[i], currentNode]
: [currentNode, proof.pathElements[i]];
currentNode = dummyTree.calculateNodeHash(left, right);
}
return currentNode;
Expand Down

0 comments on commit ab11b5f

Please sign in to comment.