Operations # Known limitations > Know Leani's current production boundaries, unsupported behavior, and explicit operator obligations before deploying it. The current release is intended for evaluation, processor development, reproducible backfills, and guarded application integrations with an independent fallback. * It is not a complete Ethereum archive node and does not maintain EVM state. Arbitrary `eth_call`, balances, storage, proofs, tracing, and state-diff RPC are not served by the EVM-free core. * Xatu rows are trusted public dataset input. Sparse EraE material verifies execution commitments but still depends on an external catalog until the planned consensus-root anchoring is complete. Source trust is exposed and must not be described as fully trustless history. * Raw RPC history is post-merge exact. Ommer-aware pre-merge exactness is deferred. * Only configured processor material and bounded recent/raw-history profiles are queryable. Pruned material must be reacquired. * The native browser SDK requires same-origin hosting or an application-owned reverse proxy with an explicit CORS policy, and the page’s origin in `api.allowed_origins`. * Mainnet multi-day soak, chaos, abrupt-power-loss, broad cross-source parity, and every advertised host sweep remain release gates for a production claim. * JSON-RPC has no built-in access control, and the API bearer is the only credential for admin routes. A bind beyond loopback needs the API bearer or an explicit `allow_unauthenticated_remote` opt-in; such deployments must still use a trusted network or authenticated reverse proxy and must not expose admin/debug endpoints publicly. Treat this page and the [release process](https://leani.dev/docs/contributing/releasing/) as the public scope boundary for the current release. # Configure a node > Compose data sources, processor identities, lifecycle policies, API settings, credentials, and operating profiles. Leani reads strict, versioned TOML. Unknown fields are errors. Relative paths in a configuration file, such as `data_dir` or an archive source’s `manifest`, are relative to that file; path flags on the command line stay relative to the working directory. Version 1 has two first-class document shapes: a compact processor-oriented setup with sane network defaults, and the fully explicit advanced schema. Both become the same validated runtime configuration. The machine-readable contract is rendered in the [configuration field reference](https://leani.dev/docs/reference/configuration/); six complete advanced lifecycle profiles are checked under `config/modes`. For a continuous block-following demo, generate the compact form and a current trusted checkpoint together: ```bash leani init blocks leani doctor ``` For a local Uniswap node, select one or more markets instead: ```bash leani init uniswap-v3 ETH/USDC leani doctor ``` `init` requires a strict majority of the configured checkpoint providers, at least two of the three defaults, to agree on one finalized slot and root, and fails closed if a responding provider reports another root at that slot. It shows every provider’s answer, asks before accepting the checkpoint, writes `leani.toml`, and never overwrites an existing file. A global `--config PATH` selects another output path. The node keeps its state in `data`, beside the configuration file, unless `--data-dir` names another directory; like any path flag, a relative `--data-dir` is relative to the working directory. The generated document contains only the choices an operator normally needs: ```toml config_version = 1 network = "ethereum-mainnet" data_dir = "./data" [finality] checkpoint = "0x..." checkpoint_slot = 15100000 endpoints = [ "https://ethereum-beacon-api.publicnode.com/", "https://lodestar-mainnet.chainsafe.io/", ] [blocks] [api] bind = "127.0.0.1:18080" ``` The checkpoint and slot above are illustrative; the generator writes the live quorum result. The checkpoint is the trust root. PublicNode (`https://ethereum-beacon-api.publicnode.com/`) and Lodestar (`https://lodestar-mainnet.chainsafe.io/`) are ordinary, untrusted Beacon API transports in the compact profile’s managed transport pool; they do not provide execution blocks or Uniswap data. `init` writes that pool plus every responding checkpoint provider that also serves the Beacon light-client API, without duplicates. Leani queries the pool concurrently and verifies every response locally from the pinned checkpoint. After the first verified response it waits about two seconds for the others, then follows the highest finalized slot that `minimum_agreement` endpoints have reached or passed. With the compact profile’s default agreement of one, the most recent verified finality wins, and a stalled transport does not hold up node startup. Listing endpoints in the compact document replaces the managed defaults, which lets operators use only self-hosted transports. Compact Ethereum Mainnet configurations expand to: | Concern | Default | | ------------ | ----------------------------------------------------------------------------------------------------------------------------- | | execution | native P2P, one-peer availability floor, 16-peer healthy target, 100-peer cap | | history | public Xatu source, on-demand processor scheduling | | processor | selected built-in feed, unattested publication, checkpointed state, 256-block undo safety | | confirmation | ChainSafe’s public Lodestar node behind the `confirmed` level; a `[confirmation]` section in the compact document replaces it | | resources | 512 MiB memory, 4 GiB temporary disk, four source and mapper tasks | | retention | full query output; 64 MiB or 24 hours of change delivery | | listeners | ephemeral P2P ports, RPC `127.0.0.1:18545`/`18546`, API `127.0.0.1:18080` | The reviewed expansion is checked in as [`config/defaults/ethereum-mainnet.toml`](https://github.com/smart-byte/leani/blob/main/config/defaults/ethereum-mainnet.toml). Use the advanced schema below when any expanded field needs an override. `network` names any built-in chain entry by name or alias, such as `ethereum-hoodi`, `base`, `op`, `arbitrum-one`, or `robinhood`, and `leani init blocks --network base` writes one. The chain’s family picks the lanes. An Ethereum testnet follows its own beacon chain from the checkpoint in `[finality]`. An op-stack chain takes its blocks from execution P2P, checked against the sequencer’s signed block gossip on gossip port 9222 so that peers can dial in, and from the entry’s public JSON-RPC endpoints while no execution peer serves them; its history comes through the live lane. A Nitro chain takes its blocks from the entry’s public JSON-RPC endpoints, checked against its sequencer’s signed feed, with history from the sources the entry names: SonarX and then the endpoints for Arbitrum One, the endpoints for the others. On a rollup, `[finality]` holds the Ethereum Mainnet checkpoint its L1 anchor reads. Base Sepolia takes none: it settles on Ethereum Sepolia. Uniswap markets are Ethereum Mainnet’s. Validate a file without opening its database or any network connection: ```bash cp config/modes/windowed.toml leani.toml leani doctor --json ``` Without `--config`, Leani uses `./leani.toml`. Set `LEANI_CONFIG` when a service or shell should consistently use a configuration elsewhere. An explicit `--config` remains the highest-precedence override. Compact documents default operational tuning but never the chain identity, checkpoint trust root, or selected processor targets. Advanced documents keep every choice explicit. ## Build a configuration from requirements Instead of copying a profile and editing it, state what the application needs and let `init` build a complete advanced document: ```bash leani init uniswap-v3 ETH/USDC --keep window --window-days 30 \ --follow finalized --memory 1GiB --disk 20GiB --bandwidth 100 ``` `--keep` is `everything`, `window`, `latest`, `result`, `stream`, or `live`; `--follow` is `head`, `finalized`, or `none`, which builds a history-only node without a live lane or finality; `--history-from-block` starts a backfill; `--memory`, `--disk`, and `--bandwidth` (Mbit/s) state the host’s limits; and `--tuning` replaces the recipes the limits call for. `--requirements FILE` takes the same needs as JSON for any processor, including contract events and Wasm or custom processors. The builder writes every setting and comments each one it derived with the reason, using only the shipped profiles’ storage settings and the measured recipes of [Sizing for bandwidth, memory, and disk](#sizing-for-bandwidth-memory-and-disk). `--network` builds for another chain, as the compact `network` does; a window then keeps days by block age, because a rollup’s blocks come faster or at no fixed pace. `--json` prints the configuration, the derived settings with their reasons, warnings, and next steps. `leani guide config` describes the requirements, and a running node builds the same document at `POST /admin/v1/config/build`, which its `/playground` uses. ## Advanced root fields | Field | Type | Meaning | | ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `config_version` | integer | Must be `1`. | | `data_dir` | path | Writable node state. Use a distinct directory per deployment or test. A relative path is relative to the directory of the configuration file, not the working directory. | | `chain` | table | A built-in chain entry’s `name` or alias. `chain_id` comes from the entry and, when given, must match it. | | `artifact_storage` | table | Physical backend and bounded compaction policy for retained processor artifacts. | | `budgets` | table | Hard memory, temporary disk, pending-delta, recent-input, and concurrency limits. | | `sources` | table | Priority-ordered history sources and the optional live source. | | `finality` | table | `consensus_p2p`, `beacon_api`, `json_rpc`, `op_gossip`, `sequencer_feed`, or `disabled`. | | `processors` | array | One immutable processor kind/instance contract per entry. | | `rpc` | table | HTTP/WS binds, browser origins, request and response limits, and bounded historical lookup behavior. | | `api` | table | Native API bind, bearer-token environment variable, allowed hosts and browser origins, and delivery batching. | `budgets.recent_raw_soft_bytes` must not exceed `budgets.recent_raw_hard_bytes`. All byte budgets and concurrency values are positive. Each finality advance prunes finalized recent frames toward the soft limit. Live ingestion enforces the hard limit as it retains each frame: at the limit it waits, with live readiness down, until finality prunes (see the operations runbook’s storage pressure section). Two budgets bound a history source read’s input. `budgets.temporary_disk_bytes` bounds what one read may acquire over its life: the objects, byte ranges, and responses it fetches, and the frames it builds from them. A read that would acquire more fails with an `input_bytes` budget error, and a local archive object larger than it is refused before it is read. `budgets.memory_bytes` bounds the raw input one read holds in memory at once: one line of a local archive object, which it verifies whole and then reads a line at a time; the selected columns of one Xatu Parquet row group; one batch of EraE byte ranges, including a prefetched window when both fit the budget; one window of execution P2P frames; or one retained raw-history record. EraE normally targets 16 MiB compressed windows independently of the decoded frame buffer, and shrinks them when the resident budget is smaller. Its frames may be at most `memory_bytes`, or 32 MiB when that is less. A read that would hold more fails with a `resident_bytes` budget error naming `budgets.memory_bytes`, and a backfill then tries its next configured source. A historical RPC request, which holds everything it returns, may acquire and hold at most `memory_bytes` divided by `budgets.source_concurrency`. Raw-history jobs acquire one segment’s worth per read, `raw_history.maximum_segment_logical_bytes`. The bound is per read, not for the node. At once, the node runs up to `budgets.history_pipeline.maximum_active_chunks` backfill reads, one archive reconciliation read, the live lane, and one read per running raw-history job, and each may hold up to `memory_bytes`. What a read decodes is not counted here: decoded frames and mapped deltas have the `budgets.history_material` and pipeline budgets below, and `memory_bytes` is not a process RSS limit. On mainnet, a Xatu read of a 2023–24 transaction object, 1,000 blocks around blocks 18,000,000 to 19,430,000, holds about 80–110 MiB of compressed columns and decodes about 230–340 MiB. Keep `memory_bytes` above the largest of those, as the shipped 512 MiB is, and plan RAM for about `maximum_active_chunks` × 450 MiB during Xatu backfills, 3.6 GiB at the default 8. The allocator keeps memory a finished read freed for the next, so resident memory after a burst of reads stays near its peak: set a container’s memory limit for that peak, not for the budgets. On Linux, glibc gives each thread that allocates its own 64 MiB arena and returns little of what they free, so a long-running node grows: an rc.4 node on a 20-thread host held 5.7 GB, 4.7 GB of it in 57 such arenas. Over a 100,000-block `blobs-money` backfill from Xatu, glibc reached 1.5 GiB and kept it. The container image preloads jemalloc, which returns freed memory: the same backfill held 711 MiB and fell to 130 MiB when it finished. `deploy/leani.service` sets `MALLOC_ARENA_MAX=2`, which held it at 0.8–1.0 GiB. Wherever you run the binary yourself, set `MALLOC_ARENA_MAX=2` or preload jemalloc (Debian’s `libjemalloc2` with `LD_PRELOAD=libjemalloc.so.2`). `[budgets.history_material]` is the sole budget for shared immutable source frames and acquisition reorder buffers. Chunks read ahead of the one a job is reading reserve memory only up to half of its `memory_bytes`, so size it to at least twice the largest expected frame. The half is checked as each frame is reserved: a chunk that another job joins, or that its reading job pauses and leaves while others wait for it, becomes read-ahead with the frames it already holds, so read-ahead can hold more than half. `[budgets.history_pipeline]` is separate: `maximum_active_chunks` caps physical history reads node-wide and `maximum_mapped_bytes` caps processor-owned mapped deltas across every active job. A job reads only its own planned chunks, so a backfill subscription smaller than `maximum_active_chunks` source chunks leaves read slots idle; the node logs a hint with a size that fills them, once per processor, and `leani_history_material_active_acquisitions` against `leani_history_material_active_acquisitions_limit` shows the slots in use. Its nested `commit` table flushes a contiguous SQLite transaction at the first configured block, domain-change, stable-encoded-byte, or elapsed-time limit: by default 128 blocks, 10,000 changes, 16 MiB, or 50 ms. A batch publishes its blocks’ delivery changes in the same transaction. Blocks not yet finalized, or that the live lane already applied or holds, commit one at a time, as do the blocks of a batch whose reducer reads windowed output or rewrites it unchanged. A source error or invalid frame ends a batch after the blocks before it commit. `target_writer_hold`, 250 ms by default, controls the adaptive block limit: the runtime halves the current limit when observed p95 historical writer hold time exceeds the target and cautiously grows it again below half the target. A hold includes the commit’s WAL sync, which a smaller batch does not shorten, so on a disk whose syncs are slow a low target shrinks batches to a block or two, and every commit rewrites the same pages for little data. On a Hetzner EX44 (RAID 1 over two NVMe drives, about 8 ms per sync), the former 20 ms target ran a `rollup-txs` backfill from Xatu at 53 blocks/s and wrote 104 KiB per block; the 250 ms target ran it at 799 blocks/s and wrote 11 KiB per block. A job holds at most `maximum_buffered_frames_per_acquisition` frames of `[budgets.history_material]`, 1,024 by default, that it has not committed, so a longer `maximum_delay` makes acquisition wait instead of filling larger batches: a one-second delay ran the same backfill at 127 blocks/s when the default was 128 frames, and at 743 blocks/s with 1,024. A single mapped delta or single-block commit that exceeds its byte limit fails immediately because waiting cannot make that item fit. A backfill that reuses retained recent frames reads them in batches of at most `commit.maximum_blocks` blocks and `maximum_mapped_bytes` encoded bytes, each holding one active-chunk slot like a physical history read. `[budgets.store].maximum_physical_bytes` is the emergency node-store admission bound shared by SQLite, its WAL, and configured processor-artifact segments. It is deliberately not nested under delivery: artifacts, materialized views, correctness metadata, and delivery share the same physical capacity. It measures allocated file bytes. Stores use SQLite incremental auto-vacuum, so pruning returns pages to the filesystem and admission recovers; a store created before that needs one `leani db compact` (see the operations runbook). `[budgets.artifacts]` independently caps immutable finalized artifact bytes and unfinalized-block candidate bytes awaiting finality. A transaction that would exceed either logical limit rolls back without advancing processor coverage. Finality is the exception: when the retained limit is full, finality still advances, the finalized candidates stay pending with a logged warning, and a later finality advance promotes them once there is room. A processor’s `window` policy may prune its own instance below a tighter bound; the node-wide artifact budget still protects against the aggregate of many processors. `[artifact_storage] backend = "sqlite"` retains those immutable artifacts as KV rows. The opt-in `tiered_segments` backend uses SQLite as the durable write buffer and continuously compacts complete `segment_target_blocks` ranges into checksummed seekable files under `data_dir/processor-artifacts`. Compression, single-item/segment hard limits, compaction cadence, and maximum segments per cycle are explicit. Only processors using `artifacts.mode = "full"` are eligible in the first tiered implementation; rolling windows remain in SQLite. Segment bytes do not receive a second budget: they count against the same `[budgets.store].maximum_physical_bytes` ceiling. `[raw_history]` keeps finalized source frames in checksummed segment files under `data_dir/raw-history`, beside their own catalog. `maximum_logical_bytes` caps the frames retained, and `maximum_physical_bytes` the bytes on disk: segments, the partial files of segments being written, the catalog and its write-ahead log, and quarantined files. Before a segment is written, its maximum size and the catalog rows it will add are reserved: a fixed 64 KiB, and 512 bytes per locator row, one per block with block-hash locators and 256 per block with transaction-hash locators. A segment with more transactions still publishes its extra rows, so the catalog can exceed `maximum_physical_bytes` by that one segment’s extra rows, which the next segment’s admission counts. Reads of `maximum_segment_logical_bytes`, one segment’s worth, feed a raw-history job. A store already over either budget, for example after lowering it, still opens and serves its history, but admits no new segment until it is back under: its jobs pause at the storage limit, or fail when created with `segment.onLimit: fail`. A segment that fails verification moves to `data_dir/raw-history/quarantine`, which keeps at most 1 GiB, or one segment of `maximum_segment_physical_bytes` when that is larger: past that, the longest-quarantined files are deleted first, but never the newest (see the operations runbook). `[budgets.delivery]` supplies the shared delivery envelope above independent per-stream limits. `maximum_retained_bytes` caps exact delivery payload bytes across live and history streams. `maximum_history_retained_bytes` is a lower, non-borrowable history ceiling so stalled backfills cannot consume live-lane headroom. The two values must satisfy `history <= retained`. Reaching a shared bound backpressures only the committing lane; ACK, pruning, queries, networking, and unrelated processors remain available. The backfill subscriptions of a replaced processor instance keep counting against the history ceiling until they are deleted (see the runbook’s [Processor rebuild or rollback](/docs/operations/runbook/#processor-rebuild-or-rollback)). ## Sources and finality `[[sources.history]]` requires `id`, `kind`, `priority`, and `trust`. Supported kinds are `xatu`, `era_e`, `archive`, `json_rpc`, and `aws_public`. `xatu` reads public Parquet history; validation refuses `parquet`, which no source reads. `archive` requires `manifest`; `era_e` accepts an `https` or `file` `endpoint` ending in `/`, and `aws_public` an `https` bucket mirror. A plain `http` endpoint is accepted on loopback, or elsewhere only with `allow_insecure_http = true` on that source, which accepts a mirror whose catalog and archive bytes anyone on the path can replace. `xatu` sources are Ethereum mainnet only: another `chain.chain_id` fails validation. `aws_public` reads the chain entry’s public dataset on AWS Open Data: Ethereum mainnet from AWS’s own export, about a day behind, and Base and Arbitrum One from SonarX’s, about a week behind. It serves headers, receipts, and logs. Transaction bodies are left to other sources, because the exports store values as floating-point numbers. Rows are unsorted within a day: in October 2026 a day held about 2 GB for Ethereum, 1.5 GB for Arbitrum One, and 9 GB for Base. AWS’s Ethereum export has no page index, so each chunk downloads its whole UTC day, and `chunk_blocks` splits a day only by reading it again for each chunk. SonarX’s files index their pages, so a chunk downloads only the pages that hold its blocks: Base reads chunks of 2,000 blocks and Arbitrum One chunks of 100,000 unless `chunk_blocks` sets another size. The chunks of a day share the footers, page indexes, and dictionary pages of its files. The node keeps the byte ranges it reads in one temporary file in `data_dir`, at most `budgets.temporary_disk_bytes` for each bucket, which the system frees when the node exits, and downloads a range that several chunks need at once only once: for a log-filtered processor a Base day took about 4.3 GB, and an Arbitrum One day about 0.9 GB. A Base day’s ranges fill most of the default 4 GiB: with 2 GiB, chunks downloaded some again, and the day took 5 GB and ran 13% slower. What a chunk downloads counts against `budgets.temporary_disk_bytes`, and a chunk whose rows would decode to more than `budgets.memory_bytes` is refused before it downloads: an unfiltered Ethereum day took about 8.7 GB of memory. Each active chunk holds its own rows, so a Base backfill with the default eight active chunks peaked at about 7 GB of memory. Reads go out as parallel ranged requests, up to four per `budgets.source_concurrency`. With a log filter, only blocks whose logs bloom admits it are decoded. ### History source order A backfill splits its range into gaps of missing coverage and tries the configured history sources for each gap in `priority` order, lowest first. A source that fails on part of a gap passes only those blocks to the next source: a dataset hole, from its first to its last block in the chunk read, or the chunk whose read failed. It keeps the blocks before them, and the first source takes the gap back after them. A source that has not published the blocks, whose schema changed, or that fails again before committing a block passes the rest of the gap instead, and one that cannot fill the processor’s field groups is skipped for the job. Each backfill retries up to three times the number of sources, at least five times, before it fails. When every history source fails and the live source is execution P2P, P2P can serve the gap within `sources.live.history_fallback_blocks`. The shipped profiles list eraE at priority 10 and Xatu at priority 20: | Source | Serves | Checks each block for | Notes | | --------------------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | `era_e` | Whole blocks and receipts up to its mirror’s last catalog update | Transactions and receipts roots against the header | The public mirror’s catalog ended at block 24,518,655 (2026-02-26) when this was written | | `xatu` | Columnar projections, about one day behind the chain, until the day Glamsterdam activates | Transaction rows against the beacon payload count; log rows without a gap | Cannot prove a block’s last logs complete; Ethereum mainnet only | | `aws_public` (opt-in) | Headers, receipts, and logs: a whole UTC day per chunk on Ethereum, the pages of a chunk’s blocks on Base and Arbitrum One | Receipts root and logs bloom against the header; the block hash, where the export has every header field (Base, Arbitrum One) | The export names the canonical chain; no transaction bodies | | P2P (live source) | Recent and live blocks from peers | Commitments of every header, body, and receipt | Slowest for old history; peers may no longer serve very old blocks | So for blocks the eraE mirror covers, a backfill reads verified complete blocks; for later blocks, Xatu; and P2P fills what neither serves. Put Xatu first when bandwidth, not completeness, limits a backfill: its projections transfer fewer bytes per block for processors that read a few columns. ### Sizing for bandwidth, memory, and disk Measured with this release on a Hetzner EX44 (Intel i5-13500, 20 threads, 64 GB, RAID 1 over two NVMe drives, 1 Gbit/s) that other workloads share, 25,000-block backfills with one consumer and `MALLOC_ARENA_MAX=2`: | Backfill | Source | Downloaded per block | 4 reads, 2 chunks | 8 reads, 4 chunks | | ----------------------- | ------ | -------------------- | ----------------------------- | ------------------------------- | | `rollup-txs`, Feb 2026 | eraE | 122 KiB | 410–450 blocks/s, 180 MiB | 560 blocks/s, 270–280 MiB | | `blobs-money`, Feb 2026 | eraE | 122 KiB | 410–450 blocks/s, 180 MiB | 540–570 blocks/s, 280–290 MiB | | `rollup-txs`, Feb 2026 | Xatu | 61 KiB | 510–700 blocks/s, 310–320 MiB | 820–1,010 blocks/s, 430–550 MiB | | `blobs-money`, Feb 2026 | Xatu | 72 KiB | 570–610 blocks/s, 600–670 MiB | 620–640 blocks/s, 740–750 MiB | | `rollup-txs`, Oct 2026 | Xatu | 56 KiB | 730–770 blocks/s, 270–330 MiB | 1,080 blocks/s, 400–410 MiB | | `blobs-money`, Oct 2026 | Xatu | 46 KiB | 650–800 blocks/s, 420–430 MiB | 620–780 blocks/s, 680–860 MiB | “4 reads, 2 chunks” is `source_concurrency = 4` and `maximum_active_chunks = 2`, as `deploy/container.toml` ships; the other shipped profiles read with 8 and keep the built-in 8 chunks. Each cell gives the speed and the peak memory. Ranges span repeated runs, which differed by up to a third with the archives’ throughput and the shared host’s load. With jemalloc, which the container image preloads, peak memory stayed within a fifth of these and fell back once a backfill finished. Execution P2P served 5,000 recent blocks at 43–55 blocks/s. More reads and chunks made most backfills faster, at more memory. An eraE backfill is also limited by the frames each chunk may hold before the job commits them, `maximum_buffered_frames_per_acquisition` in `[budgets.history_material]`: with the former default of 128, the eraE backfills above ran at 320–340 blocks/s with 8 reads and 4 chunks. More than 1,024 frames, or a larger `memory_bytes`, made them no faster. Profiles: * **Default:** the shipped profiles, which try eraE before Xatu and read up to 8 chunks at once with 8 reads each. * **Less memory:** set `maximum_active_chunks = 4`, the “8 reads, 4 chunks” column. Xatu backfills then hold about half as much, and execution P2P backfills fetch about half as much at once. * **Limited memory**, such as a container under 1 GiB: use 4 reads and 2 chunks. eraE needs the least memory. * **Limited bandwidth:** a backfill downloads blocks per second times bytes per block, about 65 MiB/s from eraE at 550 blocks/s and 30–60 MiB/s from Xatu at the speeds above. On a slower link, the link sets the speed: at 100 Mbit/s, about 12 MiB/s, eraE reaches about 100 blocks/s and Xatu 170–270. There, list Xatu first for processors that read only transactions, such as `rollup-txs` and `transaction-stats`, and keep eraE first for processors that read logs, which Xatu cannot prove complete. * **Slow disk syncs**, such as network-attached volumes: keep `target_writer_hold` at 250 ms or raise it. A lower target shrinks batches (see [Advanced root fields](#advanced-root-fields)). Xatu additionally accepts three acquisition-tuning controls. `chunk_blocks` sets the generic header, transaction, and log span, while `blobs_chunk_blocks` sets the wider span used by the five-table blobs join. Both must be non-zero multiples of Xatu’s physical 1,000-block execution partition. `batch_rows` controls the bounded Arrow/Parquet decode batch and is independent of history-source concurrency. The measured defaults are 1,000, 8,000, and 8,192 respectively. Increasing a span can reduce repeated daily object reads, but it also increases per-chunk memory and is not universally faster; tune it per projection rather than as a global block-size knob. `[sources.live] kind = "p2p"` enables the shared persistent Reth peer manager. It requires verified `beacon_api` or `consensus_p2p` finality, or `op_gossip` on an op-stack chain. Stable production ports normally use `listener_port = 30303`, `discovery_port = 30303`, and `discv5_port = 30304`. Discv4 and Discv5 require distinct fixed UDP ports; zero selects an isolated ephemeral port for that protocol. `stall_timeout_seconds`, ten minutes by default and six minutes to 30 days, bounds how long the live lane may stay not ready while verified finality is ready, within one run of the network lanes: after it, the node exits with status 1 so that its process supervisor restarts it. A wait at the recent-frame hard limit does not count. Reth owns the bounded dial queue and receives TCP/RLPx failures directly. A terminal failure immediately releases its slot to another eligible peer, while Reth’s per-peer backoff prevents rapid redials. Newly authenticated DNS/Discv candidates are added to that same queue. `max_concurrent_dials` remains the hard simultaneous dial ceiling; `peer_refill_interval_ms` is only a short safety-net poll for newly added candidates, not a network request rate. `minimum_peers` is the connected-session startup gate. A peer need not finish capability qualification before requests may use it: every response is still commitment-checked, and qualification ranks proven peers first. Background qualification continues concurrently until `body_serving_peer_target` distinct peers have served a commitment-valid body at the current target; the default target is four. Request health is tracked independently for headers, bodies, and receipts. A timeout or incomplete response cools only that material lane, so a peer that cannot serve one processor’s body request remains available to processors that can use its headers or receipts. Commitment-invalid data still bans the peer. `bootstrap_dns_tree` may point at an optional EIP-1459 `enrtree://` peer-hint tree. The public key embedded in that URL authenticates its ENRs. It does not make those peers trusted sources: Leani still commitment-checks every header, body, and receipt. This is the deployment hook for a future Leani/community pool of execution nodes prepared to accept indexing traffic; compact and advanced configurations leave it unset by default. Finality checkpoints are bootstrap trust anchors, not evergreen config defaults. The first start needs a checkpoint at most 14 days old; later starts bootstrap from the newest verified anchor the node persisted (see the runbook’s [checkpoint lifecycle](/docs/operations/runbook/#checkpoint-lifecycle)). Enabled finality requires a recent 32-byte checkpoint root other than all zeros. `consensus_p2p` also requires its non-zero finalized beacon slot and a `finality.minimum_peers` of at most 24, the consensus peers dialed at once. `beacon_api` requires one or more endpoints, each transport listed once, and `minimum_agreement` within their count. Disabling finality is suitable for bounded finalized-dataset backfills, not verified head following: the live lane includes a block only once its ancestry reaches an execution header the sync committee attested, which the finality source verifies each slot, so validation refuses `sources.live.kind = "p2p"` with `finality.kind = "disabled"`. `[confirmation]` names the consensus nodes behind the `confirmed` level and JSON-RPC `safe`: Beacon API endpoints with Fast Confirmation enabled (Lighthouse `--enable-fast-confirmation`, Lodestar `--chain.fastConfirmation`), whose `fast_confirmation` event stream the node follows. They serve no chain data, and credentials in their URLs are kept out of logs and status. ```toml [confirmation] endpoints = ["http://127.0.0.1:5052/"] minimum_agreement = 1 ``` `minimum_agreement` of the endpoints, within their count and each listed once, must confirm a block. The section applies on an Ethereum chain with `sources.live.kind = "p2p"` and `beacon_api` or `consensus_p2p` finality; under other sources it is inert, with a warning at startup, and on a rollup it is refused. Compact Ethereum Mainnet configurations name ChainSafe’s public Lodestar node, a free third-party service: name your own node for production. An advanced configuration without the section, or any with `endpoints = []`, has no `confirmed` level, and `publish = "confirmed"` is then refused. The [finality levels](/docs/concepts/coverage-finality-and-reorgs/#finality-levels-and-publish-modes) say what the level means, and the [trust model](/docs/operations/trust-and-threat-model/) what the endpoints are trusted with. On an op-stack chain, such as Base, `finality.kind = "op_gossip"` follows the sequencer’s signed block gossip and needs no checkpoint. Every block the sequencer’s key signed becomes the attested head the P2P live lane follows: the chain entry’s key, a newer one the L1 anchor read, or `finality.sequencer_signer` when that is set, so blocks reach `attested` about as fast as `unattested`. Without an L1 anchor nothing finalizes a block unless `finality.finalized_by = "json_rpc"` takes the endpoints’ `finalized` block, so recent frames are pruned `finality.settle_blocks` below the newest signed head instead, about one hour of blocks when omitted, or sooner when that hour outgrows `budgets.recent_raw_soft_bytes`, as Base’s large blocks do; settled blocks keep their level. Gossip peers find the node through its discovery record: fixed, reachable `finality.listen_port` (TCP) and `finality.discovery_port` (UDP) let them dial in, which Base needs because its busy consensus nodes refuse new connections, and Unichain because its gossip peers are rarely found otherwise. Since only a few of them carry blocks to a new node, the node keeps the ones that did in `op-gossip-peers.txt` in its data directory and dials them first after a restart and again whenever signed blocks stop for 10 seconds. Peers whose handshake head lies far behind the signed head are syncing and are dropped while fewer than `body_serving_peer_target` peers serve the head. Op-stack history comes from execution P2P through the live lane. A fresh store starts at the lowest `start_block` among processors with automatic history, and at most `sources.live.history_fallback_blocks` below the first signed head when that is set. The block before that start is proven by parent links down from the signed head, and the lane catches up along the head’s chain, so caught-up blocks are `attested` like the ones that follow. A restart resumes from the store’s tip. A processor’s status shows the catch-up’s progress in `processedThrough`. Blocks are not `finalized` until the L1 anchor reads the batches that carry them. Few execution peers take a node they cannot dial back, so a fresh op-stack node behind NAT may find none. `sources.live.kind` then takes an ordered list, `["p2p", "json_rpc"]`, as compact configurations and `leani init` set it for op-stack chains: when no execution peer connects within `sources.live.peer_recovery_timeout_seconds` (60 there), the next lane run follows over the `[sources.json_rpc]` endpoints, the chain entry’s public ones unless `public_endpoints = "none"`. Each block they serve must have the hash the sequencer signed or link to a block that does, and its transactions and receipts roots must hold, so one endpoint suffices (`quorum` defaults to 1). The catch-up is proven by parent links down from the signed head, as over P2P. Every five minutes the node asks whether execution peers serve it again, and the next run returns to P2P once they do. Each return that ends within ten minutes doubles that interval, up to an hour, and one that lasts resets it. `kind = "p2p"` keeps the node on execution P2P, which World Chain’s compact configuration does: no keyless endpoint serves its blocks’ receipts at a following pace, so the fallback there needs endpoints of your own. Nitro chains (Arbitrum One and Nova, Robinhood Chain) run no public execution P2P, so `sources.live.kind = "json_rpc"` serves their blocks. With `finality.kind = "sequencer_feed"`, the node follows the sequencer feed the chain entry names, whose every message carries a block’s hash signed by the chain’s batch poster. The endpoints then only carry blocks: one whose hash differs from the signed one is refused, and one that matches makes it and every block it links to `attested`, so a single endpoint is enough (the quorum defaults to 1). Near the head, the live lane asks one endpoint for each block the feed signs, with its receipts. It moves to the next endpoint when that one fails or still lacks the block a poll interval later, and asks the next one too while it is slow. The lanes start at a signed block the endpoints serve. A feed connection silent for 30 seconds is reopened. Feed relays replay only the last few minutes, so after a longer outage blocks become `attested` once the lane reaches the feed’s blocks again. Without `[l1_anchor]` nothing is `finalized` unless `finality.finalized_by = "json_rpc"`, and recent frames settle `finality.settle_blocks` (default 3,600) below the tip. When the processors need nothing of a block but its header and transactions, such as `transaction-stats` or `block-summary`, the live lane makes the blocks the sequencer built from signed transactions from the feed’s messages, each as soon as the feed signs it, and asks one endpoint for each block’s header alone: one call per block, where a block with its receipts takes two. Once the lane reaches blocks whose messages the feed kept, such as those signed while the node started, it makes them this way however far behind it is. The header’s transactions root checks the transactions made, with senders recovered from their signatures; the frames hold no receipts or logs. A block whose header names other transactions comes whole from the endpoint: a transaction that calls `ArbRetryableTx` through a contract makes ArbOS add a retry transaction that no message carries. So do the blocks of messages from L1, such as deposits, retryables, and batch posting reports (about one block in 200 on Arbitrum One), and of direct calls to `ArbRetryableTx`. After eight contradicted blocks in a row, the lane fetches every block whole from then on. With `sources.live.trust = "trusted_dataset"`, processors that take filtered material and need nothing but transactions’ bodies, calldata, and senders get the blocks made without their headers, so the live lane follows the head without JSON-RPC. Their transactions are then declared complete, not checked: they can lack the retry a contract’s `redeem` call adds, and the sequencer’s signature binds the block hash but not where a message’s fields end, so these frames trust the feed relay to pass messages on unchanged. A fresh store under the feed catches up from the lowest `start_block` among processors with automatic history, at most `sources.live.history_fallback_blocks` below the first signed block when that is set. The node first walks the headers down from the signed block, hashing each itself, and keeps every 256th hash; each catch-up batch then ends at one of them, so no block reaches a processor before it is proven, and the caught-up blocks are `attested`. A restarted node proves the chain down to its stored tip the same way, and refuses a tip that is not on it. The walk costs one call per block, the catch-up two. Below the finalized block, history comes from automatic backfills as on Ethereum. With `[l1_anchor]` that is the block of the assertion the anchor confirmed last, about 6.4 days old; without the anchor and the feed, the endpoints’ `finalized` block. Each processor with automatic history backfills from its `start_block` up to it from `sources.history` in priority order, and the live lane takes over just below it; under the feed it then catches up from there as above; without such a processor the lanes start without waiting for the anchor. A `json_rpc` history source reads the JSON-RPC endpoint pool below. Under the L1 anchor its blocks are proven by parent links down from the confirmed hash before a processor sees them, at one more call per block, so they are `finalized` without trusting any endpoint. A source that has not published the newest blocks keeps the ones it has and hands the rest to the next, so with SonarX first Arbitrum One’s history comes from AWS up to its last exported day and from the endpoints for the days after: ```toml [[sources.history]] id = "sonarx" kind = "aws_public" priority = 0 trust = "trusted_dataset" [[sources.history]] id = "rpc" kind = "json_rpc" priority = 1 trust = "verified_material" ``` The node keeps the newest confirmed hash in `l1-anchor-confirmed.txt` in its data directory, so a restart does not wait for the next confirmation. The JSON-RPC lanes and history read a pool of endpoints: yours first, then public ones. `sources.json_rpc.endpoints` lists your own, such as a provider account’s keyed URL, paced at `sources.json_rpc.calls_per_second` (default 40). `sources.json_rpc.public_endpoints` names the public ones behind them: | `public_endpoints` | Public endpoints | Default | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------- | | `chainlist` | The chain entry’s vetted endpoints, then the keyless HTTPS endpoints chainlist.org lists for the chain whose operators state they track nothing or little (`tracking` `none` or `limited`) | With `finality.kind = "sequencer_feed"` | | `bundled` | The chain entry’s vetted endpoints only | Otherwise | | `none` | None: only your own endpoints | | ```toml [sources.json_rpc] endpoints = ["https://arb-mainnet.example.com/v2/"] public_endpoints = "chainlist" # or "bundled", or "none" for yours alone ``` Anyone can list an endpoint on chainlist.org, so its endpoints only carry blocks the node checks itself: `chainlist` needs the sequencer feed, and with `json_rpc` finality, where the endpoints vouch for the blocks, it is refused. The node fetches chainlist.org’s list at most once a day and keeps it in `chainlist-endpoints.json` in its data directory; when the list cannot be fetched, the kept one serves, and without one only your own and the bundled endpoints do. `leani doctor` shows the plan, and the lanes log the hosts they kept. At start each endpoint must serve the configured chain and `eth_getBlockReceipts`, or it is dropped. Of the public ones, the bundled stay ahead of the listed ones, which go fastest first, eight public endpoints at most, so few operators see the node’s traffic. Your endpoints take work first and a range another endpoint fails goes to them first; the public ones take what yours leave: more parallel work than yours can hold, and ranges yours fail or rate-limit. Block ranges spread over all of them in parallel, a faster endpoint taking more. Each public endpoint is paced at 40 calls per second, or slower where its rate-limit headers announce a lower limit; it waits as long as a rate limit’s `Retry-After` asks, slows down on each rate limit, and recovers gradually. All lanes of the node share each endpoint’s pace. Public endpoints are shared and offered free, so list endpoints of your own for long backfills. ### L1 anchor A rollup’s blocks become final on Ethereum twice, and the opt-in `[l1_anchor]` table reads both: verified Ethereum finality (`[l1_anchor.finality]`, `beacon_api` or `consensus_p2p`, as for an Ethereum node) names finalized L1 blocks, and execution P2P serves their bodies and receipts, checked against their roots. On an op-stack chain the anchor checks games against the sequencer’s gossip beside the P2P live lane, so `sources.live.kind` starts with `p2p` there. `finalized`: the Ethereum block that carries a rollup block’s batch is finalized, so the block can no longer change, minutes after it was made (about two hours on Zora and Soneium, whose batchers post less often). `finality.finalized_by` says how the node learns it: * `batches` (the default under `[l1_anchor]`) reads the batches from the finalized L1 blocks. On an op-stack chain these are the successful transactions from the batcher to the batch inbox, both named in the chain entry’s `[op_stack]` (`batch_inbox`, `batcher`; the SystemConfig names later batchers). Their blobs come from the `l1_anchor.finality` Beacon APIs, each checked against the versioned hash its transaction names, so `finality.kind` must be `beacon_api`. A batch names the block it builds on; when that is this node’s block and the batch follows the ones before it, that block and every block below it are `finalized`, about one batch after their own. A batch counts only when its header passes the rules of derivation that need no transaction: its L1 origin is a finalized block the lane read, inside the sequencing window, and its blocks are timed at their slots, no earlier than their origin and within the sequencer’s drift of it. That the transactions in it are valid is left to the batcher. The blobs cost about 2.2 GB a day on Base and 0.8 GB on OP Mainnet. On a Nitro chain each call to the SequencerInbox the entry’s `sequencer_inbox` names counts the chain’s messages, and message n is block `sequencer_feed.first_block` + n; the block this node holds at the last one is `finalized`. Nothing in a Nitro block names the messages it came from, so this trusts the sequencer to post the messages it signed on the feed, as `attested` does; a confirmed assertion names the block’s hash, so `settled` does not. Batch reading starts where the node starts following; history keeps the trust of its source. * `json_rpc` takes the `finalized` block the chain’s JSON-RPC endpoints agree on, which trusts them: two of them must agree where there are two, or `sources.json_rpc.quorum` when that is set. It is the one that needs no `[l1_anchor]`; without the anchor the node follows no Ethereum blocks, and no block is `settled`. * `settlement` finalizes a block only when it settles. Batches prove that a block’s transactions and order are fixed on Ethereum, not its execution: until it settles, its state root is the one the sequencer signed. `settled`: the settlement contracts in the chain entry’s `[l1_anchor]` accepted a claim covering the block, days later. A settled block is also finalized. Nothing is fetched from an RPC endpoint. * Nitro chains (Arbitrum One and Nova, Robinhood Chain): a confirmed BoLD assertion names its block hash; that block is `settled` once this node holds it. Confirmation takes about 6.4 days. Recent frames are pruned `finality.settle_blocks` (default 3,600) below the tip while blocks wait for finality. * Op-stack chains: a game of the respected type is checked when it is created against the output root of the block the sequencer signed, and that block is `settled` once the anchor state registry moves to the game, about 3.5 days later on Soneium, five on Base, and seven on the others. OP Mainnet’s, Unichain’s, Ink’s, and Soneium’s games claim super roots (`claims = "super_roots"`): the creation call carries the super root’s preimage, which holds the chain’s output root at a time, and the anchor checks the preimage against the claim and that root against the block signed at that time. Soneium, Mode, Zora, and World Chain run permissioned games: only the chain’s proposer creates them, and only its challenger can dispute them. The lane reads the receipts of the finalized L1 blocks whose logs bloom may hold the contracts’ logs, at most about 1 GB a day. Op-stack game creations and batches also need call data, so on op-stack chains, and on Nitro chains that read batches, it reads every block’s receipts and body, about 2 GB a day. Where it stopped survives restarts (`l1-anchor-cursor.json`); a cold start reads `lookback_blocks` (600 by default) below the first finalized block. Its execution P2P uses its own ports, `listener_port`, `discovery_port`, and `discv5_port`, and its own peer store. On an op-stack chain the lane also follows the rollup’s own changes in the same finalized blocks. When the chain’s SystemConfig names a new unsafe block signer, gossip blocks are checked against that key from then on, and when the anchor state registry comes to respect another game type, the anchor reads that type’s games. What the lane learned stays in `l1-anchor-cursor.json` across restarts. A rotation from before the node first ran reaches it only through the chain entry or the configuration. The claim format stays the entry’s: after a move between output-root and super-root games, the anchor settles nothing until `l1_anchor.claims` names the new one. `finality.sequencer_signer` fixes the signer, and `l1_anchor.factory`, `registry`, `game_type`, and `claims` replace the entry’s contracts; a configured `game_type` stays when the registry respects another. On a chain whose entry names no dispute games, such as Base Sepolia, `factory`, `registry`, and `game_type` together name them. ## Processor identity and publication Every modern entry declares: ```toml [[processors]] id = "evm-events" # registered processor kind instance = "weth-transfer-v1" # stable operator-selected identity version = "1.1.0" start_block = 12965000 ``` Processor code, semantic version, settings, start point, and source identity are part of an instance’s immutable identity. The node refuses a change to any of them under an `instance` its store holds (`processor instance … conflicts with its stored descriptor`), before it upgrades an older store, so it never mutates an existing cursor namespace. Give the changed processor a new `instance` ID: it indexes from its `start_block` beside the old instance, whose rows stay in the store. Settle the old instance’s backfill subscriptions before and after the switch, as the runbook’s [Processor rebuild or rollback](/docs/operations/runbook/#processor-rebuild-or-rollback) describes. Lifecycle policies, such as retention and delivery limits, are not part of the identity and can change in place. Publication values are: * `unattested` (default): publish apply/undo/finality transitions from the first level the live lane delivers, and keep an unfinalized undo window. * `attested`: publish apply/undo/finality transitions from `attested` on, and keep an unfinalized undo window. * `finalized`: publish only finalized `apply` records. Unfinalized changes wait in the store for verified finality, count against the delivery budget meanwhile, and undo is never published. * `settled`: on a rollup with an `[l1_anchor]`, publish only `apply` records of settled blocks. Finalized changes wait in the store for settlement, days, and count against the delivery budget meanwhile. `[processors.delivery] emit = "job_result"` replaces `publish` for a bounded backfill: it publishes its terminal aggregate and then becomes complete/reclaimable. Deletion remains explicit. `[processors.settings]` belongs to the selected factory and is decoded strictly. `doctor` constructs every configured processor, so malformed ABI, address, pool, or custom settings fail before source or store I/O. ### Live gap fill After downtime the live lane resumes at the newest verified finalized anchor, so a block-local processor skips the blocks between its cursor and that anchor. Automatic history refills them. With `history_mode = "on_demand"` the lane only announces them, in a `system.live_gap.put` change, and whoever requests history fills them. `[processors.live_gap_fill]` lets the lane fill a short range itself: ```toml [[processors]] id = "blobs-money" instance = "blobs-production" history_control = "application_subscriptions" history_mode = "on_demand" # ... [processors.delivery] mode = "until_acknowledged" on_limit = "pause" # the default, and the only value a fill accepts # ... [processors.live_gap_fill] max_blocks = 7200 # fill a skipped range of up to about a day; announce longer ones ``` Before the lane applies the block that follows a skipped range, live or replayed at startup, it recovers the range from the processor’s history sources, 128 blocks at a time, and applies each block, oldest first, as a finalized `apply` with `originKind: "live_recovery"`. Then it applies the block itself. The live stream stays contiguous and in block order, announces nothing for the range, and the processor’s coverage holds the filled blocks as finalized. The [change protocol](/docs/reference/native-api-and-delivery/#42-operations) describes what a consumer sees, and [Keep your application in sync](/docs/guides/keep-your-application-in-sync/) what an application still does. `max_blocks` is required and takes 1 to 7,200, about a day of slots. The table has no other setting. Validation refuses it for a processor that is not `history_mode = "on_demand"`, because automatic history refills skipped blocks, and for an ordered processor, such as `transaction-stats` or `uniswap-latest`, which holds later blocks instead of skipping them. It also requires `[processors.delivery] on_limit = "pause"`, which is the default: validation refuses `fail` and `expire_and_reset`, because a fill’s burst of blocks could fail the lane, or reset its consumers, where announcing the blocks would not. It is allowed under both `history_control` values. The lane announces a range as it does without the table, and fetches nothing, when the range is longer than `max_blocks`, when no history source serves finalized blocks, or when the range is not finalized yet. The limit is all or nothing, because blocks filled at the top of a range could not link to the cursor. A fill that starts stops at the first block it cannot fill, and the lane announces from there. That happens when history fails or serves too few blocks; when a block is not finalized, does not link by parent hash to the one before it, is not the canonical block at its height, or lacks material the processor requires; and when the time limit passes. The limit is five minutes and is fixed. The fill starts no request after it and gives up a request still running at it, so a fill runs for at most five minutes plus applying the blocks of its last request. A filled block is as trusted as the same block delivered by a `fill_missing` subscription, which uses the same sources and verification policy. The filled blocks link by parent hash from the cursor’s block through the range and, when the fill completes, to the block that follows. The sources are the processor’s history sources, in the order a history request tries them: retained raw history (`[raw_history]`, when enabled), the configured `[[sources.history]]` by `priority`, and last the execution P2P bridge, within `sources.live.history_fallback_blocks`. The bridge is available to a fill during the replay that follows a restart, too. Bandwidth depends on the source. A dataset source such as Xatu serves only the material the processor needs, about a kilobyte per block for `blobs-money`. Execution P2P transfers whole bodies and receipts, on the order of a megabyte per block on Mainnet today, so a few thousand blocks are gigabytes. Configure a dataset source for a processor that sets the table. Requests run one after another and do not coalesce, so a fill is slower than a pipelined backfill subscription over the same range. `sources.live.kind = "disabled"` leaves no live lane, so the table does nothing, and `require_retained_input = true` limits a fill to retained raw history, which usually does not hold the range: the lane announces it. The live lane is shared. While a fill runs, it takes no other block: every processor’s live lane waits, the head that JSON-RPC reports stops advancing, and WebSocket subscriptions publish nothing new. That happens after the live lane was not running for a while, and `max_blocks` and the time limit bound it. Several processors with the table fill one after another, and each fetches the blocks again. Filled blocks are ordinary delivery records under the processor’s delivery policy, and count against `delivery.max_bytes` and the node-wide `[budgets.delivery]` and `[budgets.store]` limits. A lane that reaches one of those limits mid-fill stops there. It holds the block after the range and announces nothing. While the store would refuse that block, because the lane is paused above its stream’s resume mark (90 % of `max_bytes`), a node-wide budget has no room for it, or the lane is paused at a storage limit while storage stays above its low-water mark, the lane fetches no history. When finality prunes the frame of the block after the range during a long hold, the lane recovers that block from history once the store would take it, as any paused lane recovers its first unapplied block. After a restart of the live lanes, a lane held at a node-wide budget can fetch once more before it waits again. The lane continues the fill once the store would take the block: once consumers acknowledge and pruning brings its stream down to the resume mark, once pruning any stream gives a node-wide budget room, or once storage has room. The unfilled rest is recomputed from the processor’s cursor on resume, so a history commit that an application’s subscription lands above the cursor meanwhile can shorten what the lane fills or announces. That is rare, and idempotent writes and the application’s coverage diff cover it. A single filled block larger than the stream’s `max_bytes` fails the lane, as an equally large live block would: raise `max_bytes` or remove the table. A fill also makes a pause at a delivery or storage limit more likely, and a held block’s delta counts against the shared `[budgets] pending_delta_bytes`; when it does not fit, the lane fails (`live_gap_marker_exceeds_pending_delta_budget`) until the budget is raised and the lane reset. The [runbook](/docs/operations/runbook/#crash-or-interrupted-commit) lists the log lines and the recovery. The table is not part of the instance’s identity, so add, change, or remove it in place, as with the lifecycle policies below. A release that predates the table refuses a configuration that has it, so remove it before rolling back. ## Orthogonal lifecycle policies Every processor has six independent lifecycle policies. The pre-launch `retention` shorthand has been removed so artifact, output, delivery, state, checkpoint, and undo semantics cannot be inferred from one overloaded setting. ### State `[processors.state] mode` is `durable` or `checkpointed`. The store persists processor state in both modes, and `[processors.checkpoint]` alone decides whether recovery checkpoints are taken: `checkpointed` requires `[processors.checkpoint] mode = "automatic"`. `ephemeral` is rejected, because no mode discards processor state. ### Artifacts `[processors.artifacts] mode` is `none`, `window`, or `full`. Artifacts are immutable finalized map results used for bulk scan, export, and compatible replay. They are independent of queryable output and delivery records; the default is `none`. `window` requires exactly one `[processors.artifacts.window]` limit: `max_blocks`, `max_age`, or `max_bytes`. Full retention is removed only by an explicit artifact deletion operation. ### Output `[processors.output] mode` is: * `none`: retain no queryable entity material; * `latest`: retain the current entity value per key; * `window`: retain the declared block, wall-clock age, row, or byte window; * `full`: retain all selected queryable output. `window` requires a `[processors.output.window]` table with exactly one limit: `max_blocks`, `max_age`, `max_rows`, or `max_bytes`. Validation refuses `[processors.output] finalized_only`, which was never applied; to publish only finalized blocks, set `publish = "finalized"`. How much `latest` keeps depends on the processor’s keys, not on the mode: an ordered aggregate such as `transaction-stats` writes one key and keeps one row, a per-pool processor keeps one row per pool, and a block-local processor such as `evm-events` usually writes new keys every block, one per event, so under `latest` its output grows as under `full`. `leani doctor` warns about `latest` on a block-local processor; use `window` to bound such output. ### Delivery `[processors.delivery] mode` is `best_effort`, `window`, or `until_acknowledged`. Byte sizes accept integers or `B`, `KiB`, `MiB`, `GiB`, `KB`, `MB`, and `GB` strings. Durations accept integer seconds or `s`, `m`, `h`, and `d` strings. `until_acknowledged` requires at least one required `[[processors.delivery.consumers]]`, each with a `lease_ttl` from one second to 100 years. Required consumers protect pruning until they are explicitly expired/reset; a temporarily lapsed lease does not silently advance the watermark. `on_limit` is `pause`, `fail`, or `expire_and_reset`. Paused instances automatically resume after acknowledgement/pruning moves below the low-water mark. Pruning is cumulative and block-aligned: ```toml [processors.delivery.pruning] interval = "30s" minimum_batch_blocks = 64 minimum_batch_changes = 10000 maximum_delete_changes = 10000 retain_finalized_blocks = 256 retain_acknowledged_age = "1h" ``` `max_age` and `retain_acknowledged_age` use durable node wall-clock enqueue/acknowledgement time, not Ethereum block timestamps, so the changes a backfill enqueues count as new. A pass deletes at most `maximum_delete_changes`. A pass that deletes that many is followed at once by the next, and a stream that pauses at its limit is pruned at once, without waiting for `interval`. ### Checkpoint and undo `[processors.checkpoint] mode` is `none` or `automatic`. Automatic mode checkpoints processor state at most once per 1,000 finalized blocks, and again when a historical job completes, and keeps the newest positive `keep` count. A restore repairs state only when the processor’s cursor sits exactly on a checkpoint: a cadence block or the end of a completed job, even if finality reached that block later. A processor between checkpoints cannot be restored from one; restore a full-store backup or rebuild the processor. Portable savepoints are exports, created and deleted explicitly through the API; the node cannot restore them, and automatic checkpoint pruning does not cover them. Each processor instance keeps at most 16, and each new one counts against the physical store budget, which answers 507 when it does not fit. Editing lifecycle policies, for example to raise a limit, leaves existing checkpoints and savepoints valid. `[processors.undo] mode` is `none` or `unfinalized`, and `unattested` and `attested` publication require `unfinalized`. Unfinalized blocks always keep their undo records, so a reorg can revert them in either mode. Once finality passes a block, `unfinalized` keeps its record for another `safety_blocks` blocks and `none` deletes it at once. Blocks applied as already finalized record no undo. ## API and credentials Set `api.bearer_token_env` to the name of an environment variable, never a token value. When configured, that one bearer protects native read, stream, consumer, and management routes on the API listener; operational health, metrics, and network-dashboard routes remain unauthenticated. `serve` fails to start when the variable is unset, holds fewer than 16 characters, or holds anything but printable ASCII without spaces; use a random value such as `openssl rand -hex 32`. Clients send `Authorization: Bearer `, with the scheme in any case, and the node compares tokens in constant time. A consumer created through the API carries its own credential, and a backfill subscription’s consumer can; a new one holds 32 to 512 printable ASCII characters without spaces, such as `openssl rand -hex 32`. Every consumer-scoped call for a consumer with a credential, its streams included, then needs it in `x-leani-consumer-credential` besides the bearer, and gets 403 without it, so one client cannot move another consumer’s cursor. Listing, inspecting, and revoking consumers stay administrative: only the bearer protects them, so an operator can revoke a consumer whose credential is lost. Consumers declared under `[[processors.delivery.consumers]]` have no credential and need only the bearer. The store keeps credential hashes and session-token keys under a random per-store secret, which backups carry with the store. A backfill subscription’s credential also enters its idempotency identity, an unkeyed hash of the whole request, so use random credentials. The native API, HTTP RPC, and WebSocket RPC binds must all differ. RPC has no built-in authentication. A bind beyond loopback, such as `0.0.0.0`, fails validation unless it is protected or explicitly opted in: | Listener | Beyond loopback requires | | ------------------------------ | -------------------------------------------------------------------- | | `api.bind` | `api.bearer_token_env`, or `api.allow_unauthenticated_remote = true` | | `rpc.http_bind`, `rpc.ws_bind` | `rpc.allow_unauthenticated_remote = true` | Opt in only behind a trusted network or an authenticating proxy. Put remote listeners behind a TLS/authenticating proxy and restrict the unauthenticated operational routes to a monitoring network. The compact configuration has no bearer setting, so its `[api] bind` stays on loopback; use the advanced schema to serve beyond it. ### Browser access The listeners refuse most requests a web page could make through a visitor’s browser: * The native API answers a `Host` that is an IP address, `localhost`, or a name in `api.allowed_hosts`, and answers any other name with 421. A page that points its own name at 127.0.0.1 still sends that name; an address cannot be repointed, so health probes and scrapers that call the node by IP keep working. List every name clients use to reach the API, such as a compose service name or the name a reverse proxy forwards, without a scheme or port: `allowed_hosts = ["leani", "indexer.internal"]`. * Browsers send an `Origin` header on CORS requests, such as `fetch()` calls to another origin, event streams, and WebSocket upgrades, and on POST and DELETE requests. They send none on navigations or on no-cors GET and HEAD requests, such as an image or script load. Both listeners accept requests without an `Origin`, and requests from loopback origins on any port. Any other origin gets 403. A browser application served from another origin, including one behind the same reverse proxy, needs its origin in `api.allowed_origins` or `rpc.allowed_origins`, such as `["https://app.example"]`. The node sets no CORS headers; a cross-origin application still needs a proxy that adds them and allows the `content-type` and `x-leani-request` request headers. * The native API refuses, with 403 `cross_site_request`, a GET or HEAD without an `Origin` that the browser’s Fetch Metadata marks as coming from another site’s page (`Sec-Fetch-Site: cross-site` or `same-site`) and not as a navigation (`Sec-Fetch-Mode` other than `navigate`). A consumer’s live or backfill stream route refuses such a request even as a navigation, since opening the stream takes the consumer’s session lease. Current browsers send Fetch Metadata only to potentially trustworthy URLs, which are HTTPS, loopback addresses, and `localhost`; a node reached over plain HTTP by another name or address, such as a LAN IP with `allow_unauthenticated_remote`, gets none, and neither refusal applies there. The SDK and curl send none either, and pass. * A native API POST or DELETE needs `content-type: application/json` or the header `x-leani-request: 1`, and gets 415 otherwise. JSON-RPC calls need `content-type: application/json`. The SDK sends both. A cross-site page can send neither without a CORS preflight, which the node never grants. * Only `POST /v1/processors/{processor}/collections/{collection}/entities` creates a query snapshot. A GET without a cursor reads current output without one. What still reaches the native API from a page: navigations from another site, including into a frame, to routes other than consumer streams, and GET or HEAD requests without Fetch Metadata: from browsers without it, or to a node served over plain HTTP by a name or address other than loopback or `localhost`. The page cannot read the responses, but without Fetch Metadata a GET that opens a consumer’s live or backfill stream takes that consumer’s session lease. A consumer’s credential keeps pages from opening its stream, and `api.bearer_token_env` keeps them from opening any; a browser adds neither header on its own. When upgrading a relative `data_dir`, Leani refuses to start if its former working-directory location contains a database or embedded subscriptions while the location beside the configuration holds none: it would otherwise start on an empty store. Move the old state, or set an absolute path to select the intended store. When both locations hold state, it uses the one beside the configuration and warns, naming both. Equivalent paths and symlink aliases of the same directory count as one. ### Node-side Wasm builds `api.allow_wasm_builds = true` lets the node compile processor source sent to `POST /admin/v1/wasm/build`, which the playground’s editor uses; the compact profile takes it under `[api]` too. It is off by default and a development feature, not for production: rustc can read the host’s files while it compiles, and only a denylist of source constructs guards it. With it on, the node builds Rust only for requests from its own machine, an SSH tunnel included, and TypeScript for any client the API admits; it logs a warning when it starts, and `leani doctor` reports one. A request relayed with a `Forwarded`, `X-Forwarded-For`, `X-Forwarded-Host`, or `X-Real-IP` header, or addressed to another host name, is not the node’s own, but behind a reverse proxy on the same machine that sets none of them, a remote client’s request looks local. In production, build modules where you write them, or in CI, and configure the module file with its `blake3` hash. ### Processor changes through the API `api.allow_processor_changes = true` lets `POST /admin/v1/processors` add a processor to the running node and `DELETE /admin/v1/processors/{processor}` remove one it added; the compact profile takes it under `[api]` too. The node keeps added processors in its data directory’s `processors.toml`, in the `[[processors]]` schema, and their Wasm modules in `modules/`, and loads that file after the configuration file on every start. An instance both configure runs as the configuration file says, with a warning. Each change restarts the network or JSON-RPC lanes in-process: a live pause for every processor. Off by default, as a node configured as code should not change beside its configuration. ### Historical CLI and node backfill `leani backfill --processor INSTANCE --from-block N --to-block M` uses the same history source assembly, configured pipeline, material coordinator and verified P2P fallback as node jobs. `--processor` defaults to the configuration’s only processor. When live P2P is enabled, the standalone command verifies the configured finality anchor and opens its own persistent peer pool. It checks the finalized upper bound and honors `sources.live.history_fallback_blocks`. No live listeners or processors are started. Disabled P2P and retained-input-only policies remain in force. To use a running node and its existing peer pool: ```bash leani backfill --endpoint http://127.0.0.1:18080 \ --processor INSTANCE --from-block N --to-block M ``` The command sends an authenticated materialization request and waits for its status. `LEANI_API_TOKEN` supplies the token without putting it in shell arguments. The token travels in an `Authorization` header, so across hosts use HTTPS, for example through a TLS-terminating reverse proxy; plain HTTP suits loopback or a private container network, and the command warns when it sends the token over plain HTTP beyond loopback. An optional endpoint path prefix is preserved. Ctrl-C cancels the submitted job. Without `--endpoint`, stop any process holding the data directory before starting standalone backfill. Ctrl-C cancels a standalone run, so the next `serve` does not resume it; a second Ctrl-C exits at once. A standalone job is named by processor, chain and range. When an earlier run of the same range recorded another verification policy, for example before `raw_history` was enabled, the store refuses the new input as a different job. Delete the earlier one with `DELETE /admin/v1/materialization-jobs/{id}`, or submit through `--endpoint`, which uses a fresh key per submission. Xatu exports have table-specific coverage. In particular, a recent beacon file does not prove that the execution-transaction file needed for receipts has been published. Missing or incomplete partitions can fall back to the verified P2P bridge; dataset-only configurations need another available history source. Finality or peer failures are reported rather than silently removing the configured bridge. ### JSON-RPC limits Each limit has a `rpc` setting: | Setting | Default | When exceeded | | ---------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `max_batch_requests` | 100 | the batch is refused whole with one `-32600` error | | `max_response_bytes` | `16MiB` | each call past the limit is answered with `-32005` | | `max_log_results` | 10000 | `eth_getLogs` fails with `-32005` and a smaller block range to retry | | `max_log_addresses` | 1000 | the filter fails with `-32602` | | `max_log_topic_alternatives` | 1000 | the filter fails with `-32602` | | `max_subscriptions_per_connection` | 128 | `eth_subscribe` fails with `-32005` | | `max_websocket_connections` | 256 | the WebSocket upgrade gets HTTP 503 | | `max_outbound_bytes` | `64MiB` | queued notifications of all WebSocket connections; when full, the connection holding the most is closed with `1013` | | `max_subscription_event_bytes` | `16MiB` | a WebSocket connection whose subscriptions produce more notification bytes for one chain event is closed with `1008`, and one that leaves more unread with `1013` | A closed WebSocket connection releases its slot and its subscriptions. Notifications are queued one at a time, so while earlier ones are still unsent, a connection can be closed with `1013` before one event’s notifications pass the limit that would close it with `1008`. Each connection holds at most `max_subscription_event_bytes` of queued notifications and one response to a call; it reads its next call only once that response is sent, so a slow reader slows only itself. A connection that keeps more than a quarter of its notification room queued for 30 seconds is closed with `1013`: it reads slower than its subscriptions produce. All WebSocket listeners also share `max_outbound_bytes` of queued or sending notifications (64 MiB by default). When that runs out, the connection holding the most of it is closed with `1013`, not the one that notifies next; responses never use it. A send may take 30 seconds plus the time its payload needs at 64 KiB/s before the connection is closed. These are encoded-payload limits, not process RSS limits: at the defaults, responses add at most `max_websocket_connections` × `max_response_bytes`. `max_outbound_bytes` must be at least `max_subscription_event_bytes` and at most 4,294,967,295 bytes. `rpc.transaction_locator` is deprecated and ignored: nothing reads it. The node still accepts it, with a warning in its log and in `leani doctor`; remove it. ### Delivery batching History and live delivery use independent transport limits under `api.delivery.history_batches` and `api.delivery.live_batches`. The defaults are byte-first (a `4MiB` target in both), with hard encoded-byte, event, processed-block, and maximum-delay bounds; only the delay differs (`50ms` history, `10ms` live). A live batch never waits for new blocks: at the head it holds one block, and for a consumer that is behind it packs the whole blocks already committed, reading on toward its target for at most `maximum_delay`. A block whose changes pass `maximum_events` or `maximum_encoded_bytes` arrives in several batches, which the consumer acknowledges only at the block’s end; one change larger than `maximum_encoded_bytes` ends the stream with `single_change_exceeds_delivery_batch_limit` until the limit is raised. A live batch also leaves room in `maximum_buffered_bytes` for its record’s own fields, so its changes stay below that buffer even when it is no larger than `maximum_encoded_bytes`. History subscriptions may request smaller effective limits; those values are persisted with the subscription and returned by its status endpoint. `maximum_buffered_batches` and `maximum_buffered_bytes` independently cap the per-connection encoder queue; backpressure stops the encoder producer before either bound is exceeded. SDK delivery sessions refuse an NDJSON record over 65 MiB with a non-retryable `invalid_response` error. A record carries up to `maximum_encoded_bytes` of changes plus its own fields, so for SDK clients keep each lane’s `maximum_encoded_bytes` at or below 64 MiB; raising it, and `maximum_buffered_bytes` with it, beyond that lets a record exceed what the SDK accepts. Opening a history stream may request only stricter byte/event/block/delay limits through query parameters; these are connection-local and do not mutate the durable subscription. A live stream, including one the SDK’s `streamLive()` opens, takes no such parameters and uses `live_batches` as configured. The SDK’s `latency`, `balanced`, and `throughput` profiles are convenience functions that expand to those concrete numbers and are resent after reconnect. `compression = "gzip"` is negotiated through `Accept-Encoding`; the response is one continuous gzip member with an explicit sync flush after every NDJSON record, so batches and heartbeats are observable immediately by streaming decoders. Set it to `"none"` to disable compression for that lane. ## Pre-launch schema policy The project is not live yet and has no compatibility contract for existing consumers, config files, or databases. Configuration, SDK, API, and SQLite schemas may be replaced when that produces a cleaner final design; development databases should be recreated after an announced incompatible change. Durable delivery and processor encodings remain explicitly versioned so upgrade-safe replay can become a launch requirement without changing the public cursor model. # Operations runbook > Deploy, observe, back up, restore, compact, and recover a Leani node using its explicit health and storage contracts. ## Deployment profiles `deploy/container.toml` is a safe historical-only profile. It starts the query API plus HTTP and WebSocket RPC on all container interfaces, but Docker Compose publishes them only on loopback. It does not claim live or finality readiness. Its processor uses on-demand history, so nothing is indexed until you run a bounded `backfill` against the same data volume. `serve` holds the data directory’s lock, and a backfill beside it fails with `runtime data directory /var/lib/leani is already in use by another Leani process`, so stop the service first. `docker compose run` mounts the service’s volume, and its arguments replace the image’s `serve` command, so name the profile with `--config`: ```bash docker compose stop leani docker compose run --rm leani backfill --config /etc/leani/node.toml \ --processor blobs-money --from-block 19426589 --to-block 19427588 docker compose up -d leani ``` Keep `LEANI_API_TOKEN` exported for these commands too: Compose resolves it for every command. The processor starts at block 19,426,589 and is block-local, so later ranges may follow in any order. Then query the range. Subscriptions remain quiet until a live source commits events. A live-enabled node with a verified finalized head also accepts the CLI over its native API, without stopping it: ```bash leani backfill --endpoint http://127.0.0.1:18080 \ --processor blobs-money --from-block 19426589 --to-block 19427588 ``` The standalone form attaches the same verified P2P history fallback when `sources.live.kind = "p2p"`; the historical-only container profile above leaves P2P disabled. Use a live-enabled configuration when missing Xatu partitions must be recovered from peers. The profile protects the API with a bearer token from `LEANI_API_TOKEN`: `serve` fails to start without one of at least 16 printable ASCII characters without spaces, so export it, for example `export LEANI_API_TOKEN="$(openssl rand -hex 32)"`, before `docker compose up`, which stops with an error when it is unset, or pass it with `docker run --env LEANI_API_TOKEN`. The container’s health check calls `/health/live`, which needs no token. The profile opts JSON-RPC, which has no authentication, into its all-interface binds with `rpc.allow_unauthenticated_remote`; keep its ports on loopback or behind an authenticating proxy. The API answers only `Host` names in `api.allowed_hosts`, besides `localhost` and IP addresses; the profile lists the compose service name `leani`, so other services can call `http://leani:8080`. To add the names your clients use, mount a copy of the profile with them over `/etc/leani/node.toml`. The profile runs `blobs-money` as the instance `blobs-container-1-7`. A new processor version that changes the processor’s identity takes a new instance ID, because the store refuses another version under an instance it holds. Version 0.1.0-rc.1 ran `blobs-money` 1.4.0 as `blobs-container`, rc.2 to rc.8 ran 1.5.0 as `blobs-container-1-5`, and rc.9 to 0.1.1 ran 1.6.0 as `blobs-container-1-6`, so on an earlier volume the new image starts beside that instance and leaves it inert: nothing indexes or serves it, but its rows stay in the volume and count toward `[budgets.store] maximum_physical_bytes`. This upgrade is itself an instance replacement: backfill subscriptions on the earlier instance show `processorConfigured: false` and keep counting against `[budgets.delivery] maximum_history_retained_bytes` until you settle them as step 2 of [Processor rebuild or rollback](#processor-rebuild-or-rollback) describes. For a clean slate, remove the volume with `docker compose down -v` before `docker compose up --build`, or restore a snapshot of the volume. The profile runs at most two history chunks at once (`[budgets.history_pipeline] maximum_active_chunks = 2`): a Xatu backfill holds about 450 MiB per active chunk, so two fit its 1 GiB `memory_bytes` budget and leave the rest of the compose file’s 2 GiB container limit to the node. The container’s root filesystem is read-only. The image points `SQLITE_TMPDIR` and `TMPDIR` at `/tmp/leani`, where SQLite spills statement journals and sorts that outgrow memory, and the compose file mounts a tmpfs there that the node’s user can write. Without a writable temporary directory, large statements fail with `disk I/O error` (SQLite code 6410), such as a finality advance over many blocks or a peer store refresh; mount one when you run the image another way. For a direct binary deployment: 1. install the binary as `/usr/local/bin/leani`; 2. create an `leani` system user; 3. place a validated config at `/etc/leani/node.toml`; 4. install `deploy/leani.service`; 5. give the service user write access only to the configured data directory. Keep bearer tokens in `/etc/leani/environment`, not in TOML. Public exposure should go through a TLS reverse proxy with request and connection limits. ### Inbound P2P on a public host A node that accepts inbound peers takes untrusted input from the open internet, and on a datacenter address its provider watches what it dials. These rules hold for any public host. The Docker ones apply when nodes run in containers, and the port numbers are examples, not requirements. * **Fix the peer ports the node needs.** Execution P2P listens on ephemeral ports unless `sources.live.listener_port`, `discovery_port`, and `discv5_port` are set, so set them for peers to dial in. An op-stack node needs them: a fresh one that cannot be dialed often finds no execution peer. It also takes gossip peers on `finality.listen_port` and `finality.discovery_port`, 9222 in compact configurations. An Ethereum node finds peers dialing out only, as does a rollup’s L1 anchor on its own execution P2P ports, and a Nitro chain’s node only dials out, to its sequencer feed and endpoints. * **Give each node on a host its own ports.** A single node can use 30303 for the execution listener and Discv4 (TCP and UDP), a UDP port such as 30304 for Discv5, and 9222 for gossip (TCP and UDP). Another node on the same address takes another set, such as 30400, 30401, and 9230. * **Advertise the public address.** Behind NAT, Docker’s bridge included, the node sees only its private address, and advertising that sends peers to an address that never answers. Set `sources.live.nat = "extip:"`; gossip learns its public address from its peers. The default, `none`, advertises no address, and `any`, `upnp`, and `publicip` ask ipinfo.io, icanhazip.com, or ifconfig.me for it every five minutes. * **Keep each port the same inside and outside.** The node announces its own port numbers, so a NAT or container mapping must not renumber them: `-p 30400:30400` works and `-p 30500:30400` does not. * **Refuse private destinations on the way out.** Discovery hands out peers’ LAN addresses (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, …). Dialing them from a datacenter address looks like a network scan, and providers such as Hetzner send abuse reports for it and may lock the server. Reject rather than drop, so that a dial fails at once instead of holding a peer slot until its timeout, and filter only what leaves through the public interface, so the host still reaches its own private networks. For a node running on the host, with ufw: ```sh WAN=$(ip -4 route show default | awk 'NR == 1 {print $5}') for range in 0.0.0.0/8 10.0.0.0/8 100.64.0.0/10 127.0.0.0/8 169.254.0.0/16 \ 172.16.0.0/12 192.168.0.0/16 198.18.0.0/15 224.0.0.0/4 240.0.0.0/4; do ufw reject out on "$WAN" to "$range" done ``` Containers bypass the host’s own rules, so filter their traffic in `DOCKER-USER`. These rules are lost on reboot, and the script can run again at any time, so run it from a systemd unit ordered after `docker.service`: ```sh WAN=$(ip -4 route show default | awk 'NR == 1 {print $5}') iptables -N CONTAINER-EGRESS 2>/dev/null || iptables -F CONTAINER-EGRESS for range in 0.0.0.0/8 10.0.0.0/8 100.64.0.0/10 127.0.0.0/8 169.254.0.0/16 \ 172.16.0.0/12 192.168.0.0/16 198.18.0.0/15 224.0.0.0/4 240.0.0.0/4; do iptables -A CONTAINER-EGRESS -d "$range" -j REJECT --reject-with icmp-net-unreachable done iptables -C DOCKER-USER -o "$WAN" -j CONTAINER-EGRESS 2>/dev/null || iptables -I DOCKER-USER 1 -o "$WAN" -j CONTAINER-EGRESS ``` No real peer loses anything: a private address is unreachable from the internet anyway. * **Docker: publish peer ports with an explicit host address.** Published ports bypass host firewalls such as ufw, so `-p 30400:30400` is public even when ufw denies it. Write `0.0.0.0:30400:30400` and `[::]:30400:30400` for the peer ports, and bind the API and RPC to `127.0.0.1` behind a reverse proxy, or publish them not at all. Setting the daemon’s `ip` and the `com.docker.network.bridge.host_binding_ipv4` option in `default-network-opts` to `127.0.0.1` then turns a forgotten address into a local port. First give every port that must stay public, such as a proxy’s 80 and 443, an explicit address: one published without an address turns local the next time its container is created. With `live-restore`, the daemon restart that applies the setting keeps containers running. * **Docker: harden the container the way `compose.yaml` does.** That means `read_only` with a tmpfs at `/tmp/leani`, `cap_drop: [ALL]`, `no-new-privileges`, a memory limit, `restart: unless-stopped`, and the image’s unprivileged user (uid 10001). Give each node its own network: never a database’s, and not Docker’s default bridge, where every container can reach every other. * **Docker: run released images, or images you built.** Bind-mounting a locally built binary over the image’s entrypoint runs code that no image digest or release signature describes. For an unreleased commit, build and tag an image (`docker build -t leani: .`). * **Watch connection tracking.** On a NAT host, each peer session and discovery exchange holds a conntrack entry. Compare `/proc/sys/net/netfilter/nf_conntrack_count` with `nf_conntrack_max` after adding nodes: a full table drops new connections for every service on the host. A rollup node in Docker, on the second set of ports above: ```sh docker run -d --name leani-op --restart unless-stopped \ --read-only --tmpfs /tmp/leani:size=1g,mode=1777 \ --cap-drop ALL --security-opt no-new-privileges --memory 3g --cpus 1.5 \ --network leani-op \ -p 0.0.0.0:30400:30400/tcp -p 0.0.0.0:30400:30400/udp -p 0.0.0.0:30401:30401/udp \ -p 0.0.0.0:9230:9230/tcp -p 0.0.0.0:9230:9230/udp \ -p [::]:30400:30400/tcp -p [::]:30400:30400/udp -p [::]:30401:30401/udp \ -p [::]:9230:9230/tcp -p [::]:9230:9230/udp \ -v leani-op-data:/var/lib/leani -v /srv/leani-op/leani.toml:/etc/leani/node.toml:ro \ ghcr.io/smart-byte/leani: serve --config /etc/leani/node.toml --log-format json ``` Here `leani.toml` sets `sources.live.listener_port = 30400`, `discovery_port = 30400`, `discv5_port = 30401` and `nat = "extip:"`, and `finality.listen_port = 9230` and `finality.discovery_port = 9230`. Create the network once with `docker network create leani-op`. ## Health and metrics * `GET /health/live` checks that the process serves requests and SQLite answers a trivial query. It reads no tables, so it stays fast on large stores. * `GET /health/ready` additionally checks every required live/finality actor from in-memory readiness state. * `GET /debug/network` serves the built-in P2P and coverage dashboard. * `GET /v1/network/status` returns the dashboard’s machine-readable snapshot. * `GET /metrics` returns bounded-cardinality Prometheus text metrics. Store-wide and per-processor row and byte counts are recounted at most every 10 seconds and can lag by that much. `/v1/network/status` shares the per-processor counts. * `GET /v1/processors/{id}/status` reports coverage independently of process health. A historical-only node may be ready while a requested range is incomplete; the range query still fails with `range_incomplete` unless the caller opts into partial data. A live profile remains not ready until its independently anchored live and finality actors report ready. Live readiness also drops while retained recent frames sit at `budgets.recent_raw_hard_bytes`: live ingestion waits there, logging `recent_storage_full`, until finality prunes older frames (see [Storage pressure](#storage-pressure)). A parked processor lane does not affect readiness (see [Parked processor live lane](#parked-processor-live-lane)). With `sources.live.kind = "p2p"` and either supported finality backend, `serve` verifies the configured weak-subjectivity checkpoint, seeds the finalized execution anchor, starts one shared P2P subscription, and launches cold backfills for every processor that has a capable history source. A source failure drops readiness immediately and the supervisor retries with bounded exponential backoff (see [Shutdown and supervision](#shutdown-and-supervision)). The live lane delivers `unattested` blocks at most two slots past the newest attested head: the execution header of a light-client optimistic update that at least two thirds of the sync committee signed, which the finality source verifies within the slot it appears (see [finality levels](/docs/concepts/coverage-finality-and-reorgs/#finality-levels-and-publish-modes)). When a processor requires attested frames, it includes blocks only up to that head. When no new attested head arrives for four slots, for example while the finality transports are down or sync-committee participation stays below two thirds, the lane reports itself disconnected and live readiness drops until one does. Configuration refuses `sources.live.kind = "p2p"` with `finality.kind = "disabled"`, because nothing would verify those heads; use `sources.live.kind = "disabled"` for finalized-dataset backfills. When live readiness drops this way while finality stays ready, run `leani source probe finality`. Each Beacon endpoint whose finality verified reports its `attested_head`, or in `attested_head_error` why it gave none: it served no optimistic update, its update anchors no head, or its update failed verification. The lane needs one endpoint that serves `/eth/v1/beacon/light_client/optimistic_update`; replace endpoints that serve none. With `finality.kind = "consensus_p2p"`, peers must serve the `light_client_optimistic_update` request; the debug log names each peer that served none. The network view reports the process-wide execution P2P manager. Live, history, and probe requests share its identity, discovery state, peer pool, request gate, and Reth reputation state. Each row includes: * its current phase and active/stopped state; * connected and known-peer counts; * the requested block range and attempt count; * how recently it changed; and * the most recent bounded error message. The view deliberately omits peer identities and retains only 32 stopped manager records. It also reports cumulative material requests by outcome and the time spent waiting for local peer-capacity slots. Physical peer sessions are counted by establishment and disconnect, with disconnects grouped by Reth’s protocol-level reason. A high queue wait is a local scheduling signal; a timeout occurs only after dispatch capacity was obtained. Prometheus exposes the same state under the `leani_p2p_*` metric prefix. The execution identity is stored as `execution-p2p-secret` in `data_dir`. Treat it as node identity material: keep it across restarts, restrict its permissions, and never publish it. `execution-network.sqlite` is a disposable, bounded operational store capped by `sources.live.peer_store_max_entries`. It contains both broad discovery candidates and Leani’s independently observed service evidence: verified header/body/receipt success times, highest served block, smoothed response latency, last failure classification/time, fork compatibility, and latest anchor qualification. Reth’s known-peer snapshots and new service observations are committed by a dedicated background writer, so SQLite I/O never stops the network-manager event loop. Incremental upserts retain candidates absent from one short or failed run; indexed quality ordering decides which records survive the bound. Standalone feeds merge the SQLite evidence across sibling local Mainnet contexts, so a body- or receipt-serving peer learned by one processor is preferred by another without sharing processor data or the local P2P identity secret. The peer store is reconstructible and intentionally separate from the authoritative processor database and its backups. Warm startup uses two cache tiers. A small hot tier contains recent body-serving peers whose last verified body success is newer than their last recorded failure, with IPv4 `/16` and IPv6 `/32` diversity preferred. Those peers are dialed immediately. All other records stay in the broad tier and enter Reth’s dialer in `body_serving_peer_target`-sized batches at the configured peer refill interval. The segment-correct EIP-1459 DNS seeder and Reth’s native Discv4/Discv5 discovery run concurrently from the beginning. Reth owns the only Discv4 service and the bounded dial scheduler. `/v1/network/status` groups candidate admissions, established sessions, and qualification outcomes by `cached_hot`, `cached_broad`, `dns_tree`, `trusted`, or `discv4_or_5`. Prometheus exports the same origin labels through `leani_p2p_peer_candidates_admitted_total`, `leani_p2p_peer_sessions_by_origin_total`, and `leani_p2p_peer_qualifications_total`. Use these counters when comparing cold and warm startup instead of treating cache size as evidence of usefulness. Every new ETH session is immediately tested against the current independently verified execution anchor. Leani qualifies several sessions concurrently until the configured body-serving target is ready, then one at a time. Qualification is background work at normal priority throughout: it never uses the request slots reserved for the live lane. Qualification ranks proven serving peers first but does not exclude a newly connected peer: each material response is independently verified before use, so fresh peers remain immediate fallbacks. Proven serving peers are tried before untested discovery records on the next start. `sources.live.material_request_concurrency` bounds simultaneous physical requests together with the global source budget and connected-peer capacity. Every execution P2P request shares one process-wide limit: the larger of `material_request_concurrency` and `history_header_request_concurrency`, 32 by default. History, probes, and peer qualification leave four of those slots free for the live lane (half the limit when it is below eight), and a waiting live request gets the next free slot first. Each source acquisition’s `max_in_flight_requests` and the four-request per-peer pipeline usually impose a lower effective limit. More concurrency helps only when the peer pool and link have spare capacity; it also multiplies decoded response buffers. Treat `budgets.source_concurrency` and `budgets.history_pipeline.maximum_active_chunks` as memory-affecting settings and tune them together while watching RSS and the material high-water metrics. `material_request_blocks` sets the blocks per body or receipt request; the evidence-backed default is eight. A peer that stops a reply at its response size limit serves only the first of them: those are kept and the rest is requested again. A failed request is retried block by block without narrowing other requests. Raise it only with repeated real-source evidence for the deployment’s peer and bandwidth profile. For address/topic-filtered log processors, P2P checks the verified header bloom before requesting receipts. A negative avoids the receipt bundle; a positive still downloads all receipts for that block because the ETH protocol has no server-filtered receipt request. Bodies are fetched only when the descriptor’s log identity requires transaction hash. Therefore processor requirements, pool activity, bloom false positives, and receipt density can matter more than the configured concurrency ceiling. For an inbound-capable deployment, set `sources.live.listener_port` and `sources.live.discovery_port` to `30303`, set `sources.live.discv5_port` to a distinct fixed UDP port such as `30304`, expose all three sockets, leave `enable_discv5 = true`, and configure `sources.live.nat` for the environment. Zero ports remain useful for isolated tests. Inbound reachability improves diversity but is not required for verification. `sources.live.trusted_peers` may contain stable operator/community `enode://` seeds that supplement public discovery without turning the pool into an allowlist. `sources.live.minimum_peers` is the hard connected-session floor before execution requests may start and should normally remain `1`. Capability qualification does not gate startup: it ranks proven peers first while commitment validation remains mandatory for every response. `body_serving_peer_target` controls how many peers Leani concurrently proves can serve commitment-valid bodies; reaching it does not delay startup after the minimum is available. `preferred_peers` is a soft operational target and never blocks ingestion. The Reth manager continues filling connections beyond that target in the background up to `max_outbound_peers`. Header, body, and receipt failures are isolated to their material lane. A transient miss therefore cools that lane without disconnecting a session that may still be useful to another processor; cryptographically invalid material continues to ban the peer globally. If the pool remains at zero connected peers for `sources.live.peer_recovery_timeout_seconds`, the node rebuilds the complete execution network manager and restarts Discv4, Discv5, and DNS bootstrap. This recovers stale sockets after host sleep and retries a failed cold-start bootstrap without operator action. The default is five minutes: discovery and outbound dialing continue throughout that window, allowing Reth’s per-peer backoff and candidate rotation to work before the underlying sockets are recycled. The mainnet DNS root is also resubmitted every 15 seconds so a transient resolver failure during the first lookup does not wait for the whole-manager watchdog. Each rebuild logs `building the execution P2P network manager` and then `built the execution P2P network manager` or, at warn level, `failed to build the execution P2P network manager` with its error. While the live lane reconnects, it logs each failed attempt at warn level in `the live lane could not reconnect to the execution network; retrying`. A fixed Discv5 port can stay busy for up to a minute after a rebuild, while the ended manager’s last discovery lookup finishes; the lane keeps retrying meanwhile. Processor `coverage.complete` means only that the stored range from the configured start through `processedThrough` has no internal gaps. It does not mean that `processedThrough` has reached the live source. The network status adds `storedRangeContiguous`, `syncTargetBlock`, and `blocksRemaining`; use those fields together with `readiness.liveReady` when diagnosing catch-up. `syncTargetBlock` is derived from the live session’s `observedHeadBlock`: the newest header the live lane has validated, never a head a peer only claimed. It reports validated progress, so while the node catches up it trails the network head. `fromBlock` and `toBlock` describe only its current material request. A speculative request for the block after the observed head therefore does not create artificial processor lag. `blocksRemaining` counts every missing block from the configured start through the observed head, including internal gaps; it is not merely the distance between the highest stored block and that head. `readiness.ready` means the required live and finality network lanes are usable. It can be true while a processor backfills older gaps, so the dashboard reports that combined `live + backfill` state explicitly. The `network.supervisor` object reports `running`, `backing_off`, or `stopped`, including its bounded last error, cumulative failure count, and retry countdown. A zero active-session count during `backing_off` is a supervised retry, not an idle healthy node. The live/archive overlap may map the same canonical block at different finality levels. The runtime validates all finality-only checksum variants, keeps the strongest stored finality, and removes the redundant pending delta. Any difference that cannot be reproduced by changing finality still fails closed as a real transform or source conflict. At a restart, startup reconciliation instead deletes every pending delta for a block the processor already applied, without comparing it, before opening any network lane, so archive availability or a slow P2P catch-up cannot delay cleanup; its warning counts them in `discarded_pending_deltas`. `processors[].pendingDeltas` exposes any durable rows that remain afterward. `finality.kind = "consensus_p2p"` is the self-contained profile. Configure both the independently obtained checkpoint root and its finalized beacon slot. The node uses the signed bootnode ENRs embedded for its chain, Mainnet, Sepolia, or Hoodi, unless `finality.bootnodes` overrides them, binds discv5 to `finality.discovery_port` (`0` selects an ephemeral port), performs the mandatory Status exchange, and locally verifies bootstrap, sync-committee, BLS, finality, and execution-payload proofs. Permit outbound TCP and UDP; an inbound UDP mapping improves discovery but is not a trust requirement. `finality.kind = "beacon_api"` remains available when HTTP consensus transports are operationally preferable. Configure `finality.minimum_agreement` above one when independent transports are available. Each poll waits about two seconds after the first verified endpoint for the others, then follows the highest finalized slot that `minimum_agreement` endpoints have reached or passed, so a lagging endpoint neither holds finality back nor drops readiness at an epoch transition. Finality never moves backwards, and two verified endpoints that report different roots at one slot fail closed. Endpoints that name one transport twice, for example with and without a trailing slash, fail validation because each would count toward agreement. See [Checkpoint lifecycle](#checkpoint-lifecycle) for how the configured checkpoint is used and when it must be refreshed. On-demand RPC shares the configured source-concurrency ceiling. The node divides its memory and temporary-disk budgets across those request slots, enforces a one-minute request timeout and the advertised maximum log range, tries an alternate capable source only before returning a response, and never stores fetched frames in the recent cache. Put additional connection and request-rate limits at the reverse proxy when exposing this potentially expensive path. Suggested alerts: * liveness failure: page immediately; * required live/finality readiness false for 5 minutes: page; * processor head stops advancing for 3 expected block intervals: warn; * pending-delta or outbox bytes exceed 80% of configured budget: warn; * database size approaches the filesystem limit: warn at 70%, page at 90%; * finalized cursor does not advance for 20 minutes: warn; * `leani_finality_anchor_expiry_seconds` below three days: warn; * any finalized contradiction or store-integrity failure: stop publication and page immediately. Import `observability/grafana/leani.json` for the release dashboard and load `observability/prometheus/alerts.yaml` into the Prometheus-compatible rule evaluator. The checked rules cover missing scrapes, required-component readiness, stalled processor/finality cursors, a non-draining outbox, and a finality anchor close to its age limit. The stalled-cursor rules apply only where the profile requires the live source (`leani_live_required`) or finality (`leani_finality_required`), so a historical-only node whose backfill has finished does not alert. They join processor series to those gauges on the scrape target’s `job` and `instance` labels. Keep `honor_labels` disabled, the default, for the Leani scrape job: Prometheus then stores each processor’s own `instance` label as `exported_instance`. Filesystem percentage alerts remain the host operator’s responsibility because the node exports its database/recent-cache byte counts but not host capacity. ## Shutdown and supervision `serve` stops at Ctrl-C or SIGTERM. Open change streams (SSE) and consumer delivery streams (NDJSON) end after a whole event or record, and JSON-RPC WebSocket connections get a `1001` going-away close frame; clients reconnect from their last cursor as after any closed connection. The node then waits at most 10 seconds for open connections and its background work, and at most 5 more for blocking work such as a file write, abandons whatever is still open, and exits 0. A second signal during the first 10 seconds exits at once with status 130; startup reconciliation repairs a commit it interrupted (see [Crash or interrupted commit](#crash-or-interrupted-commit)). `deploy/leani.service` (`TimeoutStopSec`) and `compose.yaml` (`stop_grace_period`) allow 30 seconds for the stop; give another container setup more than Docker’s default 10 seconds. Background work runs in supervised tasks: the durable backfill and raw-history schedulers, the network lane supervisor, artifact compaction, query snapshot cleanup, and each processor’s delivery pruning and coverage compaction. Each runs until the shutdown. A task that stops before it, by returning, failing, or panicking, shuts the node down: the log names the task in `a background task ended; shutting the node down` at error level, and the node exits with status 1 after the same bounded shutdown. The systemd unit (`Restart=on-failure`) and `compose.yaml` (`restart: unless-stopped`) start it again. A persistent execution P2P source that cannot be built, for example for an invalid `sources.live.nat`, stops the node the same way. The network lane supervisor restarts failed runs of the network lanes itself, and drops readiness whenever the lanes do not run, a panic included. A failed run restarts after 1 second, and each further failure doubles the wait up to a minute; after a run that stayed up for at least a minute, the wait starts at 1 second again. A run that ends waits for its cold backfills to stop before the next one starts; every 10 seconds of that wait, the log names the ones still running in `cancelled automatic cold backfills are still running` at warn level. When the lanes halt (see [Finality contradicts the followed chain](#finality-contradicts-the-followed-chain)), they stay stopped and not ready while the node keeps serving what it stored. A live lane that stays not ready while verified finality is ready for `sources.live.stall_timeout_seconds`, ten minutes by default, within one run of the lanes is treated as stalled. Usually its execution P2P network is wedged, which a lane restart cannot heal; it can also be a finality endpoint that stops sending attested heads, which a restart may not fix. The lanes then stop, the log says `the live lane stalled while verified finality stayed ready; the node exits so that it restarts` at error level, and the node exits with status 1 for systemd or Docker to start it again. While finality is not ready either, the network itself is likely down and the node keeps waiting, and a wait at the recent-frame hard limit does not count (see [Storage pressure](#storage-pressure)). A run that fails quickly, as when another process holds the P2P ports or `persistent_retries = false` gives up, never reaches the timeout: the supervisor restarts it with backoff and logs each failure. Run the node under a supervisor that restarts it, or raise the timeout, up to 30 days. ## Checkpoint lifecycle `finality.checkpoint`, with `finality.checkpoint_slot`, is the trust root, and it is needed only for the first start. That start verifies a light-client bootstrap for the checkpoint, which must be at most 14 days (336 hours) older than its slot. From then on, the finality source keeps one bootstrapped light client, one per endpoint for `beacon_api`, and advances it with every finality update, plus the sync-committee update when a period ends. Nothing is bootstrapped again, and no age check runs while the node keeps running. A `beacon_api` endpoint that was down at start, or bootstraps slowly, bootstraps later from the newest anchor the endpoints agreed on, so it can still join after the configured checkpoint has aged out. Its bootstrap keeps running across polls instead of restarting each time. The node persists the newest verified finalized anchor as `finality-anchor.json` in `data_dir`. It writes a temporary file, syncs it to disk, and renames it over the old one, so a crash leaves either the previous anchor or the new one. The file records the anchor’s beacon slot and root, its execution block number and hash, the configured checkpoint it was verified from, and a format `version`. It holds no secrets. Only anchors at an epoch’s first slot are written, because Beacon nodes serve bootstraps for epoch-boundary blocks, so the file trails finality by about one epoch. An older anchor never replaces a newer one. Every start, and every restart of the network lanes, bootstraps from the persisted anchor instead of the configured checkpoint when both hold: * the anchor was verified from the configured checkpoint, so it is newer by construction; and * the anchor is at most 14 days old. An anchor verified from another checkpoint is never used: changing `finality.checkpoint` re-anchors the node on the new root, and the node logs a warning naming both roots. `leani doctor` reports the mismatch too. The one exception is an embedded subscription (`leani subscribe` without a running node) that reuses a cached checkpoint, `checkpoint.json`, whose trust is `locally_verified`: an anchor the subscription verified itself on an earlier run. A persisted anchor at a later slot replaces it. A checkpoint from a provider quorum follows the rule above, whether the subscription has just accepted it or reuses it from the cache with trust `provider_quorum`. The bootstrap is still verified against the anchor’s block root, and the configured checkpoint’s own age is not checked. A missing, corrupt, or unreadable file, or an anchor past the limit, falls back to the configured checkpoint with a warning. So does a persisted anchor whose bootstrap no endpoint or peer serves. Startup fails only when the configured checkpoint is unusable too, for example because it is older than 14 days. `leani source probe finality` and the benchmark’s history probe start from the persisted anchor by the same rules, but never write the file. The persisted anchor stops advancing while verified finality stalls, while the node is stopped, and while writing the file fails. A failed write is logged and counted, and never fails finality itself. Watch these: * `leani_finality_anchor_age_seconds` is the age of the newest verified anchor; * `leani_finality_anchor_expiry_seconds` is the time left before a restart can no longer bootstrap from it, and turns negative once it has passed; * `leani_finality_anchor_write_failures_total` counts failed writes of `finality-anchor.json`: while it grows, a restart may start from an older anchor than these gauges show; * the `LeaniFinalityAnchorExpiring` alert fires when fewer than three days remain; * `leani doctor` warns when the anchor a restart would use expires within three days: the persisted anchor, or the configured checkpoint if none applies. To refresh the trust root, take a recent finalized checkpoint root and slot from independent providers, set `finality.checkpoint` and `finality.checkpoint_slot`, and restart: the persisted anchor verified from the old root is then ignored. `leani reset all` removes the file with the rest of the runtime state. Errors, logs, and probe reports show endpoint and provider URLs as `scheme://host[:port]`, with `/…` in place of any path, because providers put API keys in userinfo, query strings, and paths. Request errors add the API path, such as `eth/v1/beacon/genesis`. Endpoints that would show alike carry their index, such as `finality.endpoints[1]`. ## Backup, restore, and compact Stop the node and any embedded subscription or standalone backfill using this data directory before running `leani db` commands (including `inspect`, `verify`, and `backup`). They take the same `.leani.lock` as other writers, and every one but `backup` opens the store with migrations enabled, which upgrades a store from an earlier release. Use the API and `/metrics` for inspection while the node is running. Create a consistent backup after stopping those writers: ```bash leani db backup /backups/leani-$(date +%s).sqlite \ --config /etc/leani/node.toml ``` `db backup` reads the store through a read-only connection and never upgrades it: the backup keeps the store’s schema, so the backup of a store from an earlier release restores with that release’s binary. It refuses a store whose schema is newer than the binary supports, and a data directory without a store. That command is intentionally SQLite-only. When any processor artifact segments exist, as with `artifact_storage.backend = "tiered_segments"`, it fails before writing a backup rather than producing an incomplete restore. Until a versioned bundle-backup command ships, stop the node and snapshot the complete `data_dir` (SQLite database/WAL plus `processor-artifacts`) or use an atomic filesystem/volume snapshot. Verify the backup using an otherwise identical config whose `data_dir` points to an isolated directory, with the binary that will open it: a newer binary upgrades the copy. Never overwrite the active database. Stop the service, move the active database aside with its `leani.sqlite-wal` and `leani.sqlite-shm` files, since SQLite would replay a leftover WAL onto the restored copy, copy the verified backup into place, then start the previous compatible binary. Retain the moved database until coverage, processor counts, cursors, and subscriptions are verified. `db compact` checkpoints the WAL and vacuums the active database; immutable artifact segments need no rewrite. The rewrite also turns on SQLite incremental auto-vacuum, which new stores have from creation, so pages freed by pruning return to the filesystem. A store created before auto-vacuum was enabled logs a warning at every start and never shrinks below its high-water mark; run `db compact` on it once. Like every `leani db` command, it runs only while the node is stopped, and it needs free disk for a second copy of the database, because the vacuum rewrites the whole database. `db prune-changes` is lease-aware; expired consumers must perform the documented snapshot/reset flow. ## Failure runbooks ### History schema or source failure Stop the affected backfill, keep the last committed coverage, run the source probe, and compare its schema/source plan with the last benchmark report. Switch to another capable configured source at the missing range boundary. Never mark failed chunks complete. ### P2P outage or invalid material Readiness must become false when the live session is unavailable. Open `/debug/network` or inspect `/v1/network/status` before treating every zero-peer message as a live outage. Preserve the recent and undo windows, stop unfinalized publication before a hard storage limit, and compare local queue wait with peer timeouts. The production source keeps one persistent broad peer pool, penalizes invalid material through Reth, retries without discarding healthy connections, and caps recovery backoff. Invalid commitments are permanent evidence against that response, not retryable data. Archive lag is not a live outage. The reconciliation cursor remains at the first unverified finalized batch and tries interchangeable history sources again. A durable `failed` archive reconciliation is a correctness incident: preserve the database and source object, stop publication, and compare the processor version/configuration and block identity before resuming. With `sources.history` empty, execution P2P serves all history and no archive can reproduce it, so nothing is reconciled. Reconciliation compares only exact finalized coverage, which keeps each block’s identity and mapped-delta checksum. It skips blocks nothing covers, and blocks that coverage compaction reduced to proof segments, logging the latter once as `archive reconciliation cannot compare blocks compaction reduced to proof segments; they stay unaudited`. Compaction keeps the blocks after a processor’s first verified hot/cold handoff exact until a verified reconciliation passes them, unless they lie more than 65,536 blocks below finality, so only an audit stalled that long loses blocks to compaction. ### Finality outage or disagreement Continue only unattested or attested publication. Do not advance or prune the finalized cursor. A disagreement or contradiction is fail-closed and requires operator review of checkpoint provenance and independent endpoints. A single bad transport is not an outage: consensus P2P bans a peer whose light-client material fails verification, asks the next one, and neither asks nor dials it again, across reconnects, until the lanes restart. Stale updates are retried, so neither ends the finality stream. An exhausted peer set logs a warning at most every five minutes. ### Confirmation stalled or a confirmed block reorged When `[confirmation]` endpoints stall, reset, or disagree, nothing new is confirmed: blocks keep their level, `publish = "confirmed"` processors hold their changes until `finalized` releases them, and JSON-RPC `safe` stops advancing until the finalized head passes it. An endpoint’s stream failure logs a warning and reconnects with backoff of up to 30 seconds. `/v1/network/status` shows each endpoint’s state (`connecting`, `connected`, `stale`, `reset`, `error`) and the head they last agreed on under `network.confirmation`, and `leani_confirmation_lag_slots` in `/metrics` grows from its usual one or two slots while they stall. Check the endpoint, or name more endpoints and raise `minimum_agreement`. A reorg that reverts a `confirmed` block logs an error and counts in `leani_live_confirmed_reorgs_total`: the Fast Confirmation Rule’s synchrony or honesty assumptions failed, or an endpoint misled the node. The blocks are undone as for any reorg. Review the endpoints before trusting `confirmed` again; `endpoints = []` turns the level off. ### Network fork this release does not support Each release verifies the consensus forks it knows. Both finality kinds know Glamsterdam’s Gloas; consensus P2P finality also needs peers that serve its light-client data, and stays unavailable until enough consensus clients do, while Beacon API finality follows from endpoints that serve it. Once mainnet activates a fork a release does not know, finality stays unavailable and the live lane stops, fail-closed: consensus peers answer with a fork digest the node does not know, which it logs once as `consensus peers serve a fork this release cannot verify`, and a Beacon API endpoint fails with an error naming the fork, such as ``serves `heze` light-client data``. No peer is banned for it. Upgrade to a release that supports the fork before its mainnet activation. Upgraded within 14 days, the node resumes from its persisted finality anchor; later, it needs a fresh `finality.checkpoint`. ### Live lane disconnected during a finality apply Symptom: right after finality advances, the live lane reports itself disconnected with `no sync-committee-attested execution head above block … for … seconds`, live readiness drops, and no block is included, although the finality sources are healthy. It is most likely every 1,000 finalized blocks, when each processor with automatic checkpoints copies its whole state into a recovery checkpoint, and with large processor states. Cause: both finality sources verify and publish attested heads only while the node reads their finality stream, and the node applies each verified finality update, checkpoints included, before it reads the next. An apply that takes longer than about 36 seconds leaves the live lane without a new attested head for its 48-second grace, four slots. What to expect: nothing is lost or reverted. When the apply completes, the next attested head arrives, the lane catches up on the blocks produced meanwhile, and readiness returns. This is a known limitation of this release; a later release publishes attested heads independently of finality applies. ### Finality contradicts the followed chain When verified finality names another block at a height than the retained canonical chain holds, or a retained block below the finalized block does not link to it, the node neither finalizes either chain nor defers forever. A contradiction with retained *unfinalized* blocks, for example after the lane stalled across a reorg of an attested head, heals itself. The node logs `verified finality contradicts retained unfinalized blocks; restarting the network lanes to revert them` as a warning and restarts the network lanes after the supervisor’s backoff. The restart reverts only the retained unfinalized blocks that are not on the newly verified finalized chain, and undoes processor coverage of them as a reorg, logging `retained unfinalized blocks do not link to the verified finalized anchor; reverting them as a reorg`. Those blocks are never finalized; the cold backfill and the live lane fetch the finalized chain again. Every start, and every restart of the network lanes, decides which retained blocks are on that chain the same way. Where parent links from them do not reach the anchor, as after a contradiction or an outage longer than the finality lag, the node proves the blocks on the anchor’s chain with execution headers from its peers that link by parent hash down from the anchor, keeps and finalizes them, and logs `proved retained unfinalized blocks against the verified finalized anchor` with the blocks kept and reverted. When it cannot prove them within 60 seconds, for example without execution peers, it logs `could not prove retained unfinalized blocks against the verified finalized anchor; reverting them` as a warning; when the proof would span more than 8,192 blocks, `retained unfinalized blocks are too far below the verified finalized anchor to prove; reverting them`. It then reverts every retained unfinalized block that does not link to the anchor. The network lanes halt instead when the contradiction is with *finalized* history, which no revert repairs, or when the same unfinalized contradiction comes back a third time before finality moves to another block, so two restarts did not repair it. The node then logs `verified finality contradicts the retained canonical chain; network lanes halt until the node restarts` at error level: readiness stays false, `network.supervisor` reports `stopped` with the contradiction as its last error, and nothing retries it. The API keeps serving what is stored. 1. Preserve the database and logs. Check the checkpoint provenance and the finality transports: a halt means the node followed another chain than the one consensus finalized and could not revert it, or a trust root is wrong. 2. If the error says `verified finality contradicts finalized canonical history`, finalized history in the store is wrong and no revert repairs it: rebuild in a new `data_dir`. 3. If it says the contradiction `recurred after 2 restarts of the network lanes`, restart the node once the finality transports check out: startup reverts the unfinalized blocks as above. If it halts the same way again, rebuild in a new `data_dir`. ### Storage pressure Inspect per-processor attribution with `db inspect` and `/metrics`. Prune change history only through `db prune-changes`, respecting active leases. Never evict rollback data required by unfinalized blocks. Add capacity or stop unfinalized advancement before the hard limit. If the database file stays at its high-water mark after pruning, check the startup log for the auto-vacuum warning, stop the node, and run `db compact` once. Retained recent frames are the reorg and replay input, so the node never drops an unfinalized one to make room. When they reach `budgets.recent_raw_hard_bytes`, live ingestion stops before the next block, live readiness drops, and the log reports `recent_storage_full`. Ingestion resumes once a finality advance prunes older frames. After 15 minutes at the limit the live lane fails, and the supervisor restarts the network lanes from a fresh finalized anchor, which lets finality prune again; the live stall timeout does not count this wait. A node that keeps reaching the limit needs working finality, or a hard limit above the `rpc.minimum_recent_blocks` window plus the unfinalized tail. A processor’s delivery log is pruned in the background by its `delivery.pruning` policy, oldest change first: finalized changes older than its window, and, while the log exceeds its byte limit or the processor is paused at it, older finalized changes whatever their age, never one a required consumer has not acknowledged. A block-local processor’s history and live blocks share its log, so a live change still inside the window can precede older history. Pruning by age stops at that change. Pruning at the limit does not, since the window of a paused processor does not move; a best-effort consumer that had not read the change gets `reset_required`. A paused processor resumes once the log is below 90 percent of its limit. Embedded subscriptions (`leani subscribe` without a node) prune the same way while they run, so their built-in processors keep within 64 MiB and 24 hours of changes. Retained raw history has its own `[raw_history]` budgets. A raw-history store over either of them, for example after lowering one, still opens and serves its segments, but admits no new segment. A job created with `segment.onLimit: pause` waits at the storage limit, with the budget named in `lastError`, and resumes once the node runs with a larger budget; one created with `fail` fails. ### Retained raw-history segment failure The node verifies each retained segment’s whole-file checksum the first time it reads the segment after starting, and each block’s record checksum on every read. At startup it only checks that each segment file exists with its closed length, and logs what it recovered. A segment that fails never stops the node: it leaves the catalog, so its blocks read as missing and RPC and backfills use another source, its file moves to `data_dir/raw-history/quarantine` with a `.corrupt` suffix, and the node logs a warning. A segment whose file is missing at startup leaves the catalog the same way. A closed file no catalog row claims, left by a crash before its publication committed, moves to the quarantine with an `.orphan` suffix. 1. Check the raw-history jobs: each job that owned the segment names it and its blocks in `lastError`. A running job acquires those blocks again, and a completed one returns to the queue and does too. A failed or cancelled job keeps the error it ended with. 2. Check the disk and filesystem before trusting the node with more writes: a corrupt segment usually means a failing disk. 3. The quarantine keeps at most 1 GiB, or one segment of `raw_history.maximum_segment_physical_bytes` when that is larger. Past that, the files quarantined longest ago are deleted first, at startup and after each new quarantine, but the newest is always kept. Copy a file elsewhere to keep it for inspection; delete the others whenever you like. ### Retained raw-history segments unavailable When more than half of the catalogued segment files are missing at startup, as when the volume holding `data_dir/raw-history/segments` is not mounted yet or a restore is still running, the node takes the directory as unavailable rather than emptied. It keeps every catalog row, logs a warning, and counts them as `unavailable_segments` in its startup recovery log. A segment file that disappears while the node runs is treated the same way. Reads of those segments fail and fall back to other sources, and the jobs that own them do not acquire them again. Do not create raw-history jobs until the directory is back: a new job drops the rows of the missing segments nothing owns, and may replace others with segments it acquires itself. 1. Mount or restore the directory, then restart the node: the segments whose rows were kept serve again. A returning file whose row a new job dropped meanwhile is quarantined as an orphan. 2. If the files are gone for good, delete every raw-history job that owns them, cancelling running ones first, then create each again with the same request. The new job skips a segment whose file is gone, removes its catalog row once nothing owns it, which also frees its share of the budgets, and acquires the blocks from its sources. ### Parked processor live lane A failure that belongs to one processor parks only that processor’s live lane; shared ingestion, finality, and every other processor continue. This holds for every processor mode and delivery ordering. `/v1/processors/{id}/status` reports the lane as `paused` or `failed`. `/v1/network/status` adds its `runState`, `pauseReason`, and `liveGap` (the first unapplied block), and `leani_processor_run_state` carries the state. A paused lane resumes by itself. A failed lane is frozen: it commits no live block, and finality does not advance it. It is still mapped for a reorg’s replacement blocks, only to move its first unapplied block onto the new branch. Its first failure stands: a later failure does not change its reason, and a later park does not move its first unapplied block. Only `processor_finality_conflict` replaces the reason. A failed lane waits for an operator: fix the cause, then call `POST /admin/v1/processors/{id}/lanes/live/reset` with the header `x-leani-request: 1`, which works for every delivery ordering and pauses the lane so that it replays from its first unapplied block. A lane that fails again on the same block parks again; it does not stop the node. A reorg never leaves a parked lane’s first unapplied block on a block the chain no longer has. A reorg that replaces blocks at or below it moves it down to the first replacement block, so the lane replays the whole new branch. A reorg without a replacement branch moves it onto the new tip. When the lane has applied that tip, a paused lane resumes at once, and a failed lane’s first unapplied block moves onto the new tip’s successor once that block arrives. If the lane never applied the new tip, such as the finalized anchor the node seeds after downtime, a paused block-local lane’s gap simply completes, while an ordered lane waits there for that block from history. A failed block-local lane keeps its first unapplied block on that tip, so after a reset it waits for a history source to serve it (`finalized_gap_waiting_for_history_source`), a block it does not need: make sure a history source can serve the finalized anchor, and the lane applies it and resumes by itself. A first unapplied block found off the canonical chain, as an earlier version could leave one, moves back to the last canonical block the lane applied; the lane then replays from there instead of skipping blocks or failing. | Reason | State | Resumes when | | --------------------------------------------------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `delivery_spool_hard_limit`, `physical_store_hard_limit`, `artifact_store_hard_limit`, `pending_delta_hard_limit` | paused | Consumers acknowledge or storage frees up. | | `unfinalized_gap_waiting_for_finality` | paused | Finality reaches the first unapplied block, which then comes from the history source. No retained frame can serve that block, for example because it was retained without this processor’s material. | | `finalized_gap_waiting_for_history_source`, `finalized_gap_recovery_unavailable`, `finalized_gap_recovery_incomplete` | paused | A history source can serve the finalized gap. | | `operator_reset_pending_replay` | paused | The replay after an operator reset reaches the live tip. | | `startup_reconciliation_replay` | paused | The replay of retained frames that [startup reconciliation](#crash-or-interrupted-commit) started reaches the live tip, normally before live blocks resume. | | `hot_cold_handoff_failed` | paused | The processor’s automatic cold backfill or its overlap verification failed; the handoff is recorded as failed. A block-local lane replays and resumes at once. An ordered lane resumes once a later backfill passes its gap. A start’s backfill runs only to the finalized head, so restart the node once `chainFinalizedHead` in `/v1/network/status` has reached the lane’s `liveGap`; an earlier restart leaves the lane paused. | | `processor_live_reduce_failed` | failed | Reset after fixing the processor or its input. Its reducer, or the store’s check of what the reducer wrote, rejected the block. | | `processor_live_mapping_failed` | failed | Reset after fixing the processor or its input. Mapping the block, or checking a pending delta’s finality variants, failed. | | `processor_live_delta_conflict` | failed | Investigate before resetting: a pending delta for an applied block carries different content, so the processor’s transform is not deterministic or its inputs differed. The applied block stands. Restart the node, whose [startup reconciliation](#crash-or-interrupted-commit) deletes that pending delta, then reset the lane. | | `single_block_exceeds_delivery_limit`, `single_delta_exceeds_pending_delta_limit`, `live_gap_marker_exceeds_pending_delta_budget` | failed | Reset after raising the limit. | | `live_gap_canonical_identity_changed` and the other `finalized_gap_recovery_*` reasons | failed | Reset after checking the history source against the canonical chain. For an ordered lane, `finalized_gap_recovery_canonical_mismatch` can also mean that the block history returned does not descend from the lane’s own last applied block, which is then off the canonical chain: restart the node, whose [startup reconciliation](#crash-or-interrupted-commit) undoes an unfinalized off-chain block, then reset. The lane then waits in `operator_reset_pending_replay` until the automatic cold backfill of the next start fills the undone heights, so restart the node once more; an on-demand processor waits for a backfill request instead. A finalized off-chain block needs a rebuild. | | `processor_finality_conflict` | failed | Rebuild the processor as a replacement instance; the reset route refuses this lane with `409 live_lane_requires_rebuild`. The same instance cannot be rebuilt in place today: configure a replacement instance, with a new processor version or configuration, and move to it as in [Processor rebuild or rollback](#processor-rebuild-or-rollback). Its coverage holds a finalized block hash at another height, or another block at a finalized height, so it contradicts the canonical chain, and finality stops advancing it. This reason replaces any earlier failure reason. | ### Crash or interrupted commit A live block commits in steps: the node first retains its frame as the new canonical block, then each processor applies it in a transaction of its own. A reorg likewise switches the canonical chain first and then undoes each processor’s reverted blocks. When an apply reaches a processor’s delivery limit, the store pauses or fails the lane first and the runtime then records its first unapplied block. A crash, a kill, the embedded subscription runtime’s shutdown abort, or a network-lane restart can stop between those steps. That leaves a processor behind the canonical chain or on a reverted branch, a pending delta that nothing applies, or a stopped lane with no record of where it stopped. Every network-lane start therefore runs startup reconciliation for each processor before any lane opens: 1. It undoes the processor’s unfinalized blocks that are not the canonical block at their height, newest first, and publishes their undo changes as the reorg would have. 2. It deletes pending deltas the processor can never apply: those below its start, for a block that is not canonical, and for a block it already applied. For a block-local processor that includes any below its first unapplied block, such as one an interrupted cold-backfill commit left; the backfill maps that block again. 3. It pauses a running lane that trails the retained canonical frames at its first unapplied one, with reason `startup_reconciliation_replay`, and replays those frames through the normal gap path before live blocks resume. A lane that has applied nothing yet, such as a newly configured block-local processor, replays the retained frames too. A block-local lane whose next block falls in a hole in the retained frames, such as blocks never retained over downtime, replays from the first retained frame above the hole; its cold backfill covers the hole. 4. A lane the store paused or failed at its delivery limit, but whose first unapplied block was never recorded, gets that block recorded and keeps its state and reason. A paused lane replays from there once consumers acknowledge and delivery capacity frees up, instead of skipping the blocks it missed, and a failed lane can be reset. The recorded block carries no required delivery size, so for `single_block_exceeds_delivery_limit` the reset route cannot refuse a limit that is still too small; the replay then fails the lane again on the same block. The store can also pause or fail a lane at its delivery limit while the lane is at the live tip, for example in its cold backfill’s commit on the lane’s live stream. That records no first unapplied block either, and at a restart reconciliation has no retained block to record yet. The live lane handles it with its next block: a paused lane commits that block as usual, so the store’s refusal parks the lane there, or applies it once capacity has freed up. A failed lane records that block, which a block-local lane has not applied or which follows an ordered lane’s last applied block, so a reset replays from there. A failed ordered lane still behind its history records nothing, and its history cannot apply while it is failed. Startup reconciliation records its first unapplied block, the one after its cursor, only while that block is among the retained frames. Once finality has pruned it, nothing records it: the reset route refuses the lane with `400 invalid_request`, since it has no durable live gap, and only rebuilding the processor as a replacement instance recovers it, as in [Processor rebuild or rollback](#processor-rebuild-or-rollback). A paused or failed lane whose first unapplied block is already recorded replays from there as usual, and a lane failed for another reason, such as `processor_finality_conflict`, is left alone. Reconciliation replays nothing below the retained frames. A processor’s automatic cold backfill fills those blocks up to the finalized anchor; an on-demand processor waits for a backfill request. Before its live lane applies a block past those blocks, an on-demand block-local processor logs “the live lane skips blocks this processor never processed” at warn level, with `from_block`, `to_block`, and `announced`, and its live stream announces the range in a `system.live_gap.put` change for the application to request. A startup replay from the first retained frame above a hole announces it the same way. A processor with `[processors.live_gap_fill]` (see [Live gap fill](/docs/operations/configuration-guide/#live-gap-fill)) fills a range of at most its `max_blocks` from history first, before it applies that block. The lane logs `filling the blocks the live lane skips from history` at info level, with `from_block`, `to_block`, and `blocks`, and `filled the blocks the live lane skipped` when it is done, with `applied`, `duplicates` (blocks a history subscription had applied), and `elapsed_ms`. Every live lane waits while a fill runs, at most five minutes plus applying the blocks of its last request: a request still running at five minutes is given up. `elapsed_ms` is how long the node held all of them. A longer range logs `the live lane skips more blocks than live_gap_fill.max_blocks; announcing them` at info level, and announces as above. A fill that cannot start or finish, because no history source serves the range, the range is not finalized yet, a source fails or serves a block that does not link, or the time is up, logs `could not fill the blocks the live lane skips; announcing the rest` at warn level, with `filled_blocks` and the `reason`. The stream then announces from the first block it did not fill, and the warning above follows. A lane that reaches a delivery or storage limit mid-fill stops there. While the store would refuse its next block, at the stream’s delivery limit, at a node-wide `[budgets.delivery]` or `[budgets.store]` budget, or at a storage limit while storage stays above its low-water mark, the lane fetches no history. When finality prunes the frame of the block after the range during a long hold, the lane recovers that block from history once the store would take it, as any paused lane recovers its first unapplied block. After a restart of the live lanes, a lane held at a node-wide budget can fetch once more before it waits again. Either way it reports `paused` with that reason (see [Parked processor live lane](#parked-processor-live-lane)), announces nothing, and continues the fill once the store would take the block: once consumers acknowledge and pruning makes room in its stream or in the node-wide budget, or once storage frees up. A single filled block larger than the stream’s `max_bytes` fails the lane with `single_block_exceeds_delivery_limit`, as an equally large live block would: raise `max_bytes` or remove the table, then reset the lane. A fill also makes a pause at a delivery or storage limit more likely, and a held block’s pending delta counts against the shared `[budgets] pending_delta_bytes`. When that budget cannot take it, the lane fails with `live_gap_marker_exceeds_pending_delta_budget`: raise the budget, then reset the lane. Each processor that needed a repair logs one warning, “startup reconciliation repaired processor state against the canonical chain”, with the fields `undone_blocks`, `highest_undone_block`, `discarded_pending_deltas`, and `replay_from_block`. The info line “startup reconciliation completed” then reports, per processor, the blocks applied and reverted and the pending deltas left. A consistent store is left untouched, so the warning appears only after an interruption or for a lane that trails the retained frames. No operator action is needed. ### SQLite failure Stop writers, run `db verify`, preserve the database and WAL for diagnosis, and restore a previously verified backup into a new path. Do not run a destructive downgrade or hand-edit schema metadata. ### Expired stream cursor The API returns `410 cursor_expired` or a terminal `reset_required` SSE event. Query a fresh snapshot, atomically replace consumer state, then resume from the returned retained cursor. ### Processor rebuild or rollback Processor code/config identities create separate immutable instances. Backfill the replacement instance in parallel, compare coverage and outputs, then move consumers. Rollback selects the prior binary/store pair or restores its backup; it never mutates a newer instance in place. The old instance’s backfill subscriptions do not move. Their retained records count against `[budgets.delivery] maximum_history_retained_bytes` until they are deleted, and once the node no longer configures the old instance, their stream and acknowledgement routes refuse (normally `404 not_found`), so their consumers can neither read nor acknowledge them. Settle them around the switch: 1. Before the configuration drops the old instance, let each of its history subscriptions finish, with its consumer acknowledging the `backfill_complete` record, or cancel it. Delete each once its consumer has acknowledged what it was delivered. 2. After the node restarts without the old instance, list the subscriptions with `GET /admin/v1/backfill-subscriptions`: `processorConfigured: false` marks those of an instance the node does not configure. That can be temporary, as when a restart’s configuration leaves an instance out by mistake: configure it again instead. If the old instance will not return, cancel each of its subscriptions with `POST /admin/v1/backfill-subscriptions/{id}/cancel` and delete it with `DELETE /admin/v1/backfill-subscriptions/{id}?discardUnacknowledged=true`, which discards its unacknowledged records. Both requests need the header `x-leani-request: 1`. The SDK’s backfill client makes the same calls with `list()`, `cancel(id)`, and `delete(id, { discardUnacknowledged: true })`. A store upgrades to the binary’s schema on the first start that opens it, and the upgrade cannot be undone. A start that the store refuses for a processor under an existing instance ID (`processor instance … conflicts with its stored descriptor`) refuses before that upgrade, so the store stays usable by the binary that wrote it. Store migrations are forward only: rolling an upgraded store back means restoring the backup taken before its upgrade. # Trust and threat model > Identify the assets, trust boundaries, controls, and residual risks of a Leani deployment. ## Protected assets * canonical processor state and its undo history; * finality/checkpoint provenance; * API credentials and source URLs; * host memory, disk, file descriptors, and outbound bandwidth; * durable consumer cursors and sink delivery state. ## Trust boundaries `[confirmation]` endpoints are trusted for one judgement: that Ethereum’s Fast Confirmation Rule confirmed a beacon root. Their events count only for roots this node verified as attested with at least 384 of 512 sync-committee signers, and only while it holds that block canonical, so a wrong endpoint can at worst label as `confirmed` a block the node already follows as attested. They cannot add blocks, change data, or move `attested` or `finalized`. `/v1/network/status` lists them and their state under `network.confirmation`. Public datasets, Beacon/HTTP endpoints, and consensus P2P peers are untrusted transports. A source descriptor declares which completeness claims are dataset-trusted and which commitments were cryptographically verified. Execution P2P peers are Byzantine. Processor input requirements reject missing, partial, or failed material before mapping. The native API and JSON-RPC endpoints accept hostile input. SQLite and the configured data directory are trusted local state. No dynamic native plugins are loaded. Statically linked native processors are fully trusted code: they run in the node process with its CPU, memory, filesystem, and network privileges. Their descriptors constrain data selection and retention but are not a sandbox or a security boundary. Only build processor crates from reviewed source. Wasm processors are the boundary for logic the operator does not fully trust: a module runs in a sandboxed interpreter, without access to the node’s memory, files, network, clock, or randomness, and reaches the node only through the `leani` host ABI. Within its limits it can still spend CPU, memory, and storage, publish wrong output under its own instance, and stall that instance’s lane by failing. ## Controls * strict TOML with unknown-field rejection and localhost defaults; * explicit source capabilities, trust, range, and byte/concurrency budgets; * checksummed, path-safe local archive objects; * block/header/transaction/receipt commitment checks on P2P material; * local checkpoint, sync-committee, BLS, finality-branch, and execution-payload proof verification for both finality transports; * attested blocks anchored to attested heads: within each slot, the finality source verifies a light-client optimistic update, signed by at least 342 of the 512 sync-committee members, and its execution branch. Execution P2P requests the attested header and the header chain below it by hash, down from the attested hash; a peer that serves another header for a requested hash is banned; * unattested blocks checked before any attestation: at least two peers serve the same header, it passes reth’s consensus header rules and Leani’s slot rules on the source’s chain spec, it links to the delivered tip, and it is at most two slots past the newest attested head. A block whose header fails a rule waits for an attested head; no peer is penalised for it. Only the finality source can publish attested heads; the execution source only reads them. Only anchored headers earn peer rewards or clear withheld-header strikes, and only a mismatch anchored that way can reset the live lane; * hash-checked finality: a finalized block must be the retained canonical block at its height, only retained blocks that link to it are promoted, and a processor’s coverage at that height must hold its hash, or another block’s coverage there fails the processor’s lane. Neither chain is finalized on a contradiction. One with retained unfinalized blocks restarts the network lanes; one with finalized history, or the same one recurring a third time before finality moves on, halts them. Every start undoes, as a reorg, retained unfinalized blocks that neither link to the verified finalized anchor nor are proven to be its ancestors. Where parent links do not reach the anchor, execution headers from peers, hash-linked down from it, decide which retained unfinalized blocks are its ancestors, and those are kept and finalized. Peers can delay that proof, and a start that does not complete it within a minute undoes the blocks, but they cannot forge it; * atomic processor state, undo, coverage, change-log, and outbox commits; * opaque checksummed cursors bound to store, chain, processor, and version; * bounded API pages, request bodies, SSE batches, and source queues; * bounded JSON-RPC work: at most 100 calls per batch, 16 MiB per response, 10,000 `eth_getLogs` results, 1,000 filter addresses and topic alternatives, 128 subscriptions per WebSocket connection, and 256 connections, each configurable; * browser isolation for loopback listeners: the native API answers a `Host` that is an IP address, `localhost`, or a name in `api.allowed_hosts` (421 otherwise), so a page that points its own name at 127.0.0.1 is refused; both listeners refuse a browser `Origin` that is neither loopback nor allowed (403), on streams and WebSocket upgrades too; the native API also refuses a GET or HEAD that another site’s page sends without an `Origin` other than as a navigation, such as an image load, when the browser marks it with Fetch Metadata (403); mutations need a JSON body or `x-leani-request: 1`, and JSON-RPC calls `application/json` (415 otherwise), which a cross-site page cannot send without a preflight the node never grants; only POST creates query snapshots; and a consumer’s live or backfill stream route refuses any request that Fetch Metadata marks as cross-site or same-site without an allowed `Origin`, navigations into frames and tabs included (403); * a native API bind beyond loopback requires a bearer token, and a JSON-RPC bind beyond loopback an explicit opt-in; startup rejects tokens shorter than 16 characters or other than printable ASCII without spaces, tokens are compared in constant time, and CLI help never prints the values of `LEANI_API_TOKEN` or `LEANI_CHECKPOINT_URLS`; * optional bearer authentication with redacted debug output; * per-consumer credentials: a consumer created with one needs it on every consumer-scoped delivery route, streams included, besides any bearer token (403 otherwise); it is compared in constant time, stored as a BLAKE3 hash keyed with a random per-store secret, scoped to that processor instance, stream, and consumer identity, and a new one holds at least 32 printable ASCII characters. A backfill subscription’s credential also enters the subscription’s idempotency identity, an unkeyed BLAKE3 hash of the whole request. Credentials isolate applications on the delivery routes only: listing, inspecting, and revoking a consumer are administrative operations that only the bearer token protects; * consumer session tokens authenticated by a BLAKE3 MAC keyed with the per-store secret, which is drawn once from the operating system’s random source and never leaves the store; * acknowledgements bounded by what each consumer was delivered, by a page read or a stream batch, and on live streams by block boundaries; the generic consumer routes refuse consumers of split live streams, whose sessions fence renewal and acknowledgement; * no CORS layer; administrative routes share the native API listener and its bearer authentication, so binding it beyond localhost exposes those routes as well; * Wasm processors: the node refuses any import outside the `leani` ABI, runs every call in a fresh wasmi instance metered by fuel, and bounds its memory, table, values, changes, and host calls; an optional `blake3` pin refuses other module bytes. Ad-hoc runs at `/admin/v1/wasm/runs` take modules of at most 4 MiB with a quarter of the default fuel, two at a time, and reduce into a throwaway store; * non-root, read-only container profile with all capabilities dropped; * fail-closed unsupported RPC responses instead of synthesized partial state. ## Residual risks * `trusted_dataset` sources can omit predicate-matching rows without a cryptographic completeness proof; * under a Nitro sequencer feed, `sources.live.trust = "trusted_dataset"` takes the blocks the live lane makes from the relay’s messages unchecked. The sequencer’s signature binds each block’s hash but not where a message’s fields end, so a relay can change their transactions, and they can lack the retry a contract’s call to `ArbRetryableTx` adds; * event-derived ERC-20 balances do not model rebases or non-standard hidden balance changes; * processor changes, off unless `api.allow_processor_changes = true`, let a client the API admits run Wasm modules it sends, in the sandbox and limits of configured ones, and keep them across restarts; set `api.bearer_token_env` before the API serves anyone else; * node-side Wasm builds, off unless `api.allow_wasm_builds = true`, run the host’s compilers on posted source. Rust’s compiler reads files the source names, and only a denylist guards against that, so Rust builds only for requests from the node’s own machine; TypeScript builds, for any client the API admits, run the pinned AssemblyScript compiler on hostile input. Leave builds off where clients are not trusted; * the Beacon API finality profile still depends on configured transports even though proofs are checked locally; * `attested` rests on the sync committee: at least two thirds of it signing a header that is not on the canonical chain would make that header an attested head. An attested head is not final, so honest reorgs still remove attested blocks; a peer that follows another branch lacks the attested block and is cooled down, not banned. Attested heads need no agreement between Beacon endpoints, since each carries the committee’s signature; two different ones at one slot are ignored; * `unattested` blocks can be forged only by two colluding peers whose block satisfies every header rule, and only for two slots: an attested head on another block, or 60 s without one, undoes them. They can also be undone honestly, when the network orphans a late payload; see [finality levels](/docs/concepts/coverage-finality-and-reorgs/#finality-levels-and-publish-modes); * live following at `attested` adds one to two slots of latency, and stops, reporting not ready, while the finality source verifies no attested head; unattested delivery waits too once the newest attested head is more than two slots old; * the embedded CLI no longer prints unverified peer previews; * native consensus and execution P2P peer availability can prevent timely progress, and a stale or incorrectly sourced weak-subjectivity checkpoint can select the wrong consensus history; * bearer tokens do not provide transport encryption; * two kinds of browser GET still reach the native API without the bearer token: navigations from another site’s page to routes other than consumer streams, including into a frame, and subresource loads that carry no Fetch Metadata. Browsers send Fetch Metadata only to potentially trustworthy URLs, which are HTTPS, loopback addresses, and `localhost`, so a node reached over plain HTTP by another name or address, such as a LAN IP with `allow_unauthenticated_remote`, gets none from current browsers either. The page cannot read either response, and neither creates a query snapshot. Without Fetch Metadata, such a GET, a navigation included, can still open the live or backfill stream of a consumer without a credential and take its session lease, which locks the consumer out while the connection stays open. A bearer token, or the consumer’s own credential, prevents it, since a browser adds neither on its own. Consumers declared in the node configuration have no credential. `allow_unauthenticated_remote` and the `allowed_hosts` and `allowed_origins` lists widen what reaches a listener; keep them to what clients need; * consumer credentials do not guard the administrative routes: whoever holds the bearer token, or any client that reaches the API when none is configured, can list, inspect, and revoke every consumer, as it can reset a live lane; * the per-store secret lives in the store: anyone who can read the database or one of its backups can test guesses of consumer credentials offline and make session tokens, and a backfill subscription’s idempotency identity, an unkeyed hash of its request, lets them test guesses of that subscription’s credential without the secret. Credentials created before the 32-character minimum keep working until their consumer is re-created; * a malicious or compromised native processor can exhaust resources, disclose node secrets, corrupt process memory through unsafe dependencies, or emit plausible but false output; * resource limits reduce denial-of-service impact but do not replace an edge proxy for public internet deployment. Production exposure requires TLS, independent finality transports, filesystem quotas, monitoring, backups, and a completed fault-injected soak. # Verify a release > Check Leani archives, container images, SBOMs, and packages against their published checksums and build provenance before deploying them. Each release is built once from a tagged commit and published without being rebuilt. Check what you download against that build before deploying it. ## Release archives The [GitHub release](https://github.com/smart-byte/leani/releases) carries the native archives, `SHA256SUMS`, the CycloneDX SBOMs including the node’s `leani.cdx.json`, and the `THIRD_PARTY_LICENSES.txt` dependency notices. Check a downloaded archive against the checksum list and its build provenance: ```bash sha256sum --check --ignore-missing SHA256SUMS gh attestation verify leani-v0.1.0-x86_64-unknown-linux-gnu.tar.gz --repo smart-byte/leani ``` The attestation names the release tag, its commit, and the publication run, which checked that the archive came from a successful preparation run of that commit. ## Container images Pin a release’s image digest for deployment. The publication job attests the multiarchitecture image and each architecture’s image. It binds each architecture’s CycloneDX SBOM to that image’s digest instead of attaching it to the GitHub release, so the SBOM can be verified against the exact image. The attestations are stored with the images in GHCR as well: ```bash gh attestation verify oci://ghcr.io/smart-byte/leani:v0.1.0 --repo smart-byte/leani gh attestation verify oci://ghcr.io/smart-byte/leani@sha256: --repo smart-byte/leani gh attestation verify oci://ghcr.io/smart-byte/leani@sha256: \ --repo smart-byte/leani --predicate-type https://cyclonedx.org/bom ``` ## Packages `@smart-byte/leani-sdk` is published to npm with provenance from the repository’s `sdk-release.yml` workflow; `npm audit signatures` checks it in a project that installed it. The four Rust authoring libraries are published to crates.io through trusted publishing from `crates-release.yml`. ## Release channels Prerelease versions are marked as GitHub prereleases and do not replace the latest stable release. Until the first stable release, each SDK prerelease takes npm’s `latest` tag, so an unversioned install resolves to the newest prerelease. From the first stable release on, stable versions take `latest` and prereleases take `next`. Homebrew’s `smart-byte/tap/leani` follows the same rule as `latest`, and `smart-byte/tap/leani-rc` follows every release, release candidates included. The release coordinator opens a reviewed tap PR once a release’s archives are public.