From 09367f76a86e4f91f9db94f5f18aef5b63c37051 Mon Sep 17 00:00:00 2001 From: Roman Storm Date: Wed, 14 Oct 2020 16:46:01 -0700 Subject: [PATCH] fix fee handling --- package.json | 2 +- src/config.js | 4 ++-- src/validator.js | 6 +++--- src/worker.js | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 727c119..03be399 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "gas-price-oracle": "^0.1.5", "ioredis": "^4.14.1", "node-fetch": "^2.6.0", - "tornado-cash-anonymity-mining": "git+ssh://github.com/tornadocash/tornado-anonymity-mining.git#dd4b996b89580fad986604e507a7e56ad64a3f71", + "tornado-cash-anonymity-mining": "git+ssh://github.com/tornadocash/tornado-anonymity-mining.git#02ff4c9061eef94617b3c1b91a02c0d25bb1c410", "tx-manager": "git+ssh://github.com/tornadocash/tx-manager.git#df118be318b007e597e157504d105dfa3e6322a1", "torn-token": "git+ssh://github.com/tornadocash/torn-token.git#b90fc5adccbf9a87c3bdac6175a0e038a9ed3dd8", "uuid": "^8.3.0", diff --git a/src/config.js b/src/config.js index c08eff9..34e9c35 100644 --- a/src/config.js +++ b/src/config.js @@ -9,8 +9,8 @@ module.exports = { wsRpcUrl: process.env.WS_RPC_URL, oracleRpcUrl: process.env.ORACLE_RPC_URL || 'https://mainnet.infura.io/', oracleAddress: '0xA2b8E7ee7c8a18ea561A5CF7C9C365592026E374', - minerAddress: '0xB28038Cd60777aF2264F46C0009dC57975239B11', // each network has its own instance - swapAddress: '0xec236719BEbfC1D303739FbE11Bf3a42aF1A41f4', + minerAddress: '0x3E0a9C6Cf76136862De28ce25a56cDBF38EF9D37', // each network has its own instance + swapAddress: '0x1E73e0a484a595B692f3d212642AE4B3BF30E7e3', minerMerkleTreeHeight: 20, privateKey: process.env.PRIVATE_KEY, instances: require('torn-token').instances, diff --git a/src/validator.js b/src/validator.js index 17297b1..092b9f1 100644 --- a/src/validator.js +++ b/src/validator.js @@ -129,17 +129,17 @@ const miningWithdrawSchema = { type: 'object', properties: { amount: bytes32Type, - fee: bytes32Type, extDataHash: bytes32Type, extData: { type: 'object', properties: { + fee: bytes32Type, recipient: addressType, relayer: relayerType, encryptedAccount: encryptedAccountType, }, additionalProperties: false, - required: ['relayer', 'encryptedAccount', 'recipient'], + required: ['fee', 'relayer', 'encryptedAccount', 'recipient'], }, account: { type: 'object', @@ -161,7 +161,7 @@ const miningWithdrawSchema = { }, }, additionalProperties: false, - required: ['amount', 'fee', 'extDataHash', 'extData', 'account'], + required: ['amount', 'extDataHash', 'extData', 'account'], }, }, additionalProperties: false, diff --git a/src/worker.js b/src/worker.js index 364aa0b..ba06033 100644 --- a/src/worker.js +++ b/src/worker.js @@ -154,14 +154,14 @@ async function checkMiningFee({ args }) { .div(toBN(1e10 * 100)) /* eslint-enable */ const desiredFee = expenseInPoints.add(serviceFeePercent) // in points - + const providedFee = currentJob.data.type === jobType.MINING_REWARD ? args.fee : args.extData.fee console.log( 'sent fee, desired fee, serviceFeePercent', - toBN(args.fee).toString(), + toBN(providedFee).toString(), desiredFee.toString(), serviceFeePercent.toString(), ) - if (toBN(args.fee).lt(desiredFee)) { + if (toBN(providedFee).lt(desiredFee)) { throw new Error('Provided fee is not enough. Probably it is a Gas Price spike, try to resubmit.') } }