From 5bc591f61bfb2a3a2b7640932eb31416b5b18877 Mon Sep 17 00:00:00 2001 From: obchain Date: Sun, 26 Apr 2026 16:17:09 +0530 Subject: [PATCH 1/2] ci: restore fmt + clippy gates and switch rust job back to Linux Followup to #319 (clippy unblocked), #320 (workspace fmt), #322 (submit classifier Linux-safe). - Add cargo fmt --all -- --check as the first rust-job step. - Add cargo clippy --workspace --all-targets --locked -- -D warnings before tests, so lint regressions block merge instead of leaking in. - Switch rust job from macos-latest back to ubuntu-latest. The platform-sensitive ECONNREFUSED classifier was fixed by #334 (substring match -> structured TransportErrorKind::HttpError.status check), so the macOS pin is no longer needed. Linux runners are faster and cheaper. Reviewer (blockchain-code-reviewer) confirmed step ordering, cache locality, action syntax, and permissions are clean. --- .github/workflows/test.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4335a45..efcadfc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,13 +14,8 @@ concurrency: jobs: rust: - name: cargo test + release build - # Pinned to macos-latest to match the developer environment that produced - # the green local Layer 1 pass. charon-executor's - # submit_returns_connection_lost_when_transport_fails is platform-sensitive - # on Linux runners — see issue #322. Flip back to ubuntu-latest once the - # classifier in crates/charon-executor/src/submit.rs is broadened. - runs-on: macos-latest + name: cargo fmt + clippy + test + release + runs-on: ubuntu-latest timeout-minutes: 30 steps: - name: Checkout @@ -28,10 +23,18 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy - name: Cache cargo uses: Swatinem/rust-cache@v2 + - name: cargo fmt --all -- --check + run: cargo fmt --all -- --check + + - name: cargo clippy --workspace --all-targets --locked -- -D warnings + run: cargo clippy --workspace --all-targets --locked -- -D warnings + - name: cargo test --workspace --locked run: cargo test --workspace --locked From 51dff9c2652c55f968f6900c8b4ba5cd2fe50a3f Mon Sep 17 00:00:00 2001 From: obchain Date: Sun, 26 Apr 2026 16:18:30 +0530 Subject: [PATCH 2/2] ci: cargo fmt --all on token_meta.rs (introduced post #335) --- crates/charon-scanner/src/token_meta.rs | 35 ++++++++++++------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/crates/charon-scanner/src/token_meta.rs b/crates/charon-scanner/src/token_meta.rs index 3a8dc7b..2014366 100644 --- a/crates/charon-scanner/src/token_meta.rs +++ b/crates/charon-scanner/src/token_meta.rs @@ -51,10 +51,7 @@ const META_MAX_ATTEMPTS: usize = 5; // `fetch_with_retry` is sound only if the loop body executes at // least once. A zero attempt cap would skip the loop and hit the // unreachable, which would be a bug, not a panic-by-design. -const _: () = assert!( - META_MAX_ATTEMPTS >= 1, - "META_MAX_ATTEMPTS must be >= 1" -); +const _: () = assert!(META_MAX_ATTEMPTS >= 1, "META_MAX_ATTEMPTS must be >= 1"); /// Initial backoff before the first retry. Doubles every failed /// attempt up to `META_MAX_ATTEMPTS`. @@ -131,11 +128,7 @@ fn is_transient(err: &(impl std::fmt::Debug + ?Sized)) -> bool { /// as permanent. `op_name` and `token` are only used for the warn /// log on retry, so the operator can correlate dropped markets to /// upstream blips. -async fn fetch_with_retry( - op_name: &str, - token: Address, - mut op: F, -) -> Result +async fn fetch_with_retry(op_name: &str, token: Address, mut op: F) -> Result where F: FnMut() -> Fut, Fut: std::future::Future>, @@ -285,7 +278,9 @@ mod tests { assert!(is_transient(&"http error: status 429 Too Many Requests")); // Upstream LB 5xx (overload / brief out-of-rotation). assert!(is_transient(&"upstream error: status 502 Bad Gateway")); - assert!(is_transient(&"upstream error: status 503 Service Unavailable")); + assert!(is_transient( + &"upstream error: status 503 Service Unavailable" + )); assert!(is_transient(&"upstream error: status 504 Gateway Timeout")); // Generic JSON-RPC throttle codes. assert!(is_transient(&"rpc error: code: -32603 internal error")); @@ -314,12 +309,11 @@ mod tests { #[tokio::test(start_paused = true)] async fn fetch_with_retry_returns_first_ok() { let mut calls = 0_usize; - let result: Result = - fetch_with_retry("test", Address::ZERO, || { - calls += 1; - async move { Ok::(42) } - }) - .await; + let result: Result = fetch_with_retry("test", Address::ZERO, || { + calls += 1; + async move { Ok::(42) } + }) + .await; assert_eq!(result, Ok(42)); assert_eq!(calls, 1); } @@ -332,7 +326,9 @@ mod tests { let attempt = calls; async move { if attempt < 3 { - Err(format!("http error: status 429 Too Many Requests (attempt {attempt})")) + Err(format!( + "http error: status 429 Too Many Requests (attempt {attempt})" + )) } else { Ok(7) } @@ -395,7 +391,10 @@ mod tests { }) .await; assert!(result.is_err()); - assert_eq!(calls, 2, "permanent error must short-circuit further retries"); + assert_eq!( + calls, 2, + "permanent error must short-circuit further retries" + ); } #[tokio::test(start_paused = true)]