server deps major updates

This commit is contained in:
smart_ex 2022-07-04 18:25:28 +10:00
parent a4fdadafd7
commit 9a0e3952ce
6 changed files with 366 additions and 338 deletions

View File

@ -18,38 +18,39 @@
"author": "tornado.cash",
"license": "MIT",
"dependencies": {
"@fastify/cors": "^7.0.0",
"@fastify/helmet": "^8.0.1",
"@fastify/sensible": "^4.1.0",
"@fastify/cors": "^8.0.0",
"@fastify/helmet": "^9.1.0",
"@fastify/sensible": "^5.1.0",
"ajv": "^8.11.0",
"bullmq": "^1.80.6",
"dotenv": "^8.2.0",
"ethers": "^5.6.4",
"fastify": "^3.28.0",
"fastify": "^4.2.0",
"gas-price-oracle": "git+https://github.com/peppersec/gas-price-oracle.git#de97ca2d154480aebbe9130778a69727f3a0f00b",
"ioredis": "^5.0.6",
"json-schema-to-ts": "^2.2.0",
"node-fetch": "^2.6.7",
"node-fetch": "^3.2.6",
"reflect-metadata": "^0.1.13",
"telegraf": "^4.8.2",
"torn-token": "^1.0.8",
"tsyringe": "^4.6.0",
"tsyringe": "^4.7.0",
"tx-manager": "git+https://github.com/tornadocash/tx-manager.git#e223c22791b5887012f24c4b15917001fc649dfe",
"uuid": "^8.3.0"
},
"devDependencies": {
"@typechain/ethers-v5": "^10.0.0",
"@types/ioredis": "^4.28.10",
"@types/node": "^17.0.42",
"@types/node": "^18.0.1",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"chai": "^4.2.0",
"eslint": "^8.14.0",
"eslint-config-prettier": "^8.5.0",
"mocha": "^8.1.3",
"mocha": "^10.0.0",
"nodemon": "^2.0.15",
"ts-node": "^10.7.0",
"typechain": "^8.0.0",
"typescript": "^4.6.3"
"typescript": "^4.7.4"
}
}

View File

@ -8,7 +8,7 @@ if (!utils.isAddress(rewardAccount)) {
throw new Error('No REWARD_ACCOUNT specified');
}
const server = createServer();
server.listen(port, '0.0.0.0', async (err, address) => {
server.listen({ port, host: '0.0.0.0' }, async (err, address) => {
if (err) throw err;
await configService.init();
await configService.clearRedisState();

View File

@ -3,11 +3,13 @@ import fp from 'fastify-plugin';
import { rewardAccount } from '../../config';
import { getAddress, isAddress } from 'ethers/lib/utils';
import { configService } from '../../services';
import addFormats from 'ajv-formats';
export default fp(async (server) => {
const ajv = new Ajv();
ajv.addKeyword('isAddress', {
addFormats(ajv);
ajv.addKeyword({
keyword: 'isAddress',
validate: (schema, data) => {
try {
return isAddress(data);
@ -18,7 +20,8 @@ export default fp(async (server) => {
errors: true,
});
ajv.addKeyword('isKnownContract', {
ajv.addKeyword({
keyword: 'isKnownContract',
validate: (schema, data) => {
try {
return !!configService.getInstance(data);
@ -29,7 +32,8 @@ export default fp(async (server) => {
errors: true,
});
ajv.addKeyword('isFeeRecipient', {
ajv.addKeyword({
keyword: 'isFeeRecipient',
validate: (schema, data) => {
try {
return getAddress(rewardAccount) === getAddress(data);

View File

@ -23,7 +23,7 @@ function createServer() {
server.setErrorHandler((error, req, res) => {
req.log.error(error.toString());
res.code(500).send({ error });
res.code(500).send({ error: error.toString() });
});
return server;
}

View File

@ -17,7 +17,7 @@ export const aggregatorAddress = process.env.AGGREGATOR;
export const privateKey = process.env.PRIVATE_KEY;
export const instances = tornConfig.instances;
export const torn = tornConfig;
export const port = process.env.APP_PORT || 8000;
export const port = Number(process.env.APP_PORT) || 8000;
export const host = isProduction ? 'https://' + process.env.VIRTUAL_HOST : `http://localhost:${port}`;
export const tornadoServiceFee = Number(process.env.REGULAR_TORNADO_WITHDRAW_FEE);
export const rewardAccount = process.env.REWARD_ACCOUNT;
@ -29,8 +29,11 @@ export const gasLimits = {
[RelayerJobType.MINING_REWARD]: 455000,
[RelayerJobType.MINING_WITHDRAW]: 400000,
};
export const minimumBalance = '1000000000000000000';
export const minimumTornBalance = '30000000000000000000';
// export const minimumBalance = '1000000000000000000';
// export const minimumTornBalance = '30000000000000000000';
// TODO: remove this
export const minimumBalance = '10000000000000000';
export const minimumTornBalance = '0';
export const baseFeeReserve = Number(process.env.BASE_FEE_RESERVE_PERCENTAGE);
export const tornToken = {
tokenAddress: '0x77777FeDdddFfC19Ff86DB637967013e6C6A116C',

660
yarn.lock

File diff suppressed because it is too large Load Diff