@dcasegr/amm-client 0.0.0-stage → 0.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -2
- package/dist/client.d.ts +534 -0
- package/dist/client.js +1319 -0
- package/dist/errors.d.ts +17 -0
- package/dist/errors.js +75 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +53 -0
- package/dist/lib/config.d.ts +42 -0
- package/dist/lib/config.js +64 -0
- package/dist/lib/keys.d.ts +42 -0
- package/dist/lib/keys.js +48 -0
- package/dist/lib/overlay.d.ts +190 -0
- package/dist/lib/overlay.js +302 -0
- package/dist/lib/skein.d.ts +82 -0
- package/dist/lib/skein.js +142 -0
- package/dist/lib/tokenId.d.ts +72 -0
- package/dist/lib/tokenId.js +121 -0
- package/dist/lp/amounts.d.ts +12 -0
- package/dist/lp/amounts.js +38 -0
- package/dist/lp/close.d.ts +90 -0
- package/dist/lp/close.js +140 -0
- package/dist/lp/images.d.ts +11 -0
- package/dist/lp/images.js +45 -0
- package/dist/lp/inventory.d.ts +68 -0
- package/dist/lp/inventory.js +84 -0
- package/dist/lp/poolDeploy.d.ts +220 -0
- package/dist/lp/poolDeploy.js +291 -0
- package/dist/lp/poolRows.d.ts +13 -0
- package/dist/lp/poolRows.js +19 -0
- package/dist/lp/positions.d.ts +81 -0
- package/dist/lp/positions.js +144 -0
- package/dist/lp/rebalance.d.ts +101 -0
- package/dist/lp/rebalance.js +168 -0
- package/dist/lp/wallet.d.ts +12 -0
- package/dist/lp/wallet.js +19 -0
- package/dist/market/activeSwap.d.ts +158 -0
- package/dist/market/activeSwap.js +320 -0
- package/dist/market/plan.d.ts +85 -0
- package/dist/market/plan.js +149 -0
- package/dist/market/prices.d.ts +13 -0
- package/dist/market/prices.js +14 -0
- package/dist/market/relay.d.ts +84 -0
- package/dist/market/relay.js +201 -0
- package/dist/market/swapAction.d.ts +306 -0
- package/dist/market/swapAction.js +508 -0
- package/dist/market/swapFlow.d.ts +58 -0
- package/dist/market/swapFlow.js +86 -0
- package/dist/market/view.d.ts +58 -0
- package/dist/market/view.js +63 -0
- package/dist/pool/artifact.d.ts +23 -0
- package/dist/pool/artifact.js +38 -0
- package/dist/pool/index.d.ts +8 -0
- package/dist/pool/index.js +8 -0
- package/dist/pool/oneColor.d.ts +19 -0
- package/dist/pool/oneColor.js +39 -0
- package/dist/pool/pool.artifact.json +5069 -0
- package/dist/pool/runar-ir-schema.d.ts +21 -0
- package/dist/pool/runar-ir-schema.js +18 -0
- package/dist/pool/template.d.ts +295 -0
- package/dist/pool/template.js +715 -0
- package/dist/vendor/runar/LICENSE +21 -0
- package/dist/vendor/runar/NOTICE +15 -0
- package/dist/vendor/runar/runar-ir-schema/src/abi-type-encoding.d.ts +42 -0
- package/dist/vendor/runar/runar-ir-schema/src/abi-type-encoding.js +53 -0
- package/dist/vendor/runar/runar-ir-schema/src/anf-ir.d.ts +221 -0
- package/dist/vendor/runar/runar-ir-schema/src/anf-ir.js +33 -0
- package/dist/vendor/runar/runar-ir-schema/src/artifact.d.ts +288 -0
- package/dist/vendor/runar/runar-ir-schema/src/artifact.js +8 -0
- package/dist/vendor/runar/runar-ir-schema/src/canonical-json.d.ts +43 -0
- package/dist/vendor/runar/runar-ir-schema/src/canonical-json.js +204 -0
- package/dist/vendor/runar/runar-ir-schema/src/input-limits.d.ts +89 -0
- package/dist/vendor/runar/runar-ir-schema/src/input-limits.js +100 -0
- package/dist/vendor/runar/runar-ir-schema/src/stack-ir.d.ts +118 -0
- package/dist/vendor/runar/runar-ir-schema/src/stack-ir.js +8 -0
- package/dist/vendor/runar/runar-ir-schema/src/state-layout.d.ts +56 -0
- package/dist/vendor/runar/runar-ir-schema/src/state-layout.js +145 -0
- package/dist/vendor/runar/runar-ir-schema/src/unknown-anf-kind-error.d.ts +18 -0
- package/dist/vendor/runar/runar-ir-schema/src/unknown-anf-kind-error.js +25 -0
- package/dist/vendor/runar/runar-sdk/src/anf-interpreter.d.ts +160 -0
- package/dist/vendor/runar/runar-sdk/src/anf-interpreter.js +1149 -0
- package/dist/vendor/runar/runar-sdk/src/calling.d.ts +98 -0
- package/dist/vendor/runar/runar-sdk/src/calling.js +209 -0
- package/dist/vendor/runar/runar-sdk/src/contract.d.ts +443 -0
- package/dist/vendor/runar/runar-sdk/src/contract.js +2516 -0
- package/dist/vendor/runar/runar-sdk/src/deployment.d.ts +36 -0
- package/dist/vendor/runar/runar-sdk/src/deployment.js +119 -0
- package/dist/vendor/runar/runar-sdk/src/errors.d.ts +46 -0
- package/dist/vendor/runar/runar-sdk/src/errors.js +59 -0
- package/dist/vendor/runar/runar-sdk/src/oppushtx.d.ts +23 -0
- package/dist/vendor/runar/runar-sdk/src/oppushtx.js +95 -0
- package/dist/vendor/runar/runar-sdk/src/ordinals/envelope.d.ts +31 -0
- package/dist/vendor/runar/runar-sdk/src/ordinals/envelope.js +272 -0
- package/dist/vendor/runar/runar-sdk/src/ordinals/types.d.ts +21 -0
- package/dist/vendor/runar/runar-sdk/src/ordinals/types.js +4 -0
- package/dist/vendor/runar/runar-sdk/src/providers/provider.d.ts +65 -0
- package/dist/vendor/runar/runar-sdk/src/providers/provider.js +59 -0
- package/dist/vendor/runar/runar-sdk/src/providers/wallet-provider.d.ts +94 -0
- package/dist/vendor/runar/runar-sdk/src/providers/wallet-provider.js +297 -0
- package/dist/vendor/runar/runar-sdk/src/script-utils.d.ts +54 -0
- package/dist/vendor/runar/runar-sdk/src/script-utils.js +252 -0
- package/dist/vendor/runar/runar-sdk/src/signers/signer.d.ts +17 -0
- package/dist/vendor/runar/runar-sdk/src/signers/signer.js +4 -0
- package/dist/vendor/runar/runar-sdk/src/spend-safety.d.ts +31 -0
- package/dist/vendor/runar/runar-sdk/src/spend-safety.js +35 -0
- package/dist/vendor/runar/runar-sdk/src/state.d.ts +54 -0
- package/dist/vendor/runar/runar-sdk/src/state.js +584 -0
- package/dist/vendor/runar/runar-sdk/src/types.d.ts +227 -0
- package/dist/vendor/runar/runar-sdk/src/types.js +4 -0
- package/dist/vendor/runar/runar-sdk/src/unsound-primitives.d.ts +30 -0
- package/dist/vendor/runar/runar-sdk/src/unsound-primitives.js +42 -0
- package/dist/vendor/runar/runar-sdk.d.ts +9 -0
- package/dist/vendor/runar/runar-sdk.js +8 -0
- package/dist/wallet/action.d.ts +28 -0
- package/dist/wallet/action.js +42 -0
- package/dist/wallet/brc29.d.ts +83 -0
- package/dist/wallet/brc29.js +80 -0
- package/dist/wallet/color.d.ts +110 -0
- package/dist/wallet/color.js +134 -0
- package/dist/wallet/swapPayouts.d.ts +35 -0
- package/dist/wallet/swapPayouts.js +146 -0
- package/package.json +39 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Rúnar Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Vendored from Rúnar (https://github.com/icellan/runar), commit
|
|
2
|
+
d207ee8ec4c2b16e5d3b181da1e177fe1fd26c50 (the commit go.mod pins for the Go side),
|
|
3
|
+
MIT licence (LICENSE beside this file).
|
|
4
|
+
|
|
5
|
+
runar-sdk/src: the modules runar-sdk's contract.ts, state.ts and script-utils.ts import
|
|
6
|
+
(their import closure), copied unchanged except:
|
|
7
|
+
- every `from 'runar-ir-schema'` reads `from '../../../../pool/runar-ir-schema.js'`
|
|
8
|
+
(that package's barrel without its node-only Ajv validators);
|
|
9
|
+
- anf-interpreter.ts takes ECDSA's `verify` from `@bsv/sdk`'s root export
|
|
10
|
+
(`ECDSA.verify`) instead of the subpath `@bsv/sdk/primitives/ECDSA`, which
|
|
11
|
+
@bsv/sdk 4's package exports do not name.
|
|
12
|
+
runar-ir-schema/src: the eight modules that barrel re-exports, copied unchanged.
|
|
13
|
+
|
|
14
|
+
Why vendored: runar-sdk 1.0.0-rc.1 is not published (npm has 0.4.6, on @bsv/sdk 2),
|
|
15
|
+
and its package.json names runar-ir-schema as pnpm `workspace:*`.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ABI-type → slot value encoding — the single source of truth for HOW a
|
|
3
|
+
* constructor arg of a given ABI type is represented in the locking script.
|
|
4
|
+
*
|
|
5
|
+
* Three consumers used to answer this question with three hand-maintained
|
|
6
|
+
* `switch` statements, and they drifted:
|
|
7
|
+
*
|
|
8
|
+
* - the compiler's `slotValueEncoding` (artifact/assembler.ts), which stamps
|
|
9
|
+
* `ConstructorSlot.valueEncoding`
|
|
10
|
+
* - `runar-cli`'s `encodingForType` (commands/deploy.ts), which parses
|
|
11
|
+
* `--args`
|
|
12
|
+
* - the SDK's `interpretScriptElement` (script-utils.ts), which reads the
|
|
13
|
+
* values back off chain
|
|
14
|
+
*
|
|
15
|
+
* The drift was a funds bug. `RabinSig` / `RabinPubKey` are `bigint` ALIASES
|
|
16
|
+
* (runar-lang/src/types.ts:68-71) and the compiler consumes them with OP_MOD,
|
|
17
|
+
* i.e. as Script NUMBERS — but they were absent from every one of those
|
|
18
|
+
* switches, so the slot was described as an opaque byte push. The CLI then
|
|
19
|
+
* accepted a big-endian hex modulus and spliced it in verbatim for OP_MOD to
|
|
20
|
+
* read little-endian: the covenant can never verify and the output is
|
|
21
|
+
* unspendable. `boolean` (the CANONICAL primitive name — `bool` is the alias)
|
|
22
|
+
* was missing from the read-back switch in six of the seven SDK tiers, with
|
|
23
|
+
* the same shape of consequence.
|
|
24
|
+
*
|
|
25
|
+
* This is the constructor-slot analogue of `STATE_FIELD_WIDTHS`, which does
|
|
26
|
+
* the same job for the state tail. Keep them side by side.
|
|
27
|
+
*/
|
|
28
|
+
/** How a constructor arg of a given ABI type is encoded into its slot. */
|
|
29
|
+
export type AbiValueEncoding = 'data' | 'scriptnum' | 'bool';
|
|
30
|
+
/**
|
|
31
|
+
* ABI type name → slot value encoding, for every type that is NOT a plain
|
|
32
|
+
* data push. Types absent from this table encode as `'data'`: a raw push of
|
|
33
|
+
* the value bytes (`PubKey`, `Sha256`, `Point`, `ByteString`, ...).
|
|
34
|
+
*
|
|
35
|
+
* Aliases are listed explicitly rather than resolved, because the ABI carries
|
|
36
|
+
* the SOURCE spelling: a `RabinPubKey` param is written `"type":"RabinPubKey"`
|
|
37
|
+
* in the artifact, never `"bigint"`. `int` is the surface spelling the
|
|
38
|
+
* Solidity/Move/Go/Rust/Python frontends lower to `bigint`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ABI_VALUE_ENCODINGS: Readonly<Record<string, AbiValueEncoding>>;
|
|
41
|
+
/** Classify an ABI type name. Unknown / byte types are a raw data push. */
|
|
42
|
+
export declare function abiValueEncoding(type: string): AbiValueEncoding;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ABI-type → slot value encoding — the single source of truth for HOW a
|
|
3
|
+
* constructor arg of a given ABI type is represented in the locking script.
|
|
4
|
+
*
|
|
5
|
+
* Three consumers used to answer this question with three hand-maintained
|
|
6
|
+
* `switch` statements, and they drifted:
|
|
7
|
+
*
|
|
8
|
+
* - the compiler's `slotValueEncoding` (artifact/assembler.ts), which stamps
|
|
9
|
+
* `ConstructorSlot.valueEncoding`
|
|
10
|
+
* - `runar-cli`'s `encodingForType` (commands/deploy.ts), which parses
|
|
11
|
+
* `--args`
|
|
12
|
+
* - the SDK's `interpretScriptElement` (script-utils.ts), which reads the
|
|
13
|
+
* values back off chain
|
|
14
|
+
*
|
|
15
|
+
* The drift was a funds bug. `RabinSig` / `RabinPubKey` are `bigint` ALIASES
|
|
16
|
+
* (runar-lang/src/types.ts:68-71) and the compiler consumes them with OP_MOD,
|
|
17
|
+
* i.e. as Script NUMBERS — but they were absent from every one of those
|
|
18
|
+
* switches, so the slot was described as an opaque byte push. The CLI then
|
|
19
|
+
* accepted a big-endian hex modulus and spliced it in verbatim for OP_MOD to
|
|
20
|
+
* read little-endian: the covenant can never verify and the output is
|
|
21
|
+
* unspendable. `boolean` (the CANONICAL primitive name — `bool` is the alias)
|
|
22
|
+
* was missing from the read-back switch in six of the seven SDK tiers, with
|
|
23
|
+
* the same shape of consequence.
|
|
24
|
+
*
|
|
25
|
+
* This is the constructor-slot analogue of `STATE_FIELD_WIDTHS`, which does
|
|
26
|
+
* the same job for the state tail. Keep them side by side.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* ABI type name → slot value encoding, for every type that is NOT a plain
|
|
30
|
+
* data push. Types absent from this table encode as `'data'`: a raw push of
|
|
31
|
+
* the value bytes (`PubKey`, `Sha256`, `Point`, `ByteString`, ...).
|
|
32
|
+
*
|
|
33
|
+
* Aliases are listed explicitly rather than resolved, because the ABI carries
|
|
34
|
+
* the SOURCE spelling: a `RabinPubKey` param is written `"type":"RabinPubKey"`
|
|
35
|
+
* in the artifact, never `"bigint"`. `int` is the surface spelling the
|
|
36
|
+
* Solidity/Move/Go/Rust/Python frontends lower to `bigint`.
|
|
37
|
+
*/
|
|
38
|
+
export const ABI_VALUE_ENCODINGS = {
|
|
39
|
+
bigint: 'scriptnum',
|
|
40
|
+
int: 'scriptnum',
|
|
41
|
+
// `RabinSig` / `RabinPubKey` are `bigint` aliases. `verifyRabinSig` lowers
|
|
42
|
+
// to OP_MOD, which reads its operand as a little-endian sign-magnitude
|
|
43
|
+
// Script number — exactly what `bigint` gets.
|
|
44
|
+
RabinSig: 'scriptnum',
|
|
45
|
+
RabinPubKey: 'scriptnum',
|
|
46
|
+
// `boolean` is canonical; `bool` is the alias several frontends spell.
|
|
47
|
+
boolean: 'bool',
|
|
48
|
+
bool: 'bool',
|
|
49
|
+
};
|
|
50
|
+
/** Classify an ABI type name. Unknown / byte types are a raw data push. */
|
|
51
|
+
export function abiValueEncoding(type) {
|
|
52
|
+
return ABI_VALUE_ENCODINGS[type] ?? 'data';
|
|
53
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANF IR — A-Normal Form intermediate representation (Pass 4 output).
|
|
3
|
+
*
|
|
4
|
+
* This is the **canonical conformance boundary** for Rúnar compilers.
|
|
5
|
+
* Two compilers that accept the same Rúnar source MUST produce
|
|
6
|
+
* byte-identical ANF IR (when serialised with canonical JSON).
|
|
7
|
+
*
|
|
8
|
+
* Every compound expression is decomposed into a flat sequence of
|
|
9
|
+
* let-bindings whose right-hand sides are *simple* values: constants,
|
|
10
|
+
* variable references, a single primitive operation, or a branch/loop.
|
|
11
|
+
*/
|
|
12
|
+
export interface ANFProgram {
|
|
13
|
+
contractName: string;
|
|
14
|
+
properties: ANFProperty[];
|
|
15
|
+
methods: ANFMethod[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* One FixedArray nesting level on a synthetic scalar leaf. Outermost level
|
|
19
|
+
* first. `base` is the property name one level up (`grid`, then `grid__0`),
|
|
20
|
+
* `index` this leaf's position at that level, `length` that level's arity.
|
|
21
|
+
*/
|
|
22
|
+
export interface ANFSyntheticArrayLevel {
|
|
23
|
+
base: string;
|
|
24
|
+
index: number;
|
|
25
|
+
length: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ANFProperty {
|
|
28
|
+
name: string;
|
|
29
|
+
type: string;
|
|
30
|
+
readonly: boolean;
|
|
31
|
+
initialValue?: string | bigint | boolean;
|
|
32
|
+
/**
|
|
33
|
+
* N-095: present only on a scalar leaf minted by the expand-fixed-arrays
|
|
34
|
+
* pass. The artifact assembler consumes one level per pass to regroup the
|
|
35
|
+
* synthetic siblings back into a single FixedArray state/ABI entry, so this
|
|
36
|
+
* is load-bearing wire data: an ANF that drops it still compiles to the same
|
|
37
|
+
* script bytes but degrades the SDK's `state.grid` accessor into N raw
|
|
38
|
+
* scalars. The TS frontend reads the chain off the AST
|
|
39
|
+
* (`PropertyNode.__syntheticArrayChain`) instead and has no ANF-input mode,
|
|
40
|
+
* so it is the one tier that need not emit it.
|
|
41
|
+
*/
|
|
42
|
+
syntheticArrayChain?: ANFSyntheticArrayLevel[];
|
|
43
|
+
}
|
|
44
|
+
export interface ANFMethod {
|
|
45
|
+
name: string;
|
|
46
|
+
params: ANFParam[];
|
|
47
|
+
body: ANFBinding[];
|
|
48
|
+
isPublic: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface ANFParam {
|
|
51
|
+
name: string;
|
|
52
|
+
type: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A single let-binding: `let <name> = <value>`
|
|
56
|
+
*
|
|
57
|
+
* Names follow the pattern `t0`, `t1`, … and are scoped per method.
|
|
58
|
+
*/
|
|
59
|
+
export interface ANFBinding {
|
|
60
|
+
name: string;
|
|
61
|
+
value: ANFValue;
|
|
62
|
+
/** Debug-only: source location of the originating AST node. Not part of conformance. */
|
|
63
|
+
sourceLoc?: {
|
|
64
|
+
file: string;
|
|
65
|
+
line: number;
|
|
66
|
+
column: number;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export interface LoadParam {
|
|
70
|
+
kind: 'load_param';
|
|
71
|
+
name: string;
|
|
72
|
+
}
|
|
73
|
+
export interface LoadProp {
|
|
74
|
+
kind: 'load_prop';
|
|
75
|
+
name: string;
|
|
76
|
+
}
|
|
77
|
+
export interface LoadConst {
|
|
78
|
+
kind: 'load_const';
|
|
79
|
+
value: string | bigint | boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface BinOp {
|
|
82
|
+
kind: 'bin_op';
|
|
83
|
+
op: string;
|
|
84
|
+
left: string;
|
|
85
|
+
right: string;
|
|
86
|
+
result_type?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface UnaryOp {
|
|
89
|
+
kind: 'unary_op';
|
|
90
|
+
op: string;
|
|
91
|
+
operand: string;
|
|
92
|
+
result_type?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface Call {
|
|
95
|
+
kind: 'call';
|
|
96
|
+
func: string;
|
|
97
|
+
args: string[];
|
|
98
|
+
}
|
|
99
|
+
export interface MethodCall {
|
|
100
|
+
kind: 'method_call';
|
|
101
|
+
object: string;
|
|
102
|
+
method: string;
|
|
103
|
+
args: string[];
|
|
104
|
+
}
|
|
105
|
+
export interface If {
|
|
106
|
+
kind: 'if';
|
|
107
|
+
cond: string;
|
|
108
|
+
then: ANFBinding[];
|
|
109
|
+
else: ANFBinding[];
|
|
110
|
+
/**
|
|
111
|
+
* Ordered named result slots both arms leave (`results[0]` deepest). Entries
|
|
112
|
+
* name a branch-merged local or an arm-written contract property. Absent
|
|
113
|
+
* when the `if` carries at most one result — see the copy of this type in
|
|
114
|
+
* `packages/runar-compiler/src/ir/anf-ir.ts` for the full contract.
|
|
115
|
+
*/
|
|
116
|
+
results?: string[];
|
|
117
|
+
}
|
|
118
|
+
export interface Loop {
|
|
119
|
+
kind: 'loop';
|
|
120
|
+
count: number;
|
|
121
|
+
body: ANFBinding[];
|
|
122
|
+
iterVar: string;
|
|
123
|
+
start: bigint;
|
|
124
|
+
step: 1 | -1;
|
|
125
|
+
}
|
|
126
|
+
export interface Assert {
|
|
127
|
+
kind: 'assert';
|
|
128
|
+
value: string;
|
|
129
|
+
isAutoInjectedStateCheck?: boolean;
|
|
130
|
+
}
|
|
131
|
+
export interface UpdateProp {
|
|
132
|
+
kind: 'update_prop';
|
|
133
|
+
name: string;
|
|
134
|
+
value: string;
|
|
135
|
+
}
|
|
136
|
+
export interface GetStateScript {
|
|
137
|
+
kind: 'get_state_script';
|
|
138
|
+
}
|
|
139
|
+
export interface CheckPreimage {
|
|
140
|
+
kind: 'check_preimage';
|
|
141
|
+
preimage: string;
|
|
142
|
+
/**
|
|
143
|
+
* Issue #123: BIP-143 sighash flag the on-chain OP_PUSH_TX binding appends to
|
|
144
|
+
* the derived signature (so the node re-derives the tx sighash under this
|
|
145
|
+
* flag). Absent = default `ALL|FORKID` (0x41), byte-identical to the pinned
|
|
146
|
+
* cross-tier binding blob. Only set for a method that declares a non-default
|
|
147
|
+
* `@sighash` mode, keeping golden ANF unchanged for every existing contract.
|
|
148
|
+
*/
|
|
149
|
+
sighashFlag?: number;
|
|
150
|
+
}
|
|
151
|
+
export interface DeserializeState {
|
|
152
|
+
kind: 'deserialize_state';
|
|
153
|
+
preimage: string;
|
|
154
|
+
}
|
|
155
|
+
export interface AddOutput {
|
|
156
|
+
kind: 'add_output';
|
|
157
|
+
satoshis: string;
|
|
158
|
+
stateValues: string[];
|
|
159
|
+
preimage: string;
|
|
160
|
+
}
|
|
161
|
+
export interface AddRawOutput {
|
|
162
|
+
kind: 'add_raw_output';
|
|
163
|
+
satoshis: string;
|
|
164
|
+
scriptBytes: string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* AddDataOutput — records an additional transaction output that is NOT a
|
|
168
|
+
* state continuation. The output is included in the auto-computed
|
|
169
|
+
* continuation hash (hashOutputs) in declaration order, after state
|
|
170
|
+
* outputs and before the change output. The emit shape is identical to
|
|
171
|
+
* `add_raw_output`: amount(8LE) + varint(scriptLen) + scriptBytes.
|
|
172
|
+
*
|
|
173
|
+
* Distinguished from `add_raw_output` only at the continuation-hash
|
|
174
|
+
* composition stage: `add_data_output` refs are concatenated AFTER all
|
|
175
|
+
* `add_output` (state) refs and BEFORE the change output.
|
|
176
|
+
*/
|
|
177
|
+
export interface AddDataOutput {
|
|
178
|
+
kind: 'add_data_output';
|
|
179
|
+
satoshis: string;
|
|
180
|
+
scriptBytes: string;
|
|
181
|
+
}
|
|
182
|
+
export interface ArrayLiteral {
|
|
183
|
+
kind: 'array_literal';
|
|
184
|
+
elements: string[];
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* RawScript — an opaque opcode-byte span with declared stack arity.
|
|
188
|
+
*
|
|
189
|
+
* Mirrors the definition in `packages/runar-compiler/src/ir/anf-ir.ts`.
|
|
190
|
+
* The IR stores resolved bytes (not mnemonics) so cross-compiler
|
|
191
|
+
* conformance reduces to byte equality.
|
|
192
|
+
*/
|
|
193
|
+
export interface RawScript {
|
|
194
|
+
kind: 'raw_script';
|
|
195
|
+
bytes: string;
|
|
196
|
+
in_arity: number;
|
|
197
|
+
out_arity: number;
|
|
198
|
+
}
|
|
199
|
+
export type ANFValue = LoadParam | LoadProp | LoadConst | BinOp | UnaryOp | Call | MethodCall | If | Loop | Assert | UpdateProp | GetStateScript | CheckPreimage | DeserializeState | AddOutput | AddRawOutput | AddDataOutput | ArrayLiteral | RawScript;
|
|
200
|
+
/**
|
|
201
|
+
* Name prefix for the temporaries 04-anf-lower appends to BOTH arms of an
|
|
202
|
+
* if-statement that merges two or more locals (`appendMergedLocalResults`).
|
|
203
|
+
*
|
|
204
|
+
* Emitted by `appendBranchResults` (04-anf-lower) for — and ONLY for — an `if`
|
|
205
|
+
* that declares `results`. Both arms end with an identical 2K-binding block:
|
|
206
|
+
* K copies into `__merge$0..K-1`, then K rebinds of the declared results from
|
|
207
|
+
* those temps. That makes each arm hold exactly `results`, in `results` order,
|
|
208
|
+
* whichever arm ran and whichever of them that arm actually assigned.
|
|
209
|
+
*
|
|
210
|
+
* The block is a MATERIALISATION MECHANISM, not a signal. Stack lowering reads
|
|
211
|
+
* the node's `results` list — it does not count or recognise this block, and
|
|
212
|
+
* has not since the multi-result branch node landed (the `countMergedLocalResults`
|
|
213
|
+
* inference it used to do is deleted in all seven tiers). The prefix survives
|
|
214
|
+
* in two roles only: naming the temps, and letting the lowerer REFUSE an ANF
|
|
215
|
+
* that carries the block without `results`, which is a pre-multi-result wire
|
|
216
|
+
* format no current compiler can produce.
|
|
217
|
+
*
|
|
218
|
+
* The prefix is part of the ANF wire format: all seven compilers emit and
|
|
219
|
+
* recognise the same block.
|
|
220
|
+
*/
|
|
221
|
+
export declare const MERGED_LOCAL_TEMP_PREFIX = "__merge$";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANF IR — A-Normal Form intermediate representation (Pass 4 output).
|
|
3
|
+
*
|
|
4
|
+
* This is the **canonical conformance boundary** for Rúnar compilers.
|
|
5
|
+
* Two compilers that accept the same Rúnar source MUST produce
|
|
6
|
+
* byte-identical ANF IR (when serialised with canonical JSON).
|
|
7
|
+
*
|
|
8
|
+
* Every compound expression is decomposed into a flat sequence of
|
|
9
|
+
* let-bindings whose right-hand sides are *simple* values: constants,
|
|
10
|
+
* variable references, a single primitive operation, or a branch/loop.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Name prefix for the temporaries 04-anf-lower appends to BOTH arms of an
|
|
14
|
+
* if-statement that merges two or more locals (`appendMergedLocalResults`).
|
|
15
|
+
*
|
|
16
|
+
* Emitted by `appendBranchResults` (04-anf-lower) for — and ONLY for — an `if`
|
|
17
|
+
* that declares `results`. Both arms end with an identical 2K-binding block:
|
|
18
|
+
* K copies into `__merge$0..K-1`, then K rebinds of the declared results from
|
|
19
|
+
* those temps. That makes each arm hold exactly `results`, in `results` order,
|
|
20
|
+
* whichever arm ran and whichever of them that arm actually assigned.
|
|
21
|
+
*
|
|
22
|
+
* The block is a MATERIALISATION MECHANISM, not a signal. Stack lowering reads
|
|
23
|
+
* the node's `results` list — it does not count or recognise this block, and
|
|
24
|
+
* has not since the multi-result branch node landed (the `countMergedLocalResults`
|
|
25
|
+
* inference it used to do is deleted in all seven tiers). The prefix survives
|
|
26
|
+
* in two roles only: naming the temps, and letting the lowerer REFUSE an ANF
|
|
27
|
+
* that carries the block without `results`, which is a pre-multi-result wire
|
|
28
|
+
* format no current compiler can produce.
|
|
29
|
+
*
|
|
30
|
+
* The prefix is part of the ANF wire format: all seven compilers emit and
|
|
31
|
+
* recognise the same block.
|
|
32
|
+
*/
|
|
33
|
+
export const MERGED_LOCAL_TEMP_PREFIX = '__merge$';
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rúnar Artifact — the final compiled output of a Rúnar compiler (Pass 6).
|
|
3
|
+
*
|
|
4
|
+
* This is what gets consumed by wallets, SDKs, and deployment tooling.
|
|
5
|
+
* It bundles the locking script, ABI metadata, optional debug info,
|
|
6
|
+
* and (for stateful contracts) state field descriptors.
|
|
7
|
+
*/
|
|
8
|
+
import type { ANFProgram } from './anf-ir.js';
|
|
9
|
+
import type { StackProgram } from './stack-ir.js';
|
|
10
|
+
export interface ABIParam {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
/**
|
|
14
|
+
* Present when this ABI param represents an expanded FixedArray<T, N>.
|
|
15
|
+
* Callers can pass a plain array of length N; the SDK will flatten it
|
|
16
|
+
* into the underlying positional slots by `syntheticNames` order.
|
|
17
|
+
*/
|
|
18
|
+
fixedArray?: {
|
|
19
|
+
elementType: string;
|
|
20
|
+
length: number;
|
|
21
|
+
syntheticNames: string[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface ABIConstructor {
|
|
25
|
+
params: ABIParam[];
|
|
26
|
+
}
|
|
27
|
+
export interface ABIMethod {
|
|
28
|
+
name: string;
|
|
29
|
+
params: ABIParam[];
|
|
30
|
+
isPublic: boolean;
|
|
31
|
+
/** True for stateful contract methods that don't mutate state (no continuation output). */
|
|
32
|
+
isTerminal?: boolean;
|
|
33
|
+
/** True if the unlocking script is prefixed with `_codePart` (issue #100). */
|
|
34
|
+
usesCodePart?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Issue #123: BIP-143 sighash type from a `@sighash` directive (e.g. `0x43`
|
|
37
|
+
* for SINGLE|FORKID). Absent = default `ALL|FORKID` (0x41).
|
|
38
|
+
*/
|
|
39
|
+
sigHashType?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface ABI {
|
|
42
|
+
constructor: ABIConstructor;
|
|
43
|
+
methods: ABIMethod[];
|
|
44
|
+
}
|
|
45
|
+
export interface SourceMapping {
|
|
46
|
+
opcodeIndex: number;
|
|
47
|
+
sourceFile: string;
|
|
48
|
+
line: number;
|
|
49
|
+
column: number;
|
|
50
|
+
}
|
|
51
|
+
export interface SourceMap {
|
|
52
|
+
mappings: SourceMapping[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A compile-time default value for a state field.
|
|
56
|
+
*
|
|
57
|
+
* For scalar state fields this is a single `string | bigint | boolean`.
|
|
58
|
+
* For grouped FixedArray state fields the assembler stores a real
|
|
59
|
+
* JS array of element-typed values so the SDK can consume it without
|
|
60
|
+
* parsing a stringified tuple. For nested FixedArrays (e.g.
|
|
61
|
+
* `FixedArray<FixedArray<bigint, 2>, 2>`) the initial value is a
|
|
62
|
+
* recursive nested array that mirrors the declared shape.
|
|
63
|
+
*/
|
|
64
|
+
export type StateFieldInitialValue = string | bigint | boolean | ReadonlyArray<StateFieldInitialValue>;
|
|
65
|
+
export interface StateField {
|
|
66
|
+
name: string;
|
|
67
|
+
type: string;
|
|
68
|
+
index: number;
|
|
69
|
+
initialValue?: StateFieldInitialValue;
|
|
70
|
+
/**
|
|
71
|
+
* For state fields representing an expanded FixedArray<T, N>:
|
|
72
|
+
* - `type` is the user-facing type string (e.g. `FixedArray<bigint, 9>`)
|
|
73
|
+
* - `fixedArray.elementType` is the element primitive type (e.g. `bigint`)
|
|
74
|
+
* - `fixedArray.length` is N
|
|
75
|
+
* - `fixedArray.syntheticNames` is the flat list of underlying scalar
|
|
76
|
+
* state-field names (`Board__0`..`Board__8`), in order.
|
|
77
|
+
*
|
|
78
|
+
* Runtime SDKs use this to flatten and unflatten arrays on state read/write.
|
|
79
|
+
*/
|
|
80
|
+
fixedArray?: {
|
|
81
|
+
elementType: string;
|
|
82
|
+
length: number;
|
|
83
|
+
syntheticNames: string[];
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Wire encoding of the serialized field:
|
|
87
|
+
* - 'num2bin-le8': bigint — 8 raw bytes, little-endian sign-magnitude
|
|
88
|
+
* (OP_NUM2BIN 8 semantics; sign bit = MSB of last byte).
|
|
89
|
+
* - 'bool1': bool — 1 raw byte (0x00 / 0x01).
|
|
90
|
+
* - 'raw': fixed-size byte types — raw bytes, no framing
|
|
91
|
+
* (PubKey 33, Addr/Ripemd160 20, Sha256 32, Point 64).
|
|
92
|
+
* - 'pushdata': variable-length types — push-data framed (length
|
|
93
|
+
* prefix + bytes); byte length is value-dependent.
|
|
94
|
+
*/
|
|
95
|
+
encoding?: 'num2bin-le8' | 'bool1' | 'raw' | 'pushdata';
|
|
96
|
+
/** Byte offset from the byte AFTER the OP_RETURN separator. Omitted when
|
|
97
|
+
* any preceding field is variable-length. */
|
|
98
|
+
byteOffset?: number;
|
|
99
|
+
/** Serialized length in bytes (for fixedArray fields: total across all
|
|
100
|
+
* flattened leaves). Omitted for variable-length fields. */
|
|
101
|
+
byteLength?: number;
|
|
102
|
+
/** NEGATIVE byte offset from the END of the locking script (the state
|
|
103
|
+
* tail is the script's suffix, so `scriptLen + tailOffset` is the
|
|
104
|
+
* field's start). Omitted when this or any following field is
|
|
105
|
+
* variable-length. */
|
|
106
|
+
tailOffset?: number;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* One deploy-baked constructor slot: a 1-byte OP_0 placeholder in the
|
|
110
|
+
* TEMPLATE script (`artifact.script`) that the SDK replaces with the
|
|
111
|
+
* encoded constructor arg at deploy time.
|
|
112
|
+
*
|
|
113
|
+
* The verification-descriptor fields (`name`, `type`, `valueEncoding`,
|
|
114
|
+
* `fixedValueByteLength`, `fixedPushHeaderBytes`) are additive metadata that
|
|
115
|
+
* make cross-contract verification MECHANICAL: a consuming contract (or
|
|
116
|
+
* off-chain verifier) that inspects a companion input's parent transaction
|
|
117
|
+
* can locate each baked readonly value without re-deriving offsets by
|
|
118
|
+
* diffing/`indexOf`-ing compiled scripts — which is fragile and encoding-
|
|
119
|
+
* sensitive (bigint values 1..16 bake as a single OP_N opcode byte, 0 bakes
|
|
120
|
+
* as OP_0, and >=17 bakes as a multi-byte push that shifts every downstream
|
|
121
|
+
* offset).
|
|
122
|
+
*
|
|
123
|
+
* DESIGN SPLIT (value-independence): the compiler cannot know the byte
|
|
124
|
+
* length a slot occupies after deployment — that depends on the VALUE baked
|
|
125
|
+
* at deploy time (a 33-byte PubKey push vs. a 1-byte OP_N). So the artifact
|
|
126
|
+
* carries only value-INDEPENDENT metadata here, and the SDK's
|
|
127
|
+
* `resolveSlotLayout(artifact, constructorArgs)` / `computeTemplateHash(
|
|
128
|
+
* artifact, constructorArgs)` resolve concrete offsets/lengths/hashes for
|
|
129
|
+
* GIVEN args.
|
|
130
|
+
*/
|
|
131
|
+
export interface ConstructorSlot {
|
|
132
|
+
/** Index into `abi.constructor.params`. */
|
|
133
|
+
paramIndex: number;
|
|
134
|
+
/** Byte offset of the 1-byte OP_0 placeholder in the template script. */
|
|
135
|
+
byteOffset: number;
|
|
136
|
+
/** Constructor parameter name (matches `abi.constructor.params[paramIndex].name`). */
|
|
137
|
+
name?: string;
|
|
138
|
+
/** ABI type of the parameter (e.g. `PubKey`, `bigint`, `ByteString`). */
|
|
139
|
+
type?: string;
|
|
140
|
+
/**
|
|
141
|
+
* How the deploy-time value is encoded when spliced into the slot:
|
|
142
|
+
* - 'data': raw data push (push header + value bytes). Fixed-size
|
|
143
|
+
* types (PubKey 33B, Sha256 32B, ...) always take
|
|
144
|
+
* header 1B + value NB; variable-length ByteString
|
|
145
|
+
* header size depends on the value length.
|
|
146
|
+
* - 'scriptnum': minimally-encoded Script number. 0 → OP_0 (1 opcode
|
|
147
|
+
* byte), 1..16 → single OP_N opcode byte (0x50+N),
|
|
148
|
+
* -1 → OP_1NEGATE, else 1-byte header + LE
|
|
149
|
+
* sign-magnitude bytes.
|
|
150
|
+
* - 'bool': single opcode byte (OP_TRUE / OP_0).
|
|
151
|
+
*/
|
|
152
|
+
valueEncoding?: 'data' | 'scriptnum' | 'bool';
|
|
153
|
+
/** For fixed-size data types only: the baked value length in bytes
|
|
154
|
+
* (PubKey 33, Sha256 32, Addr/Ripemd160 20, Point 64). */
|
|
155
|
+
fixedValueByteLength?: number;
|
|
156
|
+
/** For fixed-size data types only: the push-header length in bytes that
|
|
157
|
+
* precedes the value (1 for all lengths <= 75). */
|
|
158
|
+
fixedPushHeaderBytes?: number;
|
|
159
|
+
}
|
|
160
|
+
export interface CodeSepIndexSlot {
|
|
161
|
+
/** Byte offset of the OP_0 placeholder in the template script */
|
|
162
|
+
byteOffset: number;
|
|
163
|
+
/** The template-relative codeSeparatorIndex value this placeholder represents */
|
|
164
|
+
codeSepIndex: number;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* One piece of the slot-excised template identity.
|
|
168
|
+
*
|
|
169
|
+
* The resolved code part (template with constructor args spliced in) is
|
|
170
|
+
* split at every constructor slot's VALUE bytes: `code` pieces are the
|
|
171
|
+
* byte runs kept in the template (including each slot's push header, whose
|
|
172
|
+
* presence pins the baked value's length), `slot` pieces are the excised
|
|
173
|
+
* value bytes. A verifier recomputes the template hash by concatenating
|
|
174
|
+
* the `code` pieces of a candidate script — using the concrete boundaries
|
|
175
|
+
* from the SDK's `resolveSlotLayout` — and hashing the result.
|
|
176
|
+
*/
|
|
177
|
+
export interface TemplateDigestPiece {
|
|
178
|
+
kind: 'code' | 'slot';
|
|
179
|
+
/** For kind 'slot': the excised slot's constructor param name. */
|
|
180
|
+
slot?: string;
|
|
181
|
+
/** For kind 'slot': the slot's TEMPLATE byte offset (disambiguates
|
|
182
|
+
* multiple slots baked from the same parameter). */
|
|
183
|
+
byteOffset?: number;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Recipe for recomputing the contract's slot-excised template hash.
|
|
187
|
+
*
|
|
188
|
+
* `hash256-excised-slots`: hash256 (double SHA-256) over the resolved code
|
|
189
|
+
* part with every constructor slot's VALUE bytes removed. Push headers of
|
|
190
|
+
* 'data'/'scriptnum' pushes remain in the hashed template; single-opcode
|
|
191
|
+
* encodings (OP_N / OP_0 / OP_1NEGATE / bool) contribute no header and the
|
|
192
|
+
* opcode byte itself is excised.
|
|
193
|
+
*/
|
|
194
|
+
export interface TemplateDigest {
|
|
195
|
+
algorithm: 'hash256-excised-slots';
|
|
196
|
+
/** Alternating code/slot pieces, in script order (starts and ends with a
|
|
197
|
+
* `code` piece; boundary `code` pieces may be empty byte runs). */
|
|
198
|
+
pieces: TemplateDigestPiece[];
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Byte range in the locking script produced by a `raw_script` ANF node
|
|
202
|
+
* (surfaced in source as `asm({ body, in_arity, out_arity })`).
|
|
203
|
+
*
|
|
204
|
+
* The static analyzer treats these spans as opaque — it does not walk the
|
|
205
|
+
* opcodes inside, since `raw_bytes` is a peephole barrier and the contents
|
|
206
|
+
* may be arbitrary bytes that don't form a well-formed opcode stream. The
|
|
207
|
+
* declared `inArity` / `outArity` carry the stack-effect contract so depth
|
|
208
|
+
* tracking remains sound across the span.
|
|
209
|
+
*/
|
|
210
|
+
export interface RawScriptSpan {
|
|
211
|
+
/** Byte offset of the span start in the locking script. */
|
|
212
|
+
offset: number;
|
|
213
|
+
/** Total length of the span, in bytes. */
|
|
214
|
+
length: number;
|
|
215
|
+
/** Number of stack values consumed before the span executes. */
|
|
216
|
+
inArity: number;
|
|
217
|
+
/** Number of stack values left on the stack after the span executes. */
|
|
218
|
+
outArity: number;
|
|
219
|
+
}
|
|
220
|
+
export interface RunarArtifact {
|
|
221
|
+
/** Schema version, e.g. "runar-v0.1.0" */
|
|
222
|
+
version: string;
|
|
223
|
+
/** Semver of the compiler that produced this artifact */
|
|
224
|
+
compilerVersion: string;
|
|
225
|
+
/** Name of the compiled contract */
|
|
226
|
+
contractName: string;
|
|
227
|
+
/**
|
|
228
|
+
* The base class the contract extends. Distinguishes stateful contracts
|
|
229
|
+
* (which auto-inject `checkPreimage` at method entry, placing the user
|
|
230
|
+
* `checkSig` AFTER the OP_CODESEPARATOR) from stateless / unsafe contracts.
|
|
231
|
+
*
|
|
232
|
+
* This is the authoritative stateful signal for the issue-#42 terminal
|
|
233
|
+
* sighash subscript trim: a `StatefulSmartContract` with zero mutable
|
|
234
|
+
* fields still needs the trim, even though its `stateFields` array is
|
|
235
|
+
* empty. Older artifacts that predate this field omit it.
|
|
236
|
+
*/
|
|
237
|
+
parentClass?: 'SmartContract' | 'StatefulSmartContract' | 'UnsafeSmartContract';
|
|
238
|
+
/** Public ABI (constructor + methods) */
|
|
239
|
+
abi: ABI;
|
|
240
|
+
/** Hex-encoded locking script */
|
|
241
|
+
script: string;
|
|
242
|
+
/** Human-readable assembly (space-separated opcodes) */
|
|
243
|
+
asm: string;
|
|
244
|
+
/** Optional source-level debug mappings */
|
|
245
|
+
sourceMap?: SourceMap;
|
|
246
|
+
/** Optional IR snapshots for debugging / conformance checking */
|
|
247
|
+
ir?: {
|
|
248
|
+
anf?: ANFProgram;
|
|
249
|
+
stack?: StackProgram;
|
|
250
|
+
};
|
|
251
|
+
/** ANF IR for SDK state computation (always included for stateful contracts) */
|
|
252
|
+
anf?: ANFProgram;
|
|
253
|
+
/** State field descriptors (present only for stateful contracts) */
|
|
254
|
+
stateFields?: StateField[];
|
|
255
|
+
/** Byte offsets of constructor parameter placeholders in the script,
|
|
256
|
+
* enriched with verification-descriptor metadata (name/type/encoding). */
|
|
257
|
+
constructorSlots?: ConstructorSlot[];
|
|
258
|
+
/** Recipe for recomputing the slot-excised template identity hash. */
|
|
259
|
+
templateDigest?: TemplateDigest;
|
|
260
|
+
/** Byte offsets of codeSepIndex placeholders in the script (OP_0 placeholders
|
|
261
|
+
* that the SDK must replace with the adjusted codeSeparatorIndex). */
|
|
262
|
+
codeSepIndexSlots?: CodeSepIndexSlot[];
|
|
263
|
+
/** Byte offset of OP_CODESEPARATOR in the locking script (for BIP-143 sighash) */
|
|
264
|
+
codeSeparatorIndex?: number;
|
|
265
|
+
/** Per-method OP_CODESEPARATOR byte offsets (index 0 = first public method, etc.). */
|
|
266
|
+
codeSeparatorIndices?: number[];
|
|
267
|
+
/** Byte ranges produced by `raw_script` ANF nodes (opaque to the analyzer). */
|
|
268
|
+
rawScriptSpans?: RawScriptSpan[];
|
|
269
|
+
/** ISO-8601 build timestamp */
|
|
270
|
+
buildTimestamp: string;
|
|
271
|
+
/**
|
|
272
|
+
* Builtins reached by this script that the project does not claim are sound
|
|
273
|
+
* (R-062 / CL-BUG-105). Today the only member is `verifySP1FRI`, whose
|
|
274
|
+
* codegen is a documented proof-of-concept with stubbed protocol algebra.
|
|
275
|
+
*
|
|
276
|
+
* The compiler already REFUSES to emit such a script unless the author wrote
|
|
277
|
+
* `@acknowledgeUnsoundSP1FriVerifier` or the invoker passed
|
|
278
|
+
* `--acknowledge-unsound-sp1-fri`. That acknowledgement stopped at whoever
|
|
279
|
+
* ran the compiler: the artifact handed on afterwards looked like any other,
|
|
280
|
+
* and every SDK funded it without a word. Present here, the fact travels with
|
|
281
|
+
* the artifact, and each SDK's deploy path refuses to fund it unless the
|
|
282
|
+
* caller acknowledges the same list.
|
|
283
|
+
*
|
|
284
|
+
* Absent (not empty) on every artifact that reaches no such builtin, so
|
|
285
|
+
* nothing else in the repo is affected.
|
|
286
|
+
*/
|
|
287
|
+
unsoundPrimitives?: string[];
|
|
288
|
+
}
|