Skip to content

fix: use cargo stylus CLI instead of plain cargo check/build#8

Open
keruch wants to merge 2 commits into
OpenZeppelin:mainfrom
keruch:kirill/stylus-setup-cargo-commands
Open

fix: use cargo stylus CLI instead of plain cargo check/build#8
keruch wants to merge 2 commits into
OpenZeppelin:mainfrom
keruch:kirill/stylus-setup-cargo-commands

Conversation

@keruch

@keruch keruch commented Mar 7, 2026

Copy link
Copy Markdown

After creating a project, AI tries to check if it compiles using cargo check without --target wasm32-unknown-unknown. Compilation fails, and AI falls into an infinite loop of resolving dependency issues.

@dtr0x

dtr0x commented Mar 11, 2026

Copy link
Copy Markdown

The fix should use cargo stylus check rather than raw cargo check/build with manual flags:

  • cargo stylus check already handles this. It internally runs cargo build --release --target wasm32-unknown-unknown with the -Z build-std flags (when nightly is detected), then validates the WASM on-chain. It's already in the skill under "Build & Deploy Basics."
  • cargo stylus build doesn't exist as a subcommand. check does the full compile.
  • The -Z build-std flags are conditional. cargo stylus check auto-detects nightly vs stable. Hardcoding them could break on stable toolchains.
  • Consistency. The skill uses cargo stylus for everything else (new, export-abi, deploy). Adding raw cargo commands teaches the agent the wrong workflow.

The root cause is that cargo stylus check appears too late in the skill (under "Build & Deploy"), so the agent doesn't see it right after project creation. A better fix would be adding a note right after cargo stylus new like:

After creating the project, verify it compiles with cargo stylus check (see Build & Deploy section below). Do NOT use plain cargo check or cargo build, since Stylus contracts require the cargo stylus CLI for correct WASM compilation.

This addresses the agent behavior without introducing commands that bypass the purpose-built tooling.

@keruch keruch changed the title fix: missing target in cargo commands for Stylus fix: use cargo stylus CLI instead of plain cargo check/build Mar 12, 2026
@keruch

keruch commented Mar 12, 2026

Copy link
Copy Markdown
Author

@dtr0x thank you for the review, it totally makes sense! Updated the PR with your suggestion.

@dtr0x dtr0x requested review from dtr0x and ericglau April 8, 2026 20:19

@ericglau ericglau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@ericglau

ericglau commented Apr 8, 2026

Copy link
Copy Markdown
Member

Hi @keruch, thanks a lot for the PR and sorry for the delay. In order for us to merge this, the commits need to be signed. Would you be able to sign and re-push your commits?

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.

3 participants