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: return vector of SequencerNodeConfig in create config function #2638

Open
wants to merge 1 commit into
base: spr/main/927ec671
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions crates/starknet_integration_tests/src/flow_test_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use crate::utils::{
create_chain_info,
create_config,
create_consensus_manager_configs_and_channels,
get_http_server_config,
};

const SEQUENCER_0: usize = 0;
Expand Down Expand Up @@ -95,7 +96,7 @@ pub struct SequencerSetup {
// Handle of the sequencer node.
pub sequencer_node_handles: Vec<JoinHandle<Result<(), anyhow::Error>>>,

pub config: SequencerNodeConfig,
pub configs: Vec<SequencerNodeConfig>,
}

impl SequencerSetup {
Expand All @@ -120,7 +121,7 @@ impl SequencerSetup {
.await;

// Derive the configuration for the sequencer node.
let (config, _required_params) = create_config(
let (configs, _required_params) = create_config(
sequencer_index,
chain_info,
rpc_server_addr,
Expand All @@ -129,16 +130,27 @@ impl SequencerSetup {
)
.await;

debug!("Sequencer config: {:#?}", config);
debug!("Sequencer configs: {:#?}", configs);

let (_clients, servers) = create_node_modules(&config);
let mut sequencer_clients = vec![];
let mut sequencer_servers = vec![];
for config in configs.iter() {
let (clients, servers) = create_node_modules(config);
sequencer_clients.push(clients);
sequencer_servers.push(servers);
}

let HttpServerConfig { ip, port } = config.http_server_config;
let add_tx_http_client = HttpTestClient::new(SocketAddr::from((ip, port)));
let HttpServerConfig { ip, port } =
get_http_server_config(&configs).expect("No matching HttpServerConfig found");
let add_tx_http_client = HttpTestClient::new(SocketAddr::from((*ip, *port)));

// Build and run the sequencer node.
let sequencer_node_future = run_component_servers(servers);
let sequencer_node_handles = vec![task_executor.spawn_with_handle(sequencer_node_future)];
let mut sequencer_node_handles = vec![];
for server in sequencer_servers {
let sequencer_node_future = run_component_servers(server);
let sequencer_node_handle = task_executor.spawn_with_handle(sequencer_node_future);
sequencer_node_handles.push(sequencer_node_handle);
}

// Wait for server to spin up.
// TODO(Gilad): Replace with a persistent Client with a built-in retry to protect against CI
Expand All @@ -151,7 +163,7 @@ impl SequencerSetup {
batcher_storage_file_handle: storage_for_test.batcher_storage_handle,
rpc_storage_file_handle: storage_for_test.rpc_storage_handle,
sequencer_node_handles,
config,
configs,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl IntegrationTestSetup {
create_consensus_manager_configs_and_channels(SEQUENCER_INDICES.len());

// Derive the configuration for the sequencer node.
let (config, required_params) = create_config(
let (configs, required_params) = create_config(
SEQUENCER_INDEX,
chain_info,
rpc_server_addr,
Expand All @@ -66,9 +66,11 @@ impl IntegrationTestSetup {
)
.await;

let config = &configs[0];

let node_config_dir_handle = tempdir().unwrap();
let node_config_path = dump_config_file_changes(
&config,
config,
required_params,
node_config_dir_handle.path().to_path_buf(),
);
Expand All @@ -84,7 +86,7 @@ impl IntegrationTestSetup {
add_tx_http_client,
is_alive_test_client,
batcher_storage_handle: storage_for_test.batcher_storage_handle,
batcher_storage_config: config.batcher_config.storage,
batcher_storage_config: config.batcher_config.storage.clone(),
rpc_storage_handle: storage_for_test.rpc_storage_handle,
node_config_dir_handle,
node_config_path,
Expand Down
6 changes: 3 additions & 3 deletions crates/starknet_integration_tests/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub async fn create_config(
rpc_server_addr: SocketAddr,
batcher_storage_config: StorageConfig,
mut consensus_manager_config: ConsensusManagerConfig,
) -> (SequencerNodeConfig, RequiredParams) {
) -> (Vec<SequencerNodeConfig>, RequiredParams) {
set_validator_id(&mut consensus_manager_config, sequencer_index);
let fee_token_addresses = chain_info.fee_token_addresses.clone();
let batcher_config = create_batcher_config(batcher_storage_config, chain_info.clone());
Expand All @@ -62,7 +62,7 @@ pub async fn create_config(
let monitoring_endpoint_config = create_monitoring_endpoint_config(sequencer_index);

(
SequencerNodeConfig {
vec![SequencerNodeConfig {
batcher_config,
consensus_manager_config,
gateway_config,
Expand All @@ -71,7 +71,7 @@ pub async fn create_config(
mempool_p2p_config,
monitoring_endpoint_config,
..Default::default()
},
}],
RequiredParams {
chain_id: chain_info.chain_id,
eth_fee_token_address: fee_token_addresses.eth_fee_token_address,
Expand Down
Loading