Skip to content

feat(smart_contracts): add contract registry validation - #181

Open
alez04 wants to merge 4 commits into
qubic:devfrom
alez04:feat/contract-data-source
Open

feat(smart_contracts): add contract registry validation#181
alez04 wants to merge 4 commits into
qubic:devfrom
alez04:feat/contract-data-source

Conversation

@alez04

@alez04 alez04 commented Jul 9, 2026

Copy link
Copy Markdown

Summary

  • Add contract data schemas for:
    • current smart contract metadata
    • registry manifests
    • epoch refs
    • ABI registry entries
    • ABI snapshots
  • Add a dependency-free Python validator for contract data and manifests.
  • Run contract data validation in the smart contract refresh workflow and deploy workflow.
  • Trigger the qubic-typescript sync workflow after production static deploys, so typed contract packages can be regenerated from static-owned data.

Why

This prepares static to become the canonical public source for current and historical contract registry data.

The validator gives us guardrails before generated registry data starts landing in static, and the deploy dispatch lets qubic-typescript update @qubic.org/registry and @qubic.org/contracts after static accepts and deploys new registry data.

Validation

  • python3 scripts/validate_contract_data.py
  • Parsed changed GitHub Actions workflow YAML locally with PyYAML.
  • Simulated cross-repo generation from qubic-typescript export into the static layout.
  • Validated the simulated exported data with the static validator.

Notes

  • This PR should be merged before the qubic-typescript PR.
  • The new qubic-typescript workflow depends on static/scripts/validate_contract_data.py and the contract schemas added here.
  • Add QUBIC_TYPESCRIPT_REPO_TOKEN in the static repository before expecting deploys to trigger package syncs automatically.
  • If QUBIC_TYPESCRIPT_REPO_TOKEN is missing, the deploy workflow skips the dispatch instead of failing the deployment.

Required secret

In qubic/static

QUBIC_TYPESCRIPT_REPO_TOKEN

This token must be able to create repository_dispatch events in qubic/qubic-typescript.

for from_epoch, to_epoch in sortable_ranges:
if previous_to is not None:
require(from_epoch > previous_to, errors, f"contract {contract_index} has overlapping ABI ranges")
if to_epoch is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better if we treat null end = open ended?
For example:
previous_to = float("inf") if to_epoch is None else to_epoch

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.

2 participants