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

fix(starknet_integration_tests): fix config when creating multiple nodes #2426

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

yair-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@yair-starkware yair-starkware marked this pull request as ready for review December 3, 2024 11:27
@yair-starkware yair-starkware changed the title fix(starknet_integration_test): fix config when creating multiple nodes fix(starknet_integration_tests): fix config when creating multiple nodes Dec 3, 2024
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 34.10%. Comparing base (e3165c4) to head (a4dc64d).
Report is 797 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2426      +/-   ##
==========================================
- Coverage   40.10%   34.10%   -6.01%     
==========================================
  Files          26      276     +250     
  Lines        1895    32153   +30258     
  Branches     1895    32153   +30258     
==========================================
+ Hits          760    10965   +10205     
- Misses       1100    20200   +19100     
- Partials       35      988     +953     

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

Copy link
Collaborator

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


crates/starknet_integration_tests/src/utils.rs line 39 at r1 (raw file):

// Currently the orchestrator expects the sequencer addresses in the form of [0..n_sequencers).
// TODO(yair): Change this offset to be a non-zero value once the orchestrator is updated.
pub const SEQUENCER_ADDRESS_OFFSET: usize = 0;

Shouldn't this be 100?

Suggestion:

pub const SEQUENCER_ADDRESS_OFFSET: usize = 100;

crates/starknet_integration_tests/src/utils.rs line 66 at r1 (raw file):

    let mempool_p2p_config = create_mempool_p2p_config(sequencer_id, chain_info.chain_id.clone());
    let monitoring_endpoint_config = create_monitoring_endpoint_config(sequencer_id);
    let sequencer_address = create_sequencer_address(sequencer_id);

Use this to set validator id in config.

Code quote:

let sequencer_address = create_sequencer_address(sequencer_id);

crates/starknet_integration_tests/src/utils.rs line 282 at r1 (raw file):

    config.port += u16::try_from(sequencer_id).unwrap();
    config
}

@ShahakShama can you ptal at this?

Code quote:

fn create_mempool_p2p_config(sequencer_id: usize, chain_id: ChainId) -> MempoolP2pConfig {
    let mut config = MempoolP2pConfig::default();
    // When running multiple sequencers on the same machine, we need to make sure their ports are
    // different. Use the sequencer_id to differentiate between them.
    config.network_config.tcp_port += u16::try_from(sequencer_id).unwrap();
    config.network_config.quic_port += u16::try_from(sequencer_id).unwrap();
    config.network_config.chain_id = chain_id;
    config
}

fn create_monitoring_endpoint_config(sequencer_id: usize) -> MonitoringEndpointConfig {
    let mut config = MonitoringEndpointConfig::default();
    config.port += u16::try_from(sequencer_id).unwrap();
    config
}

crates/starknet_sequencer_node/src/config/node_config.rs line 86 at r1 (raw file):

                "The sequencer address.",
            ),
            // TODO(Matan): make validator id of consensus point to the sequencer address.

We are removing the sequencer address from the block builder config. You can remove the TODO.


crates/starknet_integration_tests/src/integration_test_setup.rs line 61 at r1 (raw file):

        // Derive the configuration for the sequencer node.
        let (config, required_params) = create_config(
            SEQUENCER_ID,

It's confusing that this is an index while validator id is a contract address. Can you change everywhere to differentiate?
use index or number instead of id

Code quote:

SEQUENCER_ID

Copy link
Collaborator

@alonh5 alonh5 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 r1.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @Itay-Tsabary-Starkware and @yair-starkware)

@yair-starkware yair-starkware force-pushed the yair/refactor_setup branch 2 times, most recently from 20734a2 to 60b70c2 Compare December 9, 2024 07:54
@yair-starkware yair-starkware requested a review from alonh5 December 9, 2024 08:40
Copy link
Contributor Author

@yair-starkware yair-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 4 files reviewed, 5 unresolved discussions (waiting on @alonh5 and @Itay-Tsabary-Starkware)


crates/starknet_integration_tests/src/integration_test_setup.rs line 61 at r1 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

It's confusing that this is an index while validator id is a contract address. Can you change everywhere to differentiate?
use index or number instead of id

Done.


crates/starknet_integration_tests/src/utils.rs line 39 at r1 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Shouldn't this be 100?

Code moved


crates/starknet_integration_tests/src/utils.rs line 66 at r1 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Use this to set validator id in config.

No need to create sequencer address anymore


crates/starknet_sequencer_node/src/config/node_config.rs line 86 at r1 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

We are removing the sequencer address from the block builder config. You can remove the TODO.

Done.

Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 3 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Itay-Tsabary-Starkware and @yair-starkware)


crates/starknet_integration_tests/src/utils.rs line 256 at r3 (raw file):

    // When running multiple sequencers on the same machine, we need to make sure their ports are
    // different. Use the sequencer_index to differentiate between them.
    config.network_config.tcp_port += u16::try_from(sequencer_index).unwrap();

Can we ensure or assert that the ports aren't colliding?

@yair-starkware yair-starkware changed the base branch from yair/refactor_setup to graphite-base/2426 December 10, 2024 07:31
Copy link
Contributor Author

@yair-starkware yair-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, 1 unresolved discussion (waiting on @alonh5 and @Itay-Tsabary-Starkware)


crates/starknet_integration_tests/src/utils.rs line 256 at r3 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Can we ensure or assert that the ports aren't colliding?

It will be checked at the node's startup.

@yair-starkware yair-starkware changed the base branch from graphite-base/2426 to main December 10, 2024 08:00
Copy link
Collaborator

@alonh5 alonh5 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 r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Itay-Tsabary-Starkware and @yair-starkware)


crates/starknet_integration_tests/src/utils.rs line 261 at r4 (raw file):

    // different. Use the sequencer_index to differentiate between them.
    config.network_config.tcp_port += u16::try_from(sequencer_index).unwrap();
    config.network_config.quic_port += u16::try_from(sequencer_index).unwrap();

The quic port is configured to be 1 over the tcp port, so the first node's quic port collides with the second's tcp port.
Shahak told me the quic port isn't currently used, which is why this doesn't fail, and they will remove it. Jusy an FYI

Copy link
Collaborator

@alonh5 alonh5 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 r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Itay-Tsabary-Starkware and @yair-starkware)

@yair-starkware yair-starkware removed the request for review from Itay-Tsabary-Starkware December 10, 2024 10:29
@yair-starkware yair-starkware merged commit 2a55126 into main Dec 10, 2024
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants