Skip to content

[0.30][Security] Define cryptographic capability and authorization-domain contracts #25

Closed

Description

@a19q3

Summary

Define the 0.30 cryptographic capability policy: which exact hash, signature, commitment, and authorization operations are compiler-supported primitives; which must use identity-pinned external verifiers; and how typed message domains prevent values from being used as authority in the wrong context.

The goal is sufficient cryptographic and authorization coverage for the frozen 0.30 business corpus. It is not to reimplement every Rust cryptographic crate or add a circuit language.

Current boundary

The current branch has executable CKB BLAKE2b and SHA-256 paths, bounded byte/preimage operations, an explicit-message BIP340 route, real multisig integration, and exact-data-hash trusted external EXEC or SPAWN/WAIT. env::sighash_all remains correctly deferred because it does not yet construct the canonical signing message. Raw Address, Script identity, hashes, public keys, signatures, message digests, commitments, proofs, and witness bytes do not yet form one accepted source-level type and conversion contract.

Required decisions

Define distinct types or checked conversions for:

  • address payloads and decoded Lock Scripts;
  • complete Script, Script hash, code hash, data hash, and Type Script hash;
  • raw bytes, canonical transaction preimages, and domain-tagged message digests;
  • public keys, signatures, signer sets, thresholds, and authorization results;
  • commitments, authenticated openings, statements, and proof bytes; and
  • local compiler-proved operations versus trusted-external verifier results.

For every primitive, specify algorithm and version, personalization or domain tag, accepted encodings, key and signature normalization, malleability rules, witness ownership, failure codes, cycle/stack/code-size budgets, and whether verification is native or delegated.

Required 0.30 capability

  • canonical CKB signing-message construction for the selected standard Lock integration, or an exact standard external Lock boundary where constructing it inside CellScript would duplicate the consensus-adjacent implementation;
  • domain-separated CKB BLAKE2b and SHA-256 over bounded gathered byte ranges;
  • exact Script construction and full Script-hash comparison without confusing an address with a complete Script;
  • signature verification required by the Token, NFT/DOB, multisig, order, and committed-state acceptance fixtures;
  • exact issuer and signer authority binding with post-signing mutation rejection;
  • authenticated commitment openings coordinated with [Language design] Add explicit typed openings for digest-committed substate #13; and
  • typed external-verifier declarations for larger or protocol-specific cryptography, including exact identity, adapter, applicability, statement, and result enforcement.

Implementation phases

Phase 0 — capability and type matrix

  • inventory implemented and deferred cryptographic paths;
  • freeze the algorithms needed by the 0.30 corpus;
  • define message-domain, Script-identity, key, signature, commitment, opening, statement, proof, and result types;
  • decide native versus exact external-verifier ownership; and
  • allocate stable error and evidence classifications.

Phase 1 — frontend and semantic records

  • add only the required constructors and checked conversions;
  • reject raw-byte substitution across semantic domains;
  • retain exact algorithm, domain, source bytes, verifier identity, and enforcement location in typed semantics and ProofPlan; and
  • update formatter, LSP, VS Code, builders, manifests, and source maps.

Phase 2 — native and delegated lowering

  • implement or complete the selected native hash/signature/message operations;
  • bind delegated calls to the exact CellDep, code/data identity, adapter, statement, and zero-success contract;
  • ensure EXEC terminality and SPAWN/WAIT continuation are reflected in control-flow and claim evidence; and
  • fail before artifact emission for missing, ambiguous, or unsupported verifier contracts.

Phase 3 — adversarial evidence

  • cover wrong domains, algorithms, personalizations, keys, signatures, thresholds, Script identities, witness fields, commitments, openings, statements, verifier Cells, adapters, and result codes;
  • mutate source records, sidecars, constants, and machine checks independently;
  • compare selected native behavior with maintained reference implementations; and
  • record worst-case cycles, stack, ELF bytes, witness bytes, and dependency size.

Completion criteria

  • The capability matrix classifies every cryptographic API used by the 0.30 corpus.
  • Domain and identity types prevent raw Address/Script/hash/digest/proof substitution.
  • Canonical authorization message handling is executable or bound to an exact external standard contract.
  • [Language design] Add explicit typed openings for digest-committed substate #13 openings compose with the shared witness envelope.
  • Trusted-external evidence states that compiler proof stops at identity, adapter, statement, and result enforcement.
  • Positive and adversarial CKB-VM cases cover every admitted primitive and adapter.
  • Independent-checker mutations cover every machine property it claims.
  • Resource budgets and dependency identities are release-gated.
  • dev, ci, and backend gates pass.
  • Independent cryptographic and authorization review is complete.

Non-goals

  • supporting every Rust cryptographic crate;
  • a circuit DSL or universal ZK system;
  • treating a public owner value as proof of credential control;
  • trusting a Registry name or builder-selected verifier without on-chain identity checks; or
  • claiming the compiler proves an external verifier's parser or cryptographic internals.

Dependencies

Activity

  1. a19q3 commented on Sep 11, 2026

    @a19q3
    CollaboratorAuthor

    0.30 evidence update: commit 313603f adds exact signed-transaction coverage for the authorization business family using the pinned bundled standard multisig-v2 Lock. It records successful 2-of-2 signing and exact policy Script identity, plus post-signing mutation, copied-owner, wrong-domain, wrong-key, and partial-signature failures with exact raw/serialized transaction hashes. This strengthens the business acceptance evidence only; the issue remains open for its existing selected-network deployment, release gate, BIP340 child-verifier measurement, and independent-review requirements.

  2. a19q3 commented on Sep 12, 2026

    @a19q3
    CollaboratorAuthor

    0.30 final repository-local update at 3cf60a1: the cryptographic/authorization matrix now freezes ten capabilities and twelve value domains. Nine resource rows have exact cycle, stack, ELF, witness, transaction, and dependency measurements. The reproducible NovaSeal BIP340 child at 1e7c812 is exercised through the current WitnessArgs.input_type and GroupInput ABI; parent/child/full-transaction execution matches 4/4 expected cases, with 15,792-byte measured child peak stack and 3,679,593-cycle full-transaction maximum. The exact cryptographic resource checker passes.

    The complete clean release gate passes, including strict backend audit and pinned CKB 0.207.0 local production admission. Independent review was explicitly waived by the maintainer; it was not performed or claimed as passed.

    This issue remains open only for selected-network deployment/admission evidence with exact chain, code-cell, dependency, Script, confirmation, and readback identities. No credentials or authority for that external deployment are available in this run, and no TAC, tag, signing, release, or deployment workflow was invoked.

  3. a19q3 commented on Sep 19, 2026

    @a19q3
    CollaboratorAuthor

    Closure evidence update, 2026-09-19: the selected-network blocker in the previous comment has been resolved, and this issue is now closed for the frozen 0.30 cryptographic/authorization scope.

    The Pudge deployment manifest and verified deployment report bind twelve immutable code Cells, including the exact NovaSeal parent/BIP340 child boundary, in two confirmed transactions. Live readback passed on 2026-09-18. Reproduction from candidate 74cff5fd matched all twelve executable sizes and SHA-256 identities; historical deployment provenance remains 3cf60a10 and was not relabeled.

    The candidate passed dev, full ci within release, backend, and release. The source and product gitlinks were pushed and read back before closure. Independent review remains explicitly waived, not passed; external-verifier internals remain trusted boundaries. Public publication is separately tracked in #27. See the complete audit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions