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: add functionality to create all components #265

Conversation

lev-starkware
Copy link
Contributor

@lev-starkware lev-starkware commented Jun 20, 2024

@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/bb128e01 branch from be9ba61 to 7f40a03 Compare June 24, 2024 08:39
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/414d7889 branch from 4e33568 to 682e7c1 Compare June 24, 2024 08:39
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/bb128e01 branch from 7f40a03 to 4702767 Compare June 24, 2024 10:52
@codecov-commenter
Copy link

codecov-commenter commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.

Project coverage is 74.00%. Comparing base (378d94d) to head (609e1fd).

Files Patch % Lines
crates/mempool_node/src/components.rs 0.00% 15 Missing ⚠️
crates/gateway/src/gateway.rs 0.00% 8 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                          @@
##           pr/lev-starkware/lev_dev/414d7889     #265      +/-   ##
=====================================================================
- Coverage                              77.01%   74.00%   -3.01%     
=====================================================================
  Files                                     28       30       +2     
  Lines                                   1379     1435      +56     
  Branches                                1379     1435      +56     
=====================================================================
  Hits                                    1062     1062              
- Misses                                   262      318      +56     
  Partials                                  55       55              

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

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 5 files reviewed, 3 unresolved discussions (waiting on @lev-starkware)


crates/gateway/src/gateway.rs line 132 at r2 (raw file):

    config: GatewayConfig,
    rpc_state_reader_config: RpcStateReaderConfig,
    client: Option<SharedMempoolClient>,

When will this function be invoked with a None value for the client?
If never, please drop the Optional part, and change the type to Box<dyn MempoolClient -- we'd like to pass ownership of the client to this struct, not to share an atomic reference with all the other components that need a mempool-client.

Code quote:

Option<SharedMempoolClient>

crates/mempool_node/src/components.rs line 9 at r2 (raw file):

pub struct Components {
    pub gateway: Option<Gateway>,
    pub mempool: Option<Mempool>,

Please don't use pub visibility on fields unless there's an absolute must; that's not the case here imo.

Code quote:

    pub gateway: Option<Gateway>,
    pub mempool: Option<Mempool>,

crates/mempool_node/src/components.rs line 23 at r2 (raw file):

    if config.components.mempool_component.execute {
        components.mempool = Some(Mempool::empty());
    }

Please create each component as Some or None, and then bundle them together in the struct. That is, please do not create the struct with None values to begin with.

Code quote:

    let mut components = Components { gateway: None, mempool: None };
    if config.components.gateway_component.execute {
        components.gateway = Some(create_gateway(
            config.gateway_config.clone(),
            config.rpc_state_reader_config.clone(),
            clients.mempool_client.clone(),
        ));
    }
    if config.components.mempool_component.execute {
        components.mempool = Some(Mempool::empty());
    }

crates/mempool_node/src/lib.rs line 3 at r2 (raw file):

pub mod com_clients;
pub mod communication;
pub mod components;

Next time, please add these with at the relevant pr that introduces the new file.

Code quote:

pub mod com_clients;
pub mod communication;
pub mod components;

@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/414d7889 branch from 682e7c1 to 59e9181 Compare June 25, 2024 12:37
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/bb128e01 branch 3 times, most recently from e27da30 to 8a58f23 Compare June 25, 2024 14:48
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: 0 of 5 files reviewed, 1 unresolved discussion (waiting on @Itay-Tsabary-Starkware)


crates/mempool_node/src/components.rs line 23 at r2 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Please create each component as Some or None, and then bundle them together in the struct. That is, please do not create the struct with None values to begin with.

Done.

@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/414d7889 branch from 62bedcd to f6bd8aa Compare June 26, 2024 15:09
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/bb128e01 branch from 8a58f23 to eaac21e Compare June 26, 2024 15:09
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/bb128e01 branch from eaac21e to d19adbb Compare June 26, 2024 15:22
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/414d7889 branch from f6bd8aa to eebb8aa Compare June 26, 2024 15:22
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/414d7889 branch from eebb8aa to 70229b1 Compare June 26, 2024 16:00
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/bb128e01 branch from d19adbb to 1ba1c91 Compare June 26, 2024 16:00
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/bb128e01 branch from 1ba1c91 to 3d734de Compare June 26, 2024 17:14
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/414d7889 branch from 70229b1 to 3a1782e Compare June 26, 2024 17:14
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.

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


crates/mempool_node/src/components.rs line 14 at r3 (raw file):

pub fn create_components(config: &MempoolNodeConfig, clients: &MempoolNodeClients) -> Components {
    let gateway_component = if config.components.gateway_component.execute {
        let mempool_clent =

Typo (missing "i")

Code quote:

mempool_clent

@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/414d7889 branch from 3a1782e to 758a682 Compare June 27, 2024 10:34
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/bb128e01 branch from 3d734de to 5b15998 Compare June 27, 2024 10:34
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/bb128e01 branch from 5b15998 to 609e1fd Compare June 27, 2024 11:11
@lev-starkware
Copy link
Contributor Author

Closing pull request: commit has gone away

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.

3 participants