Skip to content

Commit

Permalink
Merge branch 'main' into update-docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
matias-gonz authored Jun 17, 2024
2 parents e97b5f3 + 3f521ac commit df6b2f3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci-zk-toolbox-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- name: Start services
run: |
ci_localnet_up
ci_run sccache --start-server
- name: Build
run: |
Expand Down Expand Up @@ -75,6 +76,7 @@ jobs:
- name: Start services
run: |
ci_localnet_up
ci_run sccache --start-server
- name: Initialize ecosystem
run: |
Expand All @@ -88,7 +90,7 @@ jobs:
- name: Run server
run: |
ci_run zk_inception server --ignore-prerequisites &>server.log &
ci_run zk_inception server --ignore-prerequisites -a --use-node-framework --verbose &>server.log &
ci_run sleep 5
- name: Run integration tests
Expand Down
20 changes: 13 additions & 7 deletions core/lib/object_store/src/gcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl From<AuthError> for ObjectStoreError {
fn from(err: AuthError) -> Self {
let is_transient = matches!(
&err,
AuthError::HttpError(err) if err.is_timeout() || err.is_connect() || has_transient_io_source(err) || upstream_unavailable(err)
AuthError::HttpError(err) if is_transient_http_error(err)
);
Self::Initialization {
source: err.into(),
Expand All @@ -96,6 +96,17 @@ impl From<AuthError> for ObjectStoreError {
}
}

fn is_transient_http_error(err: &reqwest::Error) -> bool {
err.is_timeout()
|| err.is_connect()
// Not all request errors are logically transient, but a significant part of them are (e.g.,
// `hyper` protocol-level errors), and it's safer to consider an error transient.
|| err.is_request()
|| has_transient_io_source(err)
|| err.status() == Some(StatusCode::BAD_GATEWAY)
|| err.status() == Some(StatusCode::SERVICE_UNAVAILABLE)
}

fn has_transient_io_source(mut err: &(dyn StdError + 'static)) -> bool {
loop {
if err.is::<io::Error>() {
Expand All @@ -111,11 +122,6 @@ fn has_transient_io_source(mut err: &(dyn StdError + 'static)) -> bool {
}
}

fn upstream_unavailable(err: &reqwest::Error) -> bool {
err.status() == Some(StatusCode::BAD_GATEWAY)
|| err.status() == Some(StatusCode::SERVICE_UNAVAILABLE)
}

impl From<HttpError> for ObjectStoreError {
fn from(err: HttpError) -> Self {
let is_not_found = match &err {
Expand All @@ -131,7 +137,7 @@ impl From<HttpError> for ObjectStoreError {
} else {
let is_transient = matches!(
&err,
HttpError::HttpClient(err) if err.is_timeout() || err.is_connect() || has_transient_io_source(err) || upstream_unavailable(err)
HttpError::HttpClient(err) if is_transient_http_error(err)
);
ObjectStoreError::Other {
is_transient,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
use clap::Parser;
use serde::{Deserialize, Serialize};

use crate::messages::{MSG_SERVER_COMPONENTS_HELP, MSG_SERVER_GENESIS_HELP};
use crate::messages::{
MSG_SERVER_ADDITIONAL_ARGS_HELP, MSG_SERVER_COMPONENTS_HELP, MSG_SERVER_GENESIS_HELP,
};

#[derive(Debug, Serialize, Deserialize, Parser)]
pub struct RunServerArgs {
#[clap(long, help = MSG_SERVER_COMPONENTS_HELP)]
pub components: Option<Vec<String>>,
#[clap(long, help = MSG_SERVER_GENESIS_HELP)]
pub genesis: bool,
#[clap(long, short)]
#[arg(trailing_var_arg = true, allow_hyphen_values = true, hide = false, help = MSG_SERVER_ADDITIONAL_ARGS_HELP)]
additional_args: Vec<String>,
}
2 changes: 2 additions & 0 deletions zk_toolbox/crates/zk_inception/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ pub(super) const MSG_DEPLOYING_PAYMASTER: &str = "Deploying paymaster";
/// Run server related messages
pub(super) const MSG_SERVER_COMPONENTS_HELP: &str = "Components of server to run";
pub(super) const MSG_SERVER_GENESIS_HELP: &str = "Run server in genesis mode";
pub(super) const MSG_SERVER_ADDITIONAL_ARGS_HELP: &str =
"Additional arguments that can be passed through the CLI";

/// Accept ownership related messages
pub(super) const MSG_ACCEPTING_GOVERNANCE_SPINNER: &str = "Accepting governance...";
Expand Down

0 comments on commit df6b2f3

Please sign in to comment.