did-btcr2-js

ADR 058: Remove the Legacy Helia CAS Read Path and Shrink the Method Bundle

Status: Accepted

Date: 2026-06-29

Branch / PR: refactor/remove-helia-cas-path

References: ADR 023

Context

Appendix.fetchFromCas() was an early content-addressed-store read helper: it derived a CIDv1 from a content hash and fetched the block by spinning up an in-process Helia (IPFS) node via dynamic import('helia') and import('@helia/strings'). The canonical CAS read path is now CasApi (ADR 023): resolution emits a Need* for CAS-delivered content and the caller fulfills it, with IPFS access supplied by the SDK’s executor rather than the method package embedding an IPFS node.

That left fetchFromCas as dead code: it has no callers anywhere in the workspace, only its own definition. Its cost was not zero, though:

multiformats is still used directly by two scenario-tooling scripts under lib/ (publish-scenarios.ts, verify-live.ts), which derive CIDs to pin and fetch CAS objects exactly as a resolver would. Those are development tools, not part of the published runtime surface.

Decision

Remove the legacy Helia read path and the dependency weight it carried:

  1. Delete Appendix.fetchFromCas() and its now-unused imports (CID, the digest factory, and the HashBytes type). CAS reads go solely through the CasApi path per ADR 023.
  2. Drop helia and @helia/strings from the method package entirely; nothing else references them.
  3. Demote multiformats to a dev dependency. No src module imports it anymore; the published runtime reaches it only transitively (through @web5/dids, which declares its own dependency), while the lib/ scenario scripts that import it directly are dev tooling.
  4. Remove the now-moot CJS noExternal carve-out for multiformats and the stale Helia comment from the tsup config. With no direct multiformats import, the CJS bundle contains none.

Consequences

Rejected alternatives