Skip to content

fix(tycho-indexer): support non-ethereum chains in rpc subcommand - #1237

Open
die-herdplatte wants to merge 1 commit into
mainfrom
hp/fix/indexer-rpc-chain
Open

fix(tycho-indexer): support non-ethereum chains in rpc subcommand#1237
die-herdplatte wants to merge 1 commit into
mainfrom
hp/fix/indexer-rpc-chain

Conversation

@die-herdplatte

Copy link
Copy Markdown
Collaborator

Problem

tycho-indexer rpc hardcodes the storage gateway chain:

.set_chains(&[Chain::Ethereum]) // TODO: handle multichain

Since the single-chain DB guard landed (0c1249f), starting the standalone
RPC server against any non-ethereum database fails with:

Storage failure: Unexpected storage error: Chain table already contains
'arbitrum' but attempting to initialize with 'ethereum'. Each database
instance must be dedicated to a single chain.

This breaks the protocol-testing range harness for every non-ethereum
protocol
: after indexing succeeds, the harness spawns tycho-indexer rpc
for the validation step, which then tries to initialize the freshly synced
DB as ethereum and dies.

Fix

  • Add --chain (default: ethereum, so existing invocations are unaffected)
    and --chain-config to the rpc subcommand, mirroring the run subcommand
    — including init_chains so custom chains resolve.
  • Use the parsed chain in run_rpc instead of the hardcoded Chain::Ethereum,
    resolving the TODO.
  • Pass --chain from the testing harness's start_rpc_server.

The harness is the only invocation of tycho-indexer rpc in this repo (the
other subcommands — index, run, analyze-tokens — were already
chain-aware), so no other call sites needed updating. The dockerized testing
harness builds the binary from the same source tree and picks the fix up
automatically.

Testing

  • Validated end-to-end with the range harness on Arbitrum
    (range --package arbitrum-ramses-v3 --chain arbitrum, from feat: add Ramses V3 Arbitrum support #1235):
    indexing, component state validation, on-chain balance checks, 6 simulations
    and 6 executions all pass (1/1). Previously this failed at the RPC-server
    step with the error above.
  • rpc without --chain keeps the previous behavior (ethereum default).

Note for infra

If any out-of-repo deployment manifests run tycho-indexer rpc as standalone
RPC replicas against a non-ethereum database, they have been failing on
startup with this same guard error since 0c1249f — after this fix they need
--chain <chain> added, since the default remains ethereum.

🤖 Generated with Claude Code

The rpc subcommand hardcoded Chain::Ethereum when building the storage
gateway. Since the single-chain DB guard (0c1249f), this made
`tycho-indexer rpc` fail on any non-ethereum database with "Chain table
already contains '<chain>' but attempting to initialize with 'ethereum'",
which broke the protocol-testing range harness for every non-ethereum
protocol at the post-indexing validation step.

- add --chain (default: ethereum) and --chain-config to the rpc
  subcommand, mirroring the run subcommand, and use them in run_rpc
- pass --chain from the testing harness's start_rpc_server

Validated end-to-end: arbitrum-ramses-v3 range test now passes 1/1
(component state, on-chain balances, 6 simulations, 6 executions).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant