Commit Graph

36 Commits

Author SHA1 Message Date
moebius
f7543a8783 chore: update sdk version in relayer (#50) 2025-03-19 20:09:45 -03:00
moebius
1791d4249b fix: test 2025-03-19 17:10:50 +01:00
moebius
631a5c12c8 chore: bump sdk version with optional merkle tree artifact 2025-03-06 21:51:39 +01:00
moebius
8c55562448 fix: make the merkle tree artifacts optional 2025-03-06 21:45:00 +01:00
moebius
5d054f93cb feat: trusted setup circuits keys 2025-03-06 20:40:49 +01:00
moebius
0cd8431fd3 chore: bump sdk version in packages 2025-02-25 09:33:36 +01:00
moebius
60b097071b Merge branch 'dev' of wonderland:0xbow-io/privacy-pools-core into feat/account-service 2025-02-24 15:22:16 +01:00
moebius
827f86f9b5 chore: update sdk version in the relayer 2025-02-24 13:03:01 +01:00
moebius
816b9b4b92 chore: update with dev 2025-02-22 13:06:15 +01:00
moebius
ac019e77c1 chore: update contracts with new circuit version 2025-02-22 13:05:22 +01:00
moebius
b158c7da70 feat: data provider, optimizations to history retrieval 2025-02-21 13:30:26 +01:00
moebius
16c28378f6 chore: update relayer with new sdk release 2025-02-20 17:16:48 +01:00
moebius
f6e657b1eb chore: update gh workflows 2025-02-19 11:08:44 +01:00
moebius
6ae88dbe5d fix: miscellaneous fixes (#88) 2025-02-17 19:52:57 +01:00
moebius
4ff015b167 fix: update sdk abis and bump version (#86) 2025-02-17 13:22:12 +01:00
Simon Something /DrGoNoGo
646e5508ce test: property and invariant tests (#61)
- define properties and invariants
- implement a Medusa-based fuzzing campaign

---------

Co-authored-by: drgorillamd <83670532+drgorillamd@users.noreply.github.com>
Co-authored-by: moebius <0xmoebius@protonmail.com>
2025-02-14 12:12:37 +00:00
moebius
c0d80bcf6f chore: update relayer with sdk package (#82) 2025-02-14 10:52:03 +00:00
moebius
13bbc96dc7 fix: internal review (#80)
This pull requests introduces the fixes to the internal review findings.
Tests for covering the new error cases have been added.
2025-02-14 09:20:59 +00:00
bezze
f3e9e35e0b test: relayer unit testing (#77) 2025-02-10 09:26:07 +00:00
bezze
599b2f62af feat: relayer config rework uses zod for config.json parsing (#65)
Removed environment variable parsing in favour of parsing a simple json
file.
2025-02-06 10:45:53 +01:00
bezze
b6f58e6887 feat: relayer data checks and sdk integration (#58)
The core functionality of the feature takes place at
`packages/relayer/src/services/privacyPoolRelayer.service.ts` in the
`validateWithdrawal` function. There we check in order:
1. Decode Withdrawal.data and check feeReceiver ==
CONFIGURED_FEE_RECEIVER && feeBPS == CONFIGURED_FEE_BPS
2. Hash (Withdrawal || Scope) and check hash == Proof.context
3. Verify proof with SDK.verifyProof(Proof)
4. Call Entrypoint.scopeToPool() to get asset pool
5. Call Pool.ASSET() to get withdrawn asset
6. Check proof.withdrawnAmount() >=
CONFIGURED_MINIMUM_AMOUNT[withdrawn_asset]

If everything is ok, we call the Entrypoint.relay() with the user's
proof.

I've added examples for the config files `env.example`,
`withdraw_amount.example.json`. The first one are environment variables
to be defined in the server's environment. The second one contains a
mapping of the mimimum withdraw limits for the different supported
assets. There's an env var that should contain a path to this file.

Added a `Dockerfile` and a `docker-compose.yml` to the relayer to test
it or use it in dev flows. The circuit artifacts are loaded as volumes,
so before starting the docker-compose, you should run `yarn present`
from the circuits package dir to group all the artifacts and make them
easily accesible.

Additionally added a small package in
`/packages/relayer/test/integration/relay` that can be built and run to
test the relayer.
2025-02-05 14:24:29 +00:00
moebius
fd23947363 chore: update readmes (#57) 2025-02-03 08:49:17 +00:00
bezze
cc4cd8f13f feat: relayer basic implementation (#53)
There are a lot of TODOs related to code quality, mostly happy path
assumptions, input sanitization, error handling and tests. Feature wise
it's missing the contract interaction (should be straight forward once
it's implemented in the SDK) and the sqlite database for request
tracking.
2025-01-31 19:01:11 +00:00
moebius
e32e76d398 chore: integrate SDK into contracts tests (#47)
Co-authored-by: Lempire <61431140+lempire123@users.noreply.github.com>
2025-01-28 16:19:32 +00:00
TITI
7559502b36 feat: SDK base implementation (#31)
Description:
- Implementation for crypto operations
- Proof generation
- Merkle inclusion proofs

---------

Co-authored-by: casiojapi <casiopilled@gmail.com>
Co-authored-by: moebius <0xmoebius@protonmail.com>
2025-01-24 11:28:26 +00:00
bezze
7e2881573b feat: adding rollup bundler and a minimal groth16 prover interface (#32)
Because the SDK is meant to run both in web and nodejs I focused
bundling for those two targets. I chose Rollup.js as a bundler because
it is commonly used for bundling libraries and achives a decent tradeoff
between speed and flexibility.

The nodejs bundle will have the artifacts embedded in the package, while
the web bundle will need to have the artifacts being hosted at
/artifacts/{artifact_name}. The API for the circuits has an async
initializer that abstracts away the platform and loads the binaries.
Once initialized, the `circuits` object is used to initialize the
`ZkOps` class that uses the loaded binaries under the hood.

Observation: ~~currently, to build the bundle, the scripts assume you
have all the circuits artifacts at `src/circuits/artifacts`. The PR was
getting too big so I'll relax that assumption later.~~
EDIT: Build will now succeed without the artifacts because building them
in the ci/cd was way out of scope. I provided a script to install the
artifacts to the bundle build for local testing.

Usage example:

```typescript
import { ZkOps, circuits } from "@privacy-pool-core/sdk";

; (async () => {

    await circuits.downloadArtifacts("latest");
    const zkOps = new ZkOps(circuits);
    const input = {
        value: "1",
        label: BigInt("0"),
        nullifier: BigInt("123"),
        secret: BigInt("456"),
    };

    let r = await zkOps.proveCommitment(input);
    console.log(r)

})()
```
2025-01-23 08:14:21 +00:00
moebius
edc2cc5d10 chore: update tests and replace poseidon hashers with poseidon lib (#23)
Co-authored-by: Lempire <61431140+lempire123@users.noreply.github.com>
2025-01-13 18:05:02 +00:00
Lempire
ccc8cbe4ae test: core unit tests (#6)
Co-authored-by: moebius <0xmoebius@protonmail.com>
2025-01-10 17:18:17 +00:00
moebius
b81ed7bc34 feat: add SDK package (#12)
This PR introduces the template for the SDK package.
2025-01-08 13:30:40 +00:00
moebius
c45821535e feat: CommitmentHasher and Withdrawal circuits (#1)
# 🤖 Linear

Closes 0XB-72
Closes 0XB-70
Closes 0XB-69

---------

Co-authored-by: drgorillamd <83670532+drgorillamd@users.noreply.github.com>
2025-01-07 08:42:57 +00:00
moebius
2840e0d2e7 feat: compile poseidon hashers using circomlibjs, remove poseidon-solidity (#5)
# 🤖 Linear

Closes 0XB-136
2025-01-06 14:23:22 +00:00
moebius
f42fec88e1 chore: improve natspec, rename value handling methods 2025-01-05 16:17:58 +01:00
moebius
cdb8821dee feat: add poseidon hasher 2025-01-02 12:47:03 +01:00
moebius
aaa7060cfa feat: entrypoint contract 2025-01-01 23:44:36 +01:00
moebius
a084b3d623 feat: first contracts draft 2024-12-18 13:01:30 -03:00
moebius
689f8d1971 init repository 2024-12-16 16:36:48 -03:00