forked from zeropoolnetwork/zeropool-relayer
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge the devel branch into the main branch, v4.0.0
This merge contains the following set of changes: - Fix error handler middleware (#157) - Introduction of Direct Deposits (#156) - Log for batch cache timer expiration and for number of handled deposits (#162) - Add header validation to check version of the client library (#163)
- Loading branch information
Showing
67 changed files
with
2,511 additions
and
640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ prover.js | |
*params.bin | ||
*_key.json | ||
|
||
.env | ||
*.env | ||
|
||
# Log file | ||
zp.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,60 @@ | ||
# Configuration | ||
|
||
## Common configuration | ||
These environment variables are required for all services. | ||
| name | description | value | | ||
| - | - | - | | ||
| COMMON_LOG_LEVEL | Log level | Winston log level | | ||
| COMMON_POOL_ADDRESS | Address of the pool contract | hexadecimal prefixed with "0x" | | ||
| COMMON_START_BLOCK | The block number used to start searching for events when the relayer/watcher instance is run for the first time | integer | | ||
| COMMON_REDIS_URL | Url to redis instance | URL | | ||
| COMMON_RPC_URL | The HTTPS URL(s) used to communicate to the RPC nodes. Several URLs can be specified, delimited by spaces. If the connection to one of these nodes is lost the next URL is used for connection. | URL | | ||
| COMMON_REQUIRE_HTTPS | If set to `true`, then RPC URL(s) must be in HTTPS format. HTTP RPC URL(s) should be used in test environment only. | boolean | | ||
| COMMON_RPC_SYNC_STATE_CHECK_INTERVAL | Interval in milliseconds for checking JSON RPC sync state, by requesting the latest block number. Watcher will switch to the fallback JSON RPC in case sync process is stuck. If this variable is `0` sync state check is disabled. Defaults to `0`. | integer | | ||
| COMMON_RPC_REQUEST_TIMEOUT | Timeout in milliseconds for a single RPC request. Defaults to `1000`. | integer | | ||
| COMMON_JSONRPC_ERROR_CODES | Override default JSON rpc error codes that can trigger RPC fallback to the next URL from the list (or a retry in case of a single RPC URL). Default is `-32603,-32002,-32005`. Should be a comma-separated list of negative integers. | `string` | | ||
| COMMON_EVENTS_PROCESSING_BATCH_SIZE | Batch size for one `eth_getLogs` request when processing logs. Defaults to `10000` | integer | | ||
|
||
## Relayer | ||
|
||
| name | description | value | | ||
| - | - | - | | ||
| PORT | Relayer port | integer | | ||
| RELAYER_PORT | Relayer port | integer | | ||
| RELAYER_TOKEN_ADDRESS | Address of the token contract | hexadecimal prefixed with "0x" | | ||
| RELAYER_ADDRESS_PRIVATE_KEY | Private key to sign pool transactions | hexadecimal prefixed with "0x" | | ||
| POOL_ADDRESS | Address of the pool contract | hexadecimal prefixed with "0x" | | ||
| RELAYER_GAS_LIMIT | Gas limit for pool transactions | integer | | ||
| RELAYER_FEE | Minimal accepted relayer fee (in tokens | integer | | ||
| MAX_NATIVE_AMOUNT_FAUCET | Maximal amount of faucet value (in ETH) | integer | | ||
| TREE_UPDATE_PARAMS_PATH | Local path to tree update circuit parameters | string | | ||
| TRANSFER_PARAMS_PATH | Local path to transfer circuit parameters | string | | ||
| TX_VK_PATH | Local path to transaction circuit verification key | string | | ||
| RELAYER_FEE | Minimal accepted relayer fee (in tokens) | integer | | ||
| RELAYER_MAX_NATIVE_AMOUNT_FAUCET | Maximal amount of faucet value (in ETH) | integer | | ||
| RELAYER_TREE_UPDATE_PARAMS_PATH | Local path to tree update circuit parameters | string | | ||
| RELAYER_TRANSFER_PARAMS_PATH | Local path to transfer circuit parameters | string | | ||
| RELAYER_TX_VK_PATH | Local path to transaction circuit verification key | string | | ||
| RELAYER_REQUEST_LOG_PATH | Path to a file where all HTTP request logs will be saved. Default `./zp.log`. | string | | ||
| STATE_DIR_PATH | Path to persistent state files related to tree and transactions storage. Default: `./POOL_STATE` | string | | ||
| GAS_PRICE_FALLBACK | Default fallback gas price | integer | | ||
| GAS_PRICE_ESTIMATION_TYPE | Gas price estimation type | `web3` / `gas-price-oracle` / `eip1559-gas-estimation` / `polygon-gasstation-v2` | | ||
| GAS_PRICE_SPEED_TYPE | This parameter specifies the desirable transaction speed | `instant` / `fast` / `standard` / `low` | | ||
| GAS_PRICE_FACTOR | A value that will multiply the gas price of the oracle to convert it to gwei. If the oracle API returns gas prices in gwei then this can be set to `1`. Also, it could be used to intentionally pay more gas than suggested by the oracle to guarantee the transaction verification. E.g. `1.25` or `1.5`. | integer | | ||
| GAS_PRICE_UPDATE_INTERVAL | Interval in milliseconds used to get the updated gas price value using specified estimation type | integer | | ||
| GAS_PRICE_SURPLUS | A surplus to be added to fetched `gasPrice` on initial transaction submission. Default `0.1`. | float | | ||
| MIN_GAS_PRICE_BUMP_FACTOR | Minimum `gasPrice` bump factor to meet RPC node requirements. Default `0.1`. | float | | ||
| MAX_FEE_PER_GAS_LIMIT | Max limit on `maxFeePerGas` parameter for each transaction in wei | integer | | ||
| MAX_SENT_QUEUE_SIZE | Maximum number of jobs waiting in the `sentTxQueue` at a time. | integer | | ||
| START_BLOCK | The block number used to start searching for events when the relayer instance is run for the first time | integer | ||
| EVENTS_PROCESSING_BATCH_SIZE | Batch size for one `eth_getLogs` request when reprocessing old logs. Defaults to `10000` | integer | ||
| RELAYER_LOG_LEVEL | Log level | Winston log level | | ||
| RELAYER_REDIS_URL | Url to redis instance | URL | | ||
| RPC_URL | The HTTPS URL(s) used to communicate to the RPC nodes. Several URLs can be specified, delimited by spaces. If the connection to one of these nodes is lost the next URL is used for connection. | URL | | ||
| RELAYER_STATE_DIR_PATH | Path to persistent state files related to tree and transactions storage. Default: `./POOL_STATE` | string | | ||
| RELAYER_GAS_PRICE_FALLBACK | Default fallback gas price | integer | | ||
| RELAYER_GAS_PRICE_ESTIMATION_TYPE | Gas price estimation type | `web3` / `gas-price-oracle` / `eip1559-gas-estimation` / `polygon-gasstation-v2` | | ||
| RELAYER_GAS_PRICE_SPEED_TYPE | This parameter specifies the desirable transaction speed | `instant` / `fast` / `standard` / `low` | | ||
| RELAYER_GAS_PRICE_FACTOR | A value that will multiply the gas price of the oracle to convert it to gwei. If the oracle API returns gas prices in gwei then this can be set to `1`. Also, it could be used to intentionally pay more gas than suggested by the oracle to guarantee the transaction verification. E.g. `1.25` or `1.5`. | integer | | ||
| RELAYER_GAS_PRICE_UPDATE_INTERVAL | Interval in milliseconds used to get the updated gas price value using specified estimation type | integer | | ||
| RELAYER_GAS_PRICE_SURPLUS | A surplus to be added to fetched `gasPrice` on initial transaction submission. Default `0.1`. | float | | ||
| 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 | | ||
| RELAYER_RPC_SYNC_STATE_CHECK_INTERVAL | Interval in milliseconds for checking JSON RPC sync state, by requesting the latest block number. Relayer will switch to the fallback JSON RPC in case sync process is stuck. If this variable is `0` sync state check is disabled. Defaults to `0` | integer | | ||
| INSUFFICIENT_BALANCE_CHECK_TIMEOUT | Interval in milliseconds to check for relayer balance update if transaction send failed with insufficient balance error. Default `60000` | integer | | ||
| SENT_TX_DELAY | Delay in milliseconds for sentTxWorker to verify submitted transactions | integer | | ||
| 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 | | ||
| PERMIT_DEADLINE_THRESHOLD_INITIAL | Minimum time threshold in seconds for permit signature deadline to be valid (before initial transaction submission) | integer | | ||
| PERMIT_DEADLINE_THRESHOLD_RESEND | Minimum time threshold in seconds for permit signature deadline to be valid (for re-send attempts) | integer | | ||
| 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 | | ||
| RELAYER_PERMIT_DEADLINE_THRESHOLD_INITIAL | Minimum time threshold in seconds for permit signature deadline to be valid (before initial transaction submission) | integer | | ||
| RELAYER_PERMIT_DEADLINE_THRESHOLD_RESEND | Minimum time threshold in seconds for permit signature deadline to be valid (for re-send attempts) | integer | | ||
| RELAYER_REQUIRE_TRACE_ID | If set to `true`, then requests to relayer (except `/info`, `/version`, `/params/hash/tree`, `/params/hash/tx`) without `zkbob-support-id` header will be rejected. | boolean | | ||
| RELAYER_REQUIRE_HTTPS | If set to `true`, then RPC URL(s) must be in HTTPS format. HTTP RPC URL(s) should be used in test environment only. | boolean | | ||
| RELAYER_LOG_IGNORE_ROUTES | List of space separated relayer endpoints for which request logging will be suppressed. E.g. `/fee /version` | string(s) | | ||
| RELAYER_LOG_HEADER_BLACKLIST | List of space separated HTTP headers which will be suppressed in request logs. E.g. `content-length content-type` | string(s) | | ||
| RELAYER_SCREENER_URL | Screener service URL | URL | | ||
| RELAYER_SCREENER_TOKEN | Authorization token for screener service | string | | ||
|
||
## Watcher | ||
|
||
| name | description | value | | ||
| - | - | - | | ||
| WATCHER_EVENT_POLLING_INTERVAL | The interval in milliseconds used to request the RPC node for new blocks. | integer | | ||
| WATCHER_DIRECT_DEPOSIT_BATCH_SIZE | Maximum size of a single direct deposit batch. Defaults to `16`. | integer | | ||
| WATCHER_DIRECT_DEPOSIT_BATCH_TTL | Maximum TTL in milliseconds for a new direct deposit batch. After this time batch will be submitted to the queue, even if it has less than `DIRECT_DEPOSIT_BATCH_SIZE` elements. Defaults to `3600000` (1 hour) | integer | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export const config = { | ||
tokenAddress: '0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab', | ||
poolAddress: '0xe982E462b094850F12AF94d21D470e21bE9D0E9C', | ||
tokenAddress: '0xCfEB869F69431e42cdB54A4F4f105C19C080A601', | ||
poolAddress: '0x9b1f7F645351AF3631a656421eD2e40f2802E6c0', | ||
chainId: 31337, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
PORT=8000 | ||
RELAYER_ADDRESS_PRIVATE_KEY=0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d | ||
POOL_ADDRESS=0xC89Ce4735882C9F0f0FE26686c53074E09B0D550 | ||
COMMON_POOL_ADDRESS=0x9b1f7F645351AF3631a656421eD2e40f2802E6c0 | ||
COMMON_START_BLOCK=0 | ||
COMMON_LOG_LEVEL=debug | ||
COMMON_RELAYER_REDIS_URL=127.0.0.1:6379 | ||
COMMON_RPC_URL=http://127.0.0.1:8545 | ||
|
||
RELAYER_PORT=8000 | ||
RELAYER_ADDRESS_PRIVATE_KEY=0x6370fd033278c143179d81c5526140625662b8daa446c22ee2d73db3707e620c | ||
RELAYER_TOKEN_ADDRESS=0xCfEB869F69431e42cdB54A4F4f105C19C080A601 | ||
RELAYER_GAS_LIMIT=2000000 | ||
RELAYER_FEE=0 | ||
MAX_NATIVE_AMOUNT_FAUCET=0 | ||
RELAYER_MAX_NATIVE_AMOUNT_FAUCET=0 | ||
|
||
TREE_UPDATE_PARAMS_PATH="./params/tree_params.bin" | ||
TX_VK_PATH="./params/transfer_verification_key.json" | ||
RELAYER_TREE_UPDATE_PARAMS_PATH="./params/tree_params.bin" | ||
RELAYER_TX_VK_PATH="./params/transfer_verification_key.json" | ||
RELAYER_STATE_DIR_PATH="./test/STATE_DIR/" | ||
|
||
SENT_TX_DELAY=30000 | ||
GAS_PRICE_FALLBACK= | ||
GAS_PRICE_UPDATE_INTERVAL= | ||
GAS_PRICE_ESTIMATION_TYPE="web3" | ||
RELAYER_LOG_LEVEL=debug | ||
RELAYER_REDIS_URL=127.0.0.1:6379 | ||
RPC_URL=http://127.0.0.1:8545 | ||
LETSENCRYPT_HOST=example.com | ||
VIRTUAL_HOST=example.com | ||
LETSENCRYPT_EMAIL=mail@example.com | ||
RELAYER_INSUFFICIENT_BALANCE_CHECK_TIMEOUT=500 | ||
RELAYER_SENT_TX_DELAY=2000 | ||
RELAYER_GAS_PRICE_FALLBACK= | ||
RELAYER_GAS_PRICE_UPDATE_INTERVAL=100000 | ||
RELAYER_GAS_PRICE_ESTIMATION_TYPE="eip1559-gas-estimation" |
Oops, something went wrong.