Skip to content

feat(contracts): auto-discover contracts via Makefile instead of workspace member list - #310

Open
Gpraiz01 wants to merge 6 commits into
CemAyyildiz:mainfrom
Gpraiz01:feat/issue-229-contracts-workspace-v2
Open

feat(contracts): auto-discover contracts via Makefile instead of workspace member list#310
Gpraiz01 wants to merge 6 commits into
CemAyyildiz:mainfrom
Gpraiz01:feat/issue-229-contracts-workspace-v2

Conversation

@Gpraiz01

Copy link
Copy Markdown
Contributor

Summary

Replaces --workspace cargo commands in the Makefile with shell for-loops that auto-discover all contract crates by scanning subdirectories for Cargo.toml. New contracts are picked up automatically — no more editing the workspace members list.

Changes

  • contracts/Makefile: Iterates over all contract directories for build, test, check, fmt, clippy, and clean targets. Uses status=1 aggregation so all contracts are processed even if some fail.
  • .github/workflows/contracts.yml:
    • Cache key widened to contracts/**/Cargo.lock (covers all lock files)
    • Cache paths include contracts/*/target (per-crate target dirs)
    • Timeout bumped 15 → 30 min for 24+ crates

Motivation

Previously, the Makefile used --workspace which only operated on the 4 explicitly-listed workspace members. Adding a new contract required:

  1. Adding it to contracts/Cargo.toml workspace members
  2. Ensuring it works with the shared workspace dependency versions

The new approach treats each contract crate independently — each uses its own dependency versions and is discovered automatically.

Closes #229

Gpraiz01 added 3 commits July 28, 2026 13:19
- Add contracts/Cargo.toml workspace manifest for Soroban crates
- Add contracts/Makefile with test, build, fmt, clippy targets
- Add contracts/README.md documenting local test workflow
- Add .github/workflows/contracts.yml limited to contracts/** changes
…Rng issue

soroban-env-host is pinned transitively by soroban-sdk v22. Having it as
a direct workspace dependency causes a rand/rand_core version mismatch
that makes clippy fail with E0277 (CryptoRng trait not implemented).
…space member list

Replace --workspace cargo commands with shell for-loops that discover all subdirectories containing a Cargo.toml. New contract crates are picked up automatically without editing the workspace members list.

- Makefile: iterate over all contract dirs for build/test/fmt/clippy/check
- CI: update cache key to cover all Cargo.lock files, bump timeout to 30m
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

@Gpraiz01 is attempting to deploy a commit to the cemayyildiz's projects Team on Vercel.

A member of the Team first needs to authorize it.

Gpraiz01 added 3 commits July 29, 2026 16:14
Adding [workspace] to 9 standalone contract crates so cargo fmt can run on them independently. Also runs cargo fmt across all crates to fix pre-existing formatting issues that were hidden when CI only checked the 4 workspace members.

Crates with [workspace] added: amount_scale, asset_allowlist, auth_one_address, event_invoice_paid, fee_bps_clamp, meta_info, proof_meta, quittance_receipt_hash, seller_bind
- Remove leftover old-style clippy target that caused override warning
- Run cargo fmt on event_invoice_created, expiry_check, memo_collision, network_passphrase
- Update help text and add back all target to Makefile
- All 28 crates now pass make fmt cleanly

@CemAyyildiz CemAyyildiz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Review — changes requested (please do not close)

Thanks for the auto-discover Makefile idea — that part is useful for #229.

Blockers right now

  1. CONFLICTING against main — please rebase first.
  2. Too broad — this PR touches ~40 files across almost every contract crate ([workspace] stanzas, formatting, clippy/test edits, Cargo.toml churn) in addition to Makefile/CI.
  3. Shared files (contracts/Makefile, .github/workflows/contracts.yml, root contracts/Cargo.toml) conflict easily with other Wave contract work.

What we need for merge

Keep this PR scoped to glue only:

  • contracts/Makefile (auto-discover loop)
  • .github/workflows/contracts.yml (cache / make test wiring)
  • contracts/README.md (docs for the new targets)

Please drop unrelated per-crate edits from this PR (amount_scale, error_codes, status_transitions, quittance_receipt_hash, etc.). If a crate needs a [workspace] stanza or clippy fix for make test to pass, open that as a small follow-up PR per crate (or one tightly scoped “standalone crates compile under make” PR), not bundled here.

Ignore

  • Vercel Authorization — infra on our side, not a code blocker.

Once rebased + slimmed, we will re-review and merge.

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.

[Wave Batch 2] Add contracts workspace Makefile and cargo test CI snippet

2 participants