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_gateway): implement sync state reader get block info #2942

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

noamsp-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@eitanm-starkware eitanm-starkware force-pushed the eitan/add_blockinfo_to_syncblock branch from b575e4b to 368475b Compare December 25, 2024 14:28
@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_block_info branch from dbe2a1a to fd1726a Compare December 25, 2024 15:08
@noamsp-starkware noamsp-starkware changed the base branch from eitan/add_blockinfo_to_syncblock to main December 26, 2024 09:51
@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_block_info branch from fd1726a to 7287611 Compare December 26, 2024 10:16
@noamsp-starkware noamsp-starkware changed the base branch from main to noam.s/state_sync_verify_contract_deployed December 26, 2024 10:16
Copy link
Contributor Author

noamsp-starkware commented Dec 26, 2024

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.

Reviewable status: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @eitanm-starkware and @noamsp-starkware)


crates/starknet_gateway/src/sync_state_reader.rs line 53 at r4 (raw file):

                },
            },
            use_kzg_da: matches!(block_header.l1_da_mode, L1DataAvailabilityMode::Blob),

This will compile if someone adds a variant to L1DataAvailabilityMode, and I want it to not compile in that case so that the person who added a variant will TAL at this code and decide what's right

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.

Reviewable status: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @eitanm-starkware and @noamsp-starkware)


crates/starknet_gateway/src/sync_state_reader.rs line 53 at r4 (raw file):

Previously, ShahakShama wrote…

This will compile if someone adds a variant to L1DataAvailabilityMode, and I want it to not compile in that case so that the person who added a variant will TAL at this code and decide what's right

Leaving unblocking so that if you fix it and Eitan approves you can merge

@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_block_info branch from 8c370b3 to 505f90d Compare December 30, 2024 09:21
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: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @eitanm-starkware and @ShahakShama)


crates/starknet_gateway/src/sync_state_reader.rs line 53 at r4 (raw file):

Previously, ShahakShama wrote…

Leaving unblocking so that if you fix it and Eitan approves you can merge

Fixed

Copy link
Contributor

@eitanm-starkware eitanm-starkware 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 1 of 6 files at r4, 4 of 4 files at r5, all commit messages.
Reviewable status: 5 of 7 files reviewed, 1 unresolved discussion (waiting on @ShahakShama)


crates/starknet_gateway/src/sync_state_reader.rs line 34 at r5 (raw file):

        let block = block_on(self.state_sync_client.get_block(self.block_number))
            .map_err(|e| StateError::StateReadError(e.to_string()))?
            .ok_or(StateError::StateReadError("Block not found".to_string()))?;

ok_or_else isnt eager - better practice to use it when there is a fn calculated in the brackets. leaving unblocking

Suggestion:

ok_or_else(||

@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_block_info branch from 505f90d to dc6c133 Compare December 30, 2024 12:00
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: 4 of 7 files reviewed, all discussions resolved (waiting on @eitanm-starkware and @ShahakShama)


crates/starknet_gateway/src/sync_state_reader.rs line 34 at r5 (raw file):

Previously, eitanm-starkware wrote…

ok_or_else isnt eager - better practice to use it when there is a fn calculated in the brackets. leaving unblocking

Done

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 1 of 1 files at r6, all commit messages.
Reviewable status: 5 of 7 files reviewed, all discussions resolved (waiting on @eitanm-starkware)


crates/starknet_gateway/src/sync_state_reader.rs line 34 at r5 (raw file):

Previously, noamsp-starkware wrote…

Done

No. It's actually better to do ok_or in this case. ok_or_else should only be used if the calculation is either heavy or it produces panic

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.

Reviewable status: 5 of 7 files reviewed, all discussions resolved (waiting on @eitanm-starkware)


crates/starknet_gateway/src/sync_state_reader.rs line 34 at r5 (raw file):

Previously, ShahakShama wrote…

No. It's actually better to do ok_or in this case. ok_or_else should only be used if the calculation is either heavy or it produces panic

Please revert

@noamsp-starkware noamsp-starkware force-pushed the noam.s/sync_state_reader_get_block_info branch from dc6c133 to 74ae549 Compare December 30, 2024 12:50
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 1 of 1 files at r7, all commit messages.
Reviewable status: 5 of 7 files reviewed, all discussions resolved (waiting on @eitanm-starkware)

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 2 of 6 files at r4.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noamsp-starkware)

@noamsp-starkware noamsp-starkware added this pull request to the merge queue Dec 30, 2024
Merged via the queue into main with commit 1805ce6 Dec 30, 2024
8 checks passed
@noamsp-starkware noamsp-starkware deleted the noam.s/sync_state_reader_get_block_info branch December 31, 2024 09:08
@github-actions github-actions bot locked and limited conversation to collaborators Jan 2, 2025
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.

4 participants