You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The RPC usage metrics revealed that calls to eth_getBlockByNumber were excessively high. This function is being invoked repeatedly within a for loop during our voting process. To prevent reaching the free tier limit of RPC usage, there's a necessity to optimize this implementation.
Staker Id remains the same for a staker throughout but we still call getStakerId for an address every time inside HandleBlock.
Solution
We do use GetLatestBlockWithRetry in functions GetBufferedState and GetEpoch to get the latest block number, rather we can use the existing latest block number provided in
Description
The RPC usage metrics revealed that calls to
eth_getBlockByNumber
were excessively high. This function is being invoked repeatedly within a for loop during our voting process. To prevent reaching the free tier limit of RPC usage, there's a necessity to optimize this implementation.Staker Id remains the same for a staker throughout but we still call getStakerId for an address every time inside
HandleBlock
.Solution
We do use
GetLatestBlockWithRetry
in functionsGetBufferedState
andGetEpoch
to get the latest block number, rather we can use the existing latest block number provided inFor
stakerId
we can just call
GetStakerId(address)
only once outside the voting for loop and use the same when required.The text was updated successfully, but these errors were encountered: