Skip to content

Commit

Permalink
Update @zk-kit/lean-imt (#2184)
Browse files Browse the repository at this point in the history
Just a cleanliness update while I check for changes in our various
dependencies. Here's the story behind the updated comment, for
posterity:

I originally planned to use 0 as the hash value for PODNull, but decided
against it because LeanIMT behaved badly. Turns out that behavior was a
bug, fixed here:
privacy-scaling-explorations/zk-kit#355

However, the test for that bug points out that people might assume that
0 has special meaning in many situations (including using it to mean
removal from a Merkle tree), so it's still a good idea to use a unique
non-zero value for PODNull's hash. In this PR I've updated the comment
on the related utest to describe the general reasoning, rather than
point to LeanIMT in particular.
  • Loading branch information
artwyman authored Dec 10, 2024
1 parent 11a316d commit 77f5c78
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 38 deletions.
2 changes: 1 addition & 1 deletion packages/lib/pod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dependencies": {
"@pcd/util": "0.9.0",
"@zk-kit/eddsa-poseidon": "^1.1.0",
"@zk-kit/lean-imt": "^2.2.1",
"@zk-kit/lean-imt": "^2.2.2",
"@zk-kit/utils": "^1.2.1",
"js-sha256": "^0.10.1",
"poseidon-lite": "^0.3.0"
Expand Down
6 changes: 4 additions & 2 deletions packages/lib/pod/test/podTypes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ describe("POD type values should be correct", () => {
});

it("POD_NULL_HASH should be nonzero", () => {
// We don't care what its value is, but some other libraries (e.g. LeanIMT)
// use 0 for special purposes, so we avoid it.
// We don't care what its value is, but some libraries or uses of Merkle
// trees may use 0 for special purposes (e.g. to indicate removal, or a
// missing value in an internal datastrcuture), so we avoid it to avoid
// ambiguity.
expect(POD_NULL_HASH).to.not.eq(0n);
});
});
70 changes: 35 additions & 35 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5984,20 +5984,20 @@
"@scure/base" "~1.1.0"

"@semaphore-protocol/core@^4.0.3", "@semaphore-protocol/core@^4.5.0":
version "4.7.2"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/core/-/core-4.7.2.tgz#93fe7f8fc4ed60a2e01a5576c13527d7db45b93b"
integrity sha512-bWec8FK/Z94gYqIj0Elmcizbz9VTfKGG7EHkloi3dXPcAsdcjXO0eRPWru2lpC7XhebpUb6k4Kcq+eWYbJvpLQ==
version "4.5.0"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/core/-/core-4.5.0.tgz#889da9f4f8b7868c80dc8db1f070f5a17e2d7eab"
integrity sha512-DQNLJIS4YGYnkDDtywpLf1gbQLWRhNm3X3dYGxODujApaATYQaPsFo6HHgHycMRIVgxrQwiAzSCAkTR8SNNgRg==
dependencies:
"@semaphore-protocol/group" "4.7.2"
"@semaphore-protocol/identity" "4.7.2"
"@semaphore-protocol/proof" "4.7.2"
"@semaphore-protocol/group" "4.5.0"
"@semaphore-protocol/identity" "4.5.0"
"@semaphore-protocol/proof" "4.5.0"

"@semaphore-protocol/group@4.7.2":
version "4.7.2"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/group/-/group-4.7.2.tgz#c04aecf0e8d132707941e6d4593c94828c163d1f"
integrity sha512-J5dRhAabh1PlsI2w7HyKGOqpwCyXCAYS0jVAvkP6EGbbTsIaTXny9swQU2SmVtowlI71nzBCcH9IPAgt7huoGQ==
"@semaphore-protocol/group@4.5.0":
version "4.5.0"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/group/-/group-4.5.0.tgz#8ce99ae3b558c0a3d85b01bfd3da45107495c573"
integrity sha512-8EKglTaLJ1jyKYtp9QgopyNi5BZ6bSal6qUSHXP0/LThXfbtPyiCTl0UvC9Vg0XZMeZUpu/leRgzKkOSeJ7zMg==
dependencies:
"@zk-kit/lean-imt" "2.2.2"
"@zk-kit/lean-imt" "2.2.1"
"@zk-kit/utils" "1.2.1"
poseidon-lite "0.3.0"

Expand All @@ -6011,10 +6011,10 @@
"@ethersproject/keccak256" "^5.7.0"
"@zk-kit/incremental-merkle-tree" "1.1.0"

"@semaphore-protocol/identity@4.7.2":
version "4.7.2"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/identity/-/identity-4.7.2.tgz#9935a743eb0c2c913514d829e22a2aebea74de75"
integrity sha512-chNxrmlhTQ2peJTYnN4UaFFBYefmo0PUSeo0Wa8GcKC+CfG+uAlPlgZyOU/Pz4sV35UnfRfgqEvcq6tnaN5uFw==
"@semaphore-protocol/identity@4.5.0":
version "4.5.0"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/identity/-/identity-4.5.0.tgz#d5c412eb609df2686b7216825ec88670ef73461b"
integrity sha512-TIKxF2Lir1LppDQDJU6Z/aJUkocHT03BLpzv5vFEdCo/IT4g/4BhbFp2UQui7HyDE+JgMfUASXfScbFfo/5ULA==
dependencies:
"@zk-kit/baby-jubjub" "1.0.3"
"@zk-kit/eddsa-poseidon" "1.0.4"
Expand Down Expand Up @@ -6043,12 +6043,12 @@
"@ethersproject/strings" "^5.6.1"
js-sha512 "^0.8.0"

"@semaphore-protocol/proof@4.7.2":
version "4.7.2"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/proof/-/proof-4.7.2.tgz#89e371eeaf17e1a5a90de5c32645c8f75e519d6b"
integrity sha512-a/7Ad53QS9Z9lHkGrVtK7EHrqglzGXi1kaBn8XE4qCxiYR2CsoLr1tZW2s1UwYCobHFZn5HnNMKTEhR0fTHIew==
"@semaphore-protocol/proof@4.5.0":
version "4.5.0"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/proof/-/proof-4.5.0.tgz#553f0dce3ee967284f1ce3486e16b4cf1a5b123e"
integrity sha512-/95XcIkud+3QOYxw7QB3wAS28EzbYyJsrqwmQgRy02Xk7b9aDvKZGXcdQ/pXMAjXc1D5mTPDOuJwnTtNtzrOcA==
dependencies:
"@semaphore-protocol/utils" "4.7.2"
"@semaphore-protocol/utils" "4.5.0"
"@zk-kit/artifacts" "1.8.0"
"@zk-kit/utils" "1.2.1"
ethers "6.10.0"
Expand All @@ -6067,10 +6067,10 @@
"@zk-kit/incremental-merkle-tree" "0.4.3"
poseidon-lite "^0.2.0"

"@semaphore-protocol/utils@4.7.2":
version "4.7.2"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/utils/-/utils-4.7.2.tgz#89f0201423544c94428d8bfcb225593297842635"
integrity sha512-S7t5aU2qCsyXC3vlDdDEC71RO/udEeTOrD0Sp5FqISvccA89LFkVNZuttVZar8uyKEs+E3FyAhcQs9YlzNoPhQ==
"@semaphore-protocol/utils@4.5.0":
version "4.5.0"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/utils/-/utils-4.5.0.tgz#ccf35cf8590f6f6e49804d612309b8582f0c41d9"
integrity sha512-6dfQZJvS5JFxdcKUYQTcfptoNohylVDWf6ID+mt8T9jtwgJilDCxkCuCul21lDRxfaChTVVvCm0SYsH+wkroZw==
dependencies:
ethers "^6.11.1"

Expand Down Expand Up @@ -8459,14 +8459,14 @@
resolved "https://registry.yarnpkg.com/@zk-kit/incremental-merkle-tree/-/incremental-merkle-tree-1.1.0.tgz#6b0ccce56f9e05ccf73f7ea4fa746d5ef7d24b1d"
integrity sha512-WnNR/GQse3lX8zOHMU8zwhgX8u3qPoul8w4GjJ0WDHq+VGJimo7EGheRZ/ILeBQabnlzAerdv3vBqYBehBeoKA==

"@zk-kit/[email protected]", "@zk-kit/lean-imt@^2.2.1":
"@zk-kit/[email protected]":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@zk-kit/lean-imt/-/lean-imt-2.2.1.tgz#aa24ed3d281cff270013c3654fa1eec6f785ccef"
integrity sha512-Zq5yunUYu+ztp9RR5nuqiG1GpK1wjUoAjC0+x/MB95sI/Ns7zCxpzxo/Om9E0gme74Y3jO9KM5UUh3f9tqU++w==
dependencies:
"@zk-kit/utils" "1.2.1"

"@zk-kit/[email protected]":
"@zk-kit/lean-imt@^2.2.2":
version "2.2.2"
resolved "https://registry.yarnpkg.com/@zk-kit/lean-imt/-/lean-imt-2.2.2.tgz#79c8bd70fc0d444638328cb4781479b14c69a9dd"
integrity sha512-rscIPEgBBcu9vP/DJ3J+3187G/ObKETl343G5enPawNT81oeQSdHx3e2ZapTC+GfrZ/AS2AHHUOpRS1FfdSwjg==
Expand Down Expand Up @@ -18731,9 +18731,9 @@ pretty-ms@^8.0.0:
parse-ms "^3.0.0"

pretty-ms@^9.1.0:
version "9.2.0"
resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-9.2.0.tgz#e14c0aad6493b69ed63114442a84133d7e560ef0"
integrity sha512-4yf0QO/sllf/1zbZWYnvWw3NxCQwLXKzIj0G849LSufP15BXKM0rbD2Z3wVnkMfjdn/CB0Dpp444gYAACdsplg==
version "9.1.0"
resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-9.1.0.tgz#0ad44de6086454f48a168e5abb3c26f8db1b3253"
integrity sha512-o1piW0n3tgKIKCwk2vpM/vOV13zjJzvP37Ioze54YlTHE06m4tjEbzg9WsKkvTuyYln2DHjo5pY4qrZGI0otpw==
dependencies:
parse-ms "^4.0.0"

Expand Down Expand Up @@ -20083,9 +20083,9 @@ seek-bzip@^1.0.5:
commander "^2.8.1"

"semaphore-identity-v4@npm:@semaphore-protocol/identity@^4.0.3":
version "4.7.2"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/identity/-/identity-4.7.2.tgz#9935a743eb0c2c913514d829e22a2aebea74de75"
integrity sha512-chNxrmlhTQ2peJTYnN4UaFFBYefmo0PUSeo0Wa8GcKC+CfG+uAlPlgZyOU/Pz4sV35UnfRfgqEvcq6tnaN5uFw==
version "4.5.0"
resolved "https://registry.yarnpkg.com/@semaphore-protocol/identity/-/identity-4.5.0.tgz#d5c412eb609df2686b7216825ec88670ef73461b"
integrity sha512-TIKxF2Lir1LppDQDJU6Z/aJUkocHT03BLpzv5vFEdCo/IT4g/4BhbFp2UQui7HyDE+JgMfUASXfScbFfo/5ULA==
dependencies:
"@zk-kit/baby-jubjub" "1.0.3"
"@zk-kit/eddsa-poseidon" "1.0.4"
Expand Down Expand Up @@ -21620,9 +21620,9 @@ ts-api-utils@^1.0.1:
integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==

ts-api-utils@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1"
integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==
version "1.4.0"
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.4.0.tgz#709c6f2076e511a81557f3d07a0cbd566ae8195c"
integrity sha512-032cPxaEKwM+GT3vA5JXNzIaizx388rhsSW79vGRNGXfRRAdEAn2mvk36PvK5HnOchyWZ7afLEXqYCvPCrzuzQ==

ts-custom-error@^3.2.0:
version "3.3.1"
Expand Down

0 comments on commit 77f5c78

Please sign in to comment.