feat: remove requirements in favor of auto-detection - #2508
brady-stacks wants to merge 17 commits into
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR updates Clarinet’s “external contract dependency” model by introducing [[project.address_map]] (with optional per-network overrides) and making dependency discovery automatic by scanning user contract ASTs before seeding the requirements queue. It keeps [[project.requirements]] as a legacy alias for backward compatibility while moving deployment-time identifier remapping into the on-chain broadcast path.
Changes:
- Add
address_mapto the manifest schema/model, parse bothrequirements(legacy) andaddress_mapinto a unified list, and serialize onlyaddress_map. - Auto-detect external dependencies from user contract ASTs and seed the requirements queue accordingly; carry
address_mapthroughDeploymentSpecificationand apply network-specific remaps during on-chain deployment. - Update CLI TOML editing and add/adjust tests (including new integration tests) for address_map + auto-detection behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| components/clarinet-files/src/schema.rs | Adds JSON schema for address_map and updates legacy requirements schema description. |
| components/clarinet-files/src/project_manifest.rs | Introduces AddressMapEntry, parses requirements + address_map into project.address_map, and adds unit tests for parsing/dedup. |
| components/clarinet-files/src/lib.rs | Re-exports AddressMapEntry alongside existing manifest types. |
| components/clarinet-deployments/src/types.rs | Adds address_map: Vec<AddressMapEntry> to DeploymentSpecification for on-chain remap usage. |
| components/clarinet-deployments/src/onchain/mod.rs | Pre-populates broadcast-time contract-id remaps from deployment.address_map. |
| components/clarinet-deployments/src/lib.rs | Reads user sources early, builds lightweight ASTs for dependency auto-detection, seeds requirements queue, and persists address_map onto the deployment spec. |
| components/clarinet-deployments/tests/address_map.rs | New integration tests covering testnet override “skip redeploy” and auto-detected requirements. |
| components/clarinet-deployments/tests/genesis_accounts_funding.rs | Updates test helper to populate new address_map field. |
| components/clarinet-deployments/tests/deployment_plan.rs | Updates test helper to populate new address_map field. |
| components/clarinet-cli/tests/cli.rs | Updates requirement-add test to assert via project.address_map. |
| components/clarinet-cli/src/frontend/cli.rs | Writes new entries into [[project.address_map]] (and updates TOML edit tests to recognize both keys). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
7c0a9bd to
92c47b4
Compare
requirements in favor of auto-detection
|
Opened PR here with some issues and associated tests: brady-stacks#12 |
|
Some more tests that should pass before merging: brady-stacks#13 |
8641978 to
e1845b3
Compare
…tected list - Include resolved dependencies from detect_dependencies() in auto_detected list (previously only unresolved deps were counted, missing sBTC preloaded deps) - Filter out user contract IDs when seeding auto-detected queue (user contracts are already deployed, shouldn't be fetched from mock server) - Remove needless ..Default::default() on RequirementConfig (single-field struct)
973e326 to
7ed6c7c
Compare
75473a1 to
c040bfe
Compare
Clarinet now automatically discovers external contract dependencies by scanning user contract ASTs before generating a deployment plan. Explicit
[[project.requirements]]declarations are no longer required for statically-visible references.