Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement : Refactor Settings #106

Merged
merged 8 commits into from
Sep 9, 2024
Merged

Enhancement : Refactor Settings #106

merged 8 commits into from
Sep 9, 2024

Conversation

ocdbytes
Copy link
Member

@ocdbytes ocdbytes commented Sep 3, 2024

@ocdbytes ocdbytes changed the title Enhancement : Refactor Settings [In Progress] Enhancement : Refactor Settings Sep 3, 2024
@coveralls
Copy link

coveralls commented Sep 3, 2024

Coverage Status

coverage: 64.908% (+0.4%) from 64.485%
when pulling 5185ccc on refactor/settings
into 145df8e on main.

@ocdbytes ocdbytes changed the title [In Progress] Enhancement : Refactor Settings Enhancement : Refactor Settings Sep 5, 2024
pub struct EthereumDaConfig {
pub rpc_url: String,
pub memory_pages_contract: String,
pub private_key: String,
}

#[async_trait]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we actually did this before but then later in the celestia PR we realised that we wanted it to be async and this was the better way to do it, over here #46

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this to be async ? this is config which should not be an async operation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in celestia it wasn't possible to do it sync, can you check with @heemankv once?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me check

@@ -37,3 +45,14 @@ impl DaClient for EthereumDaClient {
131072
}
}

impl EthereumDaClient {
pub fn new_with_settings(settings: &impl Settings) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should restore the build_client one as mentioned above

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crates/orchestrator/src/alerts/aws_sns/mod.rs Show resolved Hide resolved
crates/orchestrator/src/data_storage/aws_s3/mod.rs Outdated Show resolved Hide resolved
/// using the settings provider. More providers can be added eg : GCP, AZURE etc.
pub enum ProviderConfig {
AWS(Box<SdkConfig>),
INVALID,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abhi code me jha pr me match kr rha hu providerconfig ko vha pr I need to handle the other cases with a panic. so when it was alone AWS it was giving code unreachable error. So that's why added this enum temporarily.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's not the correct design. you don't need add another enum so that you can panic. if there was only AWS over here, the user couldn't pass anything else, the code won't compile so there's no issue

/// `ProviderConfig` is an enum used to represent the global config built
/// using the settings provider. More providers can be added eg : GCP, AZURE etc.
pub enum ProviderConfig {
AWS(Box<SdkConfig>),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why box here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clippy. error aa rha tha

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sdk config ka size kaafi bda h.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intersting, can you comment that?

let settlement_client = build_settlement_client(&settings_provider).await;
let prover_client = build_prover_service(&settings_provider);
let storage_client =
build_storage_client(&settings_provider, ProviderConfig::AWS(Box::new(aws_config.clone()))).await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could use Arc

Copy link
Member

@akhercha akhercha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ocdbytes ocdbytes merged commit 764c4fa into main Sep 9, 2024
8 checks passed
@ocdbytes ocdbytes deleted the refactor/settings branch September 9, 2024 09:31
ocdbytes added a commit that referenced this pull request Oct 16, 2024
* feat : added settings

* changelog

* feat : added env settings fucntion

* feat : updated settings module implementation

* feat : updated provider config

* feat : added arc for aws config

* chore : refactoring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants