From d4ea6eb90de06389499ce903dc151753b7d3439c Mon Sep 17 00:00:00 2001 From: devjayy43 Date: Sun, 28 Jun 2026 22:06:34 +0100 Subject: [PATCH] fix: pin Rust toolchain, cache tarpaulin, check fuzz targets, guard sendTransaction status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #1159 — add contracts/rust-toolchain.toml pinning channel to 1.85.0 (targets + components moved from the floating CI step so WASM hashes are reproducible across builds). Closes #1160 — replace from-source `cargo install cargo-tarpaulin` with taiki-e/install-action (pre-built binary, no compile step) and upload cobertura.xml as a CI artifact instead of discarding it. Closes #1161 — add `cargo check` in contracts/fuzz so all five fuzz targets are compiled on every push/PR; also extend Swatinem/rust-cache to cover the fuzz workspace so the check stays fast. Closes #1164 — inspect sendResult.status immediately after sendTransaction; return early with the status (and log the errorResult XDR) when the network returns ERROR or TRY_AGAIN_LATER instead of polling a doomed hash for ~30 s. --- .github/workflows/ci.yml | 21 +++++++++++++++------ backend/src/services/sorobanService.ts | 9 +++++++++ contracts/rust-toolchain.toml | 4 ++++ 3 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 contracts/rust-toolchain.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f78d716..9606fdb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -234,14 +234,12 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - targets: wasm32-unknown-unknown - components: rustfmt, clippy - name: Cache dependencies uses: Swatinem/rust-cache@v2 with: - workspaces: contracts + workspaces: | + contracts + contracts/fuzz - name: Format check run: cargo fmt --all -- --check working-directory: contracts @@ -285,7 +283,18 @@ jobs: path: contracts/target/wasm32-unknown-unknown/release/*.wasm if-no-files-found: error - name: Install tarpaulin - run: cargo install cargo-tarpaulin + uses: taiki-e/install-action@v2 + with: + tool: cargo-tarpaulin - name: Run coverage run: cargo tarpaulin --out Xml working-directory: contracts + - name: Upload coverage report + uses: actions/upload-artifact@v4 + with: + name: contracts-coverage + path: contracts/cobertura.xml + retention-days: 7 + - name: Check fuzz targets compile + run: cargo check + working-directory: contracts/fuzz diff --git a/backend/src/services/sorobanService.ts b/backend/src/services/sorobanService.ts index e1e29b32..65bbf182 100644 --- a/backend/src/services/sorobanService.ts +++ b/backend/src/services/sorobanService.ts @@ -773,6 +773,15 @@ class SorobanService { status: sendResult.status, }); + if (sendResult.status === 'ERROR' || sendResult.status === 'TRY_AGAIN_LATER') { + logger.withContext().warn('Transaction rejected at submission', { + txHash, + status: sendResult.status, + errorResult: sendResult.errorResult?.toXDR('base64'), + }); + return { txHash, status: sendResult.status }; + } + // Poll for final result const polled = await server.pollTransaction(txHash, { attempts: 30, diff --git a/contracts/rust-toolchain.toml b/contracts/rust-toolchain.toml new file mode 100644 index 00000000..6c82cab5 --- /dev/null +++ b/contracts/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.85.0" +targets = ["wasm32-unknown-unknown"] +components = ["rustfmt", "clippy"]