Skip to content

DVM intrinsics: verification + group-arithmetic primitives (verify_sig, commitments, ec_add, ec_mul, verify_adaptor) (fixes #127) - #128

Open
liqdmetal wants to merge 3 commits into
DEROFDN:community-devfrom
liqdmetal:feat/dvm-intrinsics
Open

DVM intrinsics: verification + group-arithmetic primitives (verify_sig, commitments, ec_add, ec_mul, verify_adaptor) (fixes #127)#128
liqdmetal wants to merge 3 commits into
DEROFDN:community-devfrom
liqdmetal:feat/dvm-intrinsics

Conversation

@liqdmetal

Copy link
Copy Markdown

Summary

One reviewable PR replacing three stacked PRs (#84, #105, #113). The
consolidated DVM intrinsics: group arithmetic + verification primitives.

What's in it

Intrinsic Gas Gate What it does
verify_sig 250k ≥9.0.0 Ed25519 signature auth in encrypted SCDATA (no SIGNER/ringsize-2)
hash_to_point 30k ≥9.0.0 map a value to a bn256 G1 point (self-contained Pedersen)
pedersen_commit 45k ≥9.0.0 homomorphic commitment (confidential settlement)
verify_commit 45k ≥9.0.0 verify a commitment against revealed value + blind
asset_balance 2k ≥9.0.0 SC reads its own stored balance (any asset)
ec_add 15k ≥9.0.0 bn256 G1 point addition (homomorphic accumulation)
ec_mul 30k ≥9.0.0 point scalar multiplication (homomorphic pair of ec_add)
verify_adaptor 250k ≥10.0.0 Schnorr adaptor-signature verification (cross-chain atomic)

Design notes (why it's safe)

  • Every intrinsic gated >=9.0.0 / >=10.0.0 — pre-fork contracts can't call
    them.
  • ec_mul and verify_adaptor use strict x<p point decode — rejects
    off-curve encodings that DecodeCompressed silently accepts (would be a
    chain-split vector).
  • verify_adaptor enforces low-s (non-malleable: rejects s ≥ group order).
  • verify_adaptor uses the existing bn256 + crypto.ReducedHash — zero new
    dependencies (Go stdlib has no secp256k1).

Tests

verify_sig (unit + version gate), ec_mul (homomorphic pair, composition,
identity), verify_adaptor (valid / wrong-key / tamper / malformed), pedersen,
hash_to_point, asset_balance, ec_add, + 2 wargame tests (scalar malleability,
non-canonical point).

Supersedes

Closes #84, #105, #113 in favour of this single package.

…ives + ec_mul + verify_adaptor

One reviewable package replacing three stacked PRs (DEROFDN#84 v9, DEROFDN#105 ec_mul,
DEROFDN#113 verify_adaptor):

v9 (>=9.0.0): verify_sig (Ed25519 auth in SCDATA), hash_to_point,
pedersen_commit / verify_commit (confidential settlement), asset_balance
(SC reads own balance), ec_add (homomorphic accumulation).

ec_mul (>=9.0.0, I3): bn256 G1 scalar multiplication — homomorphic pair
of ec_add; strict x<p decode (rejects off-curve encodings).

verify_adaptor (>=10.0.0, I4): Schnorr adaptor-signature verification —
the cross-chain atomic primitive; strict point decode + low-s scalar
(non-malleable).

Tests: verify_sig (unit + version gate), ec_mul (homomorphic pair,
composition, identity), verify_adaptor (valid/wrong-key/tamper/malformed),
pedersen, hash_to_point, asset_balance, ec_add, + 2 wargame (scalar
malleability, non-canonical point).
Ed25519 SC-auth keypair + SignSCData (domain:scid:entrypoint:args) +
VerifySCData. Gated contracts authorize via signature at ringsize>=4 —
removes the last legitimate use of ringsize-2 / SIGNER(). Builds directly on
the verify_sig intrinsic, so it ships as one package with the intrinsics.
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.

1 participant