Skip to content

[vm2] fix delayed-field in-place materialization for from-state base - #4842

Draft
jackzhhuang wants to merge 3 commits into
dual-verse-dagfrom
spike-delayed-only-materialize-repro
Draft

[vm2] fix delayed-field in-place materialization for from-state base#4842
jackzhhuang wants to merge 3 commits into
dual-verse-dagfrom
spike-delayed-only-materialize-repro

Conversation

@jackzhhuang

Copy link
Copy Markdown
Contributor

Summary

  • Fix InPlaceDelayedFieldChange materialization when base bytes are not yet cached.
  • Add delayed-resource duplicate key detection in mixed materialization and route those keys through sequential materialization.
  • Add a regression test for delayed-only updates that rely on state base (tests_delayed_from_state.rs).

Root Cause

materialize_in_place_change assumed base bytes always existed in DelayedFieldCache.
In delayed-only from-state scenarios, cache can be empty, causing:
Missing cached base value for delayed field exchange.

Fix

  • On cache miss, read base from StateView, insert into cache, then materialize.
  • Treat repeated delayed resource writes to the same StateKey as sequential materialization candidates to preserve ordering guarantees.

Validation

  • cargo fmt
  • cargo check
  • cargo fmt -- --check
  • cargo clippy --all-targets -- -Aclippy::doc_lazy_continuation
  • cargo test -p starcoin-vm-runtime delayed_only_from_state_without_cached_base_should_materialize -- --nocapture
  • cargo test -p starcoin-vm-runtime delayed_only_dependency_materialization_matches_legacy_all_seq -- --nocapture

@coderabbitai

coderabbitai Bot commented Apr 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 81a68f64-de1b-428e-bae6-1bc092bb4679

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch spike-delayed-only-materialize-repro

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 and usage tips.

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