Skip to content
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

feat(starknet_state_sync): implement state sync get compiled class #2817

Conversation

noamsp-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_nonce_at branch from 954e82f to 4fbbd3b Compare December 19, 2024 11:14
@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_compiled_class branch from 1f1fe73 to 9a9a9e5 Compare December 19, 2024 11:14
@noamsp-starkware noamsp-starkware marked this pull request as ready for review December 19, 2024 11:16
@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_nonce_at branch from 4fbbd3b to 8f57ae7 Compare December 19, 2024 11:25
@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_compiled_class branch from 9a9a9e5 to 3f28e7c Compare December 19, 2024 11:25
@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_compiled_class branch from 3f28e7c to af6b19d Compare December 19, 2024 13:36
@noamsp-starkware noamsp-starkware changed the base branch from noam.s/sync_state_reader_get_nonce_at to noam.s/sync_state_reader_get_class_hash_at December 19, 2024 13:37
Copy link
Contributor

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

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

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


crates/starknet_state_sync/src/lib.rs line 155 at r2 (raw file):

    ) -> StateSyncResult<(ContractClass, SierraVersion)> {
        let txn = self.storage_reader.begin_ro_txn()?;
        verify_synced_up_to(&txn, block_number)?;

The check here should be against the casm marker and not the state marker


crates/starknet_state_sync/src/lib.rs line 170 at r2 (raw file):

            let (casm, sierra) = option_casm
                .zip(option_sierra)
                .ok_or(StateSyncError::ClassHashNotFound(class_hash))?;

Add a comment that we've checked that block number is smaller than casm marker so if it's missing it's because it doesn't exist


crates/starknet_state_sync_types/src/communication.rs line 60 at r2 (raw file):

    ) -> StateSyncClientResult<ClassHash>;

    async fn get_compiled_class(

Add TODO to remove this and use compiler component client instead in SyncStateReader


crates/starknet_state_sync_types/src/communication.rs line 60 at r2 (raw file):

    ) -> StateSyncClientResult<ClassHash>;

    async fn get_compiled_class(

rename to get_compiled_class_deprecated so people will fear using it


crates/starknet_state_sync_types/src/errors.rs line 17 at r2 (raw file):

    ContractNotFound(ContractAddress),
    #[error("Class hash {0} was not found")]
    ClassHashNotFound(ClassHash),

Rename to ClassNotFound

@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_compiled_class branch from af6b19d to 4b1c3f3 Compare December 19, 2024 17:36
Copy link
Contributor Author

@noamsp-starkware noamsp-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, 5 unresolved discussions (waiting on @ShahakShama)


crates/starknet_state_sync/src/lib.rs line 155 at r2 (raw file):

Previously, ShahakShama wrote…

The check here should be against the casm marker and not the state marker

Ack.
The current rpc state reader checks the state marker and not the casm marker.


crates/starknet_state_sync/src/lib.rs line 170 at r2 (raw file):

Previously, ShahakShama wrote…

Add a comment that we've checked that block number is smaller than casm marker so if it's missing it's because it doesn't exist

Done.


crates/starknet_state_sync_types/src/communication.rs line 60 at r2 (raw file):

Previously, ShahakShama wrote…

rename to get_compiled_class_deprecated so people will fear using it

Done.


crates/starknet_state_sync_types/src/communication.rs line 60 at r2 (raw file):

Previously, ShahakShama wrote…

Add TODO to remove this and use compiler component client instead in SyncStateReader

Done.


crates/starknet_state_sync_types/src/errors.rs line 17 at r2 (raw file):

Previously, ShahakShama wrote…

Rename to ClassNotFound

Done.

@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_compiled_class branch from 4b1c3f3 to 51fdb66 Compare December 19, 2024 17:39
Copy link
Contributor

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noamsp-starkware)


crates/starknet_state_sync/src/lib.rs line 155 at r2 (raw file):

Previously, noamsp-starkware wrote…

Ack.
The current rpc state reader checks the state marker and not the casm marker.

Yes. They have a bit different case than our case

Copy link
Contributor Author

noamsp-starkware commented Dec 22, 2024

Merge activity

@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_class_hash_at branch from bfc191a to f7ff380 Compare December 22, 2024 08:54
@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_compiled_class branch from 51fdb66 to 03bc56f Compare December 22, 2024 08:54
Copy link
Contributor

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 3 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noamsp-starkware)

@noamsp-starkware noamsp-starkware merged commit 3debc32 into noam.s/sync_state_reader_get_class_hash_at Dec 22, 2024
8 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 24, 2024
@noamsp-starkware noamsp-starkware deleted the noam.s/sync_state_reader_get_compiled_class branch December 31, 2024 09:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants