mirror of
https://github.com/tornadocash/tornado-relayer
synced 2024-02-02 15:04:06 +01:00
relayer tx job attempts
This commit is contained in:
parent
185b18b33a
commit
591c2d94f3
@ -27,6 +27,7 @@ export const rewardAccount = process.env.REWARD_ACCOUNT;
|
|||||||
export const governanceAddress = '0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce';
|
export const governanceAddress = '0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce';
|
||||||
export const tornadoGoerliProxy = '0x454d870a72e29d5E5697f635128D18077BD04C60';
|
export const tornadoGoerliProxy = '0x454d870a72e29d5E5697f635128D18077BD04C60';
|
||||||
export const ovmGasPriceOracleContract = '0x420000000000000000000000000000000000000F';
|
export const ovmGasPriceOracleContract = '0x420000000000000000000000000000000000000F';
|
||||||
|
export const txJobAttempts = 3;
|
||||||
export const gasLimits = {
|
export const gasLimits = {
|
||||||
[RelayerJobType.TORNADO_WITHDRAW]: 390000,
|
[RelayerJobType.TORNADO_WITHDRAW]: 390000,
|
||||||
[RelayerJobType.WITHDRAW_WITH_EXTRA]: 700000,
|
[RelayerJobType.WITHDRAW_WITH_EXTRA]: 700000,
|
||||||
|
@ -8,6 +8,7 @@ import { RedisStore } from '../modules/redis';
|
|||||||
import { ConfigService } from '../services/config.service';
|
import { ConfigService } from '../services/config.service';
|
||||||
import { relayerProcessor } from './relayer.processor';
|
import { relayerProcessor } from './relayer.processor';
|
||||||
import { healthProcessor } from './health.processor';
|
import { healthProcessor } from './health.processor';
|
||||||
|
import { txJobAttempts } from '../config';
|
||||||
|
|
||||||
type PriceJobData = Token[];
|
type PriceJobData = Token[];
|
||||||
type PriceJobReturn = number;
|
type PriceJobReturn = number;
|
||||||
@ -92,7 +93,7 @@ export class RelayerQueueHelper {
|
|||||||
connection: this.store.client,
|
connection: this.store.client,
|
||||||
defaultJobOptions: {
|
defaultJobOptions: {
|
||||||
stackTraceLimit: 100,
|
stackTraceLimit: 100,
|
||||||
attempts: 3,
|
attempts: txJobAttempts,
|
||||||
backoff: 1000,
|
backoff: 1000,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@ import { getTxService } from '../services';
|
|||||||
import { JobStatus } from '../types';
|
import { JobStatus } from '../types';
|
||||||
import { UnrecoverableError } from 'bullmq';
|
import { UnrecoverableError } from 'bullmq';
|
||||||
import { ExecutionError } from '../services/tx.service';
|
import { ExecutionError } from '../services/tx.service';
|
||||||
|
import { txJobAttempts } from '../config';
|
||||||
|
|
||||||
class RevertError extends UnrecoverableError {
|
class RevertError extends UnrecoverableError {
|
||||||
code: string;
|
code: string;
|
||||||
@ -26,7 +27,7 @@ export const relayerProcessor: RelayerProcessor = async (job) => {
|
|||||||
const txData = await txService.prepareTxData(withdrawalData);
|
const txData = await txService.prepareTxData(withdrawalData);
|
||||||
return await txService.sendTx(txData);
|
return await txService.sendTx(txData);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof ExecutionError && e.code === 'REVERTED') {
|
if ((e instanceof ExecutionError && e.code === 'REVERTED') || job.attemptsMade === txJobAttempts) {
|
||||||
await job.update({ ...job.data, status: JobStatus.FAILED });
|
await job.update({ ...job.data, status: JobStatus.FAILED });
|
||||||
throw new RevertError(e.message, e.code);
|
throw new RevertError(e.message, e.code);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user