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(consensus): add network config #1808

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

dan-starkware
Copy link
Collaborator

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@dan-starkware dan-starkware marked this pull request as ready for review November 4, 2024 20:03
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 11.74%. Comparing base (e3165c4) to head (8e6331c).
Report is 234 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1808       +/-   ##
===========================================
- Coverage   40.10%   11.74%   -28.36%     
===========================================
  Files          26      286      +260     
  Lines        1895    33348    +31453     
  Branches     1895    33348    +31453     
===========================================
+ Hits          760     3918     +3158     
- Misses       1100    29167    +28067     
- Partials       35      263      +228     

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

:lgtm:

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dan-starkware, @Itay-Tsabary-Starkware, and @matan-starkware)


crates/sequencing/papyrus_consensus/src/config.rs line 84 at r1 (raw file):

impl Default for ConsensusConfig {
    fn default() -> Self {
        let mut network_config = NetworkConfig::default();

consider instead

let network_config = NetworkConfig {
    tcp_port: 10100,
    quic_port: 10101,
    ..Default::default()
};

@dan-starkware
Copy link
Collaborator Author

crates/sequencing/papyrus_consensus/src/config.rs line 84 at r1 (raw file):

Previously, ShahakShama wrote…

consider instead

let network_config = NetworkConfig {
    tcp_port: 10100,
    quic_port: 10101,
    ..Default::default()
};

I don't think it can work since secret key is private

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: all files reviewed, 2 unresolved discussions (waiting on @dan-starkware, @matan-starkware, and @ShahakShama)


crates/sequencing/papyrus_consensus/src/config.rs line 87 at r1 (raw file):

        // TODO(Dan/Shahak): consider something nicer, maybe a builder?
        network_config.tcp_port = 10100;
        network_config.quic_port = 10101;

Can these be made the default values of NetworkConfig?

Code quote:

        network_config.tcp_port = 10100;
        network_config.quic_port = 10101;

@dan-starkware
Copy link
Collaborator Author

crates/sequencing/papyrus_consensus/src/config.rs line 87 at r1 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Can these be made the default values of NetworkConfig?

WDYM?
They are set this way in
config/papyrus/default_config.json

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: all files reviewed, 2 unresolved discussions (waiting on @dan-starkware, @matan-starkware, and @ShahakShama)


crates/sequencing/papyrus_consensus/src/config.rs line 87 at r1 (raw file):

Previously, dan-starkware wrote…

WDYM?
They are set this way in
config/papyrus/default_config.json

Can NetworkConfig::default() return a struct whose values are

tcp_port = 10100;
quic_port = 10101;

?

@dan-starkware
Copy link
Collaborator Author

crates/sequencing/papyrus_consensus/src/config.rs line 87 at r1 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Can NetworkConfig::default() return a struct whose values are

tcp_port = 10100;
quic_port = 10101;

?

IMO, since we have more than one component that's using it, each component should have different default values.

Copy link
Contributor

@matan-starkware matan-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aa

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

Copy link
Collaborator Author

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


crates/sequencing/papyrus_consensus/src/config.rs line 37 at r1 (raw file):

Previously, matan-starkware wrote…

If it's just adding a macro annotation, why not do that now?

I'm not sure what is the right validation (and whether one is needed) for each field.
I suggest to do it for all of the fields in a designated PR


crates/sequencing/papyrus_consensus/src/config.rs line 85 at r1 (raw file):

Previously, matan-starkware wrote…

How did you choose these ports?
We have a utility for selecting a free port find_free_port.
If you prefer the constants, should we move these to the top of the file instead of inline magic numbers?

Agree. There should be a constants source somewhere, for now just moving to local consts

@dan-starkware dan-starkware changed the base branch from dan/consensus_context/rename_init to graphite-base/1808 November 5, 2024 15:26
@dan-starkware dan-starkware changed the base branch from graphite-base/1808 to main November 5, 2024 15:49
@dan-starkware dan-starkware force-pushed the dan/consensus/network_config branch 2 times, most recently from d3b9ad8 to 86230ee Compare November 6, 2024 06:54
Copy link
Collaborator Author

@dan-starkware dan-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 all commit messages.
Reviewable status: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @Itay-Tsabary-Starkware and @ShahakShama)

Copy link
Contributor

@guy-starkware guy-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:

Reviewable status: 0 of 6 files reviewed, all discussions resolved (waiting on @Itay-Tsabary-Starkware, @matan-starkware, and @ShahakShama)

Copy link
Contributor

@matan-starkware matan-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 1 files at r2, 5 of 5 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dan-starkware)

@dan-starkware dan-starkware merged commit 21c050d into main Nov 7, 2024
17 checks passed
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.

6 participants