Reduce the rate of requesting deposits to lower the risk of triggering the Infura rate limits
This commit is contained in:
parent
4eaf29875a
commit
2fd71a9aac
|
@ -31,7 +31,7 @@ contract(DepositContract):
|
|||
|
||||
const
|
||||
web3Timeouts = 60.seconds
|
||||
hasDepositRootChecks = true # defined(has_deposit_root_checks)
|
||||
hasDepositRootChecks = defined(has_deposit_root_checks)
|
||||
hasGenesisDetection* = defined(has_genesis_detection)
|
||||
|
||||
type
|
||||
|
@ -276,7 +276,6 @@ proc fetchTimestamp(p: Web3DataProviderRef, blk: Eth1Block) {.async.} =
|
|||
let web3block = await p.getBlockByHash(blk.voteData.block_hash.asBlockHash)
|
||||
blk.timestamp = Eth1BlockTimestamp web3block.timestamp
|
||||
|
||||
when hasDepositRootChecks:
|
||||
type
|
||||
DepositContractDataStatus = enum
|
||||
Fetched
|
||||
|
@ -286,6 +285,7 @@ when hasDepositRootChecks:
|
|||
DepositCountIncorrect
|
||||
DepositCountUnavailable
|
||||
|
||||
when hasDepositRootChecks:
|
||||
const
|
||||
contractCallTimeout = seconds(60)
|
||||
|
||||
|
@ -655,6 +655,10 @@ proc syncBlockRange(m: Eth1Monitor,
|
|||
toBlock = maxBlockNumberRequested
|
||||
|
||||
debug.logTime "Deposit logs obtained":
|
||||
# Reduce all request rate until we have a more general solution
|
||||
# for dealing with Infura's rate limits
|
||||
await sleepAsync(milliseconds(100))
|
||||
|
||||
let jsonLogsFut = m.dataProvider.ns.getJsonLogs(
|
||||
DepositEvent,
|
||||
fromBlock = some blockId(currentBlock),
|
||||
|
@ -671,13 +675,11 @@ proc syncBlockRange(m: Eth1Monitor,
|
|||
currentBlock = maxBlockNumberRequested + 1
|
||||
break
|
||||
|
||||
debug.logTime "Deposits grouped in blocks":
|
||||
let blocksWithDeposits = depositEventsToBlocks(depositLogs)
|
||||
|
||||
for i in 0 ..< blocksWithDeposits.len:
|
||||
let blk = blocksWithDeposits[i]
|
||||
|
||||
debug.logTime "New deposit_root computed":
|
||||
for deposit in blk.deposits:
|
||||
merkleizer[].addChunk hash_tree_root(deposit).data
|
||||
|
||||
|
|
Loading…
Reference in New Issue