-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
ocdbytes
commented
Sep 3, 2024
- Issue : feat: refactor settings #17
pub struct EthereumDaConfig { | ||
pub rpc_url: String, | ||
pub memory_pages_contract: String, | ||
pub private_key: String, | ||
} | ||
|
||
#[async_trait] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crates/orchestrator/src/config.rs
Outdated
/// using the settings provider. More providers can be added eg : GCP, AZURE etc. | ||
pub enum ProviderConfig { | ||
AWS(Box<SdkConfig>), | ||
INVALID, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
crates/orchestrator/src/config.rs
Outdated
/// `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>), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why box here?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
crates/orchestrator/src/config.rs
Outdated
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could use Arc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* 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