Skip to content

fix(statedb): correct rebase artifact boundaries#3974

Merged
jolestar merged 2 commits intomainfrom
fix/statedb-rebase-artifact-cutover
Mar 21, 2026
Merged

fix(statedb): correct rebase artifact boundaries#3974
jolestar merged 2 commits intomainfrom
fix/statedb-rebase-artifact-cutover

Conversation

@jolestar
Copy link
Contributor

Summary

  • add explicit end-of-object markers to the rebase artifact so paged parent objects rebuild correctly
  • capture sequencer_info at export start so artifact cutover metadata is not taken after traversal finishes
  • strengthen the roundtrip test to force paging/chunking and exercise the object-boundary case
  • keep the design note aligned with the in-tree rebase implementation status

Testing

  • cargo fmt --all
  • cargo test -p rooch test_rebase_export_and_build_roundtrip -- --nocapture

Notes

  • This PR fixes correctness issues in the current artifact/export-build flow.
  • It does not claim fresh-build continuation is complete yet; tx accumulator and minimal tx-history dependencies still need a follow-up pass.

@jolestar jolestar requested a review from Mine77 as a code owner March 19, 2026 10:15
Copilot AI review requested due to automatic review settings March 19, 2026 10:15
@vercel
Copy link

vercel bot commented Mar 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rooch-portal-v2.1 Ready Ready Preview, Comment Mar 20, 2026 2:41am
test-portal Ready Ready Preview, Comment Mar 20, 2026 2:41am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
rooch Ignored Ignored Preview Mar 20, 2026 2:41am

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes correctness issues in the statedb rebase artifact export/build flow by introducing explicit object-boundary markers and switching the artifact payload from JSONL to typed BCS chunks, ensuring paged objects rebuild deterministically.

Changes:

  • Export now writes BCS chunk files with explicit EndOfObject records to disambiguate paged object boundaries.
  • Build now reconstructs a fresh output DB from the artifact (no input-store checkpointing) and restores genesis_info + sequencer_info from artifact metadata.
  • Roundtrip test is strengthened to force paging and chunk splits to exercise boundary handling.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
docs/dev-guide/mainnet_active_state_rebase_redesign_20260313.md Updates the design note with the current in-tree implementation status for rebase export/build.
crates/rooch/src/commands/statedb/commands/rebase.rs Implements the v2 BCS-chunk artifact format with end-of-object markers, metadata capture, fresh-build behavior, and stronger roundtrip testing.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +220 to +224
The first refactor slice now exists in-tree:

- `rebase-export` writes typed BCS chunks instead of JSONL string records
- `rebase-build` creates a fresh output DB from the artifact instead of checkpoint-forking the full input store
- artifact metadata now carries `genesis_info` and `sequencer_info`
Comment on lines +338 to +341
let genesis_info: moveos_types::genesis_info::GenesisInfo =
bcs::from_bytes(&fs::read(self.artifact_dir.join(&manifest.genesis_file))?)?;
let sequencer_info: rooch_types::sequencer::SequencerInfo =
bcs::from_bytes(&fs::read(self.artifact_dir.join(&manifest.sequencer_file))?)?;
Comment on lines +349 to +352
for chunk_file in &manifest.chunk_files {
let chunk: RebaseObjectChunk =
bcs::from_bytes(&fs::read(self.artifact_dir.join(chunk_file))?)?;
for record in chunk.records {
@jolestar
Copy link
Contributor Author

Addressed the current Copilot comments:

  • validated artifact paths from the manifest so chunk_files, genesis_file, and sequencer_file must remain under the expected objects/ or meta/ subdirectories
  • refreshed the design note so section 6 reflects the current BCS chunk layout instead of the older NDJSON proposal
  • reran cargo fmt --all and cargo test -p rooch test_rebase_export_and_build_roundtrip -- --nocapture

The remaining known gap is still fresh-build continuation dependencies (tx_accumulator + minimal tx-history metadata), which is intentionally left for follow-up.

@jolestar jolestar merged commit 6023071 into main Mar 21, 2026
20 of 28 checks passed
@jolestar jolestar deleted the fix/statedb-rebase-artifact-cutover branch March 21, 2026 09:02
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.

2 participants