fix: ship canonical milestonex_campaign.wasm, guard against silent regressions - #64
Open
Sammygee12 wants to merge 1 commit into
Open
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #43.
make build-wasmalready compiledmilestonex-campaign(the canonicalcontract) alongside the legacy
milestonex-core, so thecargo buildhalf of the issue was already correct. The actual bug was downstream:
scripts/deploy.shhardcodedWASM_PATH/OPTIMIZED_WASM_PATHtotarget/wasm32v1-none/release/milestonex_core.wasm. Somake deploy-testnet/make deploy-sandboxshipped the legacy referencecontract, 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-checkjob only rancargo check --target wasm32v1-none, which type-checks but doesn't runcodegen/linking — it never actually produced or validated the real
.wasmartifact, so a future change that dropped-p milestonex-campaignfrom the Makefile's
build-wasmline, or broke thecdylibcrate-type,would pass CI silently.
Changes
scripts/deploy.sh: fixed artifact path, updated header comment.scripts/check-wasm-artifact.sh(new): fails loudly ifmilestonex_campaign.wasmis missing or>= 65536bytes.Makefile:build-wasmnow asserts the campaign.wasmexists right after thecargo buildline.optimizeruns the size-cap check afterwasm-opt -Oz.check-wasm-sizetarget +make helpentry..github/workflows/ci.yml(wasm-checkjob): added a realcargo build --release -p milestonex-campaign --target wasm32v1-nonestep (inaddition to the existing
cargo check), followed by the new checkscript.
Test plan
bash -non both shell scripts — syntax OK.(recipe lines confirmed to use real tabs).
make build-wasm/make optimizeend-to-end on mymachine (no working MSVC or MinGW linker in this environment,
unrelated to this repo) — please confirm the
wasm-checkCI jobgoes green, which does exercise the real
cargo build --release+size-check path on Linux.
🤖 Generated with Claude Code