paritytech / paritytech/contract-dependency-manager

Solidity contracts have no version source — publish pathway is blocked

Open
#81 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4
Forks
3
Avg merge
4d 13h
Merged PRs (30d)
3

Description

Problem

Since #76 a contract's publish version comes from its crate's Cargo.toml [package].version — which Solidity contracts don't have. resolveContractVersion (pipeline.ts) deliberately fails the whole deploy for any contract without a version, so the Foundry/Hardhat publish pathway is currently blocked: a Solidity contract with /// @custom:cdm @org/name detects fine, builds fine, and then aborts deploy with an error that (worse) tells the user to edit a Cargo.toml they don't have.

Failing loud was the right interim choice, but Solidity needs a version-source convention.

Proposal

Primary: a NatSpec tag next to the existing package-name tag, keeping version-per-contract exactly like Rust's version-per-crate:

/// @custom:cdm @org/mycontract
/// @custom:cdm-version 1.2.3
contract MyContract { … }

Fallback (or alternative): the project manifest's version (package.json for Hardhat, a [cdm]/custom key in foundry.toml) — but that's per-project, which breaks down for multi-contract repos, so the NatSpec tag should win when both exist.

Same rules as Rust: strict X.Y.Z, not 0.0.0, strictly greater than the registry's latest to publish, up-to-date skip otherwise.

Tasks

  • Parse @custom:cdm-version in the Solidity detection path (same place @custom:cdm is read), thread through the build record's version field (already string | undefined — the plumbing exists)
  • Fix resolveContractVersion's error text to give toolchain-appropriate advice (Cargo.toml vs NatSpec)
  • Template/docs: add the tag to the foundry/hardhat templates and README's Solidity section
  • Tests: detection + a pipeline case per toolchain

References

#76 (version source + idempotent deploys); src/lib/contracts/src/pipeline.ts resolveContractVersion; Solidity detection in src/lib/contracts/src/detection.ts / solidity.ts.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/lib/contracts/src/detection.ts and solidity.ts to trace how @custom:cdm is parsed, then follow the version field into src/lib/contracts/src/pipeline.ts and resolveContractVersion. Review the existing Rust version rules and tests before adding detection and pipeline coverage for Foundry and Hardhat. Done means toolchain-appropriate errors, template and README updates, and passing detection and pipeline tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity, typescript
Domain
blockchain
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.