-
Notifications
You must be signed in to change notification settings - Fork 135
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
feat(bridge): history latest log error if provider isn't giving new blocks #1148
Conversation
734935e
to
55c385a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛥️
portal-bridge/src/bridge/history.rs
Outdated
// 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; |
There was a problem hiding this comment.
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:
let mut seen_old_latest_block_index = 0; | |
let mut old_latest_block_counter = 0; |
There was a problem hiding this comment.
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
?
portal-bridge/src/bridge/history.rs
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
portal-bridge/src/bridge/history.rs
Outdated
// 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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick:
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."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
receieved
-> received
portal-bridge/src/bridge/history.rs
Outdated
// 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; |
There was a problem hiding this comment.
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
?
portal-bridge/src/bridge/history.rs
Outdated
// 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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
receieved
-> received
portal-bridge/src/bridge/history.rs
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indicates
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.