Skip to content

feat(archive): add state archive prototype implementation - #54

Draft
bladehan1 wants to merge 159 commits into
feature/archive_compare_basefrom
feature/archive_block2
Draft

feat(archive): add state archive prototype implementation#54
bladehan1 wants to merge 159 commits into
feature/archive_compare_basefrom
feature/archive_block2

Conversation

@bladehan1

@bladehan1 bladehan1 commented Sep 11, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

Adds the current State Archive, PathState, state-root, Chainbase RocksDB, recovery, serving-index, and observability implementation to the origin/develop-based comparison branch. The branch history was rebuilt so the 18 local .helper governance files are not tracked or present in Git history.

Why are these changes required?

This provides a reviewable comparison point for the State Archive prototype while keeping local execution governance and evidence files outside the product branch.

This PR has been tested by:

  • sh .helper/ai-archive/execution/scripts/check_workspace.sh
  • python3 .helper/ai-archive/execution/scripts/check_workspace_links.py --all
  • git diff --check
  • Verified git rev-list HEAD -- .helper returns zero

Follow up

Complete the remaining prototype review, recovery, serving-worker, performance, capacity, and production-operation gates under the local State Archive execution contracts.

Extra details

This Draft PR targets feature/archive_compare_base, which was created from origin/develop. Repository workflows filtered to develop, master, or release_* are therefore not selected by this base branch; GitHub may still run generic pull-request-target review automation.


Summary by cubic

Adds the opt-in State Archive prototype on feature/archive_compare_base, cut from origin/develop. It's off by default, so existing current-store execution keeps its behavior.

State Archive

  • Historical VM execution runs from request-owned archive snapshots, fails closed for CREATE, CREATE2, SELFDESTRUCT, and non-allowlisted precompiles, and supports bounded historical range and account-balance reads.
  • chainbase adds durable checkpoint WAL history, restart recovery with H/C/D/R progress authorities, engine-identity snapshot leases, partitioned history body lanes for account, storage-row, account-asset, and delegation, an exact-27 serving-key index, and an async archive writer sink.
  • Archive startup fails closed before normal producers when the base or authority set is incomplete, and exposes startup diagnostics.

Path state and tooling

  • Adds an experimental path-state trie with a non-consensus block state root, startup rebuild, P66 migration, reorg rewind, and bounded-memory parallel rebuilds.
  • Adds offline block replay and resumable HTTP export tools for archive comparison.
  • build.gradle allows RocksDB version pinning and a Java 17 override; the 18 local .helper governance files are intentionally untracked.

Written for commit 59fb272. Summary will update on new commits.

Review in cubic

bladehan1 added 30 commits July 17, 2026 14:54
Capture canonical block metadata and materialize reverse diffs from completed block snapshots. Classify archive state stores explicitly and project account-asset companion mutations before root merge.
Add deterministic history body and index records, ordered durable commit markers, and bounded asynchronous persistence.

Gate checkpoint advancement on committed archive history and cover crash, corruption, backpressure, and reorg behavior.
Persist reverse state history with bounded append-only body, index, and commit structures. Wire an opt-in archive writer into snapshot flush and add restart-safe account change indexing. Expose an experimental historical account balance endpoint for trace comparison.
Persist bounded restart checkpoints, truncation recovery, H/C/D/R progress authorities, and immutable serving generations. Pin committed history resources and fail closed on identity or durability drift.
Add durable engine identities and native LevelDB/RocksDB snapshot leases. Assemble exact Store generations under the SnapshotManager barrier and release partial acquisitions on authority drift.
Apply business mutations with participant progress in native sync batches. Freshly validate H/C/D authorities under the archive barrier and advance reader visibility only after exact convergence.
Unify LevelDB and RocksDB participants behind one recovery contract. Persist canonical mutation plans and bind checkpoint, participant, and reader progress to the same digest.
Collect exact ordinary and AccountAsset post-state without Store scans. Enforce target identity, bounded ownership, one-shot sealing, abort, and terminal payload release.
Drive an exact-27 capture batch through mixed native participants, inject a partial apply failure, and verify durable-plan replay, digest propagation, ownership, and restart convergence.
Apply two capture-produced targets through exact-27 participants. Verify per-target plan digests, overwrite and delete semantics, partial replay boundaries, reader publication, and restart convergence.
Prepare one target-bound Account and AccountAsset projection before snapshot merge, retain its forward payload through the revoking lifecycle, and seal it only against durable history markers.

Keep the integration default-off and preserve the existing proposal 66 physical layout.
Classify ABI as mutable auxiliary metadata outside the versioned state participant set while retaining an explicit tombstone classification.
Exercise proposal-bound projection, layer-to-flush ownership, durable marker sealing, retry and reorg boundaries, exact participant coverage, and ABI exclusion.
Expose durable marker receipt creation through direct and asynchronous history sinks, then gate forward payload sealing on the exact committed flush range.

Retain submitted frozen ranges across durability or receipt failures so retries do not resubmit history.
Verify direct and asynchronous receipt authority, disabled behavior, and retry ordering across durable wait and receipt failures without duplicate history submission.
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Simplify common path state preparation and fail stop on required artifact errors. Append finalized history before checkpoint flush while retaining common publication authority.

Preserve published durability markers during startup recovery and retain frame locations instead of all history payloads to avoid archive reopen heap exhaustion.
Reuse prepared encoded nodes when rebasing retained PathState snapshots and preserve root checks and native read accounting. Add finalized archive append timing and checkpoint continuation coverage.
Expose explicit block-final stages with lightweight session commit. Sample account node reads, hash verification, decoding and native reads behind an opt-in flag, and export prepared-attempt metrics with bounded labels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant