File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,11 +58,28 @@ jobs:
5858
5959 - name : Run contract tests
6060 working-directory : contracts
61- run : cargo test
61+ run : cargo test --features testutils
6262
63- - name : Build WASM release binary
63+ - name : Build WASM release binary (no testutils)
6464 working-directory : contracts
65- run : cargo build --target wasm32-unknown-unknown --release
65+ run : cargo build --target wasm32-unknown-unknown --release --no-default-features
66+
67+ - name : Verify testutils excluded from release binary
68+ working-directory : contracts
69+ run : |
70+ WASM_FILE=$(find target/wasm32-unknown-unknown/release -name "*.wasm" | head -1)
71+ if [ -z "$WASM_FILE" ]; then
72+ echo "ERROR: No WASM file found." >&2
73+ exit 1
74+ fi
75+ # Confirm the strings "testutils" or "register_stellar_asset" do not
76+ # appear in the release binary (they would only be present if test
77+ # utilities were compiled in).
78+ if strings "$WASM_FILE" | grep -qE "testutils|register_stellar_asset"; then
79+ echo "ERROR: Release binary contains test utility symbols. Ensure testutils feature is excluded from release builds." >&2
80+ exit 1
81+ fi
82+ echo "✅ Release binary does not contain test utility symbols."
6683
6784 - name : Report WASM binary size
6885 working-directory : contracts
Original file line number Diff line number Diff line change @@ -6,6 +6,15 @@ edition = "2021"
66[lib ]
77crate-type = [" cdylib" ]
88
9+ # Feature flags
10+ # ------------
11+ # `testutils` – enables soroban-sdk's test helpers (mock ledger, StellarAssetClient,
12+ # Address::generate, etc.). This feature MUST NOT be enabled for production/release
13+ # WASM builds; it is only activated during `cargo test` (via dev-dependencies) and
14+ # when explicitly requested with `--features testutils`.
15+ [features ]
16+ testutils = [" soroban-sdk/testutils" ]
17+
918[dependencies ]
1019soroban-sdk = " 21.0.0"
1120
Original file line number Diff line number Diff line change @@ -821,5 +821,4 @@ fn read_campaign(env: &Env, campaign_id: u64) -> Campaign {
821821 . get ( & DataKey :: Campaign ( campaign_id) )
822822 . unwrap_or_else ( || panic ! ( "campaign not found" ) )
823823}
824- #[ cfg( test) ]
825- mod test;
824+
You can’t perform that action at this time.
0 commit comments