-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[add]zk-kit/utils/ #782
base: main
Are you sure you want to change the base?
[add]zk-kit/utils/ #782
Conversation
@@ -9,7 +9,7 @@ | |||
"dirBuild": "./build", | |||
"optimization": 2, | |||
"inspect": true, | |||
"include": ["../../node_modules/circomlib/circuits", "../../node_modules/@zk-kit/binary-merkle-root.circom/src"], | |||
"include": ["../../node_modules/circomlib/circuits", "../../node_modules/@zk-kit/circuits/circom"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"include": ["../../node_modules/circomlib/circuits", "../../node_modules/@zk-kit/circuits/circom"], | |
"include": ["../../node_modules/circomlib/circuits", "../../node_modules/@zk-kit/binary-merkle-root.circom/src"], |
@@ -24,7 +24,7 @@ | |||
"access": "public" | |||
}, | |||
"dependencies": { | |||
"@zk-kit/binary-merkle-root.circom": "1.0.0", | |||
"@zk-kit/circuits": "0.2.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"@zk-kit/circuits": "0.2.4", | |
"@zk-kit/binary-merkle-root.circom": "1.0.0", |
@@ -40,16 +45,16 @@ export default class SemaphoreEthers { | |||
* @param options Configuration options for the ethers provider and the Semaphore contract. | |||
*/ | |||
constructor(networkOrEthereumURL: EthersNetwork | string = defaultNetwork, options: EthersOptions = {}) { | |||
checkParameter(networkOrEthereumURL, "networkOrSubgraphURL", "string") | |||
requireString(networkOrEthereumURL, "networkOrSubgraphURL"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;
is not allowed in this repo. Please, run yarn format:write
to format the code automatically.
|
||
describe("isGroupMember", () => { | ||
it("Should return true because the member is part of the group", async () => { | ||
const semaphore = new SemaphoreEthers() | ||
|
||
const isMember = await semaphore.isGroupMember("42", "1") | ||
|
||
expect(isMember).toBeTruthy() | ||
}) | ||
it("Should return false because the member is not part of the group", async () => { | ||
ContractMocked.mockReturnValueOnce({ | ||
hasMember: () => false | ||
} as any) | ||
|
||
const semaphore = new SemaphoreEthers() | ||
|
||
const isMember = await semaphore.isGroupMember("48", "2") | ||
|
||
expect(isMember).toBeFalsy() | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this test been removed?
|
||
it("Should generate a Semaphore proof without passing the tree depth", async () => { | ||
const group = new Group([1n, 2n, identity.commitment]) | ||
|
||
proof = await generateProof(identity, group, message, scope) | ||
|
||
expect(typeof proof).toBe("object") | ||
expect(BigInt(proof.merkleTreeRoot)).toBe(group.root) | ||
}, 70000) | ||
|
||
it("Should throw an error because snarkArtifacts is not an object", async () => { | ||
const group = new Group([1n, 2n, identity.commitment]) | ||
const fun = () => generateProof(identity, group, message, scope, undefined, "hello" as any) | ||
|
||
await expect(fun).rejects.toThrow("is not an object") | ||
}) | ||
|
||
it("Should throw an error because the message value is incorrect", async () => { | ||
const group = new Group([1n, 2n, identity.commitment]) | ||
|
||
const fun = () => generateProof(identity, group, Number.MAX_VALUE, scope, treeDepth) | ||
|
||
await expect(fun).rejects.toThrow("overflow") | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was to keep when you merged from the main branch.
Description
Add Dependencies about @zk-kit/utils and remplace checkParameters
Feature
dojoengine/book#272
Install @zk-kit/utils if is necessary
Related Issue(s)
Checklist
yarn format
andyarn lint
without getting any errors