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

feat(bridge): history latest log error if provider isn't giving new blocks #1148

Conversation

KolbyML
Copy link
Member

@KolbyML KolbyML commented Feb 8, 2024

What was wrong?

Currently if a provider is working, but falls out of sync with the chain we report 0 logs that the history bridge is alive or something is wrong or not. If this case happens it is a clear case the EL provider is out of sync so we should inform the user regardless.

How was it fixed?

Add a counter which prints an error if the provider doesn't give us a new block for over a minute.
This error could go off if the provider down as well either way we want to ring some bells something is wrong with the provider.

@KolbyML KolbyML self-assigned this Feb 8, 2024
@KolbyML KolbyML force-pushed the print-an-error-if-provider-doesn't-give-us-the-stuff-we-want branch from 734935e to 55c385a Compare February 8, 2024 07:19
Copy link
Member

@ogenev ogenev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛥️

// If a provider returns the same block number and doesn't time out over and over.
// this indictates the provider is no longer in sync with the chain so we want to long an
// error
let mut seen_old_latest_block_index = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think renaming this to counter is more clear:

Suggested change
let mut seen_old_latest_block_index = 0;
let mut old_latest_block_counter = 0;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe last_seen_block_counter?

@@ -128,6 +134,12 @@ impl HistoryBridge {
}
block_index = gossip_range.end;
}
// Ethereum mainnet creates a new block every 15 seconds, if we don't get 1 new block in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you paraphrase this comment, it is not very clear to me?

// the time period 4 new blocks should exist report an error something is
// wrong with the EL provider
if seen_old_latest_block_index > 60 / LATEST_BLOCK_POLL_RATE {
tracing::error!("History Latest: Haven't receieved a new block in over 60 seconds EL provider could be out of sync");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick:

Suggested change
tracing::error!("History Latest: Haven't receieved a new block in over 60 seconds EL provider could be out of sync");
tracing::error!("History Latest: Haven't receieved a new block in over 60 seconds. EL provider could be out of sync.");

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

receieved -> received

// If a provider returns the same block number and doesn't time out over and over.
// this indictates the provider is no longer in sync with the chain so we want to long an
// error
let mut seen_old_latest_block_index = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe last_seen_block_counter?

// the time period 4 new blocks should exist report an error something is
// wrong with the EL provider
if seen_old_latest_block_index > 60 / LATEST_BLOCK_POLL_RATE {
tracing::error!("History Latest: Haven't receieved a new block in over 60 seconds EL provider could be out of sync");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

receieved -> received

@@ -102,6 +102,10 @@ impl HistoryBridge {
let mut block_index = self.execution_api.get_latest_block_number().await.expect(
"Error launching bridge in latest mode. Unable to get latest block from provider.",
);
// If a provider returns the same block number and doesn't time out over and over.
// this indictates the provider is no longer in sync with the chain so we want to long an
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indicates

@KolbyML KolbyML merged commit 20f1704 into ethereum:master Feb 8, 2024
8 checks passed
@KolbyML KolbyML deleted the print-an-error-if-provider-doesn't-give-us-the-stuff-we-want branch January 22, 2025 07:51
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

Successfully merging this pull request may close these issues.

3 participants