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: implementing ComponentRunner for the gateway #355

Closed
wants to merge 1 commit into from

Conversation

lev-starkware
Copy link
Contributor

@lev-starkware lev-starkware commented Jul 3, 2024

Stack:

⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.


This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 80.85%. Comparing base (a2b8df2) to head (37d7bc8).

Files Patch % Lines
crates/gateway/src/gateway.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #355      +/-   ##
==========================================
+ Coverage   80.80%   80.85%   +0.04%     
==========================================
  Files          35       35              
  Lines        1620     1619       -1     
  Branches     1620     1619       -1     
==========================================
  Hits         1309     1309              
+ Misses        245      244       -1     
  Partials       66       66              

☔ 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.

:lgtm:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware and @dafnamatsry)

Copy link
Contributor

@ArniStarkware ArniStarkware 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, 2 unresolved discussions (waiting on @dafnamatsry and @lev-starkware)


crates/gateway/src/gateway.rs line 74 at r1 (raw file):

            .route("/is_alive", get(is_alive))
            .route("/add_tx", post(add_tx))
            .with_state(self.app_state.clone())

I am unsure if a clone is the intended behavior.

Maybe we should fix app_state so that it would implement Copy (or whatever the issue is). (Make all the members hide behind Arc).

This is not a big deal for now, but maybe it will be in the future.

Code quote:

self.app_state.clone()

crates/gateway/src/gateway.rs line 148 at r1 (raw file):

#[async_trait]
impl ComponentRunner for Gateway {
    async fn start(&mut self) -> Result<(), ComponentStartError> {

A question about Rust / design (probably out of scope for this PR).

Does the fact that start gets a reference to mut self means a single ComponentRunner may run many instances of the component?

Code quote:

impl ComponentRunner for Gateway {
    async fn start(&mut self) -> Result<(), ComponentStartError> {

Copy link
Contributor

@ArniStarkware ArniStarkware 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, 2 unresolved discussions (waiting on @dafnamatsry and @lev-starkware)


crates/gateway/src/gateway.rs line 74 at r1 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

I am unsure if a clone is the intended behavior.

Maybe we should fix app_state so that it would implement Copy (or whatever the issue is). (Make all the members hide behind Arc).

This is not a big deal for now, but maybe it will be in the future.

If you think it is an issue, add a to-do (for someone on my team, say myself) to fix it.

Copy link
Contributor

@ArniStarkware ArniStarkware 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)


crates/gateway/src/gateway.rs line 74 at r1 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

If you think it is an issue, add a to-do (for someone on my team, say myself) to fix it.

from F2f. Please add a todo on my name.


crates/gateway/src/gateway.rs line 148 at r1 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

A question about Rust / design (probably out of scope for this PR).

Does the fact that start gets a reference to mut self means a single ComponentRunner may run many instances of the component?

From F2F:

The important thing here is the mut, not the ref (&).
It is only logical that a runner would like to mutate itself.

Copy link
Contributor

@ArniStarkware ArniStarkware 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 2 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)

Copy link
Collaborator

@dafnamatsry dafnamatsry 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: all files reviewed, 1 unresolved discussion (waiting on @lev-starkware)


crates/gateway/src/gateway.rs line 74 at r1 (raw file):

            .route("/is_alive", get(is_alive))
            .route("/add_tx", post(add_tx))
            .with_state(self.app_state.clone())

I think dereferencing should work here.

Suggestion:

*self.app_state

@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/f9f21462 branch from fefc808 to ba4a577 Compare July 4, 2024 14:08
@lev-starkware lev-starkware changed the base branch from pr/lev-starkware/lev_dev/0f64f96b to main July 4, 2024 14:20
@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/f9f21462 branch 2 times, most recently from b943062 to 49daaf3 Compare July 4, 2024 17:15
Copy link
Contributor

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

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 2 files reviewed, 1 unresolved discussion (waiting on @dafnamatsry and @Itay-Tsabary-Starkware)


crates/gateway/src/gateway.rs line 74 at r1 (raw file):

Previously, dafnamatsry wrote…

I think dereferencing should work here.

I tried it not compiling.

@lev-starkware lev-starkware force-pushed the pr/lev-starkware/lev_dev/f9f21462 branch from 49daaf3 to 37d7bc8 Compare July 7, 2024 10:11
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.

Dismissed @dafnamatsry from a discussion.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @dafnamatsry)

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 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @dafnamatsry)

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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lev-starkware)

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.

Reviewed 1 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lev-starkware)

@lev-starkware lev-starkware dismissed dafnamatsry’s stale review July 7, 2024 11:41

By permission of dafna.

@lev-starkware
Copy link
Contributor Author

✓ Commit merged in pull request #339

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.

5 participants