Skip to content

blockifier: take CommitmentStateDiff in AccessedKeys::new and predicted_alias_storage_entries#14156

Open
yoavGrs wants to merge 1 commit into
accessed-keys-proof-facts-block-numberfrom
accessed-keys-commitment-state-diff
Open

blockifier: take CommitmentStateDiff in AccessedKeys::new and predicted_alias_storage_entries#14156
yoavGrs wants to merge 1 commit into
accessed-keys-proof-facts-block-numberfrom
accessed-keys-commitment-state-diff

Conversation

@yoavGrs
Copy link
Copy Markdown
Contributor

@yoavGrs yoavGrs commented May 24, 2026

CommitmentStateDiff is the natural per-block state-diff type at the OS-replay
boundary (the batcher's BlockExecutionArtifacts already carries one). Swap
both AccessedKeys::new and predicted_alias_storage_entries to consume it
directly:

  • AccessedKeys::new derives storage entries from
    state_diff.storage_updates, the modified-contracts union from
    storage_updates / address_to_nonce / address_to_class_hash, and the
    class-hash keys from address_to_class_hash + class_hash_to_compiled_class_hash.
  • predicted_alias_storage_entries now walks CommitmentStateDiff directly;
    the parity test converts its StateMaps fixture via CommitmentStateDiff::from.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

…ed_alias_storage_entries

CommitmentStateDiff is the natural per-block state-diff type at the OS-replay
boundary (the batcher's BlockExecutionArtifacts already carries one). Swap
both AccessedKeys::new and predicted_alias_storage_entries to consume it
directly:

- AccessedKeys::new derives storage entries from
  state_diff.storage_updates, the modified-contracts union from
  storage_updates / address_to_nonce / address_to_class_hash, and the
  class-hash keys from address_to_class_hash + class_hash_to_compiled_class_hash.
- predicted_alias_storage_entries now walks CommitmentStateDiff directly;
  the parity test converts its StateMaps fixture via CommitmentStateDiff::from.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

@cursor
Copy link
Copy Markdown

cursor Bot commented May 24, 2026

PR Summary

Medium Risk
Touches OS replay input derivation (AccessedKeys/alias prediction), so mistakes could cause missing trie reads or incorrect stateful compression behavior, but changes are largely mechanical type/field mapping with updated tests.

Overview
AccessedKeys::new and predicted_alias_storage_entries now take CommitmentStateDiff directly (instead of StateMaps) and derive accessed storage entries/contracts/class hashes from its storage_updates, address_to_nonce, address_to_class_hash, and class_hash_to_compiled_class_hash fields.

Tests are updated to build CommitmentStateDiff fixtures and the alias-prediction parity test converts from StateMaps via CommitmentStateDiff::from to keep predicted vs. actual alias-contract accesses aligned.

Reviewed by Cursor Bugbot for commit f457985. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

@dorimedini-starkware reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on yoavGrs).


crates/blockifier/src/state/stateful_compression.rs line 98 at r1 (raw file):

        .keys()
        .chain(state_diff.address_to_nonce.keys())
        .chain(state_diff.address_to_class_hash.keys());

this is implemented twice; make this a method of CommitmentStateDiff?

Code quote:

    let modified_contracts = state_diff
        .storage_updates
        .keys()
        .chain(state_diff.address_to_nonce.keys())
        .chain(state_diff.address_to_class_hash.keys());

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.

3 participants