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

op-proposer: Add option to wait for rollup sync during startup #10262

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

bitwiseguy
Copy link
Contributor

Description

Adds an optional flag to wait for the rollup node to sync to the current L1 tip during the op-proposer's startup.

Tests

No tests added. Main functionality is implemented by op-service/dial package's WaitNodeSync function, which is already tested within that package.

Additional context

Same basic idea as #10193, which added the same flag and option to run WaitNodeSync during the op-batcher startup.

@bitwiseguy bitwiseguy requested a review from a team as a code owner April 23, 2024 03:01
Copy link
Contributor

coderabbitai bot commented Apr 23, 2024

Walkthrough

Walkthrough

The update introduces a new feature allowing the proposer to wait for node synchronization before proceeding with its operations. This is controlled through a new configuration flag WaitNodeSyncFlag. The feature is integrated across multiple components, including configurations and service initialization, ensuring that the proposer can conditionally pause until the sequencer and rollup node are synchronized to a recent L1 block.

Changes

Files Change Summary
op-proposer/flags/flags.go, op-proposer/proposer/config.go, op-proposer/proposer/service.go Introduced WaitNodeSyncFlag and added WaitNodeSync to configurations and service initialization to manage waiting for node synchronization.
op-proposer/proposer/driver.go Added waitNodeSync function to implement the logic for waiting for node synchronization if enabled in the configuration.

Recent Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 53afefd and e61d119.
Files selected for processing (4)
  • op-proposer/flags/flags.go (2 hunks)
  • op-proposer/proposer/config.go (2 hunks)
  • op-proposer/proposer/driver.go (1 hunks)
  • op-proposer/proposer/service.go (2 hunks)
Additional comments not posted (8)
op-proposer/flags/flags.go (2)

75-81: The new WaitNodeSyncFlag is well-defined with a clear usage description. It correctly uses the prefixEnvVars function for environment variable naming, ensuring consistency with other flags.


100-100: Ensure that the new WaitNodeSyncFlag is correctly added to the optionalFlags list. This inclusion is crucial for the flag to be recognized and processed by the CLI.

op-proposer/proposer/config.go (2)

62-63: The addition of the WaitNodeSync field to the CLIConfig structure is correctly implemented. This field will store the state of the new synchronization feature flag.


112-112: The WaitNodeSync field is correctly initialized from the corresponding CLI flag in the NewConfig function. This ensures that the flag's value is properly passed to the configuration used by the proposer service.

op-proposer/proposer/service.go (2)

48-48: The WaitNodeSync field has been correctly added to the ProposerConfig structure. This field is essential for controlling the synchronization behavior based on the configuration.


94-94: The WaitNodeSync field in the ProposerService structure is properly initialized from the CLIConfig. This ensures that the synchronization behavior is configured as intended right from the start of the service.

op-proposer/proposer/driver.go (2)

418-424: The conditional check and call to waitNodeSync in the loop method are correctly implemented. This ensures that the synchronization wait only occurs if the WaitNodeSync configuration is enabled.


433-448: The waitNodeSync function is well-implemented with appropriate error handling and logging. It correctly retrieves the current L1 block number, obtains a rollup client, and waits for the rollup synchronization using the dial.WaitRollupSync function.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sebastianst sebastianst requested review from sebastianst and removed request for mslipper April 23, 2024 08:55
Copy link
Member

@sebastianst sebastianst left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@sebastianst sebastianst added this pull request to the merge queue Apr 23, 2024
Merged via the queue into develop with commit caf41c5 Apr 23, 2024
72 checks passed
@sebastianst sebastianst deleted the ss/proposer-wait-sync branch April 23, 2024 10:25
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.

2 participants