Compare commits

...

3 Commits

3 changed files with 45 additions and 11 deletions

View File

@ -21,8 +21,12 @@ export default {
networkName: 'Ethereum Mainnet', networkName: 'Ethereum Mainnet',
deployedBlock: 9116966, deployedBlock: 9116966,
rpcUrls: { rpcUrls: {
chainnodes: { tornadoRPC: {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://tornadocash-rpc.com/mainnet'
},
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607' url: 'https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
}, },
mevblockerRPC: { mevblockerRPC: {
@ -141,8 +145,12 @@ export default {
multicall: '0x41263cba59eb80dc200f3e2544eda4ed6a90e76c', multicall: '0x41263cba59eb80dc200f3e2544eda4ed6a90e76c',
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
rpcUrls: { rpcUrls: {
chainnodes: { tornadoRPC: {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://tornadocash-rpc.com/bsc'
},
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://bsc-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607' url: 'https://bsc-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
}, },
oneRPC: { oneRPC: {
@ -193,7 +201,7 @@ export default {
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
rpcUrls: { rpcUrls: {
chainnodes: { chainnodes: {
name: 'Tornado RPC', name: 'Chainnodes RPC',
url: 'https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607' url: 'https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
}, },
oneRpc: { oneRpc: {
@ -244,8 +252,12 @@ export default {
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
ovmGasPriceOracleContract: '0x420000000000000000000000000000000000000F', ovmGasPriceOracleContract: '0x420000000000000000000000000000000000000F',
rpcUrls: { rpcUrls: {
chainnodes: { tornadoRPC: {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://tornadocash-rpc.com/op'
},
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607' url: 'https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
}, },
oneRpc: { oneRpc: {
@ -295,8 +307,12 @@ export default {
multicall: '0x842eC2c7D803033Edf55E478F461FC547Bc54EB2', multicall: '0x842eC2c7D803033Edf55E478F461FC547Bc54EB2',
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
rpcUrls: { rpcUrls: {
chainnodes: { tornadoRPC: {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://tornadocash-rpc.com/arbitrum'
},
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://arbitrum-one.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607' url: 'https://arbitrum-one.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
}, },
oneRpc: { oneRpc: {
@ -350,8 +366,12 @@ export default {
multicall: '0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a', multicall: '0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a',
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
rpcUrls: { rpcUrls: {
chainnodes: { tornadoRPC: {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://tornadocash-rpc.com/gnosis'
},
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://gnosis-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607' url: 'https://gnosis-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
}, },
blockPi: { blockPi: {

View File

@ -412,10 +412,11 @@ class EventService {
async getEventsFromBlock({ fromBlock, graphMethod, type }) { async getEventsFromBlock({ fromBlock, graphMethod, type }) {
try { try {
// ToDo think about undefined // ToDo think about undefined
const rpcEvents = await this.getEventsFromRpc({ fromBlock, type }) const graphEvents = await this.getEventsFromGraph({ fromBlock, methodName: graphMethod })
const lastSyncBlock = fromBlock > graphEvents?.lastBlock ? fromBlock : graphEvents?.lastBlock
const allEvents = [].concat(rpcEvents || []) const rpcEvents = await this.getEventsFromRpc({ fromBlock: lastSyncBlock, type })
const allEvents = [].concat(graphEvents?.events || [], rpcEvents || [])
if (allEvents.length) { if (allEvents.length) {
return { return {
events: allEvents, events: allEvents,

View File

@ -3,6 +3,7 @@ import namehash from 'eth-ens-namehash'
import { BigNumber as BN } from 'bignumber.js' import { BigNumber as BN } from 'bignumber.js'
import { toChecksumAddress, isAddress } from 'web3-utils' import { toChecksumAddress, isAddress } from 'web3-utils'
import { graph } from '@/services'
import networkConfig from '@/networkConfig' import networkConfig from '@/networkConfig'
import { REGISTRY_DEPLOYED_BLOCK } from '@/constants' import { REGISTRY_DEPLOYED_BLOCK } from '@/constants'
import { sleep, flattenNArray } from '@/utils' import { sleep, flattenNArray } from '@/utils'
@ -169,9 +170,21 @@ class RelayerRegister {
fetchRelayers = async () => { fetchRelayers = async () => {
const blockRange = 10000 const blockRange = 10000
// eslint-disable-next-line prefer-const // eslint-disable-next-line prefer-const
let { blockTo, cachedEvents } = await this.getCachedData() let { blockFrom, blockTo, cachedEvents } = await this.getCachedData()
let allRelayers = cachedEvents let allRelayers = cachedEvents
if (!cachedEvents || !cachedEvents.length) {
const { lastSyncBlock, events } = await graph.getAllRegisters(blockFrom)
if (events.length) {
blockTo = lastSyncBlock + 1
cachedEvents = events.map((el) => ({
ensName: el.ensName,
relayerAddress: toChecksumAddress(el.address)
}))
}
}
const currentBlockNumber = await this.provider.getBlockNumber() const currentBlockNumber = await this.provider.getBlockNumber()
const fromBlock = cachedEvents.length === 0 ? REGISTRY_DEPLOYED_BLOCK[1] : blockTo const fromBlock = cachedEvents.length === 0 ? REGISTRY_DEPLOYED_BLOCK[1] : blockTo
const blockDifference = currentBlockNumber - fromBlock const blockDifference = currentBlockNumber - fromBlock
@ -181,7 +194,7 @@ class RelayerRegister {
let registerRelayerEvents let registerRelayerEvents
let lastSyncBlock = blockTo let lastSyncBlock = blockTo
if (cachedEvents.length > 0 || blockDifference === 0) { if (blockDifference <= 0) {
return cachedEvents return cachedEvents
} else if (blockDifference >= blockRange) { } else if (blockDifference >= blockRange) {
toBlock = currentBlockNumber toBlock = currentBlockNumber