Fix gas limit function in V4 oracle: if transaction type not specified, but transaction data provided, need to bump estimated limit
This commit is contained in:
parent
c3bfb381b7
commit
90471e0073
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tornado/tornado-oracles",
|
"name": "@tornado/tornado-oracles",
|
||||||
"version": "1.4.1",
|
"version": "1.4.2",
|
||||||
"description": "Gas oracle for Tornado-specific transactions",
|
"description": "Gas oracle for Tornado-specific transactions",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"types": "./lib/index.d.ts",
|
"types": "./lib/index.d.ts",
|
||||||
|
@ -26,8 +26,8 @@ export class TornadoFeeOracleV4 extends TornadoFeeOracle implements ITornadoFeeO
|
|||||||
// For compatibility reasons, when wee check user-provided fee for V4 withdrawal transaction, we need dump gas limit
|
// For compatibility reasons, when wee check user-provided fee for V4 withdrawal transaction, we need dump gas limit
|
||||||
// for about 20 percent,so that the transaction will be sent, even if it results in some loss for the relayer
|
// for about 20 percent,so that the transaction will be sent, even if it results in some loss for the relayer
|
||||||
if (type === 'relayer_withdrawal_check_v4') return bump(defaultWithdrawalGasLimit[this.chainId], -25).toNumber();
|
if (type === 'relayer_withdrawal_check_v4') return bump(defaultWithdrawalGasLimit[this.chainId], -25).toNumber();
|
||||||
if (!tx) return bump(21_000, bumpPercent).toNumber();
|
if (!tx || Object.keys(tx).length === 0) return bump(21_000, bumpPercent).toNumber();
|
||||||
|
|
||||||
return (await this.provider.estimateGas(tx)).toNumber();
|
return bump(await this.provider.estimateGas(tx), bumpPercent).toNumber();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user