Skip to content

feat(docs): add multichain contract reference drift check #160 - #167

Open
big6isaac wants to merge 2 commits into
wraith-protocol:developfrom
big6isaac:feat/contract-reference-drift-check-160
Open

big6isaac wants to merge 2 commits into
wraith-protocol:developfrom
big6isaac:feat/contract-reference-drift-check-160

Conversation

@big6isaac

@big6isaac big6isaac commented Sep 25, 2026 •

Copy link
Copy Markdown

Overview

This PR adds a checked-in, generated contract reference for EVM, Solana, CKB, and Stellar interfaces.
It compares generated documentation with the committed sources in CI and records source/version metadata so public API drift is visible and removals require migration notes.

Related Issue

Closes #160

Changes

Checked-in interface sources

  • [ADD] contracts/specs/evm.json, contracts/specs/solana.json, contracts/specs/ckb.json, and contracts/specs/stellar.json - checked-in ABI/IDL/contract specification sources with spec versions and source repository/path/commit metadata.
  • [ADD] contracts/specs/api-snapshot.json - public API baseline and migration-note records for intentional removals.

Generated references and drift validation

  • [ADD] scripts/generate-contract-reference.ts - generates references for all four chains and supports --check mode.
  • [MODIFY] contracts/evm.mdx, contracts/solana.mdx, contracts/ckb.mdx, and contracts/stellar.mdx - add generated method, event, storage, type, error, and metadata sections.
  • [MODIFY] package.json - adds generation/check scripts and runs both contract drift checks in test.
  • [MODIFY] .github/workflows/snippets.yml - runs the generated reference check in CI alongside the canonical contract registry check.

Verification Results

pnpm install --frozen-lockfile
✅ Lockfile is up to date; dependencies installed successfully.

pnpm test
✅ Snippet check passed: 71 MDX files, 618 checked snippets.
✅ Nav coverage passed: 71 pages checked, 71 nav entries verified.
✅ Contract registry check passed: 2 deployed contracts verified across 3 networks, with two existing non-fatal governance warnings for undeployed contracts.
✅ Contract reference is in sync with the checked-in specs.

pnpm exec tsc --noEmit
✅ Passed with no output.

pnpm run check:playground-fixtures
✅ fixtures.json is in sync.

pnpm run check:contract-registry -- --offline
✅ Local registry checks passed; remote verification was intentionally skipped by --offline.
Acceptance Criteria Status
Generate references from checked-in ABI, IDL, and contract spec sources ✅ contracts/specs/{evm,solana,ckb,stellar}.json are checked in and are the generator inputs.
Compare generated output in CI ✅ --check mode is wired into pnpm test and the contract-reference CI job.
Include version and source commit metadata ✅ Generated sections record spec version, API snapshot version, source repository/path, and source commit.
Fail when a public method or error disappears without a migration note ✅ The generator compares each current spec with api-snapshot.json and rejects undocumented removals.

The docs generated only part of the Stellar reference, and that generator
read from an external bindings directory, so nothing caught drift in the
EVM, Solana or CKB interfaces at all. There was also no record of which
spec version the docs were built from.

- Add checked-in interface sources for all four chains under
  contracts/specs/: Solidity ABIs (evm.json), Anchor IDL-equivalent
  programs (solana.json), CKB scripts (ckb.json), and Soroban contract
  specs (stellar.json). Each records its own specVersion and the source
  repository, path, and commit it was taken from.
- Add scripts/generate-contract-reference.ts, which renders every unit's
  public methods, events, storage keys and custom errors into the
  matching contracts/*.mdx between chain-specific markers, and stamps the
  generated block with spec version, API snapshot version, source
  repository/path/commit, and a removed-in-this-version line.
- Support --check to compare generated output against the committed docs
  and fail on drift, so CI can enforce it.
- Add contracts/specs/api-snapshot.json as the public API baseline. The
  check diffs current specs against it and fails when a public method,
  event, storage key or error disappears without a matching entry in
  migrations, which must name the version it was removed in and carry a
  note. Additions and signature changes pass; only removals are gated.
- Wire the check into pnpm test and add a contract-reference job to the
  snippet workflow.

The Stellar page previously showed only placeholder instructions; it now
carries the generated reference for all four contracts, including the
error and storage-key tables.

Note: .github/ is CODEOWNERS-gated to @truthixify, so the workflow change
needs maintainer approval. The new job only adds a check; it does not
change or relax any existing gate.
@drips-wave

drips-wave Bot commented Sep 25, 2026

Copy link
Copy Markdown

@big6isaac Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@truthixify

Copy link
Copy Markdown
Contributor

The generated files are internally consistent, but every source.commit value is forty zeroes. Please record the real contracts commit and validate the checked-in specs against that source so the drift gate has a trustworthy baseline.

1 similar comment
@truthixify

Copy link
Copy Markdown
Contributor

The generated files are internally consistent, but every source.commit value is forty zeroes. Please record the real contracts commit and validate the checked-in specs against that source so the drift gate has a trustworthy baseline.

…ference-drift-check-160

# Conflicts:
#	.github/workflows/snippets.yml
#	package.json
@big6isaac big6isaac changed the title feat(docs): add a multichain contract reference drift check #160 feat(docs): add multichain contract reference drift check #160 Sep 28, 2026
@truthixify

Copy link
Copy Markdown
Contributor

The rebase is clean, but all four source.commit values are still zeroes. Please use the real contracts commit and validate the checked-in specs against it.

This branch has not been deployed

No deployments
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 9] Verify generated contract references across all chains

2 participants