Update tornado-oracles to fetch gas price and limit only once

This commit is contained in:
Theo 2023-09-07 10:48:28 -07:00
parent 5191207cc2
commit d04480a62f
3 changed files with 17 additions and 12 deletions

@ -1,6 +1,6 @@
{
"name": "relay",
"version": "5.2.0",
"version": "5.2.1",
"description": "Relayer for Tornado.cash privacy solution. https://tornado.cash",
"scripts": {
"server": "node src/server.js",
@ -17,7 +17,7 @@
"author": "tornado.cash",
"license": "MIT",
"dependencies": {
"@tornado/tornado-oracles": "^2.1.0",
"@tornado/tornado-oracles": "^3.3.0",
"ajv": "^6.12.5",
"bull": "^3.12.1",
"concurrently": "^8.2.0",

@ -50,14 +50,16 @@ async function checkTornadoFee({ data }, tx) {
const userProvidedFee = toBN(data.args[4])
const { amount, decimals, currency } = getInstance(data.contract)
const relayerDesiredFee = await feeOracle.calculateWithdrawalFeeViaRelayer(
'relayer_withdrawal',
const relayerDesiredFee = await feeOracle.calculateWithdrawalFeeViaRelayer({
tx,
tornadoServiceFee,
txType: 'relayer_withdrawal',
relayerFeePercent: tornadoServiceFee,
currency,
amount,
decimals,
)
gasLimit: tx.gasLimit,
gasPrice: tx.gasPrice,
})
console.log(
'user-provided fee, desired fee',
@ -77,9 +79,12 @@ async function getTxObject({ data }) {
to: tornadoProxyInstance._address,
data: calldata,
}
const { gasLimit, gasPrice } = await feeOracle.getGasParams(incompleteTx, 'relayer_withdrawal')
const { gasLimit, gasPrice } = await feeOracle.getGasParams({
tx: incompleteTx,
txType: 'relayer_withdrawal',
})
return Object.assign(incompleteTx, { gasLimit, gasPrice })
return { ...incompleteTx, gasLimit, gasPrice }
}
async function processJob(job) {

@ -896,10 +896,10 @@
resolved "https://git.tornado.ws/api/packages/tornado-packages/npm/%40tornado%2Ftornado-config/-/2.0.0/tornado-config-2.0.0.tgz#52bbc179ecb2385f71b4d56e060b68e7dd6fb8b4"
integrity sha512-7EkpWNfEm34VEOrbLnPpvd/aUJYnA1L+6/qx2fZ/AfmuJFkjSZ18Z4jvVGNY7ktKIhTu3/Tbze+9l3eNueCNIA==
"@tornado/tornado-oracles@^2.1.0":
version "2.1.0"
resolved "https://git.tornado.ws/api/packages/tornado-packages/npm/%40tornado%2Ftornado-oracles/-/2.1.0/tornado-oracles-2.1.0.tgz#2aa0d8c9288992e6d194d4bb28acb37c2035c453"
integrity sha512-Y6FPAGnCvHLWzUnNYgGoOv+X7KY3CF02rRSawataYaLyl+v2ivh7RYZZZ3G/B5hXf+pD3IFeCdm4PDnTNyNe1g==
"@tornado/tornado-oracles@^3.3.0":
version "3.3.0"
resolved "https://git.tornado.ws/api/packages/tornado-packages/npm/%40tornado%2Ftornado-oracles/-/3.3.0/tornado-oracles-3.3.0.tgz#6358f896f399904ed8deb9b8f4253e77732bd227"
integrity sha512-OBJ+TmygY6VMcYJCPxSOAzPDZpmF4WhRVhjgTEhqw+hg70WW9L4b3DC1B1P/4Gmar2lzi6BnTI4ckkDy/xsHQQ==
dependencies:
"@tornado/gas-price-oracle" "^0.5.3"
"@tornado/tornado-config" "^2.0.0"