Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetLatestBlockWithRetry and GetStakerId contract call is called repeatedly #1199

Closed
Yashk767 opened this issue Mar 22, 2024 · 0 comments
Closed
Assignees

Comments

@Yashk767
Copy link
Contributor

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 functions GetBufferedState and GetEpoch to get the latest block number, rather we can use the existing latest block number provided in

HandleBlock(client *ethclient.Client, account types.Account, blockNumber *big.Int, config types.Configurations, rogueData types.Rogue, backupNodeActionsToIgnore []string)

For stakerId
we can just call GetStakerId(address) only once outside the voting for loop and use the same when required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant