Skip to content

refactor: remove alloy-format path from block-and-receipts importer - #2723

Draft
gventino-cw wants to merge 10 commits into
mainfrom
cleanup/remove-alloy-block-and-receipts-path
Draft

gventino-cw wants to merge 10 commits into
mainfrom
cleanup/remove-alloy-block-and-receipts-path

Conversation

@gventino-cw

Copy link
Copy Markdown
Contributor

Closes #2719.

⚠️⚠️⚠️ DO NOT MERGE OR DEPLOY BEFORE READING THIS ⚠️⚠️⚠️

This PR removes the wire-format negotiation from the block-and-receipts importer. It is a breaking change for any node that still speaks the legacy alloy format. Merge and deploy ONLY when ALL of the following are true:

  1. PR feat(rpc): stratus-native response format for stratus_getBlockAndReceipts #2717 is merged — this branch is stacked on top of it.
  2. The Serialize blocks with receipts directly from stratus types #2709/feat(rpc): stratus-native response format for stratus_getBlockAndReceipts #2717 rollout is complete in every deployment: all leaders AND all followers run feat(rpc): stratus-native response format for stratus_getBlockAndReceipts #2717 binaries with the importer on the stratus-native format (default since the followers were flipped during rollout). Verify in monitoring: followers log mined imported block number=N and keep converging; zero failed to deserialize importer data errors.
  3. No rollback plan depends on the alloy format — after this PR the old behavior cannot be re-enabled by configuration; rolling back requires redeploying pre-cleanup binaries.

What breaks if deployed out of order:

Deployment order (same as the #2717 rollout): deploy leaders first (running #2717, still serving the stratus format) → upgrade and verify every follower → then merge and deploy this PR.

Summary

The follower importer no longer understands or requests the legacy alloy response format. stratus_getBlockAndReceipts has exactly one response shape: the stratus block DTO (BlockRocksdb) with receipts embedded in each mined transaction.

Removed:

  • Importer (follower/importer): the FetchedBlockWithReceipts enum, the response_format config knob (importer.response_format), and the ExternalBlockWithReceipts route; the fetcher now always deserializes BlockRocksdb into Block.
  • RPC (eth/rpc): the ResponseFormat enum and the PaginationParams.format field; the handler unconditionally serializes the storage DTO. Old leaders that ignored the unknown format field no longer receive it — the wire format of pagination params is back to { "offset": N } only.
  • Executor (eth/executor): the whole external-transaction reexecution machinery — execute_external_block / execute_external_transaction(_inner), the TransactionTaskKind::External worker arm, the alloy receipt-based validation methods (from_failed_external_transaction, compare_with_receipt, apply_receipt, fix_logs_gas_left) and their tests, plus the executor_external_block / executor_external_transaction metrics.
  • Types (eth/types): the external module (ExternalBlock, ExternalBlockWithReceipts, ExternalReceipt, ExternalReceipts, ExternalTransaction), TryFrom<ExternalTransaction> for TransactionInput, apply_external / PartialEq bridging, TryFrom<&ExternalBlock> for BlockHeader, set_pending_from_external, and the AlloyBlockExternalTransaction alias. Also dropped dead RPC-client methods (fetch_block, fetch_transaction, fetch_receipt); subscribe_new_heads now consumes alloy_rpc_types_eth::Header directly.
  • E2E: the pagination test suites are merged into a single stratus-native test; the -stratus recipe and the follower extra-args passthrough are gone; stratus_getBlockAndReceipts assertions in the JSON-RPC suite match the DTO shape.

Kept intentionally (still used by eth_getBlockByNumber / eth_getBlockByHash): From<TransactionInput> for AlloyTransaction, to_tx_envelope, and From<Block> for AlloyBlockAlloyTransaction.

Commits

  1. refactor(importer): collapse block-and-receipts importer to stratus-native format
  2. refactor(rpc): remove response format negotiation from stratus_getBlockAndReceipts
  3. refactor(executor): remove external transaction reexecution machinery
  4. refactor(e2e): merge pagination tests into stratus-native format

Testing

  • cargo check / cargo clippy / full cargo test --lib --features dev on the worktree (nightly-2026-05-08 rustfmt clean).
  • E2E: just e2e-leader-follower-pagination (merged stratus-native pagination test), just e2e-leader-follower-pagination-changes, just e2e-leader-follower-up, and the external JSON-RPC suite against the DTO shape.

Rollout

This PR is the final step of the plan tracked in #2719 — see the disclaimer above for the required order.

…ipts (#2709)

Leader:
- `stratus_getBlockAndReceipts` gains an opt-in stratus-native response
  format via the optional pagination parameter `format` ("alloy" default,
  "stratus" new): serializes `BlockRocksdb` directly from the stratus
  `Block` type (receipts embedded) instead of converting through the
  alloy types, matching the `stratus_get_block_with_changes` precedent.

Follower:
- New importer config `importer.response_format` (default "alloy").
  With "stratus", the follower requests the native format on every
  importer request (including pagination chunks) and re-executes blocks
  through the new native path (`Executor::execute_imported_block`,
  `Miner::mine_imported`, `Block::apply_imported`), mirroring the alloy
  path behavior exactly (same signer re-derivation, receipt comparison,
  failed-transaction handling and state changes).
- Clear startup/sync error when a stratus-format follower hits an old
  leader that keeps answering in the legacy alloy format.

Old leaders ignore the unknown `format` field; old followers never send
it, so mixed fleets keep syncing during rollout (upgrade leaders first,
then flip followers via config).
…cess and failure helpers

Reduces cyclomatic complexity by extracting reexecute_imported_transaction
and recreate_failed_imported_transaction. No behavior change.
…helper

- hoist duplicated gas-left event hashes to module-level GAS_LEFT_EVENT_HASHES
- extract TransactionExecution::transaction_input() and use it in the executor and fake leader
- surface the parse error as reason in the legacy-format tracing
- drop redundant required = false from the importer response_format arg
@github-actions

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

This branch has not been deployed

No deployments
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.

Cleanup: remove alloy-format path from block-and-receipts importer (post-rollout of #2709)

1 participant