chore: update @zk-kit/protocols pkg

Former-commit-id: 286bb4a7b1
This commit is contained in:
cedoor
2022-02-14 13:59:35 +01:00
parent 9944eb3746
commit a6256d2cdb
6 changed files with 13 additions and 12 deletions

View File

@@ -178,9 +178,10 @@ describe("Greeters", function () {
const message = await signers[0].signMessage("Sign this message to create your identity!")
const identity = new ZkIdentity(Strategy.MESSAGE, message)
const identityCommitment = identity.genIdentityCommitment()
const greeting = "Hello world"
const merkleProof = generateMerkleProof(20, BigInt(0), 5, identityCommitments, 0)
const merkleProof = generateMerkleProof(20, BigInt(0), 5, identityCommitments, identityCommitment)
const witness = Semaphore.genWitness(
identity.getTrapdoor(),
identity.getNullifier(),

View File

@@ -46,7 +46,7 @@
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"@zk-kit/identity": "^1.3.1",
"@zk-kit/protocols": "^1.7.0",
"@zk-kit/protocols": "^1.7.1",
"chai": "^4.3.5",
"circomlib": "^2.0.2",
"circomlibjs": "^0.0.8",

View File

@@ -106,7 +106,7 @@ describe("SemaphoreVoting", () => {
const identity = new ZkIdentity(Strategy.MESSAGE, "test")
const identityCommitment = identity.genIdentityCommitment()
const merkleProof = createMerkleProof([identityCommitment, BigInt(1)], 0)
const merkleProof = createMerkleProof([identityCommitment, BigInt(1)], identityCommitment)
const vote = "1"
before(async () => {

View File

@@ -69,7 +69,7 @@ describe("SemaphoreWhistleblowing", () => {
it("Should not remove a whistleblower if the caller is not the editor", async () => {
const identity = new ZkIdentity()
const identityCommitment = identity.genIdentityCommitment()
const { siblings, pathIndices } = createMerkleProof([identityCommitment], 0)
const { siblings, pathIndices } = createMerkleProof([identityCommitment], identityCommitment)
const transaction = contract.removeWhistleblower(entityIds[0], identityCommitment, siblings, pathIndices)
@@ -79,7 +79,7 @@ describe("SemaphoreWhistleblowing", () => {
it("Should romove a whistleblower from an existing entity", async () => {
const identity = new ZkIdentity(Strategy.MESSAGE, "test")
const identityCommitment = identity.genIdentityCommitment()
const { siblings, pathIndices } = createMerkleProof([identityCommitment], 0)
const { siblings, pathIndices } = createMerkleProof([identityCommitment], identityCommitment)
const transaction = contract
.connect(accounts[1])
@@ -101,7 +101,7 @@ describe("SemaphoreWhistleblowing", () => {
const identity = new ZkIdentity(Strategy.MESSAGE, "test")
const identityCommitment = identity.genIdentityCommitment()
const merkleProof = createMerkleProof([identityCommitment, BigInt(1)], 0)
const merkleProof = createMerkleProof([identityCommitment, BigInt(1)], identityCommitment)
const leak = "leak"
before(async () => {

View File

@@ -4,6 +4,6 @@ import { ethers } from "ethers"
export const SnarkScalarField = BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617")
export const TreeZeroNode = BigInt(ethers.utils.solidityKeccak256(["string"], ["Semaphore"])) % SnarkScalarField
export function createMerkleProof(leaves: bigint[], leafIndex: number) {
return generateMerkleProof(20, TreeZeroNode, 5, leaves, leafIndex)
export function createMerkleProof(leaves: bigint[], leaf: bigint) {
return generateMerkleProof(20, TreeZeroNode, 5, leaves, leaf)
}

View File

@@ -1321,10 +1321,10 @@
resolved "https://registry.yarnpkg.com/@zk-kit/incremental-merkle-tree/-/incremental-merkle-tree-0.4.2.tgz#a2ad2f9dd2bde8f33d0c30164798ef09d5ed2248"
integrity sha512-9wB7RzsuH+PErr3gqBIpy339+JRsTcwgFPnGx6XxkAKatDlxlGFcwJV/vFo0rnhDZhQ7GZviScO51pxusurZyQ==
"@zk-kit/protocols@^1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@zk-kit/protocols/-/protocols-1.6.0.tgz#86fc5e6128895f89c4ecffbb4bb2e84aee6e7f82"
integrity sha512-DCWTnrmjvYPYzeM/6ve+RXeRP+CoRnMVwKkAQuNXgsXgUvuX3jIQdyGc2F2Qget2nWSFQmrjhljldeV4gbrtNA==
"@zk-kit/protocols@^1.7.1":
version "1.7.1"
resolved "https://registry.yarnpkg.com/@zk-kit/protocols/-/protocols-1.7.1.tgz#a6a5c2fb40a4ccff84eeec4e470bad03a98f8416"
integrity sha512-no3p9LdXn0CMGYbDSpup9LhYxrrufD8NAtHJ1hGpSwGE0THtQJXZSnVyPIc+fJ/lDrqHxzg1dtD486I5zdD30A==
dependencies:
"@ethersproject/bytes" "^5.5.0"
"@ethersproject/solidity" "^5.5.0"