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

Node/EVM: Track latest block #3470

Merged
merged 4 commits into from
Nov 2, 2023
Merged

Node/EVM: Track latest block #3470

merged 4 commits into from
Nov 2, 2023

Conversation

bruce-riley
Copy link
Contributor

@bruce-riley bruce-riley commented Oct 27, 2023

This PR changes the EVM watcher so that it publishes latest, safe and finalized blocks for all chains. These are published in the gossip heartbeats and in Prometheus metrics.

This PR does the following:

  • Adds a new BatchPollConnector which uses batch RPC calls to query chains that support querying for finalized and safe.
  • For chains that support instant finality, the EthereumConnector and CeloConnector publish each block as latest, safe and finalized.
  • For Polygon, in addition to using the root contract on Ethereum to read finalized blocks (which are also published as safe), it also subscribes to block events to be published as latest.
  • For chains that do not have instant finality and do not support querying for the finalized tag (currently only Neon), the existing BlockPollConnector that uses a finalizer was modified to also publish latest and safe, in addition to the current finalized.

The result of this PR is that every chain now publishes all three finality types, where if the chain does not provide a query for safe, it is published when the block is finalized.

@panoel panoel changed the title DRAFE: Node/EVM track latest block DRAFT: Node/EVM track latest block Oct 27, 2023
@bruce-riley bruce-riley force-pushed the node/evm_track_latest_block branch 3 times, most recently from e17bd21 to 5b4918a Compare October 29, 2023 18:17
@bruce-riley bruce-riley changed the title DRAFT: Node/EVM track latest block Node/EVM track latest block Oct 29, 2023
@bruce-riley bruce-riley changed the title Node/EVM track latest block Node/EVM: Track latest block Oct 29, 2023
@bruce-riley bruce-riley marked this pull request as ready for review October 29, 2023 21:14
panoel
panoel previously approved these changes Oct 30, 2023
node/cmd/guardiand/node.go Outdated Show resolved Hide resolved
node/pkg/watchers/evm/connectors/ethereum.go Outdated Show resolved Hide resolved
node/pkg/watchers/evm/watcher.go Outdated Show resolved Hide resolved
node/pkg/watchers/evm/watcher.go Outdated Show resolved Hide resolved
node/pkg/watchers/evm/watcher.go Outdated Show resolved Hide resolved
node/pkg/watchers/evm/connectors/poller.go Outdated Show resolved Hide resolved
node/pkg/watchers/evm/connectors/poller.go Outdated Show resolved Hide resolved
node/pkg/watchers/evm/connectors/poller.go Show resolved Hide resolved
node/pkg/watchers/evm/watcher.go Show resolved Hide resolved
@bruce-riley bruce-riley marked this pull request as draft October 31, 2023 13:57
@bruce-riley bruce-riley marked this pull request as ready for review November 1, 2023 17:08
@bruce-riley bruce-riley force-pushed the node/evm_track_latest_block branch 2 times, most recently from 392a874 to 9458000 Compare November 1, 2023 17:35
panoel
panoel previously approved these changes Nov 1, 2023
Copy link
Contributor

@evan-gray evan-gray left a comment

Choose a reason for hiding this comment

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

I think there's one case of not setting safe + ccq that I'm concerned about.

node/pkg/watchers/evm/watcher.go Show resolved Hide resolved
@evan-gray evan-gray merged commit 9be9a56 into main Nov 2, 2023
22 checks passed
@evan-gray evan-gray deleted the node/evm_track_latest_block branch November 2, 2023 15:59
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