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): pass new internal blocks from state sync to p2p sync client #2631

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AlonLStarkWare
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

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 r1, 3 of 3 files at r2, all commit messages.
Reviewable status: 4 of 8 files reviewed, all discussions resolved (waiting on @ShahakShama)

@AlonLStarkWare AlonLStarkWare force-pushed the alonl/pass_AddNewBlock_requests_from_StateSync_to_P2pSyncClient branch from 51929fb to 6d8f02a Compare December 10, 2024 13:44
Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 10.00000% with 18 lines in your changes missing coverage. Please review.

Project coverage is 77.08%. Comparing base (e3165c4) to head (365db40).
Report is 816 commits behind head on main.

Files with missing lines Patch % Lines
crates/starknet_state_sync/src/lib.rs 0.00% 9 Missing ⚠️
crates/starknet_state_sync/src/runner/mod.rs 0.00% 5 Missing ⚠️
crates/starknet_state_sync_types/src/errors.rs 0.00% 3 Missing ⚠️
crates/papyrus_node/src/run.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2631       +/-   ##
===========================================
+ Coverage   40.10%   77.08%   +36.97%     
===========================================
  Files          26      393      +367     
  Lines        1895    42577    +40682     
  Branches     1895    42577    +40682     
===========================================
+ Hits          760    32819    +32059     
- Misses       1100     7463     +6363     
- Partials       35     2295     +2260     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 all commit messages.
Reviewable status: 4 of 8 files reviewed, 4 unresolved discussions (waiting on @AlonLStarkWare and @eitanm-starkware)


crates/starknet_state_sync/src/runner/mod.rs line 74 at r2 (raw file):

            storage_writer,
            p2p_sync_client_channels,
            Box::pin(new_block_receiver),

use .boxed() instead


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

    StorageError(String),
    #[error("Failed to send message to P2pSyncClient")]
    P2PSyncClientError,

Read the comment above on the StorageError. The reason we did not use #[error(transparent)] and used the direct error in StorageError is because StorageError does not derive stuff

If your error type also doesn't derive these, copy the comment and change the type to string and implement the conversion manually
If it does, just contain the error and the #[error(transparent)] will implement the From by itself

Please note that in a different comment in the PR I wrote about changing the error here


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

                        .send((block_number, sync_block))
                        .await
                        .map_err(|_| StateSyncError::P2PSyncClientError),

This is a send error. not a sync client error


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

                        .send((block_number, sync_block))
                        .await
                        .map_err(|_| StateSyncError::P2PSyncClientError),

If you implement error conversion like I said below, you can just use ? instead of map_err or use into()

Copy link
Contributor Author

@AlonLStarkWare AlonLStarkWare 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 9 files reviewed, 4 unresolved discussions (waiting on @eitanm-starkware and @ShahakShama)


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

Previously, ShahakShama wrote…

This is a send error. not a sync client error

Done.


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

Previously, ShahakShama wrote…

If you implement error conversion like I said below, you can just use ? instead of map_err or use into()

SendError does not implement Deserialize so I changed to from


crates/starknet_state_sync/src/runner/mod.rs line 74 at r2 (raw file):

Previously, ShahakShama wrote…

use .boxed() instead

Done.


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

Previously, ShahakShama wrote…

Read the comment above on the StorageError. The reason we did not use #[error(transparent)] and used the direct error in StorageError is because StorageError does not derive stuff

If your error type also doesn't derive these, copy the comment and change the type to string and implement the conversion manually
If it does, just contain the error and the #[error(transparent)] will implement the From by itself

Please note that in a different comment in the PR I wrote about changing the error here

Done.

@AlonLStarkWare AlonLStarkWare force-pushed the alonl/pass_AddNewBlock_requests_from_StateSync_to_P2pSyncClient branch from f87d8e8 to 365db40 Compare December 11, 2024 13:23
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 4 of 6 files at r1, 5 of 5 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @AlonLStarkWare)


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

Previously, AlonLStarkWare (Alon-Lukatch-Starkware) wrote…

Done.

Copy the comment

@AlonLStarkWare AlonLStarkWare force-pushed the alonl/pass_AddNewBlock_requests_from_StateSync_to_P2pSyncClient branch 2 times, most recently from b30ae06 to bccdf63 Compare December 15, 2024 09:08
Copy link
Contributor Author

@AlonLStarkWare AlonLStarkWare 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 9 files reviewed, 1 unresolved discussion (waiting on @ShahakShama)


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

Previously, ShahakShama wrote…

Copy the comment

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 4 of 5 files at r7, 5 of 5 files at r9, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @AlonLStarkWare)

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:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @AlonLStarkWare)

@AlonLStarkWare AlonLStarkWare force-pushed the alonl/pass_AddNewBlock_requests_from_StateSync_to_P2pSyncClient branch from bccdf63 to 0ed3534 Compare December 15, 2024 13:10
@AlonLStarkWare AlonLStarkWare force-pushed the alonl/pass_AddNewBlock_requests_from_StateSync_to_P2pSyncClient branch from 0ed3534 to 92a266c Compare December 16, 2024 12:22
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.

Reviewable status: 4 of 9 files reviewed, 3 unresolved discussions (waiting on @AlonLStarkWare and @ShahakShama)


crates/starknet_state_sync/src/runner/mod.rs line 46 at r12 (raw file):

    pub fn new(
        config: StateSyncConfig,
        new_block_receiver: Receiver<(BlockNumber, SyncBlock)>,

Suggestion:

internal

crates/starknet_state_sync/src/runner/mod.rs line 75 at r12 (raw file):

            storage_writer,
            p2p_sync_client_channels,
            new_block_receiver.boxed(),

Suggestion:

internal

crates/starknet_state_sync/src/lib.rs line 34 at r12 (raw file):

pub struct StateSync {
    storage_reader: StorageReader,
    new_block_sender: Sender<(BlockNumber, SyncBlock)>,

Suggestion:

internal

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