tornado-core 1.0.17

* add static relayer
* removed rpc that censors transactions
This commit is contained in:
Tornado Contrib 2024-10-01 23:27:23 +00:00
parent 6aa7ecd311
commit 4a884e4f41
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
8 changed files with 60 additions and 112 deletions

@ -2,7 +2,7 @@ import { BaseContract, Provider, EventLog, ContractEventName } from 'ethers';
import type { Tornado, TornadoRouter, TornadoProxyLight, Governance, RelayerRegistry, Echoer, Aggregator } from '@tornado/contracts';
import { BatchEventsService, BatchBlockService, BatchTransactionService, BatchEventOnProgress, BatchBlockOnProgress } from '../batch';
import { fetchDataOptions } from '../providers';
import type { NetIdType, SubdomainMap } from '../networkConfig';
import { type NetIdType, type SubdomainMap } from '../networkConfig';
import { RelayerParams } from '../relayerClient';
import type { TovarishClient } from '../tovarishClient';
import type { BaseEvents, CachedEvents, MinimalEvents, DepositsEvents, WithdrawalsEvents, EncryptedNotesEvents, AllGovernanceEvents, RegistersEvents, EchoEvents } from './types';

35
dist/index.js vendored

@ -1778,10 +1778,6 @@ const defaultConfig = {
name: "SecureRpc",
url: "https://api.securerpc.com/v1"
},
meowrpc: {
name: "Meow RPC",
url: "https://eth.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/ethereum-mainnet"
@ -1923,10 +1919,6 @@ const defaultConfig = {
name: "NodeReal",
url: "https://binance.nodereal.io"
},
meowrpc: {
name: "Meow RPC",
url: "https://bsc.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/bsc-mainnet"
@ -1981,10 +1973,6 @@ const defaultConfig = {
name: "1RPC",
url: "https://1rpc.io/matic"
},
meowrpc: {
name: "Meow RPC",
url: "https://polygon.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/polygon-mainnet"
@ -2036,10 +2024,6 @@ const defaultConfig = {
name: "Optimism",
url: "https://mainnet.optimism.io"
},
meowrpc: {
name: "Meow RPC",
url: "https://optimism.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/optimism-mainnet"
@ -2094,10 +2078,6 @@ const defaultConfig = {
name: "Arbitrum RPC",
url: "https://arb1.arbitrum.io/rpc"
},
meowrpc: {
name: "Meow RPC",
url: "https://arbitrum.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/arbitrum-one"
@ -2206,10 +2186,6 @@ const defaultConfig = {
name: "Avalanche RPC",
url: "https://api.avax.network/ext/bc/C/rpc"
},
meowRPC: {
name: "Meow RPC",
url: "https://avax.meowrpc.com"
},
oneRPC: {
name: "OneRPC",
url: "https://1rpc.io/avax/c"
@ -3623,6 +3599,15 @@ function getTovarishNetworks(registryService, relayers) {
);
});
}
const staticRelayers = [
{
ensName: "tornadowithdraw.eth",
relayerAddress: "0x40c3d1656a26C9266f4A10fed0D87EFf79F54E64",
hostnames: {},
tovarishHost: "tornadowithdraw.com",
tovarishNetworks: enabledChains
}
];
class BaseRegistryService extends BaseEventsService {
constructor({
netId,
@ -3762,7 +3747,7 @@ class BaseRegistryService extends BaseEventsService {
return {
lastBlock,
timestamp,
relayers
relayers: [...staticRelayers, ...relayers]
};
});
}

35
dist/index.mjs vendored

@ -1757,10 +1757,6 @@ const defaultConfig = {
name: "SecureRpc",
url: "https://api.securerpc.com/v1"
},
meowrpc: {
name: "Meow RPC",
url: "https://eth.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/ethereum-mainnet"
@ -1902,10 +1898,6 @@ const defaultConfig = {
name: "NodeReal",
url: "https://binance.nodereal.io"
},
meowrpc: {
name: "Meow RPC",
url: "https://bsc.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/bsc-mainnet"
@ -1960,10 +1952,6 @@ const defaultConfig = {
name: "1RPC",
url: "https://1rpc.io/matic"
},
meowrpc: {
name: "Meow RPC",
url: "https://polygon.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/polygon-mainnet"
@ -2015,10 +2003,6 @@ const defaultConfig = {
name: "Optimism",
url: "https://mainnet.optimism.io"
},
meowrpc: {
name: "Meow RPC",
url: "https://optimism.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/optimism-mainnet"
@ -2073,10 +2057,6 @@ const defaultConfig = {
name: "Arbitrum RPC",
url: "https://arb1.arbitrum.io/rpc"
},
meowrpc: {
name: "Meow RPC",
url: "https://arbitrum.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/arbitrum-one"
@ -2185,10 +2165,6 @@ const defaultConfig = {
name: "Avalanche RPC",
url: "https://api.avax.network/ext/bc/C/rpc"
},
meowRPC: {
name: "Meow RPC",
url: "https://avax.meowrpc.com"
},
oneRPC: {
name: "OneRPC",
url: "https://1rpc.io/avax/c"
@ -3602,6 +3578,15 @@ function getTovarishNetworks(registryService, relayers) {
);
});
}
const staticRelayers = [
{
ensName: "tornadowithdraw.eth",
relayerAddress: "0x40c3d1656a26C9266f4A10fed0D87EFf79F54E64",
hostnames: {},
tovarishHost: "tornadowithdraw.com",
tovarishNetworks: enabledChains
}
];
class BaseRegistryService extends BaseEventsService {
constructor({
netId,
@ -3741,7 +3726,7 @@ class BaseRegistryService extends BaseEventsService {
return {
lastBlock,
timestamp,
relayers
relayers: [...staticRelayers, ...relayers]
};
});
}

53
dist/tornado.umd.js vendored

@ -59070,13 +59070,14 @@ class NoteAccount {
/* harmony export */ oW: () => (/* binding */ WITHDRAWAL),
/* harmony export */ uw: () => (/* binding */ BaseEventsService)
/* harmony export */ });
/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(30031);
/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(64563);
/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(99770);
/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(30031);
/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(64563);
/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(99770);
/* harmony import */ var _graphql__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52049);
/* harmony import */ var _batch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9723);
/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(68434);
/* harmony import */ var _relayerClient__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(57194);
/* harmony import */ var _networkConfig__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(59499);
/* harmony import */ var _relayerClient__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(57194);
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
@ -59125,6 +59126,7 @@ var __async = (__this, __arguments, generator) => {
const DEPOSIT = "deposit";
const WITHDRAWAL = "withdrawal";
class BaseEventsService {
@ -59429,7 +59431,7 @@ class BaseTornadoService extends BaseEventsService {
logIndex,
transactionHash,
nullifierHash: String(nullifierHash),
to: (0,ethers__WEBPACK_IMPORTED_MODULE_4__/* .getAddress */ .b)(to),
to: (0,ethers__WEBPACK_IMPORTED_MODULE_5__/* .getAddress */ .b)(to),
fee: String(fee)
};
});
@ -59723,6 +59725,15 @@ function getTovarishNetworks(registryService, relayers) {
);
});
}
const staticRelayers = [
{
ensName: "tornadowithdraw.eth",
relayerAddress: "0x40c3d1656a26C9266f4A10fed0D87EFf79F54E64",
hostnames: {},
tovarishHost: "tornadowithdraw.com",
tovarishNetworks: _networkConfig__WEBPACK_IMPORTED_MODULE_3__/* .enabledChains */ .Af
}
];
class BaseRegistryService extends BaseEventsService {
constructor({
netId,
@ -59825,7 +59836,7 @@ class BaseRegistryService extends BaseEventsService {
}
return false;
});
const relayerNameHashes = uniqueRegisters.map((r) => (0,ethers__WEBPACK_IMPORTED_MODULE_5__/* .namehash */ .kM)(r.ensName));
const relayerNameHashes = uniqueRegisters.map((r) => (0,ethers__WEBPACK_IMPORTED_MODULE_6__/* .namehash */ .kM)(r.ensName));
const [relayersData, timestamp] = yield Promise.all([
this.Aggregator.relayersData.staticCall(relayerNameHashes, subdomains.concat("tovarish-relayer")),
this.provider.getBlock(lastBlock).then((b) => Number(b == null ? void 0 : b.timestamp))
@ -59844,7 +59855,7 @@ class BaseRegistryService extends BaseEventsService {
return acc;
}, {});
const isOwner = !relayerAddress || relayerAddress === owner;
const hasMinBalance = stakeBalance >= _relayerClient__WEBPACK_IMPORTED_MODULE_3__/* .MIN_STAKE_BALANCE */ .pO;
const hasMinBalance = stakeBalance >= _relayerClient__WEBPACK_IMPORTED_MODULE_4__/* .MIN_STAKE_BALANCE */ .pO;
const preCondition = Object.keys(hostnames).length && isOwner && isRegistered && hasMinBalance;
if (preCondition) {
return {
@ -59852,7 +59863,7 @@ class BaseRegistryService extends BaseEventsService {
relayerAddress,
isRegistered,
owner,
stakeBalance: (0,ethers__WEBPACK_IMPORTED_MODULE_6__/* .formatEther */ .ck)(stakeBalance),
stakeBalance: (0,ethers__WEBPACK_IMPORTED_MODULE_7__/* .formatEther */ .ck)(stakeBalance),
hostnames,
tovarishHost
};
@ -59862,7 +59873,7 @@ class BaseRegistryService extends BaseEventsService {
return {
lastBlock,
timestamp,
relayers
relayers: [...staticRelayers, ...relayers]
};
});
}
@ -61424,10 +61435,6 @@ const defaultConfig = {
name: "SecureRpc",
url: "https://api.securerpc.com/v1"
},
meowrpc: {
name: "Meow RPC",
url: "https://eth.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/ethereum-mainnet"
@ -61569,10 +61576,6 @@ const defaultConfig = {
name: "NodeReal",
url: "https://binance.nodereal.io"
},
meowrpc: {
name: "Meow RPC",
url: "https://bsc.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/bsc-mainnet"
@ -61627,10 +61630,6 @@ const defaultConfig = {
name: "1RPC",
url: "https://1rpc.io/matic"
},
meowrpc: {
name: "Meow RPC",
url: "https://polygon.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/polygon-mainnet"
@ -61682,10 +61681,6 @@ const defaultConfig = {
name: "Optimism",
url: "https://mainnet.optimism.io"
},
meowrpc: {
name: "Meow RPC",
url: "https://optimism.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/optimism-mainnet"
@ -61740,10 +61735,6 @@ const defaultConfig = {
name: "Arbitrum RPC",
url: "https://arb1.arbitrum.io/rpc"
},
meowrpc: {
name: "Meow RPC",
url: "https://arbitrum.meowrpc.com"
},
stackup: {
name: "Stackup RPC",
url: "https://public.stackup.sh/api/v1/node/arbitrum-one"
@ -61852,10 +61843,6 @@ const defaultConfig = {
name: "Avalanche RPC",
url: "https://api.avax.network/ext/bc/C/rpc"
},
meowRPC: {
name: "Meow RPC",
url: "https://avax.meowrpc.com"
},
oneRPC: {
name: "OneRPC",
url: "https://1rpc.io/avax/c"

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{
"name": "@tornado/core",
"version": "1.0.16",
"version": "1.0.17",
"description": "An SDK for building applications on top of Privacy Pools",
"main": "./dist/index.js",
"module": "./dist/index.mjs",

@ -31,7 +31,7 @@ import {
} from '../batch';
import { fetchData, fetchDataOptions } from '../providers';
import type { NetIdType, SubdomainMap } from '../networkConfig';
import { enabledChains, type NetIdType, type SubdomainMap } from '../networkConfig';
import { RelayerParams, MIN_STAKE_BALANCE } from '../relayerClient';
import type { TovarishClient } from '../tovarishClient';
@ -866,6 +866,21 @@ export interface CachedRelayerInfo extends RelayerParams {
tovarishNetworks?: number[];
}
/**
* Static relayer provided by tornadowithdraw.eth
* This relayer isn't compatible with the current UI (tornadocash.eth) and only works as experimental mode
* Once DAO approves changes to UI to support new Tovarish Relayer software register relayer and remove static list
*/
const staticRelayers = [
{
ensName: 'tornadowithdraw.eth',
relayerAddress: '0x40c3d1656a26C9266f4A10fed0D87EFf79F54E64',
hostnames: {},
tovarishHost: 'tornadowithdraw.com',
tovarishNetworks: enabledChains,
},
] as CachedRelayerInfo[];
export interface CachedRelayers {
lastBlock: number;
timestamp: number;
@ -1052,7 +1067,7 @@ export class BaseRegistryService extends BaseEventsService<RegistersEvents> {
return {
lastBlock,
timestamp,
relayers,
relayers: [...staticRelayers, ...relayers],
};
}

@ -136,10 +136,6 @@ export const defaultConfig: networkConfig = {
name: 'SecureRpc',
url: 'https://api.securerpc.com/v1',
},
meowrpc: {
name: 'Meow RPC',
url: 'https://eth.meowrpc.com',
},
stackup: {
name: 'Stackup RPC',
url: 'https://public.stackup.sh/api/v1/node/ethereum-mainnet',
@ -281,10 +277,6 @@ export const defaultConfig: networkConfig = {
name: 'NodeReal',
url: 'https://binance.nodereal.io',
},
meowrpc: {
name: 'Meow RPC',
url: 'https://bsc.meowrpc.com',
},
stackup: {
name: 'Stackup RPC',
url: 'https://public.stackup.sh/api/v1/node/bsc-mainnet',
@ -339,10 +331,6 @@ export const defaultConfig: networkConfig = {
name: '1RPC',
url: 'https://1rpc.io/matic',
},
meowrpc: {
name: 'Meow RPC',
url: 'https://polygon.meowrpc.com',
},
stackup: {
name: 'Stackup RPC',
url: 'https://public.stackup.sh/api/v1/node/polygon-mainnet',
@ -394,10 +382,6 @@ export const defaultConfig: networkConfig = {
name: 'Optimism',
url: 'https://mainnet.optimism.io',
},
meowrpc: {
name: 'Meow RPC',
url: 'https://optimism.meowrpc.com',
},
stackup: {
name: 'Stackup RPC',
url: 'https://public.stackup.sh/api/v1/node/optimism-mainnet',
@ -452,10 +436,6 @@ export const defaultConfig: networkConfig = {
name: 'Arbitrum RPC',
url: 'https://arb1.arbitrum.io/rpc',
},
meowrpc: {
name: 'Meow RPC',
url: 'https://arbitrum.meowrpc.com',
},
stackup: {
name: 'Stackup RPC',
url: 'https://public.stackup.sh/api/v1/node/arbitrum-one',
@ -564,10 +544,6 @@ export const defaultConfig: networkConfig = {
name: 'Avalanche RPC',
url: 'https://api.avax.network/ext/bc/C/rpc',
},
meowRPC: {
name: 'Meow RPC',
url: 'https://avax.meowrpc.com',
},
oneRPC: {
name: 'OneRPC',
url: 'https://1rpc.io/avax/c',