Skip to content

feat(archiver): validate historical L1 log availability at startup#22644

Merged
PhilWindle merged 3 commits into
merge-train/spartanfrom
spl/feat/archiver-validate-historical-l1-logs
Apr 21, 2026
Merged

feat(archiver): validate historical L1 log availability at startup#22644
PhilWindle merged 3 commits into
merge-train/spartanfrom
spl/feat/archiver-validate-historical-l1-logs

Conversation

@spalladino

@spalladino spalladino commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Motivation

Some Ethereum RPC nodes prune historical logs. If an Aztec node points at such
an RPC, L1 sync silently misses events the archiver (and slasher, sequencer)
depend on, producing corrupt state or wrong behavior rather than a clear
failure. We want startup to abort with a clear, actionable error instead.

See also A-927

Approach

On archiver start, after the existing debug/trace probe, query the
OwnershipTransferred event that every Rollup emits via Ownable in its
constructor (on l1StartBlock). This is a cheap, guaranteed log at a known
old block. The L1 PublicClient is typically a viem fallback over several
user-configured RPC URLs, so the validator introspects its transport, builds
a single-URL client per URL, and probes each in sequence — the first URL that
fails throws. The error message names the failing URL, its
web3_clientVersion, the addresses whose logs must be retained (Rollup,
Inbox, Registry, GovernanceProposer), and reth-specific guidance when
applicable. ARCHIVER_SKIP_HISTORICAL_LOGS_CHECK=true bypasses the check.

Changes

  • ethereum (contracts/rollup): New RollupContract.getOwnershipTransferredEventsAtDeploy() that queries the event at l1StartBlock.
  • ethereum (client): New getRpcUrlsFromClient() helper that extracts URLs from a viem fallback transport.
  • archiver (l1/validate_historical_logs): New validator that iterates over each configured RPC URL, probes it with a dedicated single-URL client, and builds a rich operator-facing error on failure (per-URL client version, contract addresses required to have log retention, reth-specific guidance).
  • archiver (archiver): Wire the validator into start() after validateAndLogTraceAvailability; widen l1Addresses to include rollupAddress / inboxAddress.
  • archiver (config): New ARCHIVER_SKIP_HISTORICAL_LOGS_CHECK env var (default false), plumbed through mapArchiverConfig, factory, and ArchiverSpecificConfig.
  • foundation (config/env_var): Register the new env var name.
  • ethereum/archiver (tests): Anvil-backed test covering the positive path (rollup.test.ts); unit tests for the validator covering multi-URL iteration, per-URL failure reporting, reth vs generic guidance, and skip behavior; existing archiver tests updated for the new address shape.

Probe each configured L1 RPC for the OwnershipTransferred event emitted by
the Rollup at deploy to detect providers that prune old logs. Abort startup
with a detailed error (per-URL client version, required contract addresses,
reth-specific guidance) unless ARCHIVER_SKIP_HISTORICAL_LOGS_CHECK=true.
@spalladino spalladino added the ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure label Apr 17, 2026
…orts

The archiver's mock viem client used in archiver-sync tests does not carry
a fallback transport, so transport.transports is undefined and accessing
.map() throws. Handle both single-http transports and missing transports
shape gracefully by returning an empty array when we cannot infer URLs.
@PhilWindle PhilWindle merged commit 578e83e into merge-train/spartan Apr 21, 2026
12 checks passed
@PhilWindle PhilWindle deleted the spl/feat/archiver-validate-historical-l1-logs branch April 21, 2026 11:51
chrismarino pushed a commit to chrismarino/aztec-packages that referenced this pull request May 5, 2026
BEGIN_COMMIT_OVERRIDE
fix(kv-store): ensure LMDB cursor is closed on iteration abort (AztecProtocol#22509)
fix(telemetry-client): use appropriate histogram buckets for L1 gas
prices (AztecProtocol#22512)
fix(telemetry-client): log warning when BatchSpanProcessor drops spans
(AztecProtocol#22511)
fix(stdlib): wrap HA signer databaseUrl in SecretValue (AztecProtocol#22510)
fix(prover-client): don't mark in-progress epoch N jobs as stale when
epoch N+1 starts (AztecProtocol#22508)
chore: (A-730) graceful shutdown for services in node startup failure
path (AztecProtocol#22112)
fix(prover-client): reject stale job promises and count timeouts toward
retry limit (AztecProtocol#21842)
feat(archiver): validate historical L1 log availability at startup
(AztecProtocol#22644)
fix(archiver): do not query MessageSent events by blockhash (AztecProtocol#22641)
refactor(e2e): skip initial sequencer in p2p and epochs tests (AztecProtocol#22535)
fix: handle missing L1 finalized block on devnets (AztecProtocol#22663)
fix(world-state): treat historical block 0 queries as historical, not
latest (AztecProtocol#22679)
fix(sequencer): re-check parent checkpoint validity before pipelined L1
submission (AztecProtocol#22586)
fix(world-state): make block 0 a first-class historical block (AztecProtocol#22711)
chore: show all running versions (AztecProtocol#22376)
chore: fix prettier inside worktrees (AztecProtocol#22557)
feat: use optimized verifier for rollup (AztecProtocol#21840)
fix(kv-store): skip pool creation on ephemeral deleteDb to unstick
browser tests (AztecProtocol#22693)
chore: rm claude lockfile (AztecProtocol#22718)
fix(e2e): wait for first checkpoint in fee_asset_price_oracle_gossip
test (AztecProtocol#22719)
chore(prover-node): track estimated L1 fee when proof publishing is
disabled (AztecProtocol#22691)
fix(ci): rerun squashed PR check on base branch change (AztecProtocol#22713)
feat(archiver): decouple calldata from blob fetching in L1 synchronizer
(AztecProtocol#22716)
refactor(e2e): enable pipelining in e2e_epochs tests (AztecProtocol#22544)
feat(p2p): reject and evict txs with insufficient max fee per gas
(AztecProtocol#22118)
refactor(world-state): always index block 0 regardless of initial tree
size (AztecProtocol#22724)
fix(e2e): fix redistribution test (AztecProtocol#22729)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants