Skip to content

[CompactSealedState] Add import-compact-execution-state-to-storehouse util - #8699

Draft
zhangchiqing wants to merge 1 commit into
leo/8665-t2-compact-execution-statefrom
leo/8665-import-compact-execution-state-to-storehouse
Draft

[CompactSealedState] Add import-compact-execution-state-to-storehouse util#8699
zhangchiqing wants to merge 1 commit into
leo/8665-t2-compact-execution-statefrom
leo/8665-import-compact-execution-state-to-storehouse

Conversation

@zhangchiqing

@zhangchiqing zhangchiqing commented Sep 11, 2026

Copy link
Copy Markdown
Member

Part of #8665. Stacked on #8673 (T2).

Problem

Bootstrapping a storehouse (payloadless) register store requires indexing registers from the root block to the latest height, which takes days on a long-running execution node. ImportRegistersFromCheckpoint can seed the storehouse from a single-trie checkpoint, and compact-execution-state produces exactly that — a checkpoint at the last sealed and executed block. However, the EN's own startup import is hardwired to root.checkpoint at the sealed root height, so there was no way to seed the register store from the compacted checkpoint.

Changes

New util import-compact-execution-state-to-storehouse (cmd/util/cmd/import-compact-execution-state-to-storehouse), registered in cmd/util/cmd/root.go.

It requires the EN to be stopped and the execution state to be in the Compacted Sealed State, then:

  1. Resolves the last finalized and executed block and its state commitment C, mirroring ExecutionState.GetHighestFinalizedExecuted: the executed-block pointer capped by the finalized head, with the commit read from the commits store.
  2. Verifies the highest-numbered checkpoint in --execution-state-dir is a compacted single-trie checkpoint whose root hash equals C (wal.CheckpointHasSingleRootHash).
  3. Verifies --register-dir does not exist or is empty, and that the register store has not been bootstrapped.
  4. Imports the checkpoint registers with 16 workers via bootstrap.ImportRegistersFromCheckpoint, which sets the register store's first and latest heights to the resolved height.

After that the node starts with storehouse enabled, skips its own root-checkpoint import, and resumes execution at height + 1, indexing forward only.

Verification

  • go build ./cmd/util/cmd/..., go vet, gofmt clean.
  • Smoke test: built cmd/util and ran import-compact-execution-state-to-storehouse --help.
  • End-to-end import needs a real Compacted Sealed State, protocol DB and empty register store, so it was not run here.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

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.

@zhangchiqing
zhangchiqing added this pull request to stack #8672 September 11, 2026 22:50
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