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

fix(katana): merge ServerOptions #3047

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions crates/katana/cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,7 @@ impl NodeArgs {

#[cfg(feature = "server")]
{
if self.server == ServerOptions::default() {
if let Some(server) = config.server {
self.server = server;
}
}
self.server.merge(config.server.as_ref());

if self.metrics == MetricsOptions::default() {
if let Some(metrics) = config.metrics {
Expand Down
38 changes: 38 additions & 0 deletions crates/katana/cli/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,44 @@ impl Default for ServerOptions {
}
}

impl ServerOptions {
Comment on lines 155 to +157
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix formatting: Add newline after closing brace.

The pipeline indicates a formatting issue. Please run rustfmt or add a newline after the closing brace of the Default implementation.

    }
}
+
impl ServerOptions {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
}
impl ServerOptions {
}
}
impl ServerOptions {
🧰 Tools
🪛 GitHub Actions: ci

[error] 155-155: Rust formatting check failed. Please run 'rustfmt' to format the code.

pub fn merge(&mut self, other: Option<&Self>){
if let Some(other) = other {
if self.http_addr == DEFAULT_RPC_ADDR {
self.http_addr = other.http_addr;
}
if self.http_port == DEFAULT_RPC_PORT {
self.http_port = other.http_port;
}
if self.http_cors_origins.len() == 0 {
self.http_cors_origins = other.http_cors_origins.clone();
}
if self.http_modules.is_none() {
self.http_modules = other.http_modules.clone();
}
if self.max_event_page_size == DEFAULT_RPC_MAX_EVENT_PAGE_SIZE {
self.max_event_page_size = other.max_event_page_size;
}
if self.max_proof_keys == DEFAULT_RPC_MAX_PROOF_KEYS {
self.max_proof_keys = other.max_proof_keys;
}
if self.max_connections.is_none() {
self.max_connections = other.max_connections;
}
if self.max_request_body_size.is_none() {
self.max_request_body_size = other.max_request_body_size;
}
if self.max_response_body_size.is_none() {
self.max_response_body_size = other.max_response_body_size;
}
if self.max_call_gas == DEFAULT_RPC_MAX_CALL_GAS {
self.max_call_gas = other.max_call_gas;
}
}
}
}


#[derive(Debug, Args, Clone, Serialize, Deserialize, Default, PartialEq)]
#[command(next_help_heading = "Starknet options")]
pub struct StarknetOptions {
Expand Down
Loading