Skip to content

Expose typed CheckSigFromStack builtins#132

Open
elldeeone wants to merge 2 commits into
kaspanet:masterfrom
elldeeone:checkdatasig
Open

Expose typed CheckSigFromStack builtins#132
elldeeone wants to merge 2 commits into
kaspanet:masterfrom
elldeeone:checkdatasig

Conversation

@elldeeone

@elldeeone elldeeone commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds typed SilverScript builtins for Kaspa signature verification from stack:

  • CheckSigFromStack(datasig signature, byte[32] digest, pubkey publicKey)
  • CheckSigFromStackECDSA(datasig signature, byte[32] digest, byte[33] publicKey)

These expose the digest-level VM primitives directly, so contracts can choose the hashing scheme they need before passing a fixed 32-byte digest.

Changes

  • Lower CheckSigFromStack to OP_CHECKSIGFROMSTACK.
  • Lower CheckSigFromStackECDSA to OP_CHECKSIGFROMSTACKECDSA.
  • Type-check builtin arguments and bool return values.
  • Require a fixed byte[32] digest instead of accepting raw byte[] messages.
  • Add runtime tests for valid and forged Schnorr/ECDSA signatures.
  • Update examples, docs, and syntax highlighting.

Testing

  • npm --prefix tree-sitter run sync:highlights
  • cargo test -p silverscript-lang checksig -- --nocapture
  • cargo test -p silverscript-lang
  • cargo fmt --all --check
  • git diff --check

@elldeeone elldeeone changed the title Implement checkDataSig lowering to OP_CHECKSIGFROMSTACK Expose typed CheckSigFromStack builtins Jun 25, 2026
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