Skip to content

Commit

Permalink
refactor env (#145)
Browse files Browse the repository at this point in the history
* refactor env

* added changelog

* add back aws endpoint for test env

---------

Co-authored-by: Heemank Verma <[email protected]>
  • Loading branch information
apoorvsadana and heemankv authored Oct 9, 2024
1 parent 63e4fa1 commit 5922af6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
12 changes: 10 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ PORT=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=
AWS_ENDPOINT_URL=

##### Omniqueue #####

AWS_DEFAULT_REGION="localhost"

##### STORAGE #####

Expand All @@ -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=
Expand All @@ -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=
Expand Down
11 changes: 6 additions & 5 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 #####

Expand All @@ -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 #####

Expand All @@ -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"

Expand All @@ -64,14 +62,17 @@ 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"

##### 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"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions crates/da-clients/ethereum/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self> {
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 {
Expand Down
2 changes: 1 addition & 1 deletion crates/prover-services/sharp-service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
})
}
}
2 changes: 1 addition & 1 deletion e2e-tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 5922af6

Please sign in to comment.