From 54284eae60dd789b96d33239fbccf57140e830bd Mon Sep 17 00:00:00 2001 From: keanji-x Date: Tue, 26 May 2026 15:35:50 +0800 Subject: [PATCH] fix(ci): make the Rust pipeline deterministic and green gravity_bench has no rustfmt.toml of its own, so a standalone CI checkout ran `cargo fmt --all -- --check` against rustfmt's *defaults* (91 files non-compliant -> red), while a nested local checkout silently borrowed the parent gravity-sdk rustfmt.toml -> green. The toolchain also floated (dtolnay/rust-toolchain@stable) against the repo's pinned rust-toolchain.toml, and three tests either need a live node or brute-force 1M key derivations, which would hang `cargo test` once fmt was unblocked. - add rustfmt.toml (use_small_heuristics = "Max", etc.) so formatting is self-contained and identical whether checked out standalone (CI) or nested (local); the tree is already compliant, so no reformatting is needed - pin the toolchain to the latest stable 1.95.0 in both rust-toolchain.toml and the workflow (dtolnay/rust-toolchain@1.95.0) -- no more floating @stable - #[ignore] the two node-dependent tests and the 1M-key brute-force lookup; run them on demand with `cargo test -- --ignored` Verified locally under 1.95.0: cargo fmt --check clean, cargo build --release ok, cargo test = 2 passed / 0 failed / 3 ignored. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/rust.yml | 4 ++-- rust-toolchain.toml | 2 +- rustfmt.toml | 3 +++ src/util/gen_account.rs | 3 +++ 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 rustfmt.toml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 31b3704..d9f1f77 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@v4 - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@1.95.0 with: components: rustfmt, clippy @@ -53,7 +53,7 @@ jobs: uses: actions/checkout@v4 - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@1.95.0 - name: Cache Cargo dependencies uses: actions/cache@v4 diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 3a5705d..8a6e1b4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.91.0" +channel = "1.95.0" components = ["cargo", "clippy", "rustc", "rust-std", "rustfmt"] diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..057dc57 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,3 @@ +reorder_imports = true +use_small_heuristics = "Max" +use_field_init_shorthand = true diff --git a/src/util/gen_account.rs b/src/util/gen_account.rs index eb92c1c..f700962 100644 --- a/src/util/gen_account.rs +++ b/src/util/gen_account.rs @@ -213,6 +213,7 @@ mod tests { } #[test] + #[ignore = "brute-force scan of 1M key derivations; manual lookup utility, too slow for CI; run with `cargo test -- --ignored`"] fn test_find_account_by_address() { // Find account ID for a specific address let target_address = "0x3ece3a612e4e8849a3eaf093c61683b1370f3418"; @@ -308,6 +309,7 @@ mod tests { } #[tokio::test] + #[ignore = "requires a running node at localhost:8545; run with `cargo test -- --ignored`"] async fn test_check_account_balances() { use crate::eth::EthHttpCli; @@ -367,6 +369,7 @@ mod tests { } #[tokio::test] + #[ignore = "requires a running node at localhost:8545; run with `cargo test -- --ignored`"] async fn test_faucet_eth_to_accounts() { use crate::eth::{EthHttpCli, TxnBuilder}; use alloy::primitives::U256;