Skip to content

Ship a shared LibCopyArtifacts in rainix #168

@thedavidmeister

Description

@thedavidmeister

Multiple repos need the same script/CopyArtifacts.sol + script/lib/LibCopyArtifacts.sol pair to commit a deterministic ABI subset for Rust consumption:

  • rain.math.float has its own copy at script/lib/LibCopyArtifacts.sol.
  • rain.interpreter (rainlang) is now adding the same in #498.
  • Any other repo with both Solidity contracts and Rust crates using alloy::sol! will need it.

The implementation is the same up to the contract list and the committed output path. Right now we're forking the same Solidity per repo, which means a fix or improvement to extractStable (e.g. tightening the deterministic subset, switching off jq) has to land N times.

What to ship in rainix

  • LibCopyArtifacts.sol — a library with livePath(name) and extractStable(vm, name). The downstream committedPath differs per repo (where the abi files live), so leave that to the consumer.
  • An optional CopyArtifacts.sol runnable script that consumers can either reuse via inheritance or copy-paste.

Each consumer ships only:

  • A small script that defines its contract list and committed path.
  • A repo-side workflow that calls the upstream rainix-copy-artifacts.yaml reusable (separate work item; pair this with adding that reusable to rainix's .github/workflows/).

Migration plan

Once the shared lib is shipped in rainix:

  1. Bump rainix dep in rain.math.float, replace its script/lib/LibCopyArtifacts.sol with the rainix import, keep its contract list + committed path.
  2. Same in rain.interpreter (rainlang).
  3. New repos pick it up from rainix from day one.

Both repos must end up consuming the shared lib — leaving either on a local copy defeats the purpose.

Notes

  • The extractStable jq is non-trivial — exactly which keys are deterministic across machines is the kind of thing that should live in one place.
  • committedPath differs per repo (crates/float/abi/ vs crates/abi/), so it stays consumer-side.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions