From 5922af60337e5672a82f3215c7cf6938652070f5 Mon Sep 17 00:00:00 2001 From: Apoorv Sadana <95699312+apoorvsadana@users.noreply.github.com> Date: Wed, 9 Oct 2024 23:10:50 +0530 Subject: [PATCH] refactor env (#145) * refactor env * added changelog * add back aws endpoint for test env --------- Co-authored-by: Heemank Verma --- .env.example | 12 ++++++++++-- .env.test | 11 ++++++----- CHANGELOG.md | 1 + crates/da-clients/ethereum/src/config.rs | 8 +------- crates/prover-services/sharp-service/src/config.rs | 2 +- e2e-tests/tests.rs | 2 +- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.env.example b/.env.example index b4f888ad..09157c04 100644 --- a/.env.example +++ b/.env.example @@ -8,7 +8,10 @@ PORT= AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_REGION= -AWS_ENDPOINT_URL= + +##### Omniqueue ##### + +AWS_DEFAULT_REGION="localhost" ##### STORAGE ##### @@ -23,6 +26,11 @@ SQS_JOB_VERIFICATION_QUEUE_URL= SQS_JOB_HANDLE_FAILURE_QUEUE_URL= SQS_WORKER_TRIGGER_QUEUE_URL= +##### SNS ##### + +ALERTS="sns" +AWS_SNS_ARN="arn:aws:sns:us-east-1:000000000000:madara-orchestrator-arn" + ##### DATABASE ##### DATABASE= @@ -44,7 +52,7 @@ DA_LAYER= SETTLEMENT_LAYER= SETTLEMENT_RPC_URL= MADARA_RPC_URL= -MEMORY_PAGES_CONTRACT_ADDRESS= +GPS_VERIFIER_CONTRACT_ADDRESS= PRIVATE_KEY= ETHEREUM_PRIVATE_KEY= L1_CORE_CONTRACT_ADDRESS= diff --git a/.env.test b/.env.test index 99815845..eb6f0c5a 100644 --- a/.env.test +++ b/.env.test @@ -8,7 +8,6 @@ PORT=3000 AWS_ACCESS_KEY_ID="AWS_ACCESS_KEY_ID" AWS_SECRET_ACCESS_KEY="AWS_SECRET_ACCESS_KEY" AWS_REGION="us-east-1" -AWS_ENDPOINT_URL="http://localhost.localstack.cloud:4566" ##### Omniqueue ##### @@ -31,7 +30,6 @@ SQS_WORKER_TRIGGER_QUEUE_URL="http://sqs.us-east-1.localhost.localstack.cloud:45 ALERTS="sns" AWS_SNS_ARN="arn:aws:sns:us-east-1:000000000000:madara-orchestrator-arn" -AWS_SNS_ARN_NAME="madara-orchestrator-arn" ##### DATABASE ##### @@ -55,7 +53,7 @@ DA_LAYER="ethereum" SETTLEMENT_LAYER="ethereum" SETTLEMENT_RPC_URL="https://eth-sepolia.public.blastapi.io" MADARA_RPC_URL="" -MEMORY_PAGES_CONTRACT_ADDRESS="0x07ec0D28e50322Eb0C159B9090ecF3aeA8346DFe" +GPS_VERIFIER_CONTRACT_ADDRESS="0x07ec0D28e50322Eb0C159B9090ecF3aeA8346DFe" ETHEREUM_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" L1_CORE_CONTRACT_ADDRESS="0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057" @@ -64,10 +62,9 @@ L1_CORE_CONTRACT_ADDRESS="0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057" RPC_FOR_SNOS="" -##### STARKNET SETTLEMENT TEST ##### +##### STARKNET SETTLEMENT ##### STARKNET_PRIVATE_KEY=0x76f2ccdb23f29bc7b69278e947c01c6160a31cf02c19d06d0f6e5ab1d768b86 STARKNET_ACCOUNT_ADDRESS=0x3bb306a004034dba19e6cf7b161e7a4fef64bc1078419e8ad1876192f0b8cd1 -MADARA_BINARY_PATH="/path/to/madara" ## Instrumentation OTEL_SERVICE_NAME="madara_orchestrator" @@ -75,3 +72,7 @@ OTEL_SERVICE_NAME="madara_orchestrator" ##### Tests ##### STARKNET_OPERATOR_ADDRESS="0x5b98B836969A60FEC50Fa925905Dd1D382a7db43" +AWS_SNS_ARN_NAME="madara-orchestrator-arn" +MADARA_BINARY_PATH="/path/to/madara" +# pick up by AWS sdk +AWS_ENDPOINT_URL="http://localhost.localstack.cloud:4566" \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 49a9b1ce..375af158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## Changed +- cleaned .env.example and .env.test files - bumped snos and downgraded rust to match SNOS rust version - Bumped dependencies, and associated api changes done - ethereum DA client builder diff --git a/crates/da-clients/ethereum/src/config.rs b/crates/da-clients/ethereum/src/config.rs index 0627d824..f5fa9d86 100644 --- a/crates/da-clients/ethereum/src/config.rs +++ b/crates/da-clients/ethereum/src/config.rs @@ -12,17 +12,11 @@ use crate::EthereumDaClient; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct EthereumDaConfig { pub rpc_url: String, - pub memory_pages_contract: String, - pub private_key: String, } impl EthereumDaConfig { pub fn new_with_settings(settings: &impl Settings) -> color_eyre::Result { - Ok(Self { - rpc_url: settings.get_settings_or_panic("SETTLEMENT_RPC_URL"), - memory_pages_contract: settings.get_settings_or_panic("MEMORY_PAGES_CONTRACT_ADDRESS"), - private_key: settings.get_settings_or_panic("ETHEREUM_PRIVATE_KEY"), - }) + Ok(Self { rpc_url: settings.get_settings_or_panic("SETTLEMENT_RPC_URL") }) } pub async fn build_client(&self) -> EthereumDaClient { diff --git a/crates/prover-services/sharp-service/src/config.rs b/crates/prover-services/sharp-service/src/config.rs index 2e17b806..475dee2d 100644 --- a/crates/prover-services/sharp-service/src/config.rs +++ b/crates/prover-services/sharp-service/src/config.rs @@ -19,7 +19,7 @@ impl SharpConfig { Ok(Self { service_url: settings.get_settings_or_panic("SHARP_URL").parse().unwrap(), rpc_node_url: settings.get_settings_or_panic("SETTLEMENT_RPC_URL").parse().unwrap(), - verifier_address: settings.get_settings_or_panic("MEMORY_PAGES_CONTRACT_ADDRESS").parse().unwrap(), + verifier_address: settings.get_settings_or_panic("GPS_VERIFIER_CONTRACT_ADDRESS").parse().unwrap(), }) } } diff --git a/e2e-tests/tests.rs b/e2e-tests/tests.rs index 970e7275..7d184eb0 100644 --- a/e2e-tests/tests.rs +++ b/e2e-tests/tests.rs @@ -91,7 +91,7 @@ impl Setup { // Anvil.addresses[0] env_vec .push(("STARKNET_OPERATOR_ADDRESS".to_string(), "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266".to_string())); - env_vec.push(("MEMORY_PAGES_CONTRACT_ADDRESS".to_string(), verifier_contract_address.to_string())); + env_vec.push(("GPS_VERIFIER_CONTRACT_ADDRESS".to_string(), verifier_contract_address.to_string())); env_vec.push(("L1_CORE_CONTRACT_ADDRESS".to_string(), starknet_core_contract_address.to_string())); Self { mongo_db_instance, starknet_client, sharp_client, env_vector: env_vec, localstack_instance }