mirror of
https://github.com/0xbow-io/privacy-pools-core.git
synced 2026-01-09 09:27:58 -05:00
chore: update readmes (#57)
This commit is contained in:
@@ -8,18 +8,22 @@ The protocol implements a system of smart contracts and zero-knowledge proofs to
|
||||
|
||||
## Repository Structure
|
||||
|
||||
This is a Yarn workspaces monorepo containing two main packages:
|
||||
This is a Yarn workspaces monorepo containing four packages:
|
||||
|
||||
```
|
||||
├── packages/
|
||||
│ ├── circuits/ # Zero-knowledge circuit implementations
|
||||
│ ├── circuits/ # Zero-knowledge circuits
|
||||
│ └── contracts/ # Smart contract implementations
|
||||
│ └── relayer/ # Minimal relayer implementation
|
||||
│ └── sdk/ # Typescript toolkit
|
||||
```
|
||||
|
||||
See the README in each package for detailed information about their specific implementations:
|
||||
|
||||
- [Circuits Package](./packages/circuits/README.md)
|
||||
- [Contracts Package](./packages/contracts/README.md)
|
||||
- [Relayer Package](./packages/relayer/README.md)
|
||||
- [SDK Package](./packages/sdk/README.md)
|
||||
|
||||
## Development
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "privacy-pool-core",
|
||||
"version": "0.1.0",
|
||||
"description": "Core repository for the Privacy Pool protocol circuits and smart contracts",
|
||||
"description": "Core repository for the Privacy Pool protocol",
|
||||
"repository": "https://github.com/defi-wonderland/privacy-pool-core",
|
||||
"license": "MIT",
|
||||
"author": "Wonderland",
|
||||
@@ -13,12 +13,15 @@
|
||||
"packages/relayer"
|
||||
],
|
||||
"devDependencies": {
|
||||
"prettier": "3.3.3",
|
||||
"@typescript-eslint/eslint-plugin": "7.18.0",
|
||||
"@typescript-eslint/parser": "7.18.0",
|
||||
"eslint": "9.18.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-plugin-prettier": "5.2.1",
|
||||
"prettier": "3.3.3",
|
||||
"typescript-eslint": "8.20.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ts-node": "^10.9.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,19 +14,19 @@ The withdrawal circuit verifies that a user can privately withdraw funds from th
|
||||
- The unique related commitments identifier (label)
|
||||
- A state root and ASP (Association Set Provider) root
|
||||
- A proof of inclusion in the state tree
|
||||
- A proof of membership in the ASP tree
|
||||
- A proof of inclusion in the ASP tree
|
||||
- Nullifier and commitment secrets
|
||||
|
||||
The circuit ensures the withdrawal is valid by verifying:
|
||||
|
||||
- The user knows the preimage of the commitment
|
||||
- The commitment exists in the state tree
|
||||
- The comimtment label is included in the ASP tree
|
||||
- The withdrawal amount is valid and matches the commitment
|
||||
- The nullifier has not been previously used
|
||||
|
||||
### LeanIMT Circuit
|
||||
|
||||
The LeanIMT (Lean Incremental Merkle Tree) circuit handles Merkle tree operations. It implements an optimized Merkle tree that:
|
||||
The LeanIMT (Lean Incremental Merkle Tree) circuit handles merkle tree operations. It implements an optimized merkle tree that:
|
||||
|
||||
- Supports dynamic depth
|
||||
- Optimizes node computations by propagating single child values
|
||||
@@ -62,6 +62,18 @@ yarn compile
|
||||
yarn test
|
||||
```
|
||||
|
||||
### Generating Groth16 Solidity verifiers
|
||||
|
||||
```bash
|
||||
# Generate verifier for the withdrawal circuit
|
||||
yarn gencontract:withdraw
|
||||
```
|
||||
|
||||
```bash
|
||||
# Generate verifier for the commitment circuit
|
||||
yarn gencontract:commitment
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
|
||||
@@ -28,15 +28,14 @@ To withdraw funds privately, users:
|
||||
3. The pool verifies the proof and processes the withdrawal
|
||||
4. A new commitment is created for the remaining funds (even if it is zero)
|
||||
|
||||
### Emergency Exit (`ragequit`)
|
||||
### Emergency Exit (`ragequit`)
|
||||
|
||||
The protocol implements a ragequit mechanism that allows original depositors to withdraw their funds directly in case of emergency. This process:
|
||||
The protocol implements a ragequit mechanism that allows original depositors to withdraw their funds directly for non ASP approved funds. This process:
|
||||
|
||||
1. Requires the original deposit label
|
||||
2. Reveals the nullifier and secret
|
||||
3. Bypasses the approved address set verification
|
||||
4. Can only be executed by the original depositor
|
||||
5. Withdraws the full deposit amount
|
||||
2. Bypasses the approved address set verification
|
||||
3. Can only be executed by the original depositor
|
||||
4. Withdraws the full commitment amount
|
||||
|
||||
## Contract Architecture
|
||||
|
||||
@@ -94,9 +93,6 @@ Manages protocol-wide operations:
|
||||
**`ProofLib.sol`**
|
||||
Handles accessing a proof signals values.
|
||||
|
||||
**`Poseidon.sol`**
|
||||
Poseidon hashers generated using `circomlibjs`.
|
||||
|
||||
## Development
|
||||
|
||||
### Prerequisites
|
||||
@@ -115,6 +111,11 @@ yarn build
|
||||
### Testing
|
||||
|
||||
```bash
|
||||
# Run contract tests
|
||||
yarn test
|
||||
```
|
||||
# Run unit tests
|
||||
yarn test:unit
|
||||
```
|
||||
|
||||
```bash
|
||||
# Run integration tests (with `ffi` enabled)
|
||||
yarn test:integraiton
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user