From 4e135e7e9b5e3cf03af3a88c4573c59de8fed12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CEnchanterme=E2=80=9D?= <“encountermehere@gmail.com”> Date: Mon, 19 Oct 2026 15:35:53 +0100 Subject: [PATCH] fix(milestones): re-export contract module; fail CI on dead_code The milestones crate wrapped MilestonesContract in a private `mod contract` without re-exporting it, so the contract struct, its generated MilestonesContractClient and the events defined there were unreachable from outside the module. That broke the tests, failed references such as MilestoneRefundPaid outside the module, and left helpers like require_admin / is_paused / refund_remaining_budget reported as dead code. Add `pub use contract::*;`, matching escrow and maintenance-pool, so all three crates expose the same API. Also add a CI step that builds the workspace with `-D dead_code`, so a contract module that isn't re-exported fails the build instead of only printing warnings. Related: #324 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 8 ++++++++ contracts/milestones/src/lib.rs | 2 ++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ae31059..67c23daa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,14 @@ jobs: - run: cargo fmt --check - run: cargo clippy --workspace --all-targets --locked -- -D warnings + + # A contract module that isn't re-exported leaves the contract struct, + # its generated Client and every helper it calls unreachable, which + # surfaces as dead_code warnings on a plain library build. + - name: Build without dead_code warnings + env: + RUSTFLAGS: "-D dead_code" + run: cargo build --workspace --locked - run: cargo test --workspace --locked - name: Security audit diff --git a/contracts/milestones/src/lib.rs b/contracts/milestones/src/lib.rs index 8c17e9c9..46d6a7c7 100644 --- a/contracts/milestones/src/lib.rs +++ b/contracts/milestones/src/lib.rs @@ -1170,6 +1170,8 @@ mod contract { } } // mod contract +pub use contract::*; + /// Pays each contributor their share of `milestone.remaining_budget` (the /// unallocated remainder of the pool), computed as /// `remaining_budget * contribution.amount / total_budget` — i.e. in