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

chore(starknet_state_sync): boxing SyncBlock in requests and responses #3263

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

lev-starkware
Copy link
Contributor

@lev-starkware lev-starkware commented Jan 12, 2025

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor

@Itay-Tsabary-Starkware Itay-Tsabary-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 3 files reviewed, 1 unresolved discussion (waiting on @lev-starkware)


crates/starknet_state_sync_types/src/communication.rs line 119 at r1 (raw file):

#[allow(clippy::large_enum_variant)]
pub enum StateSyncResponse {
    GetBlock(StateSyncResult<Box<Option<SyncBlock>>>),

@ShahakShama Box<Option<...>> or Option<Box<...>> ?

Code quote:

Box<Option<SyncBlock>>>

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 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @Itay-Tsabary-Starkware and @lev-starkware)


crates/starknet_state_sync_types/src/communication.rs line 119 at r1 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

@ShahakShama Box<Option<...>> or Option<Box<...>> ?

IMO Option<Box<...>


crates/starknet_state_sync/src/test.rs line 63 at r1 (raw file):

        panic!("Expected StateSyncResponse::GetBlock::Ok(Box(Some(_))), but got {:?}", response);
    };
    let Some(block) = *boxed_sync_block else {

Unite this with the let above


crates/starknet_state_sync/src/lib.rs line 50 at r1 (raw file):

            StateSyncRequest::GetBlock(block_number) => {
                let result: StateSyncResult<Box<Option<SyncBlock>>> =
                    match self.get_block(block_number) {

Use map instead

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: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @Itay-Tsabary-Starkware and @lev-starkware)


crates/starknet_state_sync_types/src/communication.rs line 119 at r1 (raw file):

Previously, ShahakShama wrote…

IMO Option<Box<...>

After talking with lev that is impossible so we should stay with Box<Option<

@lev-starkware lev-starkware changed the base branch from spr/main/42314d29 to main January 13, 2025 08:44
Copy link
Contributor Author

@lev-starkware lev-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: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @Itay-Tsabary-Starkware and @ShahakShama)


crates/starknet_state_sync/src/lib.rs line 50 at r1 (raw file):

Previously, ShahakShama wrote…

Use map instead

Done.


crates/starknet_state_sync_types/src/communication.rs line 119 at r1 (raw file):

Previously, ShahakShama wrote…

After talking with lev that is impossible so we should stay with Box<Option<

Macro, currently, can deal with Result<Box<Response>, Err> but not with Result<Option<Box<PartialResponse>>, Err>.

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 1 of 2 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Itay-Tsabary-Starkware)

Copy link
Contributor

@Itay-Tsabary-Starkware Itay-Tsabary-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 3 files at r1, 1 of 2 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lev-starkware)

@lev-starkware lev-starkware added this pull request to the merge queue Jan 13, 2025
Merged via the queue into main with commit fde2171 Jan 13, 2025
8 checks passed
@lev-starkware lev-starkware deleted the spr/main/fba480c4 branch January 13, 2025 12:26
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