Skip to content

Backfill StateSync Command#1784

Merged
lucca30 merged 11 commits intodevelopfrom
lmartins/backfill-statesync-command
Sep 25, 2025
Merged

Backfill StateSync Command#1784
lucca30 merged 11 commits intodevelopfrom
lmartins/backfill-statesync-command

Conversation

@lucca30
Copy link
Copy Markdown
Contributor

@lucca30 lucca30 commented Sep 22, 2025

Description

The backfill-statesync-txs command receives a trusted file containing statesync txs and events from a time period and backfill it into the database. It walks over the block period checking any missing data and backfilling them. It writes just over KV database, which means the data which were supposed to already be on ancient will be now always at ancient.

Changes

  • 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)
  • Changes only for a subset of nodes

@lucca30 lucca30 requested a review from a team September 22, 2025 18:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new backfill-statesync-txs command that allows backfilling missing StateSync transaction data and receipts from a trusted JSON file into the database. The command validates the input file, checks for missing data in the database, and only inserts entries that don't already exist.

  • Implements comprehensive validation of StateSync data including consecutiveness checks for StateSync IDs
  • Adds parallel processing for efficient database checking and batched writes
  • Includes proper error handling and progress reporting throughout the backfill process

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/cli/command.go Registers the new backfill command in the CLI command map
internal/cli/backfill_statesync_txs.go Main implementation with validation, parsing, and database operations
docs/cli/backfill_statesync_txs.md Documentation for the new command
core/rawdb/bor_receipt.go Updates nil check to use len(data) != 0 for consistency
core/rawdb/accessors_chain.go Minor formatting cleanup removing blank line

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

lucca30 and others added 2 commits September 25, 2025 07:40
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud
Copy link
Copy Markdown

@lucca30 lucca30 merged commit 2997bd3 into develop Sep 25, 2025
12 checks passed
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.

4 participants