diff --git a/.github/workflows/papyrus_ci.yml b/.github/workflows/papyrus_ci.yml index a343590cd3..81ce0aed60 100644 --- a/.github/workflows/papyrus_ci.yml +++ b/.github/workflows/papyrus_ci.yml @@ -40,7 +40,7 @@ jobs: - name: Run executable run: > - target/debug/papyrus_node --base_layer.node_url ${{ secrets.CI_BASE_LAYER_NODE_URL }} + target/debug/papyrus_node --chain_id SN_SEPOLIA --base_layer.node_url ${{ secrets.CI_BASE_LAYER_NODE_URL }} & sleep 30 ; kill $! executable-run-no-rpc: @@ -55,7 +55,7 @@ jobs: - name: Run executable run: > - target/debug/papyrus_node --base_layer.node_url ${{ secrets.CI_BASE_LAYER_NODE_URL }} + target/debug/papyrus_node --chain_id SN_SEPOLIA --base_layer.node_url ${{ secrets.CI_BASE_LAYER_NODE_URL }} & sleep 30 ; kill $! # FIXME: Job is currently running out of disk space, error is hidden inside the `Annoatations` diff --git a/config/papyrus/default_config.json b/config/papyrus/default_config.json index ee8d6fb9ec..9aac78a33a 100644 --- a/config/papyrus/default_config.json +++ b/config/papyrus/default_config.json @@ -60,9 +60,9 @@ "privacy": "Public" }, "chain_id": { - "description": "The chain to follow. For more details see https://docs.starknet.io/documentation/architecture_and_concepts/Blocks/transactions/#chain-id.", - "privacy": "TemporaryValue", - "value": "SN_MAIN" + "description": "A required param! The chain to follow. For more details see https://docs.starknet.io/documentation/architecture_and_concepts/Blocks/transactions/#chain-id.", + "param_type": "String", + "privacy": "TemporaryValue" }, "collect_metrics": { "description": "If true, collect metrics for the node.", diff --git a/crates/blockifier/src/context.rs b/crates/blockifier/src/context.rs index fdf6be73b2..0236996b69 100644 --- a/crates/blockifier/src/context.rs +++ b/crates/blockifier/src/context.rs @@ -187,6 +187,7 @@ impl ChainInfo { impl Default for ChainInfo { fn default() -> Self { ChainInfo { + // TODO(guyn): should we remove the default value for chain_id? chain_id: ChainId::Other("0x0".to_string()), fee_token_addresses: FeeTokenAddresses::default(), } diff --git a/crates/papyrus_config/src/loading.rs b/crates/papyrus_config/src/loading.rs index 0876ef6950..2ab10c9256 100644 --- a/crates/papyrus_config/src/loading.rs +++ b/crates/papyrus_config/src/loading.rs @@ -57,7 +57,6 @@ pub fn load_and_process_config Deserialize<'a>>( ) -> Result { let deserialized_default_config: Map = serde_json::from_reader(default_config_file)?; - // Store the pointers separately from the default values. The pointers will receive a value // only at the end of the process. let (default_config_map, pointers_map) = split_pointers_map(deserialized_default_config); diff --git a/crates/papyrus_node/src/bin/central_source_integration_test.rs b/crates/papyrus_node/src/bin/central_source_integration_test.rs index 10da36ce31..7649a8ab41 100644 --- a/crates/papyrus_node/src/bin/central_source_integration_test.rs +++ b/crates/papyrus_node/src/bin/central_source_integration_test.rs @@ -17,6 +17,7 @@ async fn main() { let _ = fs::remove_dir_all(path.clone()); fs::create_dir_all(path.clone()).expect("Should make a temporary `data` directory"); let config = NodeConfig::load_and_process(vec![ + "Placeholder-binary-name".to_owned(), "--chain_id=SN_SEPOLIA".to_owned(), "--starknet_url=https://alpha-sepolia.starknet.io/".to_owned(), "--base_layer.node_url=https://mainnet.infura.io/v3/1234".to_owned(), diff --git a/crates/papyrus_node/src/config/config_test.rs b/crates/papyrus_node/src/config/config_test.rs index 218971cf7a..9fa01f695f 100644 --- a/crates/papyrus_node/src/config/config_test.rs +++ b/crates/papyrus_node/src/config/config_test.rs @@ -64,10 +64,10 @@ fn required_args() -> Vec { args } -fn get_args(additional_args: Vec<&str>) -> Vec { +fn get_args(additional_args: impl IntoIterator) -> Vec { let mut args = vec!["Papyrus".to_owned()]; - args.append(&mut required_args()); - args.append(&mut additional_args.into_iter().map(|s| s.to_owned()).collect()); + args.extend(required_args()); + args.extend(additional_args.into_iter().map(|s| s.to_string())); args } @@ -75,12 +75,18 @@ fn get_args(additional_args: Vec<&str>) -> Vec { fn load_default_config() { env::set_current_dir(resolve_project_relative_path("").unwrap()) .expect("Couldn't set working dir."); - NodeConfig::load_and_process(get_args(vec![])).expect("Failed to load the config."); + NodeConfig::load_and_process(get_args(["--chain_id", "SN_MAIN"])) + .expect("Failed to load the config."); } #[test] fn load_http_headers() { - let args = get_args(vec!["--central.http_headers", "NAME_1:VALUE_1 NAME_2:VALUE_2"]); + let args = get_args([ + "--central.http_headers", + "NAME_1:VALUE_1 NAME_2:VALUE_2", + "--chain_id", + "SN_MAIN", + ]); env::set_current_dir(resolve_project_relative_path("").unwrap()) .expect("Couldn't set working dir."); let config = NodeConfig::load_and_process(args).unwrap(); @@ -113,12 +119,17 @@ fn test_dump_default_config() { fn test_default_config_process() { env::set_current_dir(resolve_project_relative_path("").unwrap()) .expect("Couldn't set working dir."); - assert_eq!(NodeConfig::load_and_process(get_args(vec![])).unwrap(), NodeConfig::default()); + assert_eq!( + NodeConfig::load_and_process(get_args(["--chain_id", "SN_MAIN"])).unwrap(), + NodeConfig::default() + ); } #[test] fn test_update_dumped_config_by_command() { - let args = get_args(vec![ + let args = get_args([ + "--chain_id", + "SN_MAIN", "--central.retry_config.retry_max_delay_millis", "1234", "--storage.db_config.path_prefix", diff --git a/crates/papyrus_node/src/config/pointers.rs b/crates/papyrus_node/src/config/pointers.rs index d6ec67520a..56a89fce08 100644 --- a/crates/papyrus_node/src/config/pointers.rs +++ b/crates/papyrus_node/src/config/pointers.rs @@ -18,6 +18,7 @@ use papyrus_config::dumping::{ append_sub_config_name, ser_optional_sub_config, ser_pointer_target_param, + ser_pointer_target_required_param, set_pointing_param_paths, ConfigPointers, Pointers, @@ -26,7 +27,7 @@ use papyrus_config::dumping::{ use papyrus_config::loading::load_and_process_config; #[cfg(not(feature = "rpc"))] use papyrus_config::ParamPrivacyInput; -use papyrus_config::{ConfigError, ParamPath, SerializedParam}; +use papyrus_config::{ConfigError, ParamPath, SerializationType, SerializedParam}; use papyrus_monitoring_gateway::MonitoringGatewayConfig; use papyrus_network::NetworkConfig; use papyrus_p2p_sync::client::{P2pSyncClient, P2pSyncClientConfig}; @@ -51,9 +52,9 @@ use crate::version::VERSION_FULL; pub static CONFIG_POINTERS: LazyLock = LazyLock::new(|| { vec![ ( - ser_pointer_target_param( + ser_pointer_target_required_param( "chain_id", - &ChainId::Mainnet, + SerializationType::String, "The chain to follow. For more details see https://docs.starknet.io/documentation/architecture_and_concepts/Blocks/transactions/#chain-id.", ), set_pointing_param_paths(&[ diff --git a/crates/papyrus_storage/src/db/mod.rs b/crates/papyrus_storage/src/db/mod.rs index e7785226c6..fee25f5d11 100644 --- a/crates/papyrus_storage/src/db/mod.rs +++ b/crates/papyrus_storage/src/db/mod.rs @@ -76,6 +76,7 @@ impl Default for DbConfig { fn default() -> Self { DbConfig { path_prefix: PathBuf::from("./data"), + // TODO(guyn): should we remove the default for chain_id? chain_id: ChainId::Mainnet, enforce_file_exists: false, min_size: 1 << 20, // 1MB diff --git a/crates/starknet_integration_tests/src/flow_test_setup.rs b/crates/starknet_integration_tests/src/flow_test_setup.rs index 3b93be6702..2fc7cf450f 100644 --- a/crates/starknet_integration_tests/src/flow_test_setup.rs +++ b/crates/starknet_integration_tests/src/flow_test_setup.rs @@ -15,6 +15,7 @@ use papyrus_storage::StorageConfig; use starknet_api::rpc_transaction::RpcTransaction; use starknet_api::transaction::TransactionHash; use starknet_consensus_manager::config::ConsensusManagerConfig; +use starknet_consensus_manager::consensus_manager::CONSENSUS_PROPOSALS_TOPIC; use starknet_gateway_types::errors::GatewaySpecError; use starknet_http_server::config::HttpServerConfig; use starknet_http_server::test_utils::HttpTestClient; @@ -202,9 +203,7 @@ pub fn create_consensus_manager_configs_and_channels( let channels_network_config = network_configs.pop().unwrap(); let broadcast_channels = network_config_into_broadcast_channels( channels_network_config, - papyrus_network::gossipsub_impl::Topic::new( - starknet_consensus_manager::consensus_manager::CONSENSUS_PROPOSALS_TOPIC, - ), + papyrus_network::gossipsub_impl::Topic::new(CONSENSUS_PROPOSALS_TOPIC), ); let n_network_configs = network_configs.len();