Skip to content

Conversation

@fbac
Copy link
Collaborator

@fbac fbac commented May 26, 2025

Different RPC might have different block page sizes.

Summary by CodeRabbit

  • New Features

    • Backfill block size configuration is now available separately for each chain type, allowing more granular control for both app chains and settlement chains.
    • Added a new setting for maximum chain disconnect time in settlement chain options.
  • Chores

    • Updated internal configuration handling to remove the global backfill block size setting and move it to individual chain configurations.

@fbac fbac requested a review from a team as a code owner May 26, 2025 12:11
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 26, 2025

Walkthrough

This change moves the BackfillBlockSize configuration from a global contracts option to per-chain options within AppChainOptions and SettlementChainOptions. Corresponding updates are made to constructors and configuration usage, removing the need to pass BackfillBlockSize as a separate parameter and ensuring it is sourced directly from each chain's configuration. Additionally, MaxChainDisconnectTime is added to SettlementChainOptions.

Changes

File(s) Change Summary
pkg/config/options.go Removed BackfillBlockSize from ContractsOptions; added it to AppChainOptions and SettlementChainOptions; added MaxChainDisconnectTime to SettlementChainOptions.
pkg/indexer/app_chain/app_chain.go Removed blockSize parameter from NewAppChain; now uses cfg.BackfillBlockSize directly.
pkg/indexer/settlement_chain/settlement_chain.go Removed blockSize parameter from NewSettlementChain; now uses cfg.BackfillBlockSize directly.
pkg/indexer/indexer.go Updated NewIndexer to stop passing cfg.BackfillBlockSize to chain constructors.
pkg/testutils/config.go Updated test config to set BackfillBlockSize in both AppChainOptions and SettlementChainOptions; removed top-level field.

Sequence Diagram(s)

sequenceDiagram
    participant Indexer
    participant AppChainConfig
    participant AppChain
    participant SettlementChainConfig
    participant SettlementChain

    Indexer->>AppChainConfig: Read BackfillBlockSize
    Indexer->>AppChain: NewAppChain(cfg)
    AppChain->>AppChainConfig: Use BackfillBlockSize

    Indexer->>SettlementChainConfig: Read BackfillBlockSize
    Indexer->>SettlementChain: NewSettlementChain(cfg)
    SettlementChain->>SettlementChainConfig: Use BackfillBlockSize
Loading

Possibly related PRs

  • xmtp/xmtpd#834: Introduces support for configurable backfill block sizes in log streaming, closely related to this PR's refactor of backfill size configuration.

Suggested reviewers

  • mkysel

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 943d479 and e987349.

📒 Files selected for processing (2)
  • pkg/config/options.go (1 hunks)
  • pkg/indexer/settlement_chain/settlement_chain.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/indexer/settlement_chain/settlement_chain.go
  • pkg/config/options.go
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Push Docker Images to GitHub Packages (xmtpd-cli)
  • GitHub Check: Push Docker Images to GitHub Packages (xmtpd)
  • GitHub Check: Test (Node)
  • GitHub Check: Upgrade Tests
  • GitHub Check: Code Review
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@macroscopeapp
Copy link

macroscopeapp bot commented May 26, 2025

Move BackfillBlockSize configuration from ContractsOptions to chain-specific AppChainOptions and SettlementChainOptions structs with default value of 500

Moves the BackfillBlockSize configuration field from the global ContractsOptions struct to chain-specific AppChainOptions and SettlementChainOptions structs in options.go. Updates the NewAppChain and NewSettlementChain constructors in app_chain.go and settlement_chain.go to remove the blockSize parameter and access the configuration directly from their respective chain options. Modifies the indexer initialization in indexer.go to remove the BackfillBlockSize parameter from constructor calls. Updates test configuration in config.go to reflect the new structure.

📍Where to Start

Start with the configuration changes in options.go to understand how the BackfillBlockSize field has been moved from ContractsOptions to the chain-specific option structs.

Changes since #850 opened

  • Removed duplicate field definition from configuration structure [e987349]
  • Changed backfill block size parameter source in blockchain streamer configuration [e987349]

Macroscope summarized e987349.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
pkg/testutils/config.go (1)

45-45: Consistent implementation for SettlementChainOptions.

The addition of BackfillBlockSize: 500 to SettlementChainOptions maintains consistency with AppChainOptions. This completes the migration to per-chain configuration as intended.

For future flexibility, consider extracting the backfill size (500) as a constant at the package level, which would make it easier to adjust if different values are needed for testing different chain behaviors.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 748fe0b and cf668a0.

📒 Files selected for processing (5)
  • pkg/config/options.go (1 hunks)
  • pkg/indexer/app_chain/app_chain.go (1 hunks)
  • pkg/indexer/indexer.go (0 hunks)
  • pkg/indexer/settlement_chain/settlement_chain.go (1 hunks)
  • pkg/testutils/config.go (2 hunks)
💤 Files with no reviewable changes (1)
  • pkg/indexer/indexer.go
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Push Docker Images to GitHub Packages (xmtpd-cli)
  • GitHub Check: Code Review
  • GitHub Check: Test (Node)
  • GitHub Check: Push Docker Images to GitHub Packages (xmtpd)
  • GitHub Check: Upgrade Tests
🔇 Additional comments (4)
pkg/indexer/app_chain/app_chain.go (1)

116-116: LGTM! Correctly uses per-chain backfill configuration.

The change appropriately sources BackfillBlockSize directly from the AppChainOptions configuration, aligning with the PR's objective to support per-chain backfill sizes.

pkg/indexer/settlement_chain/settlement_chain.go (1)

86-86: LGTM! Consistent with app chain implementation.

The change correctly sources BackfillBlockSize from the SettlementChainOptions configuration, maintaining consistency with the app chain implementation.

pkg/config/options.go (1)

38-38: Well-structured per-chain configuration.

The addition of BackfillBlockSize to both AppChainOptions and SettlementChainOptions enables independent configuration for each chain type, which is essential given that different RPCs may have different block page size limits. The consistent default value of 500 and unique environment variables for each chain are appropriate design choices.

Also applies to: 47-47

pkg/testutils/config.go (1)

33-33: LGTM!

The addition of BackfillBlockSize: 500 to AppChainOptions correctly implements the migration of this configuration from global to per-chain settings. The value matches the documented default.

@fbac fbac merged commit d4f8495 into 05-25-settlement_chain May 28, 2025
10 checks passed
@fbac fbac deleted the 05-26-backfill_block_num_per_chain branch May 28, 2025 10:46
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