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

Introduce block tracker poll interval #1887

Merged
merged 5 commits into from
Sep 13, 2023

Conversation

goran-ethernal
Copy link
Collaborator

@goran-ethernal goran-ethernal commented Sep 7, 2023

Description

Some of the clients experienced an issue with block tracker (which is a part of ethgo third party library), where on all validator nodes, it polled rootchain rpc endpoints eth_getBlockByNumber and eth_getBlockByHash each second, causing them to spend all their allowed limit for querying rpc points on a main net such as Ethereum. This sequentially caused all other bridge actions to fail such as state sync events for deposits, or checkpointing. This issue only persisted for block trackers on validator nodes that track the state sync events (which transfer data from L1 to L2).

Block tracker in ethgo has a PollInterval (in time.Duration), which determines how often it calls given rpc endpoints, but it's configuration was not exposed explicitly, so we needed to expand our event_tracker to receive an interval, which then is set to the block tracker through its field.

This PR introduces two new flags:

  1. In genesis command - we introduced a new flag --block-tracker-poll-interval, which is defined in time duration (for example, --block-tracker-poll-interval "1s" or block-tracker-poll-interval "12s"). This is part of the genesis command and genesis.json file because, all validator nodes are tracking state sync events. Block proposers are the ones that add state sync commitment transactions at the end of a sprint, while the rest of the validators validate the given transaction, hence all validators need to track state sync events from rootchain. For a state sync commitment transaction to be valid, quorum of validators must be reached, meaning at lest 2/3+1 validators must have the same state sync events tracked. So if we are to set this flag on a server level, that means that each validator can have a different poll time, and will have different number of state sync events tracked at a point of time, which is not a desired behavior.
  2. In server command - we introduced a new flag --relayer-poll-interval, which is defined in time duration (for example, example, --relayer-poll-interval "1s" or --relayer-poll-interval "12s"). Since relayer node uses block tracker as well, but for child chain (tracking when a state sync commitment is submitted to child contract), we added this flag, so that the user can configure their relayer nodes as well to poll given rpc endpoints on child chain at desired intervals.

Tagging @DannyS03 to update the documentation.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

@goran-ethernal goran-ethernal added the feature New update to Polygon Edge label Sep 7, 2023
@goran-ethernal goran-ethernal self-assigned this Sep 7, 2023
@goran-ethernal goran-ethernal requested a review from a team September 7, 2023 12:39
@goran-ethernal goran-ethernal marked this pull request as ready for review September 7, 2023 12:42
Copy link
Collaborator

@Stefan-Ethernal Stefan-Ethernal left a comment

Choose a reason for hiding this comment

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

Generally LGTM

tracker/event_tracker.go Outdated Show resolved Hide resolved
consensus/polybft/state_sync_manager.go Outdated Show resolved Hide resolved
command/server/config/config.go Outdated Show resolved Hide resolved
consensus/polybft/common/polybft_config.go Show resolved Hide resolved
consensus/polybft/statesyncrelayer/state_sync_relayer.go Outdated Show resolved Hide resolved
command/server/server.go Show resolved Hide resolved
@goran-ethernal goran-ethernal force-pushed the Block-tracker-poll-intervall branch 2 times, most recently from dd26e6d to 792a197 Compare September 12, 2023 07:11
@goran-ethernal goran-ethernal merged commit 498ef15 into develop Sep 13, 2023
7 checks passed
@goran-ethernal goran-ethernal deleted the Block-tracker-poll-intervall branch September 13, 2023 09:29
@github-actions github-actions bot locked and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New update to Polygon Edge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants