feat(archive): add state archive with historical query serving
What does this PR do?
Introduces the state archive feature: append-file state archive with catalog serving, geth-style archive index, checkpoint-bound recovery, path-state snapshot pipeline, historical query RPC/VM context wiring, and related performance and metrics attribution work. Rebuilt as a fully GPG-signed (Verified) history from feature/archive_block2; content is tree-identical to that branch.
Why are these changes required?
Provides bounded historical state storage and point-query serving for archive data, with recovery semantics aligned to checkpoints.
This PR has been tested by:
- Unit Tests
- Manual Testing
Follow up
Extra details
174 commits, all GPG signed. Branch is based on an older develop point and shows divergence from current develop; reconcile (merge/rebase) before merge if required.
Summary by cubic
Adds an opt-in state archive that persists bounded historical state and serves exact point-in-time and range queries, enabling historical RPC and VM execution without changing current chain processing.
- Stores append-only history body, index, and commit records with checkpoint-bound crash recovery and WAL validation, recovering truncation and restart authorities on boot; checkpoint generation and retained scans are bounded.
- Publishes immutable serving generations with an incremental exact-27 serving index and a bounded range index from committed history.
- Acquires native LevelDB/RocksDB snapshot leases and engine identities, with request-owned historical read sessions that fail closed.
- Rebuilds a non-consensus path-state root on startup, tracks it through blocks and reorgs, and publishes it in block headers; the rebuild is streamed, parallelized, and memory-bounded.
- Raises path-state native-store defaults to a 2GiB giant block cache with raised memtable and target-file sizes per tier, and a 1GiB L1 resident node cache; shard bits remain configurable per deployment. Adds Prometheus counters for L1 resident cache access, archive database on-disk size, and a config-gated repeat-read distance trace for diff-layer absorption sizing.
- Adds per-batch checkpoint consolidation behind the default-off
perBatchSyncflag: sync barriers make the batch's target writes durable (with WAL barrier support adapted for RocksDB 5.15.10 on x86 and for TxCacheDB and PathState stores), the shared checkpoint prunes to the latest crash-redo record, and startup recovery redoes it idempotently; path-state consolidation barriers run in parallel. - Historical VM execution rejects state-changing opcodes and unsupported precompiles via
HistoricalExecutionGuard, with fail-closed fork gates, deadline-bounded pairing checks, and TRC10 balance resolution at the queried state. - Adds offline block replay, resumable HTTP export, archive startup diagnostics, and a proposal for the TVM storage optimization.
- Fixes archive CI regressions, including a
rocksdbVersionbuild property for pinned validation candidates, isolated shared VM request configuration, legacy tail cache retirement, and archive default and smoke-test alignment. - Archive is default-off; existing nodes need no migration.