cmd/utils/app: process all files passed to import command#21513
Open
yperbasis wants to merge 4 commits into
Open
cmd/utils/app: process all files passed to import command#21513yperbasis wants to merge 4 commits into
yperbasis wants to merge 4 commits into
Conversation
The import command documented multi-file support but only processed cliCtx.Args().First(), silently ignoring the rest. This forced Hive's erigon entrypoint to restart a full erigon process per block file; on block-heavy BlockchainTests (walletReorganizeOwners, ForkStressTest) the ~0.5s/process startup overhead times hundreds of blocks blew past Hive's 180s container-startup timeout. Iterate every file argument in a single process, tolerating per-file failures when several files are given, matching go-ethereum. This lets the hive entrypoint import all blocks in one invocation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced May 29, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the erigon import command to process every positional file argument in a single initialized process, aligning implementation with the command’s documented multi-file behavior and reducing repeated startup overhead for Hive block imports.
Changes:
- Replaces single-file import handling with ordered iteration over all provided files.
- Adds helper behavior to continue processing remaining files after per-file failures.
- Adds unit tests covering multi-file processing and error surfacing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
cmd/utils/app/import_cmd.go |
Adds multi-file import iteration via importFiles. |
cmd/utils/app/import_cmd_test.go |
Adds tests for processing order, continued iteration after failures, and single-file error propagation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The import command builds the full node via eth.New, which starts the embedded MCP SSE server by default (mcp.addr/mcp.port). A one-shot block import has no use for it, so force-disable it via --mcp.disable alongside the existing NAT/downloader/external-consensus disables. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A SIGINT/SIGTERM was treated like a per-file import failure, so on a multi-file import the interrupt only aborted the current file and the loop continued with the next. Return a sentinel errInterrupted from ImportChain and stop the importFiles loop on it, so user cancellation aborts the whole command. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Hive
legacy-cancunBlockchainTests suite intermittently fails 4 tests withclient did not start: timed out waiting for container startup:walletReorganizeOwners_{Cancun,Istanbul,London,Paris}(e.g. this run). They took ~181s, just over Hive's 180s container-startup timeout. The same test on other forks (Shanghai/Berlin) and
ForkStressTest_*sit at 146–150s — right at the cliff.Root cause
The
importcommand documents multi-file support:but
importChainonly processedcliCtx.Args().First(), silently ignoring the rest. That forced Hive's erigon entrypoint into a one-process-per-block-file loop. ForwalletReorganizeOwners(235 block files) that is 235 full erigon startups — measured at ~0.5s/process × 261 = 145s of pure startup, while actual block execution is ~40ms each. go-ethereum has no such problem: its entrypoint imports every block in onegeth importinvocation.Fix
Iterate every file argument in a single process, tolerating per-file failures when several files are given (matching go-ethereum). This lets the hive entrypoint import all blocks in one invocation, collapsing hundreds of process startups into one (~150s → ~10s).
It also force-disables the embedded MCP server for the one-shot import (
--mcp.disable, alongside the existing NAT / downloader / external-consensus disables) — a batch import has no use for it.Companion change (required)
The hive entrypoint must pass all block files in one invocation: ethereum/hive#1519. Order matters — the hive change depends on this one (on an old erigon,
import /blocks/*would import only the first block).Testing
import_cmd_test.go): all-files iteration, per-file failure tolerance, single-file error surfacing.erigon import a.rlp b.rlpnow attempts both files in one process (previously stopped after the first).make lintclean;make erigon integrationbuilds.