Skip to content

blockifier: add predicted_alias_storage_entries#14102

Merged
yoavGrs merged 1 commit into
mainfrom
accessed-keys-predicted-alias-storage-entries
May 24, 2026
Merged

blockifier: add predicted_alias_storage_entries#14102
yoavGrs merged 1 commit into
mainfrom
accessed-keys-predicted-alias-storage-entries

Conversation

@yoavGrs
Copy link
Copy Markdown
Contributor

@yoavGrs yoavGrs commented May 19, 2026

Predicts the alias-contract storage entries that allocate_aliases_in_storage
would touch for a given state_diff, without running the allocation. Used by
the batcher to assemble the accessed-keys set written for OS replay.

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 19, 2026

PR Summary

Low Risk
Low risk: adds a pure helper for predicting alias-contract storage access plus a parity test; core alias allocation/compression behavior is unchanged aside from refactoring the compression predicates.

Overview
Adds predicted_alias_storage_entries, a helper that computes which alias-contract (ContractAddress, StorageKey) entries allocate_aliases_in_storage will touch for a given StateMaps, without performing allocation.

Refactors the compression decision logic into shared should_compress_address/should_compress_storage_key helpers, and adds a unit test asserting the predicted entry set matches actual alias-contract writes when no aliases pre-exist.

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

Copy link
Copy Markdown
Contributor

@ArielElp ArielElp left a comment

Choose a reason for hiding this comment

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

:lgtm:

@ArielElp reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on yoavGrs).

@yoavGrs yoavGrs force-pushed the accessed-keys-predicted-alias-storage-entries branch from b002b93 to 851e1d7 Compare May 20, 2026 11:50
@yoavGrs yoavGrs force-pushed the accessed-keys-visited-contract-addresses branch from a0228f5 to 066d324 Compare May 20, 2026 11:50
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 2 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 85 at r1 (raw file):

/// read (and may write) for the given `state_diff`, without running the allocation. Mirrors the
/// access pattern of `AliasUpdater::new` (counter read) plus each `AliasUpdater::insert_alias`
/// call (one read per qualifying key).

kind of annoying that you need this function. can you see if you can reuse / generalize allocate_aliases_in_storage for this?
in your test it seems that they seem to have the same result...

I would go on to say the allocate_aliases_in_storage should be an associated function of AliasUpdater, and the new predicted_alias_storage_entries should also be an associated function of AliasUpdater.

(it bugs me because there are duplicated ifs and scanning logic, I prefer these to be in one place..)

Code quote:

/// Predicts the storage entries on the alias contract that `allocate_aliases_in_storage` will
/// read (and may write) for the given `state_diff`, without running the allocation. Mirrors the
/// access pattern of `AliasUpdater::new` (counter read) plus each `AliasUpdater::insert_alias`
/// call (one read per qualifying key).

@graphite-app graphite-app Bot changed the base branch from accessed-keys-visited-contract-addresses to graphite-base/14102 May 20, 2026 12:31
Predicts the alias-contract storage entries that allocate_aliases_in_storage
would touch for a given state_diff, without running the allocation. Used by
the batcher to assemble the accessed-keys set written for OS replay.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@yoavGrs yoavGrs force-pushed the accessed-keys-predicted-alias-storage-entries branch from 851e1d7 to b5f856e Compare May 20, 2026 13:46
@yoavGrs yoavGrs force-pushed the graphite-base/14102 branch from 066d324 to 1bec947 Compare May 20, 2026 13:46
Copy link
Copy Markdown
Contributor Author

@yoavGrs yoavGrs left a comment

Choose a reason for hiding this comment

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

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


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

Previously, dorimedini-starkware wrote…

kind of annoying that you need this function. can you see if you can reuse / generalize allocate_aliases_in_storage for this?
in your test it seems that they seem to have the same result...

I would go on to say the allocate_aliases_in_storage should be an associated function of AliasUpdater, and the new predicted_alias_storage_entries should also be an associated function of AliasUpdater.

(it bugs me because there are duplicated ifs and scanning logic, I prefer these to be in one place..)

Done.

@yoavGrs yoavGrs changed the base branch from graphite-base/14102 to main May 20, 2026 13:46
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 20, 2026

Artifacts upload workflows:

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 1 file and all commit messages, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on yoavGrs).

@yoavGrs yoavGrs added this pull request to the merge queue May 24, 2026
Merged via the queue into main with commit 23ae186 May 24, 2026
77 of 175 checks passed
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.

4 participants