Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/dependency-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ jobs:
# packages that require a newer Go version than it was built with,
# so a stale pin here fails every scan step with "package requires
# newer Go version".
go-version: '1.26'
# 1.26.5 is affected by GO-2026-5972 in encoding/asn1. Pin the
# patched point release so govulncheck does not fail on the runner's
# cached vulnerable standard library.
go-version: '1.26.6'
cache: false
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,12 @@ All formats parse into the same `ContractNode` AST. From there, the pipeline is

## Example Contracts

24 example contracts demonstrate the major contract patterns implemented across the maintained native-language frontends:
Selected example contracts demonstrate the major contract patterns implemented across the maintained native-language frontends:

| Contract | Pattern | Stateful | Multi-method |
|----------|---------|----------|-------------|
| [P2PKH](examples/ts/p2pkh/) | Pay-to-Public-Key-Hash | No | No |
| [R1K1Wallet](examples/ts/r1-k1-wallet/) | P-256 hardware key with K1 recovery | No | Yes (2 paths) |
| [Escrow](examples/ts/escrow/) | Multi-party authorization | No | Yes (4 paths) |
| [Counter](examples/ts/stateful-counter/) | Stateful state machine | Yes | Yes |
| [Auction](examples/ts/auction/) | Bidding with deadline | Yes | Yes |
Expand All @@ -426,7 +427,7 @@ All formats parse into the same `ContractNode` AST. From there, the pipeline is
| [BSV20Token](examples/ts/bsv20-token/) | BSV-20 fungible token inscription | No | No |
| [BSV21Token](examples/ts/bsv21-token/) | BSV-21 fungible token inscription | No | No |

All 24 examples are available in `ts/`, `go/`, `rust/`, `python/`, and `zig/`. 71 contracts are available in all 9 formats (TypeScript, Go, Rust, Ruby, Python, Zig, Java, Solidity, Move). FunctionPatterns, PostQuantumWallet, SPHINCSWallet, SchnorrZKP, and ConvergenceProof are available in TypeScript, Go, Rust, Ruby, and Python. The full example set is also mirrored in `sol/` and `move/` (72 contracts each).
The original 24 cross-format examples are available in `ts/`, `go/`, `rust/`, `python/`, and `zig/`; R1K1Wallet is available in all 9 formats (TypeScript, Go, Rust, Ruby, Python, Zig, Java, Solidity, Move). 72 contracts are available in all 9 formats. FunctionPatterns, PostQuantumWallet, SPHINCSWallet, SchnorrZKP, and ConvergenceProof are available in TypeScript, Go, Rust, Ruby, and Python. The full example set is also mirrored in `sol/` and `move/` (73 contracts each).
```
examples/
ts/p2pkh/ P2PKH.runar.ts + P2PKH.test.ts
Expand Down
33 changes: 30 additions & 3 deletions conformance/golden-provenance-allowlist.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@
},
{
"path": "conformance/script-size-baseline.json",
"sha256": "d2817459528c70d767f065d672ca37b40716c68f7d9a9202a5f5ace4a6724473",
"sha256": "204e0e66078a18d01961a7eeb163cd0df0db137b05f2f7ef6f6c8057ece5ca77",
"verified-against": "second-implementation",
"reason": "MERGE RE-STAMP, not a new size change. The previous pin (38cb4fc1) was stamped on fix/ec-complete-formulas and described only that branch's deltas; merging fix/testing-gap-remediation alongside it makes the file the UNION of both branches' edits, so the hash moved without any fixture size moving for a new reason. Verified mechanically rather than by assertion: every one of the 71 entries was recomputed as len(conformance/tests/<fixture>/expected-script.hex)/2 and all 71 match the committed number exactly (0 mismatches, 0 missing hex files), so this file is a pure function of goldens that are themselves gated elsewhere -- 639/639 seven-tier Stack-IR + hex parity in BOTH fold modes, plus the real-crypto witnesses under conformance/witnesses/real-crypto/. Per-entry provenance of the delta vs origin/main e7221a7b: 5 entries are NEW fixtures from the testing-gap branch (assert-false-guard 2019, loop-if-merged-locals 2011, merge-locals-prop-updates 1006, merge-locals-shapes 3031, state-bigint-edges 952); 2 moved on that branch only (branched-readonly-len 1086 -> 1096, if-else 14 -> 20, both from the multi-result branch node); 9 moved on the EC branch only (ec-unit 453374 -> 479716, ec-demo and ec-primitives 1329161 -> 1332782, convergence-proof 451172 -> 452386, schnorr-zkp 872782 -> 875189, p256-primitives 924855 -> 928219, p256-wallet 955310 -> 958792, p384-primitives 1879251 -> 1883767, p384-wallet 1958395 -> 1963300, from the complete addition formulas plus the r/s range gate that closes the all-zero-signature universal forgery). Every merged value equals exactly the one branch that changed it -- no entry holds a blended or averaged number, which is the check that the merge did not silently reconcile two different size claims. All growth is inside the +10% tolerance and nothing shrank. See docs/audit/2026-08-ec-degenerate-cases.md.",
"reason": "Adds the new r1-k1-wallet fixture at exactly 959592 bytes. The update command recomputed all 72 entries from their expected-script.hex files; the only new baseline row is r1-k1-wallet, and its size independently equals the byte length emitted by all nine source frontends and all seven compiler tiers in multi-format conformance.",
"reviewer": "unreviewed:generated-by-agent",
"date": "2026-08-07",
"date": "2026-08-14",
"review-status": "unreviewed"
},
{
Expand Down Expand Up @@ -109,6 +109,15 @@
"reviewer": "gh:icellan",
"date": "2026-08-05"
},
{
"path": "conformance/sdk-output/tests/r1-k1-wallet/expected-locking.hex",
"sha256": "4609dccc9ea1844fbcf821f164fe1f200c2e9e139ac5af458327c20e3cf425c3",
"verified-against": "second-implementation",
"reason": "First deploy-locking golden for the R1-K1 wallet, produced by replacing its two fixed 20-byte Addr constructor slots with distinct commitments. Independent TypeScript, Go, Python, Ruby, Rust, and Java SDK tools locally reproduced the same 959632-byte script and SHA-256 digest; the required SDK-output CI gate additionally verifies the Zig implementation and all seven tiers byte-for-byte against this pin.",
"reviewer": "unreviewed:generated-by-agent",
"date": "2026-08-14",
"review-status": "unreviewed"
},
{
"path": "conformance/sdk-output/tests/state-bigint-edges-127/expected-locking.hex",
"sha256": "385ac444ab679f44a4cd4d2dac33e23d65bd50463c2345d57e8a39e42bca118e",
Expand Down Expand Up @@ -1518,6 +1527,24 @@
"reviewer": "gh:icellan",
"date": "2026-07-09"
},
{
"path": "conformance/tests/r1-k1-wallet/expected-ir.json",
"sha256": "03927dd806bd12b2de88807b22af47052c6bf7d7d1cdb1bedabebe42090db1fe",
"verified-against": "second-implementation",
"reason": "New R1-K1 multi-format fixture. The TypeScript-generated ANF is independently reproduced byte-for-byte by the Go, Rust, Python, Zig, Ruby, and Java compiler tiers from each of the nine source-language variants, in both fold modes.",
"reviewer": "unreviewed:generated-by-agent",
"date": "2026-08-14",
"review-status": "unreviewed"
},
{
"path": "conformance/tests/r1-k1-wallet/expected-script.hex",
"sha256": "868bc54b6c6016b945d1871c5878462b0314c11d76609046abf7aa711f528fce",
"verified-against": "second-implementation",
"reason": "New R1-K1 multi-format fixture. All nine source frontends and all seven independent compiler tiers emit the same 959592-byte locking script in fold-off and fold-on conformance; the focused real-crypto suite separately verifies genuine P-256 and K1 signatures and negative witnesses.",
"reviewer": "unreviewed:generated-by-agent",
"date": "2026-08-14",
"review-status": "unreviewed"
},
{
"path": "conformance/tests/schnorr-zkp/expected-script.hex",
"sha256": "da32369778973ca691fd02a5df3363dc658bbfc5deeb10b6c8ea7ece825988f7",
Expand Down
1 change: 1 addition & 0 deletions conformance/script-size-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"post-quantum-wots": 19582,
"private-helper-outputs": 2879,
"property-initializers": 1878,
"r1-k1-wallet": 959592,
"schnorr-zkp": 875189,
"selector": 985,
"sha256-compress": 23145,
Expand Down
24 changes: 22 additions & 2 deletions conformance/sdk-output/generate-inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = join(__dirname, '../..');
const TESTS_DIR = join(__dirname, 'tests');
const CONFORMANCE_TESTS_DIR = join(ROOT, 'conformance/tests');
// Reuse the loader that is already executing this TypeScript generator. This
// works for both a workspace-local tsx and the temporary package installed by
// `npx tsx`, without a second package-manager invocation or module lookup.
const TSX_NODE_ARGS = process.execArgv;

interface TestSpec {
name: string;
Expand Down Expand Up @@ -41,6 +45,7 @@ function resolveTestSource(spec: TestSpec): string {
// Standard test values
const PK = '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798';
const ADDR = '751e76e8199196d454941c45d1b3a323f1433bd6';
const ALT_ADDR = '89abcdefabbaabbaabbaabbaabbaabbaabbaabba';
const HASH32 = '0000000000000000000000000000000000000000000000000000000000000001';
const POINT = '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8';
const HELLO = '48656c6c6f';
Expand Down Expand Up @@ -240,6 +245,14 @@ const TEST_SPECS: TestSpec[] = [
{ type: 'ByteString', value: P256_PKHASH },
],
},
{
name: 'r1-k1-wallet',
source: 'examples/ts/r1-k1-wallet/R1K1Wallet.runar.ts',
constructorArgs: [
{ type: 'Addr', value: ADDR },
{ type: 'Addr', value: ALT_ADDR },
],
},
{
name: 'p384-primitives',
source: 'examples/ts/p384-primitives/P384Primitives.runar.ts',
Expand Down Expand Up @@ -423,8 +436,15 @@ for (const spec of TEST_SPECS) {
console.log(`Compiling ${spec.name} (${sourceRel})...`);
try {
execFileSync(
'npx',
['tsx', 'packages/runar-cli/src/bin.ts', 'compile', sourcePath, '-o', TMP_DIR],
process.execPath,
[
...TSX_NODE_ARGS,
'packages/runar-cli/src/bin.ts',
'compile',
sourcePath,
'-o',
TMP_DIR,
],
{ cwd: ROOT, stdio: 'pipe' },
);
} catch (err: any) {
Expand Down
8 changes: 6 additions & 2 deletions conformance/sdk-output/runner/sdk-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const ROOT = resolve(join(__dirname, '..', '..', '..'));
// Reuse the loader that is already executing this TypeScript runner. This
// works for both a workspace-local tsx and the temporary package installed by
// `npx tsx`, without a second package-manager invocation or module lookup.
const TSX_NODE_ARGS = process.execArgv;

interface SdkResult {
sdk: string;
Expand Down Expand Up @@ -47,8 +51,8 @@ function buildSdkTools(): SdkTool[] {
const tools: SdkTool[] = [
{
name: 'typescript',
cmd: 'npx',
args: (input) => ['tsx', join(toolsDir, 'ts-sdk-tool.ts'), input],
cmd: process.execPath,
args: (input) => [...TSX_NODE_ARGS, join(toolsDir, 'ts-sdk-tool.ts'), input],
},
{
name: 'go',
Expand Down

Large diffs are not rendered by default.

127 changes: 127 additions & 0 deletions conformance/sdk-output/tests/r1-k1-wallet/input.json

Large diffs are not rendered by default.

Loading
Loading