-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix LatestFinalizedBlock=0 bug [BCI-3618](https://smartcontract-it.atlassian.net/browse/BCI-3618) #13861
Merged
reductionista
merged 4 commits into
develop
from
bug/logpoller_set_latest_finalized_block
Jul 17, 2024
Merged
Fix LatestFinalizedBlock=0 bug [BCI-3618](https://smartcontract-it.atlassian.net/browse/BCI-3618) #13861
reductionista
merged 4 commits into
develop
from
bug/logpoller_set_latest_finalized_block
Jul 17, 2024
Conversation
This file contains 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
reductionista
force-pushed
the
bug/logpoller_set_latest_finalized_block
branch
from
July 16, 2024 02:26
1693ce1
to
d370a72
Compare
dhaidashenko
approved these changes
Jul 16, 2024
ilija42
approved these changes
Jul 16, 2024
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Jul 16, 2024
connorwstein
approved these changes
Jul 16, 2024
kidambisrinivas
approved these changes
Jul 16, 2024
jmank88
approved these changes
Jul 16, 2024
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Jul 16, 2024
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Jul 17, 2024
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Jul 17, 2024
Quality Gate passedIssues Measures |
This was referenced Jul 17, 2024
This was referenced Jul 31, 2024
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.
Some products rely on
LatestBlock()
to return a validLatestFinalizedBlock
(eg in order to compute where to start polling from).This is always filled in for unfinalized logs, but for the case of backfilling finalized logs it was not being set.
Ordinarily, as soon as we're done pulling finalized logs we continue on to pull the unfinalized logs before returning from
PollAndSaveLogs
, but if there is an issue with the rpc server just as it's about to pull the first unfinalized log (or if the node gets restarted at that crucial moment), the db can be left in a state where the latest block saved is a finalized block withLatestFinalizedBlock
set to 0. To fix this, we can just setLatestFinalizedBlock = BlockNumber
(its own block number) for finalized blocks that get saved to the db.If this is the last batch of blocks requested in a series of batches during a backfill, then it should always be true. If it's not the last batch, then the actual latest finalized block can be larger than the current block number. However, it still seems better to set these equal as returning
LatestFinalizedBlock > LatestBlock
seems awkward and more likely to cause the caller to get confused. It's still correct in that this is the latest finalized block that LogPoller has saved to the db (as well as the latest block).