Skip to content

Commit

Permalink
update: env vars renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
heemankv committed Nov 7, 2024
1 parent 3fc6d65 commit c7e5522
Show file tree
Hide file tree
Showing 17 changed files with 108 additions and 122 deletions.
140 changes: 67 additions & 73 deletions .env.test

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/orchestrator/src/cli/alert/aws_sns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ pub struct AWSSNSCliArgs {
pub aws_sns: bool,

/// The name of the S3 bucket.
#[arg(env = "SNS_NAME", long, default_value = Some("madara-orchestrator-arn"))]
#[arg(env = "MADARA_ORCHESTRATOR_AWS_SNS_ARN", long, default_value = Some("madara-orchestrator-arn"))]
pub sns_arn: Option<String>,
}
8 changes: 6 additions & 2 deletions crates/orchestrator/src/cli/aws_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ pub struct AWSConfigParams {
pub aws_region: String,

/// The endpoint URL.
#[arg(env = "AWS_ENDPOINT_URL", long, default_value = "http://localhost.localstack.cloud:4566")]
#[arg(
env = "MADARA_ORCHESTRATOR_AWS_ENDPOINT_URL",
long,
default_value = "http://localhost.localstack.cloud:4566"
)]
pub aws_endpoint_url: String,

/// The default region.
#[arg(env = "AWS_DEFAULT_REGION", long, default_value = "localhost")]
#[arg(env = "MADARA_ORCHESTRATOR_AWS_DEFAULT_REGION", long, default_value = "localhost")]
pub aws_default_region: String,
}
2 changes: 1 addition & 1 deletion crates/orchestrator/src/cli/da/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ pub struct EthereumDaCliArgs {
pub da_on_ethereum: bool,

/// The RPC URL of the Ethereum node.
#[arg(env = "DA_RPC_URL", long)]
#[arg(env = "MADARA_ORCHESTRATOR_ETHEREUM_DA_RPC_URL", long)]
pub da_rpc_url: Option<Url>,
}
4 changes: 2 additions & 2 deletions crates/orchestrator/src/cli/database/mongodb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ pub struct MongoDBCliArgs {
pub mongodb: bool,

/// The connection string to the MongoDB server.
#[arg(env = "MONGODB_CONNECTION_URL", long, default_value = Some("mongodb://localhost:27017"))]
#[arg(env = "MADARA_ORCHESTRATOR_MONGODB_CONNECTION_URL", long, default_value = Some("mongodb://localhost:27017"))]
pub connection_url: Option<String>,

/// The name of the database.
#[arg(env = "DATABASE_NAME", long, default_value = Some("orchestrator"))]
#[arg(env = "MADARA_ORCHESTRATOR_DATABASE_NAME", long, default_value = Some("orchestrator"))]
pub database_name: Option<String>,
}
1 change: 0 additions & 1 deletion crates/orchestrator/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ impl RunCmd {
sharp_url: self.sharp_args.sharp_url.clone().unwrap(),
sharp_user_crt: self.sharp_args.sharp_user_crt.clone().unwrap(),
sharp_user_key: self.sharp_args.sharp_user_key.clone().unwrap(),
sharp_rpc_node_url: self.sharp_args.sharp_rpc_node_url.clone().unwrap(),
sharp_proof_layout: self.sharp_args.sharp_proof_layout.clone().unwrap(),
gps_verifier_contract_address: self.sharp_args.gps_verifier_contract_address.clone().unwrap(),
sharp_server_crt: self.sharp_args.sharp_server_crt.clone().unwrap(),
Expand Down
20 changes: 8 additions & 12 deletions crates/orchestrator/src/cli/prover/sharp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,38 @@ use url::Url;

/// Parameters used to config Sharp.
#[derive(Debug, Clone, Args)]
#[group(requires_all = ["sharp_customer_id", "sharp_url", "sharp_user_crt", "sharp_user_key", "sharp_rpc_node_url"])]
#[group(requires_all = ["sharp_customer_id", "sharp_url", "sharp_user_crt", "sharp_user_key", "sharp_server_crt", "sharp_proof_layout", "gps_verifier_contract_address"])]
pub struct SharpCliArgs {
/// Use the Sharp prover.
#[arg(long)]
pub sharp: bool,

/// The customer id for Sharp.
#[arg(env = "SHARP_CUSTOMER_ID", long)]
#[arg(env = "MADARA_ORCHESTRATOR_SHARP_CUSTOMER_ID", long)]
pub sharp_customer_id: Option<String>,

/// The URL of the Sharp server.
#[arg(env = "SHARP_URL", long)]
#[arg(env = "MADARA_ORCHESTRATOR_SHARP_URL", long)]
pub sharp_url: Option<Url>,

/// The user certificate for Sharp.
#[arg(env = "SHARP_USER_CRT", long)]
#[arg(env = "MADARA_ORCHESTRATOR_SHARP_USER_CRT", long)]
pub sharp_user_crt: Option<String>,

/// The user key for Sharp.
#[arg(env = "SHARP_USER_KEY", long)]
#[arg(env = "MADARA_ORCHESTRATOR_SHARP_USER_KEY", long)]
pub sharp_user_key: Option<String>,

/// The RPC node URL for Sharp.
#[arg(env = "SHARP_RPC_NODE_URL", long)]
pub sharp_rpc_node_url: Option<Url>,

/// The server certificate for Sharp.
#[arg(env = "SHARP_SERVER_CRT", long)]
#[arg(env = "MADARA_ORCHESTRATOR_SHARP_SERVER_CRT", long)]
pub sharp_server_crt: Option<String>,

/// The proof layout for Sharp.
#[arg(env = "SHARP_PROOF_LAYOUT", long, default_value = "small")]
#[arg(env = "MADARA_ORCHESTRATOR_SHARP_PROOF_LAYOUT", long, default_value = "small")]
pub sharp_proof_layout: Option<String>,

// TODO: GPS is a direct dependency of Sharp, hence GPS can be kept in SharpParams
/// The GPS verifier contract address.
#[arg(env = "GPS_VERIFIER_CONTRACT_ADDRESS", long)]
#[arg(env = "MADARA_ORCHESTRATOR_GPS_VERIFIER_CONTRACT_ADDRESS", long)]
pub gps_verifier_contract_address: Option<String>,
}
6 changes: 3 additions & 3 deletions crates/orchestrator/src/cli/queue/aws_sqs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ pub struct AWSSQSCliArgs {
pub aws_sqs: bool,

/// The name of the S3 bucket.
#[arg(env = "SQS_PREFIX", long, default_value = Some("madara_orchestrator"))]
#[arg(env = "MADARA_ORCHESTRATOR_SQS_PREFIX", long, default_value = Some("madara_orchestrator"))]
pub sqs_prefix: Option<String>,

/// The suffix of the queue.
#[arg(env = "SQS_SUFFIX", long, default_value = Some("queue"))]
#[arg(env = "MADARA_ORCHESTRATOR_SQS_SUFFIX", long, default_value = Some("queue"))]
pub sqs_suffix: Option<String>,

/// The QUEUE url
#[arg(env = "SQS_BASE_QUEUE_URL", long)]
#[arg(env = "MADARA_ORCHESTRATOR_SQS_BASE_QUEUE_URL", long)]
pub queue_base_url: Option<String>,
}
4 changes: 2 additions & 2 deletions crates/orchestrator/src/cli/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use clap::Args;
#[group(requires_all = ["host", "port"])]
pub struct ServerCliArgs {
/// The host to listen on.
#[arg(env = "HOST", long, default_value = "127.0.0.1")]
#[arg(env = "MADARA_ORCHESTRATOR_HOST", long, default_value = "127.0.0.1")]
pub host: String,

/// The port to listen on.
#[arg(env = "PORT", long, default_value = "3000")]
#[arg(env = "MADARA_ORCHESTRATOR_PORT", long, default_value = "3000")]
pub port: u16,
}
4 changes: 2 additions & 2 deletions crates/orchestrator/src/cli/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use clap::Args;
#[group(requires_all = ["rpc_for_snos"])]
pub struct ServiceCliArgs {
/// The maximum block to process.
#[arg(env = "MAX_BLOCK_TO_PROCESS", long)]
#[arg(env = "MADARA_ORCHESTRATOR_MAX_BLOCK_NO_TO_PROCESS", long)]
pub max_block_to_process: Option<u64>,

/// The minimum block to process.
#[arg(env = "MIN_BLOCK_TO_PROCESS", long)]
#[arg(env = "MADARA_ORCHESTRATOR_MIN_BLOCK_NO_TO_PROCESS", long)]
pub min_block_to_process: Option<u64>,
}
8 changes: 4 additions & 4 deletions crates/orchestrator/src/cli/settlement/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ pub struct EthereumSettlementCliArgs {
pub settle_on_ethereum: bool,

/// The URL of the Ethereum RPC node.
#[arg(env = "ETHEREUM_SETTLEMENT_RPC_URL", long)]
#[arg(env = "MADARA_ORCHESTRATOR_ETHEREUM_SETTLEMENT_RPC_URL", long)]
pub ethereum_rpc_url: Option<Url>,

/// The private key of the Ethereum account.
#[arg(env = "ETHEREUM_PRIVATE_KEY", long)]
#[arg(env = "MADARA_ORCHESTRATOR_ETHEREUM_PRIVATE_KEY", long)]
pub ethereum_private_key: Option<String>,

/// The address of the L1 core contract.
#[arg(env = "L1_CORE_CONTRACT_ADDRESS", long)]
#[arg(env = "MADARA_ORCHESTRATOR_L1_CORE_CONTRACT_ADDRESS", long)]
pub l1_core_contract_address: Option<String>,

/// The address of the Starknet operator.
#[arg(env = "STARKNET_OPERATOR_ADDRESS", long)]
#[arg(env = "MADARA_ORCHESTRATOR_STARKNET_OPERATOR_ADDRESS", long)]
pub starknet_operator_address: Option<String>,
}
12 changes: 6 additions & 6 deletions crates/orchestrator/src/cli/settlement/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ pub struct StarknetSettlementCliArgs {
pub settle_on_starknet: bool,

/// The URL of the Ethereum RPC node.
#[arg(env = "STARKNET_RPC_URL", long)]
#[arg(env = "MADARA_ORCHESTRATOR_STARKNET_SETTLEMENT_RPC_URL", long)]
pub starknet_rpc_url: Option<Url>,

/// The private key of the Ethereum account.
#[arg(env = "STARKNET_PRIVATE_KEY", long)]
#[arg(env = "MADARA_ORCHESTRATOR_STARKNET_PRIVATE_KEY", long)]
pub starknet_private_key: Option<String>,

/// The address of the Starknet account.
#[arg(env = "STARKNET_ACCOUNT_ADDRESS", long)]
#[arg(env = "MADARA_ORCHESTRATOR_STARKNET_ACCOUNT_ADDRESS", long)]
pub starknet_account_address: Option<String>,

/// The address of the Cairo core contract.
#[arg(env = "STARKNET_CAIRO_CORE_CONTRACT_ADDRESS", long)]
#[arg(env = "MADARA_ORCHESTRATOR_STARKNET_CAIRO_CORE_CONTRACT_ADDRESS", long)]
pub starknet_cairo_core_contract_address: Option<String>,

/// The number of seconds to wait for finality.
#[arg(env = "STARKNET_FINALITY_RETRY_WAIT_IN_SECS", long)]
#[arg(env = "MADARA_ORCHESTRATOR_STARKNET_FINALITY_RETRY_WAIT_IN_SECS", long)]
pub starknet_finality_retry_wait_in_secs: Option<u64>,

/// The path to the Madara binary.
#[arg(env = "MADARA_BINARY_PATH", long)]
#[arg(env = "MADARA_ORCHESTRATOR_MADARA_BINARY_PATH", long)]
pub madara_binary_path: Option<String>,
}
2 changes: 1 addition & 1 deletion crates/orchestrator/src/cli/snos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use url::Url;
#[group(requires_all = ["rpc_for_snos"])]
pub struct SNOSCliArgs {
/// The RPC URL for SNOS.
#[arg(env = "RPC_FOR_SNOS", long)]
#[arg(env = "MADARA_ORCHESTRATOR_RPC_FOR_SNOS", long)]
pub rpc_for_snos: Url,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/orchestrator/src/cli/storage/aws_s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ pub struct AWSS3CliArgs {
pub aws_s3: bool,

/// The name of the S3 bucket.
#[arg(env = "AWS_S3_BUCKET_NAME", long, default_value = Some("madara-orchestrator-bucket"))]
#[arg(env = "MADARA_ORCHESTRATOR_AWS_S3_BUCKET_NAME", long, default_value = Some("madara-orchestrator-bucket"))]
pub bucket_name: Option<String>,
}
1 change: 0 additions & 1 deletion crates/prover-services/sharp-service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub struct SharpParams {
pub sharp_url: Url,
pub sharp_user_crt: String,
pub sharp_user_key: String,
pub sharp_rpc_node_url: Url,
pub sharp_server_crt: String,
pub sharp_proof_layout: String,
pub gps_verifier_contract_address: String,
Expand Down
12 changes: 4 additions & 8 deletions crates/prover-services/sharp-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,8 @@ impl SharpProverService {

pub fn new_with_settings(sharp_params: &SharpParams) -> Self {
let sharp_client = SharpClient::new_with_settings(sharp_params.sharp_url.clone(), sharp_params);
let fact_checker = FactChecker::new(
sharp_params.sharp_rpc_node_url.clone(),
sharp_params.gps_verifier_contract_address.clone(),
);
let fact_checker =
FactChecker::new(sharp_params.sharp_url.clone(), sharp_params.gps_verifier_contract_address.clone());
Self::new(sharp_client, fact_checker)
}

Expand All @@ -147,10 +145,8 @@ impl SharpProverService {
format!("http://127.0.0.1:{}", port).parse().expect("Failed to create sharp client with the given params"),
sharp_params,
);
let fact_checker = FactChecker::new(
sharp_params.sharp_rpc_node_url.clone(),
sharp_params.gps_verifier_contract_address.clone(),
);
let fact_checker =
FactChecker::new(sharp_params.sharp_url.clone(), sharp_params.gps_verifier_contract_address.clone());
Self::new(sharp_client, fact_checker)
}
}
2 changes: 0 additions & 2 deletions crates/prover-services/sharp-service/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ async fn prover_client_submit_task_works() {
sharp_url: Url::parse(&get_env_var_or_panic("SHARP_URL")).unwrap(),
sharp_user_crt: get_env_var_or_panic("SHARP_USER_CRT"),
sharp_user_key: get_env_var_or_panic("SHARP_USER_KEY"),
sharp_rpc_node_url: Url::parse(&get_env_var_or_panic("SHARP_RPC_NODE_URL")).unwrap(),
sharp_server_crt: get_env_var_or_panic("SHARP_SERVER_CRT"),
sharp_proof_layout: get_env_var_or_panic("SHARP_PROOF_LAYOUT"),
gps_verifier_contract_address: get_env_var_or_panic("GPS_VERIFIER_CONTRACT_ADDRESS"),
Expand Down Expand Up @@ -71,7 +70,6 @@ async fn prover_client_get_task_status_works(#[case] cairo_job_status: CairoJobS
sharp_url: Url::parse(&get_env_var_or_panic("SHARP_URL")).unwrap(),
sharp_user_crt: get_env_var_or_panic("SHARP_USER_CRT"),
sharp_user_key: get_env_var_or_panic("SHARP_USER_KEY"),
sharp_rpc_node_url: Url::parse(&get_env_var_or_panic("SHARP_RPC_NODE_URL")).unwrap(),
sharp_server_crt: get_env_var_or_panic("SHARP_SERVER_CRT"),
sharp_proof_layout: get_env_var_or_panic("SHARP_PROOF_LAYOUT"),
gps_verifier_contract_address: get_env_var_or_panic("GPS_VERIFIER_CONTRACT_ADDRESS"),
Expand Down

0 comments on commit c7e5522

Please sign in to comment.