Uh oh!
There was an error while loading. Please reload this page.
test: unit tests for state migrations - #6486
Conversation
WalkthroughThreads a new StateLookupPolicy through state resolution and execution paths; makes DB loading async with an optional chain/actor-bundle parameter; refactors state compute/validate helpers to return/use a next-tipset for runtime verification; updates call sites, tooling, CI, docs, and tests. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Caller (RPC / Dev / Sync)
participant Validator as Validation / Command Layer
participant StateMgr as State Manager
participant Snapshot as Snapshot / ActorBundle Loader
Caller->>Validator: request state/read/validation (tipset)
Validator->>StateMgr: tipset_state(tipset, state_lookup)
alt StateLookupPolicy::Enabled
StateMgr->>StateMgr: attempt fast-path using next-tipset (ts_next)
StateMgr-->>Validator: return state_root / receipts from next-tipset
else StateLookupPolicy::Disabled
StateMgr->>Snapshot: ensure snapshots / actor bundles loaded
Snapshot-->>StateMgr: snapshots and bundles ready
StateMgr->>StateMgr: compute state for tipset (apply messages, use ts and ts_next)
StateMgr-->>Validator: return computed state_root / receipts
end
Validator-->>Caller: result (state / validation)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly Related PRs
Suggested Reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
LesnyRumcajs
commented
Jan 27, 2026
no green checkmark, no review! |
6344888 to
bb4f6a8Comparebb4f6a8 to
fecb541CompareUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@src/dev/subcommands/state_cmd.rs`:
- Around line 125-134: The second anyhow::ensure! currently uses the wrong error
text ("state root mismatch") for the receipt check; update the ensure! that
compares receipt_root to *ts_next.parent_message_receipts() so its error message
reads something like "receipt root mismatch, receipt_root: {receipt_root},
expected_receipt_root: {expected_receipt_root}" to accurately reflect the
compared variables (receipt_root and expected_receipt_root).
- Around line 84-107: After calling chain_store.chain_index().tipset_by_height
for ts and ts_next, add an explicit guard that detects when ts_next resolves to
the same tipset as ts (compare ts_next.key() to ts.key() or equivalent equality
on the loaded Tipset) and return a clear, descriptive error (or early return)
instead of proceeding; locate the calls to tipset_by_height and the later usage
of ts_next (symbols: tipset_by_height, ts_next, ts,
chain_store.heaviest_tipset(), ResolveNullTipset::TakeNewer,
SettingsStoreExt::write_obj) and ensure you perform the equality check before
writing HEAD_KEY or doing root checks so you avoid misleading mismatch errors
when epoch is already the chain head.
In `@src/state_manager/utils.rs`:
- Around line 299-305: The second anyhow::ensure call currently uses the wrong
error text ("state root mismatch") while checking receipt_root vs
expected_receipt_root; update the error message in the ensure that references
receipt_root and expected_receipt_root to say "receipt root mismatch" (or
similar) and include both receipt_root and expected_receipt_root in the
formatted message to match the variables being validated.
🧹 Nitpick comments (1)
src/state_manager/utils.rs (1)
204-277: Add rustdoc for the public helpers instate_compute.
These are public APIs and should be documented for intent and usage.As per coding guidelines, document all public functions and structs with rustdoc comments.
Also applies to: 279-283
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
349bf3a to
bea74daComparehanabi1224
commented
Jan 28, 2026
@LesnyRumcajs all green now! |
Uh oh!
There was an error while loading. Please reload this page.
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes
Other information and links
Change checklist
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Tests
Chores / Docs
✏️ Tip: You can customize this high-level summary in your review settings.