Skip to content

Commit

Permalink
Merge the devel branch into the main branch, v4.1.0
Browse files Browse the repository at this point in the history
This merge contains the following set of changes:
  - Fix json log formatting (#164)
  - Add user IP validation (#165)
  - Logging improvements (#173)
  - Add params precompute flag (#177)
  - Add /maxNativeAmount endpoint (#175)
  - Add dynamic fee functionality (#172)
  - Add precompute flag parameter (#179)
  - Cache fee options #180
  - Fix cache overwrite (#182)
  • Loading branch information
akolotov authored Jun 12, 2023
2 parents 5cbe127 + 4535bc9 commit c8e1516
Show file tree
Hide file tree
Showing 50 changed files with 1,967 additions and 188 deletions.
15 changes: 12 additions & 3 deletions CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ These environment variables are required for all services.
| name | description | value |
| - | - | - |
| COMMON_LOG_LEVEL | Log level | Winston log level |
| COMMON_COLORIZE_LOGS | If set to `true`, log levels will be colorized when printed to stdout. | boolean |
| 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 |
Expand All @@ -24,7 +25,7 @@ These environment variables are required for all services.
| RELAYER_ADDRESS_PRIVATE_KEY | Private key to sign pool transactions | hexadecimal prefixed with "0x" |
| RELAYER_GAS_LIMIT | Gas limit for pool transactions | integer |
| RELAYER_FEE | Minimal accepted relayer fee (in tokens) | integer |
| RELAYER_MAX_NATIVE_AMOUNT_FAUCET | Maximal amount of faucet value (in ETH) | integer |
| RELAYER_MAX_NATIVE_AMOUNT | Maximal amount of pool's tokens which can be converted to native in one withdrawal transaction. Defaults to 0. | 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 |
Expand All @@ -50,11 +51,19 @@ These environment variables are required for all services.
| 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 |
| RELAYER_BLOCKED_COUNTRIES | A list of country codes delimited by spaces | string|
| RELAYER_EXPRESS_TRUST_PROXY | If set to `true`, then `trust proxy` express setting will be enabled. Defaults to `false` | boolean |
| RELAYER_FEE_MANAGER_TYPE | Fee manager that will be used for fee estimations | FeeManagerType |
| RELAYER_FEE_MARGIN_FACTOR | Margin factor (in percent) that is used to adjust fee estimations during validation. Defaults to 100. | number |
| RELAYER_FEE_SCALING_FACTOR | Scaling factor (in percent) that is used to adjust both exposed user fees and fee estimations during validation. Defaults to 100. | number |
| RELAYER_PRICE_FEED_TYPE | Price feed type that will be used for rate conversions. | PriceFeedType |
| RELAYER_PRICE_FEED_CONTRACT_ADDRESS | Price feed contract address. | address |
| RELAYER_PRICE_FEED_BASE_TOKEN_ADDRESS | Base token that will be used for rate conversions. | address |

## 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 |
| DIRECT_DEPOSIT_BATCH_SIZE | Maximum size of a single direct deposit batch. Defaults to `16`. | integer |
| 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 |
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ Note, that requests to all endpoints (except `/`, `/info`, `/params/hash/tree`,
}
```
- `/maxNativeAmount` - returns maximum amount of pool's tokens (already denominated) that can be swapped to native tokens in one withdrawal transaction.
- `/params/hash/tree` - hash of pool tree proving parameters.
- `/params/hash/tx` - hash of pool transaction proving parameters.
2 changes: 1 addition & 1 deletion docker/Dockerfile.relayer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.61.0-slim-buster as base
FROM rust:1.69.0-slim-buster as base

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion test-flow-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"@metamask/eth-sig-util": "^4.0.1",
"http-server": "14.1.1",
"libzkbob-rs-node": "1.0.0",
"libzkbob-rs-node": "1.1.0",
"libzkbob-rs-wasm-web": "1.0.0",
"node-polyfill-webpack-plugin": "^1.1.4",
"puppeteer": "^19.2.0",
Expand Down
2 changes: 1 addition & 1 deletion test-flow-generator/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const config = {
tokenAddress: '0xCfEB869F69431e42cdB54A4F4f105C19C080A601',
poolAddress: '0x9b1f7F645351AF3631a656421eD2e40f2802E6c0',
poolAddress: '0x0290FB167208Af455bB137780163b7B7a9a10C16',
chainId: 31337,
}
27 changes: 5 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -492,14 +492,6 @@
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.0.0.tgz#3205bcd15ada9bc681ac20bef64e9e6df88fd297"
integrity sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==

"@types/node-fetch@^2.5.12":
version "2.5.12"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66"
integrity sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==
dependencies:
"@types/node" "*"
form-data "^3.0.0"

"@types/node@*":
version "16.10.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.10.2.tgz#5764ca9aa94470adb4e1185fe2e9f19458992b2e"
Expand Down Expand Up @@ -1551,7 +1543,7 @@ colorspace@1.1.x:
color "^3.1.3"
text-hex "1.0.x"

combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6:
combined-stream@^1.0.6, combined-stream@~1.0.6:
version "1.0.8"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
Expand Down Expand Up @@ -2499,15 +2491,6 @@ forever-agent@~0.6.1:
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=

form-data@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"
integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"

form-data@~2.3.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6"
Expand Down Expand Up @@ -3477,10 +3460,10 @@ libzeropool-rs-wasm-bundler@0.3.8:
resolved "https://registry.yarnpkg.com/libzeropool-rs-wasm-bundler/-/libzeropool-rs-wasm-bundler-0.3.8.tgz#2b55628a741f4bd0f776d87365c22ed0da63ba6c"
integrity sha512-b+W6M/gyeaoKZ4LJC2ThtZmXHVOoEtsa3foPezAyfdgbsyNGDHbSMBcqoTIXVHkP6ul7BKxjOP3xvfi3F6klTg==

libzkbob-rs-node@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/libzkbob-rs-node/-/libzkbob-rs-node-1.0.0.tgz#a65582e2aca8fc8f90e9c501facf5da16709f14a"
integrity sha512-WiIAON2Fe+oakYBgh1ajjG9NQkQFZPTAWc2hvs3BEkw8ezgjkkvh1/yZ8ap8QQE2PAm/rSqsAPuQgj7160Ulvg==
libzkbob-rs-node@1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/libzkbob-rs-node/-/libzkbob-rs-node-1.1.0.tgz#b2b8054c4210a608379537f4d27b5c799b0e4f78"
integrity sha512-SKb0NEA4bi4x9fmuJNaKLWeLq5gyPjrHi1XEbviGECihucMp9RbNT+qRkCdFHhOcsQ1nnrlRvujWUhuO63vJ/Q==
dependencies:
cargo-cp-artifact "^0.1"

Expand Down
222 changes: 222 additions & 0 deletions zp-relayer/abi/erc20.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "balance",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "spender",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
]
Loading

0 comments on commit c8e1516

Please sign in to comment.