mirror of
https://github.com/semaphore-protocol/semaphore.git
synced 2026-01-13 00:28:00 -05:00
Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c9d1737d3 | ||
|
|
1318b0e74b | ||
|
|
c0fcc94e82 | ||
|
|
e70ae1151b | ||
|
|
fd38539908 | ||
|
|
8bd45d8c46 | ||
|
|
534e69683a | ||
|
|
a0a3b9380b | ||
|
|
bc9f7df1da | ||
|
|
571ffdab0e | ||
|
|
773696f40c | ||
|
|
f679583498 | ||
|
|
05926d0ef7 | ||
|
|
eef277281d | ||
|
|
b96467f3d4 | ||
|
|
e530412f27 | ||
|
|
4df7693367 | ||
|
|
0ca80ca716 | ||
|
|
ed8141e873 | ||
|
|
0f4aca3ded | ||
|
|
6e2ef756bc | ||
|
|
c2dce437b4 | ||
|
|
8b91d75c6f | ||
|
|
abfcf9f006 | ||
|
|
a2e8f5a15c | ||
|
|
f77df8d98f | ||
|
|
2b9fde2676 | ||
|
|
ac4ddfc6eb | ||
|
|
afae06e8e1 | ||
|
|
4cc6980b55 | ||
|
|
6b04ec0eca | ||
|
|
13a9480165 | ||
|
|
53967a9a3c | ||
|
|
5b92c0a2bc | ||
|
|
31c776ea68 | ||
|
|
8d83d59220 | ||
|
|
9e4fb5376c | ||
|
|
745edb8e92 | ||
|
|
e732992952 | ||
|
|
3fcce15375 | ||
|
|
ebb6731d89 | ||
|
|
0c23acf9cf |
4
.github/pull_request_template.md
vendored
4
.github/pull_request_template.md
vendored
@@ -29,10 +29,12 @@
|
||||
|
||||
<!-- Please check if the PR fulfills these requirements. -->
|
||||
|
||||
- [ ] My code follows the style guidelines of this project
|
||||
- [ ] I have performed a self-review of my code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have run `yarn format` and `yarn lint` without getting any errors
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] New and existing unit tests pass locally with my changes
|
||||
|
||||
> [!IMPORTANT]
|
||||
> We do not accept minor grammatical fixes (e.g., correcting typos, rewording sentences) unless they significantly improve clarity in technical documentation. These contributions, while appreciated, are not a priority for merging. If there is a grammatical error feel free to message the team.
|
||||
|
||||
2
.github/workflows/production.yml
vendored
2
.github/workflows/production.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
run: yarn lint
|
||||
|
||||
test-subgraph:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04 # Context: https://github.com/graphprotocol/graph-tooling/issues/1546#issuecomment-2589680195
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
2
.github/workflows/pull-requests.yml
vendored
2
.github/workflows/pull-requests.yml
vendored
@@ -75,7 +75,7 @@ jobs:
|
||||
run: yarn run eslint ${{ steps.changed-files.outputs.to_lint_all_changed_files }} --ext .cjs,.js,.jsx,.ts,.tsx
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04 # Context: https://github.com/graphprotocol/graph-tooling/issues/1546#issuecomment-2589680195
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -22,7 +22,7 @@ Pull requests are great if you want to add a feature or fix a bug. Here's a quic
|
||||
|
||||
3. Add a test for your change. Only refactoring and documentation changes require no new tests.
|
||||
|
||||
4. Make sure to check out the [Style Guide](/CONTRIBUTING#style-guide) and ensure that your code complies with the rules.
|
||||
4. Make sure to check out the [Style Guide](/CONTRIBUTING.md#style-guide) and ensure that your code complies with the rules.
|
||||
|
||||
5. Make the test pass.
|
||||
|
||||
@@ -30,6 +30,9 @@ Pull requests are great if you want to add a feature or fix a bug. Here's a quic
|
||||
|
||||
7. Push to your fork and submit a pull request on our `main` branch. Please provide us with some explanation of why you made the changes you made. For new features make sure to explain a standard use case to us.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> We do not accept minor grammatical fixes (e.g., correcting typos, rewording sentences) unless they significantly improve clarity in technical documentation. These contributions, while appreciated, are not a priority for merging. If there is a grammatical error feel free to message the team.
|
||||
|
||||
## CI (Github Actions) Tests
|
||||
|
||||
We use GitHub Actions to test each PR before it is merged.
|
||||
|
||||
30
README.md
30
README.md
@@ -275,12 +275,18 @@ Clone this repository:
|
||||
git clone https://github.com/semaphore-protocol/semaphore.git
|
||||
```
|
||||
|
||||
And install the dependencies:
|
||||
Install the dependencies:
|
||||
|
||||
```bash
|
||||
cd semaphore && yarn
|
||||
```
|
||||
|
||||
And build the repository:
|
||||
|
||||
```bash
|
||||
yarn build
|
||||
```
|
||||
|
||||
## 📜 Usage
|
||||
|
||||
Copy the `.env.example` file as `.env`:
|
||||
@@ -367,12 +373,28 @@ The output will be placed on the `docs` folder.
|
||||
|
||||
### Releases
|
||||
|
||||
Bump a new version with:
|
||||
Steps:
|
||||
|
||||
1. Bump a new version with:
|
||||
|
||||
```bash
|
||||
yarn version:bump <version>
|
||||
# e.g. yarn version:bump 2.0.0
|
||||
```
|
||||
|
||||
It will create a commit and a git tag that will need to be pushed on the main branch. A workflow will be triggered and will
|
||||
publish the Semaphore packages on [npm](https://www.npmjs.com/) and release a new version on Github with its changelogs automatically.
|
||||
This step creates a commit and a git tag.
|
||||
|
||||
2. Push the changes to main:
|
||||
|
||||
```bash
|
||||
git push origin main
|
||||
```
|
||||
|
||||
3. Push the new git tag:
|
||||
|
||||
```bash
|
||||
git push origin <version>
|
||||
# e.g. git push origin v2.0.0
|
||||
```
|
||||
|
||||
After pushing the new git tag, a workflow will be triggered to publish the Semaphore packages on [npm](https://www.npmjs.com/) and release a new version on GitHub with its changelogs automatically.
|
||||
|
||||
@@ -390,8 +390,5 @@
|
||||
},
|
||||
"footer.right.connect.link2": {
|
||||
"message": "X (Twitter)"
|
||||
},
|
||||
"footer.copyright": {
|
||||
"message": "Copyright © 2024 Ethereum Foundation"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"message": "Valores públicos"
|
||||
},
|
||||
"section.identities.box2.description": {
|
||||
"message": "Semaphore utiliza la función hash Poseidon para crear el identtity commitment a partir de los valores privados. Los identity commitments se pueden compartir públicamente, de forma similar a las direcciones Ethereum."
|
||||
"message": "Semaphore utiliza la función hash Poseidon para crear el identity commitment a partir de los valores privados. Los identity commitments se pueden compartir públicamente, de forma similar a las direcciones Ethereum."
|
||||
},
|
||||
"section.identities.box3.title": {
|
||||
"message": "Generar identidades"
|
||||
@@ -390,8 +390,5 @@
|
||||
},
|
||||
"footer.right.connect.link2": {
|
||||
"message": "X (Twitter)"
|
||||
},
|
||||
"footer.copyright": {
|
||||
"message": "Copyright © 2024 Ethereum Foundation"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ as well as relevant circuits in
|
||||
which the Semaphore zk-SNARK uses.
|
||||
|
||||
The summary of the audit results can be found
|
||||
[here](https://github.com/appliedzkp/semaphore/tree/master/audit). After three
|
||||
[here](https://github.com/semaphore-protocol/semaphore/blob/main/apps/docs/versioned_docs/version-V1/audit.md). After three
|
||||
rounds of fixes, all security and performance issues were fixed, and the few
|
||||
remaining issues are minor and do not affect security.
|
||||
|
||||
@@ -58,7 +58,7 @@ Hardhat includes the Hardhat Network, a local Ethereum network for development.
|
||||
|
||||
## Install Semaphore packages
|
||||
|
||||
Semaphore provides contracts, JavaScript libraries and an Hardhat plugin for developers building zero-knowledge applications.
|
||||
Semaphore provides contracts, JavaScript libraries and a Hardhat plugin for developers building zero-knowledge applications.
|
||||
|
||||
- `@semaphore-protocol/contracts` provides contracts to manage groups and verify Semaphore proofs on-chain.
|
||||
- JavaScript libraries help developers build zero-knowledge applications.
|
||||
|
||||
@@ -19,7 +19,7 @@ Para utilizar los contratos e interfaces Semaphore en su proyecto, instale el pa
|
||||
|
||||
Semaphore ofrece los siguientes contratos base:
|
||||
|
||||
- [`SemaphoreVerifier.sol`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/contracts/base/SemaphoreVerifier.sol): contiene una función para verificar pruebas Semaphore;
|
||||
- [`SemaphoreVerifier.sol`](https://github.com/semaphore-protocol/semaphore/blob/v3.15.2/packages/contracts/contracts/base/SemaphoreVerifier.sol): contiene una función para verificar pruebas Semaphore;
|
||||
- [`SemaphoreGroups.sol`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/contracts/base/SemaphoreGroups.sol): contiene las funciones para crear grupos y añadir/remover/actualizar miembros.
|
||||
|
||||
Los contratos base están relacionados de forma muy cercana al protocolo.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"@docusaurus/core": "3.5.2",
|
||||
"@docusaurus/preset-classic": "3.5.2",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"@semaphore-protocol/utils": "4.7.0",
|
||||
"@semaphore-protocol/utils": "4.9.2",
|
||||
"@svgr/webpack": "^5.5.0",
|
||||
"clsx": "^1.2.1",
|
||||
"docusaurus-plugin-sass": "^0.2.5",
|
||||
|
||||
@@ -54,11 +54,7 @@ function Footer() {
|
||||
<hr />
|
||||
|
||||
<div>
|
||||
<p>
|
||||
{translate({
|
||||
id: "footer.copyright"
|
||||
})}
|
||||
</p>
|
||||
<p>Copyright © {new Date().getFullYear()} Ethereum Foundation</p>
|
||||
|
||||
<Logo
|
||||
style={{ marginRight: -8 }}
|
||||
|
||||
@@ -12,6 +12,6 @@ as well as relevant circuits in
|
||||
which the Semaphore zk-SNARK uses.
|
||||
|
||||
The summary of the audit results can be found
|
||||
[here](https://github.com/appliedzkp/semaphore/tree/master/audit). After three
|
||||
[here](https://github.com/semaphore-protocol/semaphore/blob/main/apps/docs/versioned_docs/version-V1/audit.md). After three
|
||||
rounds of fixes, all security and performance issues were fixed, and the few
|
||||
remaining issues are minor and do not affect security.
|
||||
|
||||
@@ -121,7 +121,7 @@ authenticity of the signal and prevents front-running attacks.
|
||||
|
||||
## Cryptographic primitives
|
||||
|
||||
Semaphore uses MiMC for the Merkle tree, Pedersen commmitments for the identity
|
||||
Semaphore uses MiMC for the Merkle tree, Pedersen commitments for the identity
|
||||
commitments, Blake2 for the nullifiers hash, and EdDSA for the signature.
|
||||
|
||||
MiMC is a relatively new hash function. We use the recommended MiMC
|
||||
|
||||
@@ -145,7 +145,7 @@ Returns `false` otherwise.
|
||||
|
||||
**`signMsg(privKey: EddsaPrivateKey, msg: SnarkBigInt): EdDSAMiMcSpongeSignature)`**
|
||||
|
||||
Encapsualtes `circomlib.eddsa.signMiMCSponge` to sign a message `msg` using private key `privKey`.
|
||||
Encapsulates `circomlib.eddsa.signMiMCSponge` to sign a message `msg` using private key `privKey`.
|
||||
|
||||
**`verifySignature(msg: SnarkBigInt, signature: EdDSAMiMcSpongeSignature, pubKey: EddsaPublicKey)`: boolean**
|
||||
|
||||
@@ -190,7 +190,7 @@ const genWitness = async (
|
||||
- `circuit` is the output of `genCircuit()`.
|
||||
- `identity` is the `Identity` whose identity commitment you want to prove is
|
||||
in the set of registered identities.
|
||||
- `idCommitments` is an array of registered identity commmitments; i.e. the
|
||||
- `idCommitments` is an array of registered identity commitments; i.e. the
|
||||
leaves of the tree.
|
||||
- `treeDepth` is the number of levels which the Merkle tree used has
|
||||
- `externalNullifier` is the current external nullifier
|
||||
@@ -212,7 +212,7 @@ Only `witness` is essential to generate the proof; the other data is only
|
||||
useful for debugging and additional off-chain checks, such as verifying the
|
||||
signature and the Merkle tree root.
|
||||
|
||||
**`formatForVerifierContract = (proof: SnarkProof, publicSignals: SnarkPublicSignals`**
|
||||
**`formatForVerifierContract = (proof: SnarkProof, publicSignals: SnarkPublicSignals)`**
|
||||
|
||||
Converts the data in `proof` and `publicSignals` to strings and rearranges
|
||||
elements of `proof.pi_b` so that `snarkjs`'s `verifier.sol` will accept it.
|
||||
|
||||
@@ -55,7 +55,7 @@ In sum, Semaphore provides the ability to:
|
||||
### External nullifiers
|
||||
|
||||
Think of an external nullifier as a voting booth where each user may only cast
|
||||
one vote. If they try to cast a second vote a the same booth, that vote is
|
||||
one vote. If they try to cast a second vote at the same booth, that vote is
|
||||
invalid.
|
||||
|
||||
An external nullifier is any 29-byte value. Semaphore always starts with one
|
||||
@@ -89,7 +89,7 @@ An anonymous voting app would be configured differently:
|
||||
| ----------------------------------- | ------------------------ |
|
||||
| The hash of the respondent's answer | The hash of the question |
|
||||
|
||||
This allows any user to vote with an arbitary response (e.g. yes, no, or maybe)
|
||||
This allows any user to vote with an arbitrary response (e.g. yes, no, or maybe)
|
||||
to any question. The user, however, can only vote once per question.
|
||||
|
||||
## About the code
|
||||
|
||||
@@ -9,7 +9,7 @@ Site owners publish _subgraphs_ that expose site data for anyone to query.
|
||||
Semaphore's subgraph allows you to retrieve data from the [`Semaphore.sol`](https://github.com/semaphore-protocol/semaphore/tree/v2.6.1/packages/contracts/Semaphore.sol) smart contract.
|
||||
|
||||
:::tip
|
||||
The Graph protocol uses the [GraphQL](https://graphql.org/) query lanaguage. For examples, see the [GraphQL API documentation](https://thegraph.com/docs/developer/graphql-api). Visit the [subgraph repository](https://github.com/semaphore-protocol/subgraph) to see the list of Semaphore subgraphs.
|
||||
The Graph protocol uses the [GraphQL](https://graphql.org/) query language. For examples, see the [GraphQL API documentation](https://thegraph.com/docs/developer/graphql-api). Visit the [subgraph repository](https://github.com/semaphore-protocol/subgraph) to see the list of Semaphore subgraphs.
|
||||
:::
|
||||
|
||||
## Schema
|
||||
|
||||
@@ -14,7 +14,7 @@ The public [Semaphore identity](#identity) value used in [Semaphore groups](#gro
|
||||
|
||||
## Group
|
||||
|
||||
A group is a [Merkle tree](#merkle-tree) in which each leaf is an [identity commitment](#identity-commitment) for a user. Semaphore uses the [LeanIMT](https://zkkit.pse.dev/classes/_zk_kit_imt.LeanIMT.html) implementation, which is an optimized binary incremental Merkle tree. The tree nodes are calculated using [Poseidon](https://www.poseidon-hash.info).
|
||||
A group is a [Merkle tree](#merkle-tree) in which each leaf is an [identity commitment](#identity-commitment) for a user. Semaphore uses the [LeanIMT](https://zkkit.pse.dev/classes/_zk_kit_lean_imt.LeanIMT.html) implementation, which is an optimized binary incremental Merkle tree. The tree nodes are calculated using [Poseidon](https://www.poseidon-hash.info).
|
||||
|
||||
## Merkle tree
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ To prevent fraud, the owner should keep their private key secret.
|
||||
|
||||
## Install package
|
||||
|
||||
In your code, use the [`@semaphore-protocol/identity`](https://github.com/semaphore-protocol/semaphore/tree/main/packages/identity) package to manage Semaphore identites.
|
||||
In your code, use the [`@semaphore-protocol/identity`](https://github.com/semaphore-protocol/semaphore/tree/main/packages/identity) package to manage Semaphore identities.
|
||||
|
||||
<Tabs
|
||||
defaultValue="npm"
|
||||
|
||||
@@ -79,7 +79,7 @@ const group = new Group(members)
|
||||
|
||||
Each proof requires a [scope](/glossary#scope), on which each user may only generate one valid proof. The scope, together with the user's private key, is used to generate the nullifier, which is the value you can actually use to check whether a proof with that scope has already been generated by that user. In a voting application where double-voting must be prevented, the scope could be the ballot id, or the Merkle root of the group.
|
||||
|
||||
### 4. Generate the anomymous message
|
||||
### 4. Generate the anonymous message
|
||||
|
||||
Finally, you can generate the proof with the anonymous message using the `generateProof` function. For example:
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ slug: /
|
||||
Additionally, it provides a simple mechanism to prevent double-signaling.
|
||||
Use cases include private voting, whistleblowing, anonymous DAOs and mixers.
|
||||
|
||||
For in-depth technical details about Semaphore, refer to the [Semaphore V4 Specification](https://github.com/zkspecs/zkspecs/blob/main/specs/3/README.md).
|
||||
|
||||
## Features
|
||||
|
||||
With Semaphore, you can allow your users to do the following:
|
||||
@@ -33,7 +35,7 @@ Semaphore is designed to be a simple and generic _privacy layer_ for decentraliz
|
||||
|
||||
## About the code
|
||||
|
||||
The core of the protocol is the [circuit logic](https://github.com/semaphore-protocol/semaphore/tree/main/packages/circuits/semaphore.circom).
|
||||
The core of the protocol is the [circuit logic](https://github.com/semaphore-protocol/semaphore/tree/main/packages/circuits/src/semaphore.circom).
|
||||
In addition to circuits,
|
||||
Semaphore provides [Solidity contracts](https://github.com/semaphore-protocol/semaphore/tree/main/packages/contracts)
|
||||
and [JavaScript libraries](https://github.com/semaphore-protocol/semaphore/tree/main#-packages) that allow developers to generate zero-knowledge proofs and verify them with minimal effort.
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
## Networks
|
||||
|
||||
You can access any subgraph supported by Semaphore with the following URL: https://api.studio.thegraph.com/query/14377/semaphore-<network-name>/v4.1.0.
|
||||
You can access any subgraph supported by Semaphore with the following URL: `https://api.studio.thegraph.com/query/14377/semaphore-<network-name>/v4.2.0`.
|
||||
|
||||
Supported networks:
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
"test": "graph test Semaphore -v 0.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@graphprotocol/graph-cli": "0.78.0",
|
||||
"@graphprotocol/graph-ts": "0.35.1",
|
||||
"@graphprotocol/graph-cli": "0.95.0",
|
||||
"@graphprotocol/graph-ts": "0.37.0",
|
||||
"@semaphore-protocol/utils": "workspace:packages/utils"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mustache": "^4.2.2",
|
||||
"matchstick-as": "0.5.0",
|
||||
"@types/mustache": "^4.2.5",
|
||||
"matchstick-as": "0.6.0",
|
||||
"mustache": "^4.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function Build() {
|
||||
url: "https://github.com/semaphore-protocol/boilerplate",
|
||||
details: [
|
||||
"Begin your projects with a ready-to-use example template",
|
||||
"Create identity, join group, send anonmous feedback",
|
||||
"Create identity, join group, send anonymous feedback",
|
||||
"Easily modify to align with specific project goals"
|
||||
]
|
||||
},
|
||||
@@ -133,7 +133,7 @@ export default function Build() {
|
||||
</VStack>
|
||||
</Flex>
|
||||
|
||||
<Box position="relative" w={{ base: "full", xl: "727px" }} h="630" overflow="hidden">
|
||||
<Box position="relative" w={{ base: "full", xl: "727px" }} h="630px" overflow="hidden">
|
||||
<Image
|
||||
src="https://semaphore.cedoor.dev/flower-shadow.jpg"
|
||||
alt=""
|
||||
|
||||
@@ -225,7 +225,7 @@ export default function Home() {
|
||||
<VStack mb="32" spacing="32">
|
||||
<VStack w="full" maxW="1110px">
|
||||
<Heading fontSize={{ base: "30px", md: "44px" }} pb="90px">
|
||||
2024 Roadmap
|
||||
2024-2025 Roadmap
|
||||
</Heading>
|
||||
|
||||
<HStack display={{ base: "none", md: "flex" }} w="full" mt="60px">
|
||||
@@ -287,7 +287,7 @@ export default function Home() {
|
||||
Upcoming Events
|
||||
</Heading>
|
||||
|
||||
<VStack align="left" spacing="10" maxH="600" overflowY="auto">
|
||||
<VStack align="left" spacing="10" maxH="600px" overflowY="auto">
|
||||
{events.map((event) => (
|
||||
<Link href={event.link} key={event.name} isExternal>
|
||||
<VStack align="left">
|
||||
|
||||
@@ -88,7 +88,7 @@ export default function Footer() {
|
||||
</Link>
|
||||
|
||||
<Text fontSize={{ base: "12px", md: "14px" }} color="text.500" pt="2">
|
||||
Copyright © 2024 Ethereum Foundation
|
||||
Copyright © {new Date().getFullYear()} Ethereum Foundation
|
||||
</Text>
|
||||
</VStack>
|
||||
</VStack>
|
||||
|
||||
@@ -40,5 +40,19 @@
|
||||
"date": "2024-01-01",
|
||||
"authors": ["Vivek Bhupatiraju"],
|
||||
"url": "https://vivs.wiki/Semaphore"
|
||||
},
|
||||
{
|
||||
"title": "Getting Started with Semaphore: Building Privacy-Preserving dApps on Ethereum",
|
||||
"minRead": 7,
|
||||
"date": "2024-12-09",
|
||||
"authors": ["glasswing"],
|
||||
"url": "https://mirror.xyz/0xBE98D44c29D179588b7E717Db8898529e5cD770F/5Xlv1jzwJKfKgP-m257kjivBlUIM_cwTzsmpf9F0Su8"
|
||||
},
|
||||
{
|
||||
"title": "Semaphore V4 Specification",
|
||||
"minRead": 10,
|
||||
"date": "2025-03-01",
|
||||
"authors": ["Semaphore Team"],
|
||||
"url": "https://github.com/zkspecs/zkspecs/blob/main/specs/3/README.md"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -10,5 +10,11 @@
|
||||
"date": "Nov 12-15, 2024",
|
||||
"description": "Semaphore team will deliver an in-person talk and run workshops.",
|
||||
"link": "https://devcon.org/en/"
|
||||
},
|
||||
{
|
||||
"name": "ETHIndia",
|
||||
"date": "Dec 6-8, 2024",
|
||||
"description": "Semaphore team will deliver an in-person talk on Semaphore and Bandada.",
|
||||
"link": "https://ethindia.co"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -565,5 +565,15 @@
|
||||
"links": {
|
||||
"github": "https://github.com/evgongora/VeilEscrow"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Obscurus",
|
||||
"categories": ["Voting", "Privacy"],
|
||||
"tagline": "An anonymity layer for Safe Wallet owners, built using Semaphore and Zodiac.",
|
||||
"pse": false,
|
||||
"icon": "",
|
||||
"links": {
|
||||
"github": "https://github.com/quartz-technology/obscurus"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -23,16 +23,24 @@
|
||||
"name": "Support more Testnets/Mainnets",
|
||||
"done": true
|
||||
},
|
||||
{
|
||||
"name": "Documentation improvements",
|
||||
"done": false
|
||||
},
|
||||
{
|
||||
"name": "New Explorer",
|
||||
"done": true
|
||||
},
|
||||
{
|
||||
"name": "Semaphore V4 Specification",
|
||||
"done": true
|
||||
},
|
||||
{
|
||||
"name": "Semaphore Rust Implementation",
|
||||
"done": false
|
||||
},
|
||||
{
|
||||
"name": "RLN extension",
|
||||
"name": "Semaphore Noir Implementation",
|
||||
"done": false
|
||||
},
|
||||
{
|
||||
"name": "Scaling Semaphore with PIR",
|
||||
"done": false
|
||||
}
|
||||
]
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
"scripts": {
|
||||
"build": "yarn build:libraries && yarn build:subgraph && yarn build:website && yarn build:docs",
|
||||
"build:libraries": "yarn workspaces foreach -Apt --no-private run build",
|
||||
"clean:subgraph": "rimraf apps/subgraph/node_modules",
|
||||
"build:subgraph": "yarn clean:subgraph && yarn workspace semaphore-subgraph build:sepolia",
|
||||
"build:subgraph": "yarn workspace semaphore-subgraph build:sepolia",
|
||||
"build:website": "yarn workspace semaphore-website build",
|
||||
"build:docs": "yarn workspace semaphore-docs build",
|
||||
"compile:contracts": "yarn workspace semaphore-contracts compile",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/circuits",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "Semaphore Circom circuits to generate zero-knowledge proofs.",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
|
||||
@@ -56,7 +56,7 @@ template Semaphore(MAX_DEPTH) {
|
||||
// Proof of membership verification.
|
||||
// The Merkle root passed as output must be equal to that calculated within
|
||||
// the circuit through the inputs of the Merkle proof.
|
||||
// See https://github.com/privacy-scaling-explorations/zk-kit/blob/main/packages/circuits/circom/binary-merkle-root.circom
|
||||
// See https://github.com/privacy-scaling-explorations/zk-kit.circom/blob/main/packages/binary-merkle-root/src/binary-merkle-root.circom
|
||||
// to know more about how the 'BinaryMerkleRoot' template works.
|
||||
merkleRoot <== BinaryMerkleRoot(MAX_DEPTH)(identityCommitment, merkleProofLength, merkleProofIndices, merkleProofSiblings);
|
||||
|
||||
|
||||
13
packages/cli-template-contracts-foundry/.editorconfig
Normal file
13
packages/cli-template-contracts-foundry/.editorconfig
Normal file
@@ -0,0 +1,13 @@
|
||||
#root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 120
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
3
packages/cli-template-contracts-foundry/.env.example
Normal file
3
packages/cli-template-contracts-foundry/.env.example
Normal file
@@ -0,0 +1,3 @@
|
||||
SEPOLIA_RPC_URL=
|
||||
PRIVATE_KEY=
|
||||
ETHERSCAN_API_KEY=
|
||||
43
packages/cli-template-contracts-foundry/.gitignore
vendored
Normal file
43
packages/cli-template-contracts-foundry/.gitignore
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
node_modules
|
||||
.env
|
||||
|
||||
# solidity-coverage files
|
||||
/coverage
|
||||
/coverage.json
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
.DS_Store
|
||||
|
||||
# yarn v3
|
||||
.pnp.*
|
||||
.pnp.js
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Foundry artifact
|
||||
cache/
|
||||
out/
|
||||
|
||||
# artifact for deploying on local Anvil node
|
||||
**/31337
|
||||
|
||||
30
packages/cli-template-contracts-foundry/.prettierignore
Normal file
30
packages/cli-template-contracts-foundry/.prettierignore
Normal file
@@ -0,0 +1,30 @@
|
||||
# dependencies
|
||||
node_modules
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
.yarn
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# testing
|
||||
coverage
|
||||
coverage.json
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Foundry artifact
|
||||
cache/
|
||||
out/
|
||||
|
||||
# artifact for deploying on local Anvil node
|
||||
**/31337
|
||||
6
packages/cli-template-contracts-foundry/.prettierrc.json
Normal file
6
packages/cli-template-contracts-foundry/.prettierrc.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"semi": false,
|
||||
"arrowParens": "always",
|
||||
"trailingComma": "none",
|
||||
"plugins": ["prettier-plugin-solidity"]
|
||||
}
|
||||
6
packages/cli-template-contracts-foundry/.solhint.json
Normal file
6
packages/cli-template-contracts-foundry/.solhint.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "solhint:recommended",
|
||||
"rules": {
|
||||
"func-visibility": ["error", { "ignoreConstructors": true }]
|
||||
}
|
||||
}
|
||||
893
packages/cli-template-contracts-foundry/.yarn/releases/yarn-4.1.0.cjs
vendored
Executable file
893
packages/cli-template-contracts-foundry/.yarn/releases/yarn-4.1.0.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
7
packages/cli-template-contracts-foundry/.yarnrc.yml
Normal file
7
packages/cli-template-contracts-foundry/.yarnrc.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
compressionLevel: mixed
|
||||
|
||||
enableGlobalCache: false
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.1.0.cjs
|
||||
113
packages/cli-template-contracts-foundry/README.md
Normal file
113
packages/cli-template-contracts-foundry/README.md
Normal file
@@ -0,0 +1,113 @@
|
||||
# Semaphore Foundry Template
|
||||
|
||||
This project demonstrates a basic Semaphore use case. It comes with a sample contract, a test for that contract and a sample script that deploys that contract.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
This project requires [**Foundry**](https://getfoundry.sh/), and thus a [**Rust environment**](https://www.rust-lang.org/), installed in the machine.
|
||||
|
||||
## Install
|
||||
|
||||
### Install dependencies
|
||||
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Compile contracts
|
||||
|
||||
```bash
|
||||
yarn compile
|
||||
```
|
||||
|
||||
### Test contracts
|
||||
|
||||
```bash
|
||||
yarn test
|
||||
```
|
||||
|
||||
You can also generate a test coverage report:
|
||||
|
||||
```bash
|
||||
yarn test:coverage
|
||||
```
|
||||
|
||||
Or a test gas report:
|
||||
|
||||
```bash
|
||||
yarn test:gas-report
|
||||
```
|
||||
|
||||
You can also start a local [Anvil node](https://book.getfoundry.sh/anvil/) with Semaphore and Feedback contracts deployed on it with:
|
||||
|
||||
```bash
|
||||
yarn dev
|
||||
```
|
||||
|
||||
### Code quality and formatting
|
||||
|
||||
Run [solhint](https://github.com/protofire/solhint) to analyze the code and catch bugs:
|
||||
|
||||
```bash
|
||||
yarn lint
|
||||
```
|
||||
|
||||
Run [Prettier](https://prettier.io/) to check formatting rules:
|
||||
|
||||
```bash
|
||||
yarn prettier
|
||||
```
|
||||
|
||||
Or to automatically format the code:
|
||||
|
||||
```bash
|
||||
yarn prettier:write
|
||||
```
|
||||
|
||||
### Integrating with Semaphore Boilerplate
|
||||
|
||||
You can also integrate this project with [Semaphore Boilerplate](https://github.com/semaphore-protocol/boilerplate), using this project as the contract end and connecting with Boilerplate front end.
|
||||
|
||||
1. In `cli-template-contracts-foundry` package directory, run:
|
||||
|
||||
```sh
|
||||
yarn install
|
||||
yarn dev
|
||||
```
|
||||
|
||||
After running `yarn dev`, notice the output of
|
||||
|
||||
```sh
|
||||
# ...
|
||||
# ...
|
||||
|
||||
== Return ==
|
||||
feedbackAddr: address 0x6f1AFCA8BCA87bF02091AF6187a5002802f9FB31
|
||||
semaphoreAddr: address 0xb730ce6CAE3FB706e83E4E00dFA31623966570eB
|
||||
semaphoreVerifierAddr: address 0xE2c114f548bEf410eaCe04D0390b61cc963df295
|
||||
|
||||
# ...
|
||||
# ...
|
||||
```
|
||||
|
||||
2. Now, with another terminal, clone Semaphore Boilerplate down:
|
||||
|
||||
```sh
|
||||
# Clone Semaphore boilerplate and build dependencies
|
||||
git clone https://github.com/semaphore-protocol/boilerplate.git
|
||||
cd boilerplate
|
||||
yarn install
|
||||
|
||||
# Use the sample .env.example
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
3. Open the file `apps/web-app/.env.development`. Modify the values of `NEXT_PUBLIC_FEEDBACK_CONTRACT_ADDRESS` and `NEXT_PUBLIC_SEMAPHORE_CONTRACT_ADDRESS` with **feedbackAddr** and **semaphoreAddr** values shown in step 1.
|
||||
|
||||
4. Run the Boilerplate front end:
|
||||
|
||||
```sh
|
||||
yarn dev:web-app
|
||||
```
|
||||
15
packages/cli-template-contracts-foundry/foundry.toml
Normal file
15
packages/cli-template-contracts-foundry/foundry.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[profile.default]
|
||||
src = "src"
|
||||
out = "out"
|
||||
script = "script"
|
||||
libs = ["node_modules"]
|
||||
allow_paths = ["*", "../.."]
|
||||
|
||||
[rpc_endpoints]
|
||||
anvil = "http://127.0.0.1:8545"
|
||||
# sepolia = "${SEPOLIA_RPC_URL}"
|
||||
|
||||
[etherscan]
|
||||
# sepolia = { key = "${ETHERSCAN_API_KEY}" }
|
||||
|
||||
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
|
||||
45
packages/cli-template-contracts-foundry/package.json
Normal file
45
packages/cli-template-contracts-foundry/package.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-contracts-foundry",
|
||||
"version": "4.9.2",
|
||||
"description": "Semaphore Foundry template.",
|
||||
"license": "Unlicense",
|
||||
"devDependencies": {
|
||||
"@semaphore-protocol/contracts": "4.9.2",
|
||||
"@zk-kit/lean-imt.sol": "2.0.1",
|
||||
"forge-std": "github:foundry-rs/forge-std#v1.9.4",
|
||||
"poseidon-solidity": "0.0.5",
|
||||
"prettier": "^3.2.5",
|
||||
"prettier-plugin-solidity": "^1.3.1",
|
||||
"solhint": "^4.1.1",
|
||||
"wait-on": "^8.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "anvil & (wait-on tcp:8545 && forge script script/DeployFeedback.s.sol --rpc-url anvil --broadcast --sender 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)",
|
||||
"compile": "forge build",
|
||||
"clean": "forge clean",
|
||||
"test": "forge test -vvv",
|
||||
"test:report-gas": "forge test --gas-report",
|
||||
"test:coverage": "forge coverage",
|
||||
"lint": "yarn solhint \"{script,src,test}/**/*.sol\"",
|
||||
"prettier": "prettier -c \"**/*.{json,md,svg,yml,sol}\"",
|
||||
"prettier:write": "prettier -w \"**/*.{json,md,svg,yml,sol}\"",
|
||||
"check": "yarn test & yarn lint & yarn prettier",
|
||||
"prepublish": "tar -czf files.tgz .gitignore .yarn .yarnrc.yml"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"test",
|
||||
"script",
|
||||
"package.json",
|
||||
"foundry.toml",
|
||||
"remappings.txt",
|
||||
"README.md",
|
||||
"files.tgz",
|
||||
".editorconfig",
|
||||
".env.example",
|
||||
".prettierignore",
|
||||
".prettierrc.json",
|
||||
".solhint.json"
|
||||
],
|
||||
"packageManager": "yarn@4.1.0"
|
||||
}
|
||||
4
packages/cli-template-contracts-foundry/remappings.txt
Normal file
4
packages/cli-template-contracts-foundry/remappings.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
@semaphore/contracts/=./node_modules/@semaphore-protocol/contracts/
|
||||
@zk-kit/lean-imt.sol/=./node_modules/@zk-kit/lean-imt.sol/
|
||||
forge-std/=./node_modules/forge-std/src/
|
||||
poseidon-solidity/=./node_modules/poseidon-solidity/
|
||||
@@ -0,0 +1,37 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.23;
|
||||
|
||||
import {Feedback} from "../src/Feedback.sol";
|
||||
import {Semaphore} from "@semaphore/contracts/Semaphore.sol";
|
||||
import {SemaphoreVerifier} from "@semaphore/contracts/base/SemaphoreVerifier.sol";
|
||||
import {ISemaphoreVerifier} from "@semaphore/contracts/interfaces/ISemaphoreVerifier.sol";
|
||||
import {Script} from "forge-std/Script.sol";
|
||||
|
||||
// Passing SALT parameter to use CREATE2 for deterministic contract address
|
||||
bytes32 constant SALT = bytes32(0);
|
||||
|
||||
contract DeployFeedback is Script {
|
||||
function run() external returns (address feedbackAddr, address semaphoreAddr, address semaphoreVerifierAddr) {
|
||||
// Default to use the first test user private key of anvil node
|
||||
uint256 deployerPrivateKey = vm.envOr(
|
||||
"PRIVATE_KEY",
|
||||
uint256(0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80)
|
||||
);
|
||||
|
||||
vm.startBroadcast(deployerPrivateKey);
|
||||
|
||||
// Deploy SemaphoreVerifier
|
||||
SemaphoreVerifier semaphoreVerifierContract = new SemaphoreVerifier{salt: SALT}();
|
||||
semaphoreVerifierAddr = address(semaphoreVerifierContract);
|
||||
|
||||
// Deploy Semaphore
|
||||
Semaphore semaphoreContract = new Semaphore{salt: SALT}(ISemaphoreVerifier(semaphoreVerifierAddr));
|
||||
semaphoreAddr = address(semaphoreContract);
|
||||
|
||||
// Deploy Feedback
|
||||
Feedback feedbackContract = new Feedback{salt: SALT}(semaphoreAddr);
|
||||
feedbackAddr = address(feedbackContract);
|
||||
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
}
|
||||
39
packages/cli-template-contracts-foundry/src/Feedback.sol
Normal file
39
packages/cli-template-contracts-foundry/src/Feedback.sol
Normal file
@@ -0,0 +1,39 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.23;
|
||||
|
||||
import {ISemaphore} from "@semaphore/contracts/interfaces/ISemaphore.sol";
|
||||
|
||||
contract Feedback {
|
||||
ISemaphore public semaphore;
|
||||
|
||||
uint256 public groupId;
|
||||
|
||||
constructor(address semaphoreAddress) {
|
||||
semaphore = ISemaphore(semaphoreAddress);
|
||||
|
||||
groupId = semaphore.createGroup();
|
||||
}
|
||||
|
||||
function joinGroup(uint256 identityCommitment) external {
|
||||
semaphore.addMember(groupId, identityCommitment);
|
||||
}
|
||||
|
||||
function sendFeedback(
|
||||
uint256 merkleTreeDepth,
|
||||
uint256 merkleTreeRoot,
|
||||
uint256 nullifier,
|
||||
uint256 feedback,
|
||||
uint256[8] calldata points
|
||||
) external {
|
||||
ISemaphore.SemaphoreProof memory proof = ISemaphore.SemaphoreProof(
|
||||
merkleTreeDepth,
|
||||
merkleTreeRoot,
|
||||
nullifier,
|
||||
feedback,
|
||||
groupId,
|
||||
points
|
||||
);
|
||||
|
||||
semaphore.validateProof(groupId, proof);
|
||||
}
|
||||
}
|
||||
74
packages/cli-template-contracts-foundry/test/Feedback.t.sol
Normal file
74
packages/cli-template-contracts-foundry/test/Feedback.t.sol
Normal file
@@ -0,0 +1,74 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.23;
|
||||
|
||||
import {Test} from "forge-std/Test.sol";
|
||||
import {ISemaphore} from "@semaphore/contracts/interfaces/ISemaphore.sol";
|
||||
import {ISemaphoreGroups} from "@semaphore/contracts/interfaces/ISemaphoreGroups.sol";
|
||||
import {Feedback} from "../src/Feedback.sol";
|
||||
import {DeployFeedback} from "../script/DeployFeedback.s.sol";
|
||||
|
||||
contract FeedbackTest is Test {
|
||||
event MemberAdded(uint256 indexed groupId, uint256 index, uint256 identityCommitment, uint256 merkleTreeRoot);
|
||||
|
||||
Feedback internal feedbackContract;
|
||||
ISemaphore internal semaphoreContract;
|
||||
ISemaphoreGroups internal semaphoreGroups;
|
||||
uint256 internal groupId;
|
||||
|
||||
function setUp() external {
|
||||
DeployFeedback deployFeedback = new DeployFeedback();
|
||||
(address feedbackAddress, address semaphoreAddress, ) = deployFeedback.run();
|
||||
feedbackContract = Feedback(feedbackAddress);
|
||||
semaphoreContract = ISemaphore(semaphoreAddress);
|
||||
semaphoreGroups = ISemaphoreGroups(semaphoreAddress);
|
||||
groupId = feedbackContract.groupId();
|
||||
}
|
||||
|
||||
function testGroupCreatedInConstructor() public view {
|
||||
uint256 groupCount = semaphoreContract.groupCounter();
|
||||
assertEq(groupCount, 1);
|
||||
}
|
||||
|
||||
function testJoinGroup() public {
|
||||
// The commitment below is generated with private key of the first account in Anvil
|
||||
uint256 identityCommitment = 15072455385723004728391568434269917452175057560864330595979104241296826134229;
|
||||
|
||||
// Test: expect an event emitted. Check for all event topics and data
|
||||
vm.expectEmit(true, true, true, true);
|
||||
emit MemberAdded(groupId, 0, identityCommitment, identityCommitment);
|
||||
|
||||
feedbackContract.joinGroup(identityCommitment);
|
||||
}
|
||||
|
||||
function testSendFeedback() public {
|
||||
uint256[] memory commitments = new uint256[](2);
|
||||
commitments[0] = uint256(11005642493773047649202648265396872197147567800455247120861783398111750817516);
|
||||
commitments[1] = uint256(14473821761500463903284857947161896352613497175238126022206384102438097355186);
|
||||
|
||||
for (uint256 i = 0; i < commitments.length; ++i) {
|
||||
feedbackContract.joinGroup(commitments[i]);
|
||||
}
|
||||
|
||||
uint256 merkleTreeDepth = 1;
|
||||
uint256 merkleTreeRoot = semaphoreGroups.getMerkleTreeRoot(groupId);
|
||||
uint256 feedback = uint256(bytes32("Hello World"));
|
||||
|
||||
// These values are computed by running through @semaphore-protocol/circuits
|
||||
uint256 nullifier = 14622092170088252518938850323258916742048811914834592843410744760450844885096;
|
||||
uint256[8] memory points = [
|
||||
2004484873491928515306456072357737929124240734208600886081152392890959117520,
|
||||
21291026142870585364296731900941597996672838511394659364623185352043543529323,
|
||||
4657264777014371046112557309523098953851041383509685591373847255581509612788,
|
||||
6904165961903336246592681066375875983213983935764940579845010085396463328555,
|
||||
1952750241178995674697344628236393389729638396609772141225880353616301956443,
|
||||
106937615136633409337870509099767689510837462832227699340906789167349502398,
|
||||
13080722838047436988558418790480431472161933638137155324683844808531903905810,
|
||||
2547578906197450986657523555784319153413167960139250957065929818900731634820
|
||||
];
|
||||
|
||||
vm.expectEmit(true, true, true, true);
|
||||
emit ISemaphore.ProofValidated(groupId, merkleTreeDepth, merkleTreeRoot, nullifier, feedback, groupId, points);
|
||||
|
||||
feedbackContract.sendFeedback(merkleTreeDepth, merkleTreeRoot, nullifier, feedback, points);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-contracts-hardhat",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "Semaphore Hardhat template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
@@ -16,7 +16,8 @@
|
||||
".prettierrc.json",
|
||||
"hardhat.config.ts",
|
||||
"tsconfig.json",
|
||||
"README.md"
|
||||
"README.md",
|
||||
".solhint.json"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@@ -41,9 +42,9 @@
|
||||
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
|
||||
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
|
||||
"@nomicfoundation/hardhat-verify": "^2.0.0",
|
||||
"@semaphore-protocol/core": "4.7.0",
|
||||
"@semaphore-protocol/hardhat": "4.7.0",
|
||||
"@semaphore-protocol/utils": "4.7.0",
|
||||
"@semaphore-protocol/core": "4.9.2",
|
||||
"@semaphore-protocol/hardhat": "4.9.2",
|
||||
"@semaphore-protocol/utils": "4.9.2",
|
||||
"@typechain/ethers-v6": "^0.5.0",
|
||||
"@typechain/hardhat": "^9.0.0",
|
||||
"@types/chai": "^4.2.0",
|
||||
@@ -59,7 +60,7 @@
|
||||
"eslint-config-airbnb-typescript": "^17.1.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"ethers": "^6.4.0",
|
||||
"ethers": "^6.13.4",
|
||||
"hardhat": "^2.20.1",
|
||||
"hardhat-gas-reporter": "^1.0.8",
|
||||
"prettier": "^3.2.5",
|
||||
@@ -71,7 +72,7 @@
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/contracts": "4.7.0"
|
||||
"@semaphore-protocol/contracts": "4.9.2"
|
||||
},
|
||||
"packageManager": "yarn@4.1.0"
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
|
||||
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
|
||||
"@nomicfoundation/hardhat-verify": "^2.0.0",
|
||||
"@semaphore-protocol/core": "4.7.0",
|
||||
"@semaphore-protocol/hardhat": "4.7.0",
|
||||
"@semaphore-protocol/utils": "4.7.0",
|
||||
"@semaphore-protocol/core": "4.9.2",
|
||||
"@semaphore-protocol/hardhat": "4.9.2",
|
||||
"@semaphore-protocol/utils": "4.9.2",
|
||||
"@typechain/ethers-v6": "^0.5.0",
|
||||
"@typechain/hardhat": "^9.0.0",
|
||||
"@types/chai": "^4.2.0",
|
||||
@@ -38,7 +38,7 @@
|
||||
"eslint-config-airbnb-typescript": "^17.1.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"ethers": "^6.4.0",
|
||||
"ethers": "^6.13.4",
|
||||
"hardhat": "^2.20.1",
|
||||
"hardhat-gas-reporter": "^1.0.8",
|
||||
"prettier": "^3.2.5",
|
||||
@@ -50,7 +50,7 @@
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/contracts": "4.7.0"
|
||||
"@semaphore-protocol/contracts": "4.9.2"
|
||||
},
|
||||
"packageManager": "yarn@4.1.0"
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/core": "4.7.0",
|
||||
"@semaphore-protocol/data": "4.7.0",
|
||||
"@semaphore-protocol/utils": "4.7.0",
|
||||
"ethers": "^6.11.1",
|
||||
"@semaphore-protocol/core": "4.9.2",
|
||||
"@semaphore-protocol/data": "4.9.2",
|
||||
"@semaphore-protocol/utils": "4.9.2",
|
||||
"ethers": "^6.13.4",
|
||||
"next": "14.1.0",
|
||||
"next-pwa": "^5.6.0",
|
||||
"react": "^18",
|
||||
|
||||
@@ -114,7 +114,7 @@ export default function GroupsPage() {
|
||||
</a>{" "}
|
||||
are{" "}
|
||||
<a
|
||||
href="https://zkkit.pse.dev/classes/_zk_kit_imt.LeanIMT.html"
|
||||
href="https://zkkit.pse.dev/classes/_zk_kit_lean_imt.LeanIMT.html"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener nofollow"
|
||||
>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-monorepo-ethers",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "Semaphore Hardhat + Next.js + SemaphoreEthers template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
|
||||
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
|
||||
"@nomicfoundation/hardhat-verify": "^2.0.0",
|
||||
"@semaphore-protocol/core": "4.7.0",
|
||||
"@semaphore-protocol/hardhat": "4.7.0",
|
||||
"@semaphore-protocol/utils": "4.7.0",
|
||||
"@semaphore-protocol/core": "4.9.2",
|
||||
"@semaphore-protocol/hardhat": "4.9.2",
|
||||
"@semaphore-protocol/utils": "4.9.2",
|
||||
"@typechain/ethers-v6": "^0.5.0",
|
||||
"@typechain/hardhat": "^9.0.0",
|
||||
"@types/chai": "^4.2.0",
|
||||
@@ -38,7 +38,7 @@
|
||||
"eslint-config-airbnb-typescript": "^17.1.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"ethers": "^6.4.0",
|
||||
"ethers": "^6.13.4",
|
||||
"hardhat": "^2.20.1",
|
||||
"hardhat-gas-reporter": "^1.0.8",
|
||||
"prettier": "^3.2.5",
|
||||
@@ -50,7 +50,7 @@
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/contracts": "4.7.0"
|
||||
"@semaphore-protocol/contracts": "4.9.2"
|
||||
},
|
||||
"packageManager": "yarn@4.1.0"
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/core": "4.7.0",
|
||||
"@semaphore-protocol/data": "4.7.0",
|
||||
"@semaphore-protocol/utils": "4.7.0",
|
||||
"ethers": "^6.11.1",
|
||||
"@semaphore-protocol/core": "4.9.2",
|
||||
"@semaphore-protocol/data": "4.9.2",
|
||||
"@semaphore-protocol/utils": "4.9.2",
|
||||
"ethers": "^6.13.4",
|
||||
"next": "14.1.0",
|
||||
"next-pwa": "^5.6.0",
|
||||
"react": "^18",
|
||||
|
||||
@@ -114,7 +114,7 @@ export default function GroupsPage() {
|
||||
</a>{" "}
|
||||
are{" "}
|
||||
<a
|
||||
href="https://zkkit.pse.dev/classes/_zk_kit_imt.LeanIMT.html"
|
||||
href="https://zkkit.pse.dev/classes/_zk_kit_lean_imt.LeanIMT.html"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener nofollow"
|
||||
>
|
||||
|
||||
@@ -90,7 +90,7 @@ export default function GroupsPage() {
|
||||
</a>{" "}
|
||||
are{" "}
|
||||
<a
|
||||
href="https://zkkit.pse.dev/classes/_zk_kit_imt.LeanIMT.html"
|
||||
href="https://zkkit.pse.dev/classes/_zk_kit_lean_imt.LeanIMT.html"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener nofollow"
|
||||
>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-monorepo-subgraph",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "Semaphore Hardhat + Next.js + SemaphoreSubgraph template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli",
|
||||
"type": "module",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "A command line tool to set up your Semaphore project and get group data.",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
@@ -41,8 +41,8 @@
|
||||
"rollup-plugin-cleanup": "^3.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/data": "4.7.0",
|
||||
"@semaphore-protocol/utils": "4.7.0",
|
||||
"@semaphore-protocol/data": "4.9.2",
|
||||
"@semaphore-protocol/utils": "4.9.2",
|
||||
"axios": "^1.6.7",
|
||||
"boxen": "^7.1.1",
|
||||
"chalk": "^5.3.0",
|
||||
|
||||
@@ -32,6 +32,10 @@ const supportedTemplates = [
|
||||
{
|
||||
value: "contracts-hardhat",
|
||||
name: "Hardhat"
|
||||
},
|
||||
{
|
||||
value: "contracts-foundry",
|
||||
name: "Foundry"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/contracts",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "Semaphore contracts to manage groups and broadcast anonymous signals.",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
@@ -30,6 +30,6 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@zk-kit/lean-imt.sol": "2.0.0"
|
||||
"@zk-kit/lean-imt.sol": "2.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"@types/ncp": "^2",
|
||||
"@types/node": "^20.10.7",
|
||||
"chai": "^4.2.0",
|
||||
"ethers": "^6.4.0",
|
||||
"ethers": "^6.13.4",
|
||||
"hardhat": "^2.19.4",
|
||||
"hardhat-gas-reporter": "^1.0.8",
|
||||
"ncp": "^2.0.0",
|
||||
@@ -42,6 +42,6 @@
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@zk-kit/lean-imt.sol": "2.0.0"
|
||||
"@zk-kit/lean-imt.sol": "2.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,9 +463,62 @@ describe("Semaphore", () => {
|
||||
|
||||
const proof = await generateProof(identity, group, message, group.root, merkleTreeDepth)
|
||||
|
||||
return { semaphoreContract, groupId, proof }
|
||||
return { semaphoreContract, groupId, proof, accountAddresses }
|
||||
}
|
||||
|
||||
it("Should insert members,remove member,update member and verifyProof", async () => {
|
||||
const { semaphoreContract, accountAddresses } = await loadFixture(deployValidateProofFixture)
|
||||
|
||||
const identity = new Identity("0")
|
||||
const members = Array.from({ length: 3 }, (_, i) => new Identity(i.toString())).map(
|
||||
({ commitment }) => commitment
|
||||
)
|
||||
const group = new Group(members)
|
||||
|
||||
// Create a group and add 3 members.
|
||||
await semaphoreContract["createGroup(address)"](accountAddresses[0])
|
||||
|
||||
const groupId = 2
|
||||
|
||||
// Adding members to group
|
||||
|
||||
await semaphoreContract.addMembers(groupId, members)
|
||||
|
||||
// Remove the third member.
|
||||
{
|
||||
group.removeMember(2)
|
||||
const { siblings } = group.generateMerkleProof(2)
|
||||
|
||||
await semaphoreContract.removeMember(groupId, members[2], siblings)
|
||||
}
|
||||
|
||||
// Update the second member.
|
||||
{
|
||||
group.updateMember(1, members[2])
|
||||
const { siblings } = group.generateMerkleProof(1)
|
||||
|
||||
await semaphoreContract.updateMember(groupId, members[1], members[2], siblings)
|
||||
}
|
||||
|
||||
// Validate a proof.
|
||||
|
||||
const proof = await generateProof(identity, group, 42, group.root)
|
||||
|
||||
const transaction = await semaphoreContract.validateProof(groupId, proof)
|
||||
|
||||
await expect(transaction)
|
||||
.to.emit(semaphoreContract, "ProofValidated")
|
||||
.withArgs(
|
||||
groupId,
|
||||
proof.merkleTreeDepth,
|
||||
proof.merkleTreeRoot,
|
||||
proof.nullifier,
|
||||
proof.message,
|
||||
proof.merkleTreeRoot,
|
||||
proof.points
|
||||
)
|
||||
})
|
||||
|
||||
it("Should throw an exception if the proof is not valid", async () => {
|
||||
const { semaphoreContract, groupId, proof } = await loadFixture(deployValidateProofFixture)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/core",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "Core library for the essential Semaphore features.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -42,8 +42,8 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/group": "4.7.0",
|
||||
"@semaphore-protocol/identity": "4.7.0",
|
||||
"@semaphore-protocol/proof": "4.7.0"
|
||||
"@semaphore-protocol/group": "4.9.2",
|
||||
"@semaphore-protocol/identity": "4.9.2",
|
||||
"@semaphore-protocol/proof": "4.9.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/data",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "A library for querying Semaphore smart contract.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -37,8 +37,9 @@
|
||||
"rollup-plugin-cleanup": "^3.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/utils": "4.7.0",
|
||||
"@semaphore-protocol/utils": "4.9.2",
|
||||
"@zk-kit/utils": "1.3.0",
|
||||
"axios": "1.6.6",
|
||||
"ethers": "6.11.0"
|
||||
"ethers": "6.13.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* Validates the type of a given parameter against an expected type.
|
||||
* Throws a {@link TypeError} if the validation fails.
|
||||
* This function is useful for ensuring that function arguments conform to expected types at runtime.
|
||||
* @param value The value of the parameter to check.
|
||||
* @param name The name of the parameter, used in the error message for easier debugging.
|
||||
* @param type The expected JavaScript type as a string (e.g., 'string', 'number', 'object').
|
||||
* @throws {TypeError} Throws an error if the type of `value` does not match the `type`.
|
||||
*/
|
||||
export default function checkParameter(value: any, name: string, type: string) {
|
||||
if (typeof value !== type) {
|
||||
throw new TypeError(`Parameter '${name}' is not ${type === "object" ? "an" : "a"} ${type}`)
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
Provider
|
||||
} from "ethers/providers"
|
||||
import { SemaphoreABI } from "@semaphore-protocol/utils/constants"
|
||||
import { requireString } from "@zk-kit/utils/error-handlers"
|
||||
import { EthersNetwork, EthersOptions, GroupResponse } from "./types"
|
||||
import checkParameter from "./checkParameter"
|
||||
import getEvents from "./getEvents"
|
||||
|
||||
/**
|
||||
@@ -40,16 +40,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, "networkOrEthereumURL", "string")
|
||||
requireString(networkOrEthereumURL, "networkOrEthereumURL")
|
||||
|
||||
if (options.provider) {
|
||||
checkParameter(options.provider, "provider", "string")
|
||||
requireString(options.provider, "provider")
|
||||
} else if (!networkOrEthereumURL.startsWith("http")) {
|
||||
options.provider = "infura"
|
||||
}
|
||||
|
||||
if (options.apiKey) {
|
||||
checkParameter(options.apiKey, "apiKey", "string")
|
||||
requireString(options.apiKey, "apiKey")
|
||||
}
|
||||
|
||||
if (isSupportedNetwork(networkOrEthereumURL)) {
|
||||
@@ -58,13 +58,13 @@ export default class SemaphoreEthers {
|
||||
options.address ??= address
|
||||
options.startBlock ??= startBlock
|
||||
} else {
|
||||
if (options.address === undefined) {
|
||||
throw new Error(`Network '${networkOrEthereumURL}' needs a Semaphore contract address`)
|
||||
}
|
||||
|
||||
options.startBlock ??= 0
|
||||
}
|
||||
|
||||
if (options.address === undefined) {
|
||||
throw new Error(`Network '${networkOrEthereumURL}' needs a Semaphore contract address`)
|
||||
}
|
||||
|
||||
let provider: Provider
|
||||
|
||||
switch (options.provider) {
|
||||
@@ -140,7 +140,7 @@ export default class SemaphoreEthers {
|
||||
* @returns A promise that resolves to a GroupResponse object.
|
||||
*/
|
||||
async getGroup(groupId: string): Promise<GroupResponse> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
requireString(groupId, "groupId")
|
||||
|
||||
const groupAdmin = await this._contract.getGroupAdmin(groupId)
|
||||
|
||||
@@ -172,7 +172,7 @@ export default class SemaphoreEthers {
|
||||
* @returns A promise that resolves to an array of member identity commitments as strings.
|
||||
*/
|
||||
async getGroupMembers(groupId: string): Promise<string[]> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
requireString(groupId, "groupId")
|
||||
|
||||
const groupAdmin = await this._contract.getGroupAdmin(groupId)
|
||||
|
||||
@@ -257,7 +257,7 @@ export default class SemaphoreEthers {
|
||||
* @returns A promise that resolves to an array of validated proofs.
|
||||
*/
|
||||
async getGroupValidatedProofs(groupId: string): Promise<any> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
requireString(groupId, "groupId")
|
||||
|
||||
const groupAdmin = await this._contract.getGroupAdmin(groupId)
|
||||
|
||||
@@ -290,8 +290,8 @@ export default class SemaphoreEthers {
|
||||
* @returns A promise that resolves to true if the member is part of the group, otherwise false.
|
||||
*/
|
||||
async isGroupMember(groupId: string, member: string): Promise<boolean> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
checkParameter(member, "member", "string")
|
||||
requireString(groupId, "groupId")
|
||||
requireString(member, "member")
|
||||
|
||||
return this._contract.hasMember(groupId, member)
|
||||
}
|
||||
|
||||
@@ -12,5 +12,5 @@ export default function getURL(supportedNetwork: SupportedNetwork): string {
|
||||
throw new TypeError(`Network '${supportedNetwork}' is not supported`)
|
||||
}
|
||||
|
||||
return `https://api.studio.thegraph.com/query/14377/semaphore-${supportedNetwork}/v4.1.0`
|
||||
return `https://api.studio.thegraph.com/query/14377/semaphore-${supportedNetwork}/v4.2.0`
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defaultNetwork, SupportedNetwork } from "@semaphore-protocol/utils/networks"
|
||||
import { AxiosRequestConfig } from "axios"
|
||||
import checkParameter from "./checkParameter"
|
||||
import { requireString, requireObject, requireBoolean } from "@zk-kit/utils/error-handlers"
|
||||
import getURL from "./getURL"
|
||||
import request from "./request"
|
||||
import { GroupOptions, GroupResponse } from "./types"
|
||||
@@ -10,7 +10,7 @@ import { jsDateToGraphqlDate } from "./utils"
|
||||
* The SemaphoreSubgraph class provides an interface to interact with the Semaphore smart contract
|
||||
* via subgraph queries. It enables operations such as retrieving lists of group members and validated proofs,
|
||||
* as well as checking membership within groups.
|
||||
* Each group in Semaphore is represented as a {@link https://zkkit.pse.dev/classes/_zk_kit_imt.LeanIMT.html | LeanIMT}
|
||||
* Each group in Semaphore is represented as a {@link https://zkkit.pse.dev/classes/_zk_kit_lean_imt.LeanIMT.html | LeanIMT}
|
||||
* (Lean Incremental Merkle Tree). This class supports interaction through either a
|
||||
* {@link SupportedNetwork} or a direct URL to the subgraph. The subgraphs themselves are hosted on
|
||||
* {@link https://thegraph.com/ | The Graph} protocol, facilitating efficient and decentralized query processing.
|
||||
@@ -24,7 +24,7 @@ export default class SemaphoreSubgraph {
|
||||
* @param networkOrSubgraphURL Either a supported network identifier or a direct URL to the subgraph.
|
||||
*/
|
||||
constructor(networkOrSubgraphURL: SupportedNetwork | string = defaultNetwork) {
|
||||
checkParameter(networkOrSubgraphURL, "networkOrSubgraphURL", "string")
|
||||
requireString(networkOrSubgraphURL, "networkOrSubgraphURL")
|
||||
|
||||
if (typeof networkOrSubgraphURL === "string" && networkOrSubgraphURL.startsWith("http")) {
|
||||
this._url = networkOrSubgraphURL
|
||||
@@ -73,12 +73,12 @@ export default class SemaphoreSubgraph {
|
||||
* @returns A promise that resolves to an array of group details.
|
||||
*/
|
||||
async getGroups(options: GroupOptions = {}): Promise<GroupResponse[]> {
|
||||
checkParameter(options, "options", "object")
|
||||
requireObject(options, "options")
|
||||
|
||||
const { members = false, validatedProofs = false } = options
|
||||
|
||||
checkParameter(members, "members", "boolean")
|
||||
checkParameter(validatedProofs, "validatedProofs", "boolean")
|
||||
requireBoolean(members, "members")
|
||||
requireBoolean(validatedProofs, "validatedProofs")
|
||||
|
||||
let filtersQuery = ""
|
||||
|
||||
@@ -164,13 +164,13 @@ export default class SemaphoreSubgraph {
|
||||
* @returns A promise that resolves to the details of the specified group.
|
||||
*/
|
||||
async getGroup(groupId: string, options: Omit<GroupOptions, "filters"> = {}): Promise<GroupResponse> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
checkParameter(options, "options", "object")
|
||||
requireString(groupId, "groupId")
|
||||
requireObject(options, "options")
|
||||
|
||||
const { members = false, validatedProofs = false } = options
|
||||
|
||||
checkParameter(members, "members", "boolean")
|
||||
checkParameter(validatedProofs, "validatedProofs", "boolean")
|
||||
requireBoolean(members, "members")
|
||||
requireBoolean(validatedProofs, "validatedProofs")
|
||||
|
||||
const config: AxiosRequestConfig = {
|
||||
method: "post",
|
||||
@@ -247,8 +247,8 @@ export default class SemaphoreSubgraph {
|
||||
* @returns A promise that resolves to true if the member is part of the group, otherwise false.
|
||||
*/
|
||||
async isGroupMember(groupId: string, member: string): Promise<boolean> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
checkParameter(member, "member", "string")
|
||||
requireString(groupId, "groupId")
|
||||
requireString(member, "member")
|
||||
|
||||
const config: AxiosRequestConfig = {
|
||||
method: "post",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/group",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "A library to create and manage Semaphore groups.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -36,8 +36,8 @@
|
||||
"rollup-plugin-cleanup": "^3.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@zk-kit/lean-imt": "2.2.1",
|
||||
"@zk-kit/utils": "1.2.1",
|
||||
"@zk-kit/lean-imt": "2.2.3",
|
||||
"@zk-kit/utils": "1.3.0",
|
||||
"poseidon-lite": "0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { BigNumber } from "@zk-kit/utils"
|
||||
import { poseidon2 } from "poseidon-lite/poseidon2"
|
||||
|
||||
/**
|
||||
* The Semaphore group is a {@link https://zkkit.pse.dev/classes/_zk_kit_imt.LeanIMT.html | LeanIMT}
|
||||
* The Semaphore group is a {@link https://zkkit.pse.dev/classes/_zk_kit_lean_imt.LeanIMT.html | LeanIMT}
|
||||
* (Lean Incremental Merkle Tree), i.e. an optimized version of the incremental binary Merkle tree
|
||||
* used by Semaphore V3. The new tree does not use zero hashes, and its depth is dynamic.
|
||||
* The members of a Semaphore group, or the leaves of a tree, are the identity commitments.
|
||||
@@ -13,7 +13,7 @@ import { poseidon2 } from "poseidon-lite/poseidon2"
|
||||
* generation and verification. Groups can also be exported or imported.
|
||||
*/
|
||||
export class Group {
|
||||
// The {@link https://zkkit.pse.dev/classes/_zk_kit_imt.LeanIMT.html | LeanIMT} instance.
|
||||
// The {@link https://zkkit.pse.dev/classes/_zk_kit_lean_imt.LeanIMT.html | LeanIMT} instance.
|
||||
public leanIMT: LeanIMT
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/hardhat",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "A Hardhat plugin to deploy Semaphore contracts.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -41,8 +41,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@nomicfoundation/hardhat-ethers": "^3.0.0",
|
||||
"@semaphore-protocol/contracts": "4.7.0",
|
||||
"ethers": "^6.4.0",
|
||||
"@semaphore-protocol/contracts": "4.9.2",
|
||||
"ethers": "^6.13.4",
|
||||
"hardhat-dependency-compiler": "^1.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/identity",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "A library to create Semaphore identities.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -39,7 +39,7 @@
|
||||
"dependencies": {
|
||||
"@zk-kit/baby-jubjub": "1.0.3",
|
||||
"@zk-kit/eddsa-poseidon": "1.0.4",
|
||||
"@zk-kit/utils": "1.2.1",
|
||||
"@zk-kit/utils": "1.3.0",
|
||||
"poseidon-lite": "0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/proof",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "A library to generate and verify Semaphore proofs.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -47,14 +47,14 @@
|
||||
"rollup-plugin-cleanup": "^3.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@semaphore-protocol/group": "4.7.0",
|
||||
"@semaphore-protocol/identity": "4.7.0"
|
||||
"@semaphore-protocol/group": "4.9.2",
|
||||
"@semaphore-protocol/identity": "4.9.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/utils": "4.7.0",
|
||||
"@semaphore-protocol/utils": "4.9.2",
|
||||
"@zk-kit/artifacts": "1.8.0",
|
||||
"@zk-kit/utils": "1.2.1",
|
||||
"ethers": "6.10.0",
|
||||
"@zk-kit/utils": "1.3.0",
|
||||
"ethers": "6.13.4",
|
||||
"snarkjs": "0.7.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/utils",
|
||||
"version": "4.7.0",
|
||||
"version": "4.9.2",
|
||||
"description": "A library to provide utility functions to the other Semaphore packages.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -54,6 +54,6 @@
|
||||
"rollup-plugin-cleanup": "^3.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"ethers": "^6.11.1"
|
||||
"ethers": "^6.13.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ const EXCLUDE_PKGS = [
|
||||
"cli-template-contracts-hardhat",
|
||||
"cli-template-monorepo-ethers",
|
||||
"cli-template-monorepo-subgraph",
|
||||
"cli-template-contracts-foundry",
|
||||
"contracts",
|
||||
"core",
|
||||
"hardhat"
|
||||
|
||||
Reference in New Issue
Block a user