Skip to content

fix: ship canonical milestonex_campaign.wasm, guard against silent regressions - #64

Open
Sammygee12 wants to merge 1 commit into
MillestoneX:mainfrom
Sammygee12:fix/issue-43-canonical-campaign-wasm
Open

fix: ship canonical milestonex_campaign.wasm, guard against silent regressions#64
Sammygee12 wants to merge 1 commit into
MillestoneX:mainfrom
Sammygee12:fix/issue-43-canonical-campaign-wasm

Conversation

@Sammygee12

Copy link
Copy Markdown
Contributor

Summary

Closes #43.

make build-wasm already compiled milestonex-campaign (the canonical
contract) alongside the legacy milestonex-core, so the cargo build
half of the issue was already correct. The actual bug was downstream:

  • scripts/deploy.sh hardcoded WASM_PATH / OPTIMIZED_WASM_PATH to
    target/wasm32v1-none/release/milestonex_core.wasm. So make deploy-testnet / make deploy-sandbox shipped the legacy reference
    contract
    , not the campaign contract the rest of the codebase treats as
    canonical. Fixed to point at milestonex_campaign.wasm.

  • There was no regression coverage for either the "binary exists" or
    the "< 64 KiB" acceptance criteria. CI's wasm-check job only ran
    cargo check --target wasm32v1-none, which type-checks but doesn't run
    codegen/linking — it never actually produced or validated the real
    .wasm artifact, so a future change that dropped -p milestonex-campaign
    from the Makefile's build-wasm line, or broke the cdylib crate-type,
    would pass CI silently.

Changes

  • scripts/deploy.sh: fixed artifact path, updated header comment.
  • scripts/check-wasm-artifact.sh (new): fails loudly if
    milestonex_campaign.wasm is missing or >= 65536 bytes.
  • Makefile:
    • build-wasm now asserts the campaign .wasm exists right after the
      cargo build line.
    • optimize runs the size-cap check after wasm-opt -Oz.
    • new check-wasm-size target + make help entry.
  • .github/workflows/ci.yml (wasm-check job): added a real cargo build --release -p milestonex-campaign --target wasm32v1-none step (in
    addition to the existing cargo check), followed by the new check
    script.

Test plan

  • bash -n on both shell scripts — syntax OK.
  • Manually reviewed Makefile diff for tab-vs-space correctness
    (recipe lines confirmed to use real tabs).
  • Could not run make build-wasm / make optimize end-to-end on my
    machine (no working MSVC or MinGW linker in this environment,
    unrelated to this repo) — please confirm the wasm-check CI job
    goes green, which does exercise the real cargo build --release +
    size-check path on Linux.

🤖 Generated with Claude Code

… regressions

scripts/deploy.sh hardcoded WASM_PATH/OPTIMIZED_WASM_PATH to
target/wasm32v1-none/release/milestonex_core.wasm — the legacy reference
contract — so `make deploy-testnet`/`deploy-sandbox` shipped the wrong
binary even though the Makefile's build-wasm target already compiles
milestonex-campaign (the canonical, actively-developed contract). Point
both paths at milestonex_campaign.wasm instead.

Add scripts/check-wasm-artifact.sh, a regression check that fails loudly if
milestonex_campaign.wasm is missing (e.g. a future change silently drops
`-p milestonex-campaign` from build-wasm, leaving only the legacy core
binary) or is >= the 64 KiB Soroban ceiling for hosted contracts. Wire it
into `make build-wasm` (existence guard) and `make optimize` (size-cap
check on the wasm-opt'd artifact actually shipped).

CI's wasm-check job previously only ran `cargo check --target
wasm32v1-none`, which type-checks but never runs codegen/linking, so it
never actually produced or validated the deployable binary. Add a real
`cargo build --release -p milestonex-campaign` step followed by the new
check script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the canonical milestonex_campaign.wasm binary and ship it as the default deployment artifact

2 participants