11use std:: fmt:: { Display , Formatter , Result } ;
2- use std:: fs:: read_to_string;
32use std:: path:: PathBuf ;
43
5- use alloy:: primitives:: Address as EthereumContractAddress ;
64use apollo_http_server_config:: config:: HTTP_SERVER_PORT ;
7- use apollo_infra_utils:: template:: Template ;
85use apollo_monitoring_endpoint_config:: config:: MONITORING_ENDPOINT_DEFAULT_PORT ;
96use serde:: { Deserialize , Serialize } ;
10- use serde_json:: from_str;
11- use starknet_api:: block:: BlockNumber ;
12- use starknet_api:: core:: ContractAddress ;
137use strum:: { EnumDiscriminants , EnumIter , IntoEnumIterator } ;
14- use strum_macros:: { Display , EnumString } ;
15- use url:: Url ;
8+ use strum_macros:: Display ;
169
17- use crate :: addresses:: PEER_IDS ;
18- use crate :: deployment:: { Deployment , P2PCommunicationType } ;
10+ use crate :: deployment:: Deployment ;
1911use crate :: deployment_definitions:: testing:: system_test_deployments;
2012#[ cfg( test) ]
2113#[ path = "deployment_definitions_test.rs" ]
@@ -46,55 +38,6 @@ pub(crate) const DEPLOYMENT_CONFIG_DIR_NAME: &str = "deployments/";
4638
4739const BASE_APP_CONFIGS_DIR_PATH : & str = "crates/apollo_deployments/resources/app_configs" ;
4840
49- pub ( crate ) type NodeAndValidatorId = ( usize , String ) ;
50-
51- #[ derive( Debug , Deserialize ) ]
52- pub struct DeploymentInputs {
53- pub node_and_validator_ids : Vec < NodeAndValidatorId > ,
54- pub num_validators : usize ,
55- pub http_server_ingress_alternative_name : String ,
56- pub ingress_domain : String ,
57- pub secret_name_format : Template ,
58- pub node_namespace_format : Template ,
59- pub starknet_contract_address : EthereumContractAddress ,
60- pub chain_id_string : String ,
61- pub eth_fee_token_address : ContractAddress ,
62- pub starknet_gateway_url : Url ,
63- pub strk_fee_token_address : ContractAddress ,
64- pub l1_startup_height_override : Option < BlockNumber > ,
65- pub state_sync_type : StateSyncType ,
66- pub p2p_communication_type : P2PCommunicationType ,
67- pub deployment_environment : Environment ,
68- pub requires_k8s_service_config_params : bool ,
69- pub audited_libfuncs_only : bool ,
70- pub http_server_port : u16 ,
71- pub monitoring_endpoint_config_port : u16 ,
72- pub state_sync_config_rpc_config_port : u16 ,
73- pub mempool_p2p_config_network_config_port : u16 ,
74- pub consensus_manager_config_network_config_port : u16 ,
75- }
76-
77- impl DeploymentInputs {
78- pub fn load_from_file ( path : PathBuf ) -> DeploymentInputs {
79- // Read the file into a string
80- let data = read_to_string ( path) . expect ( "Failed to read deployment input JSON file" ) ;
81-
82- // Parse JSON into the DeploymentInputs struct
83- let deployment_inputs: Self =
84- from_str ( & data) . expect ( "Should be able to parse deployment input JSON" ) ;
85-
86- for ( node_id, _) in & deployment_inputs. node_and_validator_ids {
87- assert ! (
88- * node_id < PEER_IDS . len( ) ,
89- "Node node_id {node_id} exceeds the number of nodes {}" ,
90- PEER_IDS . len( )
91- ) ;
92- }
93-
94- deployment_inputs
95- }
96- }
97-
9841#[ derive( Clone , Debug , PartialEq , Serialize , Deserialize ) ]
9942#[ serde( untagged) ]
10043pub enum Environment {
@@ -110,16 +53,6 @@ impl Display for Environment {
11053 }
11154}
11255
113- #[ derive( EnumString , Clone , Display , PartialEq , Debug , Serialize , Deserialize ) ]
114- #[ strum( serialize_all = "snake_case" ) ]
115- pub enum CloudK8sEnvironment {
116- Mainnet ,
117- SepoliaIntegration ,
118- SepoliaTestnet ,
119- #[ strum( serialize = "upgrade_test" ) ]
120- UpgradeTest ,
121- }
122-
12356impl Environment {
12457 pub fn env_dir_path ( & self ) -> PathBuf {
12558 let env_str = match self {
0 commit comments