Skip to content

blockifier: get compiled class hash v2 dict state reader #8435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: aviv/add_compiled_class_hash_to_feature_contract_data
Choose a base branch
from

Conversation

AvivYossef-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

AvivYossef-starkware commented Aug 5, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

github-actions bot commented Aug 5, 2025

Copy link
Collaborator

@meship-starkware meship-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noaov1)


a discussion (no related file):
Can you add a simple test that adds a class and tries to read the compiled class and compiled class v2?
Can be in a separate PR

Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @AvivYossef-starkware)


crates/blockifier/src/test_utils/dict_state_reader.rs line 88 at r1 (raw file):

    fn get_compiled_class_hash(&self, class_hash: ClassHash) -> StateResult<CompiledClassHash> {
        // Try to get the v2 compiled class hash first.

Why is it needed? What will happen if we want to declare an "old" class (to test the migration)?
Note that the use of add_class is for the preprocess (so it can be an old declare)

Code quote:

        // Try to get the v2 compiled class hash first.

crates/blockifier/src/test_utils/dict_state_reader.rs line 98 at r1 (raw file):

        // Fallback.
        let compiled_class_hash =
            self.class_hash_to_compiled_class_hash.get(&class_hash).copied().unwrap_or_default();

Note that this is updated only in case of declare transaction (and not in add_class)

Code quote:

 self.class_hash_to_compiled_class_hash.get(&class_hash).copied().unwrap_or_default();

@graphite-app graphite-app bot changed the base branch from aviv/get_compiled_class_hash_v2_cached_state to graphite-base/8435 August 6, 2025 12:04
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/get_compiled_class_hash_v2_dict_state branch from 41c4067 to 009f424 Compare August 7, 2025 08:20
@AvivYossef-starkware AvivYossef-starkware changed the base branch from graphite-base/8435 to aviv/add_compiled_class_hash_to_feature_contract_data August 7, 2025 08:20
Copy link
Collaborator

@meship-starkware meship-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @AvivYossef-starkware)

Copy link
Contributor Author

@AvivYossef-starkware AvivYossef-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @meship-starkware and @noaov1)


a discussion (no related file):

Previously, meship-starkware (Meshi Peled) wrote…

Can you add a simple test that adds a class and tries to read the compiled class and compiled class v2?
Can be in a separate PR

Still relevant?


crates/blockifier/src/test_utils/dict_state_reader.rs line 88 at r1 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Why is it needed? What will happen if we want to declare an "old" class (to test the migration)?
Note that the use of add_class is for the preprocess (so it can be an old declare)

Discussed


crates/blockifier/src/test_utils/dict_state_reader.rs line 98 at r1 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Note that this is updated only in case of declare transaction (and not in add_class)

Discussed

Copy link
Collaborator

@meship-starkware meship-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noaov1)


a discussion (no related file):

Previously, AvivYossef-starkware wrote…

Still relevant?

No, we will test it as part of the migration

Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @AvivYossef-starkware)


crates/blockifier/src/test_utils/dict_state_reader.rs line 30 at r2 (raw file):

impl DictStateReader {
    /// Adds a contract class to the state reader.

Suggestion:

/// Pre-process: declares a class.

crates/blockifier/src/test_utils/dict_state_reader.rs line 57 at r2 (raw file):

    /// Adds the compiled class hashes of the contract to the state reader.
    /// The `hash_version` parameter is used to determine if we should add the class before the
    //  migration.

Suggestion:

    ///  migration.

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