Skip to content
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

Decentralized relayer #214

Merged
merged 48 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
dddcbbb
Initial TRON support
lok52 Aug 26, 2023
c69473a
Fix error catching
lok52 Aug 26, 2023
a90bb32
Support for TRON address type in /limits endpoint
lok52 Aug 26, 2023
368caaf
Minor refactoring
lok52 Sep 19, 2023
845e276
Remove mock proof
lok52 Oct 11, 2023
b1c0524
Make configurable feeLimit
lok52 Nov 2, 2023
86079c0
Add MPC guard service
lok52 Dec 17, 2023
9d4fc86
MPC relayer
lok52 Dec 18, 2023
13f6848
Fix guard signatures
lok52 Dec 19, 2023
9ffb428
Fix guard signature
lok52 Dec 20, 2023
5ccf6e9
Update launch scripts
lok52 Dec 20, 2023
415308b
Add debug logs
lok52 Dec 20, 2023
11f15f5
Handle trongrid error
lok52 Jan 13, 2024
5ce3a0a
Initial
lok52 Feb 9, 2024
1da9a24
Update launch script
lok52 Feb 13, 2024
55a0a60
Ingore legacy ts errors
lok52 Feb 13, 2024
3db7b35
Fix memo offset
lok52 Feb 13, 2024
f09042c
Fix commitment-watcher
lok52 Feb 13, 2024
17a4a95
Fix fetching limits from external accounting contract
lok52 Feb 20, 2024
c57fd63
Add /fee and /address endpoints for prover
lok52 Feb 20, 2024
a635d36
Fix job state & RelayPool fetcher
lok52 Feb 21, 2024
312856d
Add /proverFee endpoint
lok52 Feb 22, 2024
7785e49
Fix fee manager init
lok52 Feb 22, 2024
57742fe
Fix RelayPool validation
lok52 Mar 4, 2024
a8e71c9
Fix commitment processing condition (#215)
AllFi Mar 27, 2024
b0abe89
Add indexer service & make relayer stateless
lok52 Apr 2, 2024
d75f555
Fix build
lok52 Apr 2, 2024
a7145c3
Add proxy optimistic state
lok52 Apr 10, 2024
d9c8bdd
Fix indexer sync
lok52 Apr 10, 2024
e854e70
Add TxStore
lok52 Apr 10, 2024
b3d6097
Fix build
lok52 Apr 10, 2024
06dd331
Fix indexer offset
lok52 Apr 10, 2024
0a835c7
Fix prover sync bug (#216)
AllFi Apr 19, 2024
4e446c8
Add direct deposits
lok52 Jun 7, 2024
6ce96ca
Fix watcher init
lok52 Jun 7, 2024
b52416b
updates job status on queue inclusion (#217)
r0wdy1 Jun 14, 2024
b29ef3c
Fix basic dd logic (#219)
AllFi Jun 27, 2024
404597f
Mark job as failed if the indexer isn't synced yet
AllFi Jul 10, 2024
5e21934
Remove obsolete job
AllFi Jul 10, 2024
c9b36f6
Fix sync
AllFi Jul 10, 2024
a4c2e71
Fix sync
AllFi Jul 10, 2024
f8bc615
Attempt to fix dd flow
AllFi Jul 11, 2024
7ea6d89
Remove unnecessary code
AllFi Jul 11, 2024
a82c66b
Merge pull request #221 from zkBob/fix/prover-sync
AllFi Jul 19, 2024
b11b878
Refactor code
AllFi Jul 24, 2024
f6f04e1
Merge pull request #222 from zkBob/feature/decentralized-relayer-refa…
AllFi Jul 25, 2024
3c91321
remove redundant methods
r0wdy1 Aug 7, 2024
1673b32
Merge branch 'devel' into feature/decentralized-relayer
r0wdy1 Aug 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ zp-relayer/poolTxs.db

*.md
*.yml
**/lib/
**/build/
**/*.json
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"singleQuote": true,
"arrowParens": "avoid",
"bracketSpacing": true,
"quoteProps": "consistent"
"quoteProps": "consistent",
"plugins": ["prettier-plugin-organize-imports"]
}
2 changes: 1 addition & 1 deletion CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ These environment variables are required for all services.
| RELAYER_MIN_GAS_PRICE_BUMP_FACTOR | Minimum `gasPrice` bump factor to meet RPC node requirements. Default `0.1`. | float |
| RELAYER_MAX_FEE_PER_GAS_LIMIT | Max limit on `maxFeePerGas` parameter for each transaction in wei | integer |
| RELAYER_MAX_SENT_QUEUE_SIZE | Maximum number of jobs waiting in the `sentTxQueue` at a time. | integer |
| RELAYER_TX_REDUNDANCY | If set to `true`, instructs relayer to send `eth_sendRawTransaction` requests through all available RPC urls defined in `RPC_URL` variables instead of using first available one. Defaults to `false` | boolean |
| TX_REDUNDANCY | If set to `true`, instructs relayer to send `eth_sendRawTransaction` requests through all available RPC urls defined in `RPC_URL` variables instead of using first available one. Defaults to `false` | boolean |
| RELAYER_INSUFFICIENT_BALANCE_CHECK_TIMEOUT | Interval in milliseconds to check for relayer balance update if transaction send failed with insufficient balance error. Default `60000` | integer |
| RELAYER_SENT_TX_DELAY | Delay in milliseconds for sentTxWorker to verify submitted transactions | integer |
| RELAYER_SENT_TX_ERROR_THRESHOLD | Maximum number of re-sends which is considered to be normal. After this threshold each re-send will log a corresponding error (but re-send loop will continue). Defaults to `3`. | integer |
Expand Down
75 changes: 45 additions & 30 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,62 @@
version: '3.8'

services:
ganache:
image: trufflesuite/ganache-cli
command: >
--deterministic
--gasLimit 20000000
--allowUnlimitedContractSize
--networkId 1337
--chainId 1337
ports:
- 8545:8545
contracts:
image: lok52/zp-contracts:latest
verifier:
image: lok52/verifier:latest
build:
context: ./docker
dockerfile: Dockerfile.verifier
redis:
redis_indexer:
command: [redis-server, --appendonly, 'yes']
image: redis:6.2.6
indexer:
image: ghcr.io/zkbob/zkbob-relayer:${RELAYER_VERSION:-latest}
build:
context: .
dockerfile: docker/Dockerfile.relayer
command: yarn run start:indexer:prod
volumes:
- ./zp-relayer/params:/app/zp-relayer/params/
env_file: ./zp-relayer/indexer.env
environment:
- INDEXER_PORT=80
- COMMON_REDIS_URL=redis_indexer:6379
ports:
- 6379:6379
- 8000:80
depends_on:
- redis_indexer
redis_relayer:
command: [redis-server, --appendonly, 'yes']
image: redis:6.2.6
relayer:
image: ghcr.io/zkbob/zkbob-relayer:${RELAYER_VERSION:-latest}
build:
context: .
dockerfile: docker/Dockerfile.relayer
volumes:
- relayer_tree:/app/tree.db
- relayer_txs:/app/txs.db
- $PARAMS_PATH:/app/zp-relayer/params/
env_file: ./zp-relayer/relayer.env
- ./zp-relayer/params:/app/zp-relayer/params/
env_file: ./zp-relayer/relayer-decentralized.env
environment:
- RELAYER_PORT=80
- RELAYER_PROVER_URL=http://commitment_watcher:80
- COMMON_INDEXER_URL=http://indexer:80
- COMMON_REDIS_URL=redis_relayer:6379
ports:
- 8000:8000
watcher:
- 8001:80
depends_on:
- redis_relayer
redis_prover:
command: [redis-server, --appendonly, 'yes']
image: redis:6.2.6
commitment_watcher:
image: ghcr.io/zkbob/zkbob-relayer:${RELAYER_VERSION:-latest}
build:
context: .
dockerfile: docker/Dockerfile.relayer
command: yarn run start:direct-deposit-watcher:prod
env_file: ./zp-relayer/watcher.env
volumes:
relayer_tree:
relayer_txs:
command: yarn run start:commitment-watcher:prod
volumes:
- ./zp-relayer/params:/app/zp-relayer/params/
env_file: ./zp-relayer/commitment-watcher.env
environment:
- COMMITMENT_WATCHER_PORT=80
- COMMON_INDEXER_URL=http://indexer:80
- COMMON_REDIS_URL=redis_prover:6379
ports:
- 8002:80
depends_on:
- redis_prover
6 changes: 3 additions & 3 deletions docker/Dockerfile.relayer
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM rust:1.69.0-slim-buster as base
FROM rust:1.77.0-slim-buster as base

WORKDIR /app

RUN apt-get update && \
apt-get -y install curl && \
curl -sL https://deb.nodesource.com/setup_18.x | bash && \
curl -sL https://deb.nodesource.com/setup_20.x | bash && \
apt-get -y install nodejs libclang-dev clang && \
npm install -g yarn cargo-cp-artifact

Expand All @@ -29,7 +29,7 @@ RUN yarn build:relayer
RUN yarn install --frozen-lockfile --production


FROM node:18
FROM node:20

ARG RELAYER_REF
ARG RELAYER_SHA
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"devDependencies": {
"@types/node": "^18.11.17",
"prettier": "^2.7.1",
"prettier-plugin-organize-imports": "^3.2.4",
"ts-loader": "9.4.2",
"tsc-alias": "^1.7.0",
"tsconfig-paths": "^4.1.0",
Expand Down
Loading
Loading