Reduce number of ETH RPC calls during block polling#2775
Merged
Conversation
thomshutt
approved these changes
Mar 21, 2023
Contributor
thomshutt
left a comment
There was a problem hiding this comment.
This looks great, thanks for the detailed explanation of why we've done each piece. If this works then it's also a big win in terms of reducing our code complexity!
mjh1
approved these changes
Mar 22, 2023
f4da0f0 to
109a6f3
Compare
Codecov Report
@@ Coverage Diff @@
## master #2775 +/- ##
===================================================
+ Coverage 56.28521% 56.60971% +0.32450%
===================================================
Files 88 88
Lines 19172 19078 -94
===================================================
+ Hits 10791 10800 +9
+ Misses 7789 7684 -105
- Partials 592 594 +2
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this pull request do? Explain your changes. (required)
Reduce the number of ETH RPC calls during the block polling operations.
From my measurements, this change (together with changing
blockPollingIntervalfrom10to20) should bring the RPC req reduction by the factor of 7-8x.The main improvement is that I removed the
pollNextBlock()andbuildCanonicalChain()parts, which I believe are not important after the migration to Arbitrum. The rationale is that Ethereum had a different approach to the block finality than Arbitrum:123,234,345, but after some time they could be reorganized to123,234,456.123,234,345, they will always stay this wayI believe this whole code part with
pollNextBlock()was so complex because the block reorg needed to be supported.Specific updates (required)
pollNextBlock()andbuidCanonicalChain()maxBlocksInGetLogsQueryfrom60to1000(this limit was too low which resulted in multipleeth_getLogscalls instead of one callHow did you test each of these updates (required)
Tested with local runs (running for a long time).
Further improvements
The code could be refactored even further, but I don't want to do it in this PR, since I'd like to limit the number of changes done here to the minimum that brings good results. Additional possible improvements:
stackand its operations (stack.go)fix #2298
Checklist:
makeruns successfully./test.shpassREADME and other documentation updated