@inversealtruism/cairnx-core 0.2.3 → 0.2.7
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/CHANGELOG.md +149 -0
- package/CONVENTION.md +655 -34
- package/MAKERS.md +8 -4
- package/README.md +108 -65
- package/dist/index.cjs +1112 -391
- package/dist/index.d.cts +275 -14
- package/dist/index.d.ts +275 -14
- package/dist/index.js +1085 -382
- package/package.json +3 -2
- package/test/vectors/cases-rules.json +446 -0
- package/test/vectors/codes.json +200 -0
- package/test/vectors/events.json +70 -0
- package/test/vectors/hashes.json +47 -0
package/CONVENTION.md
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
# CairnX Convention v1
|
|
2
2
|
|
|
3
|
-
**Status:** v2.9 (normative; v2.9
|
|
3
|
+
**Status:** v2.9 (normative; v2.9 activated at `V29_HEIGHT` = 88 000, crossed 2026-08-31, see §32; v2.8 activated at 60 000, crossed 2026-07-23; supersedes the 2026-06-10 v1.0 draft; §33 to §40 carry no gate and move no state) · **Domain:** `cairnx:v1` · **Base activation:** 29 860
|
|
4
4
|
|
|
5
5
|
**Version ladder** (each gate non-retroactive: below it, behavior + canonical hashes are byte-identical to history):
|
|
6
6
|
v1.1 @ 29 960 · v1.2 @ 30 300 · v1.3 @ 31 100 · v1.4 @ 31 400 · v1.5 @ 32 000 · v1.6 @ 33 600 (§19) ·
|
|
7
7
|
v1.7 @ 34 000 (§20) · v1.9 @ 36 700 (§22) · v2.0 @ 38 400 (§23) · v1.8 @ 40 000 (§21) · v2.1 @ 40 100 (§24) ·
|
|
8
8
|
v2.2 @ 41 300 (§25) · v2.4 @ 46 400 (§27) · v2.5 @ 46 440 (§28) · v2.6 @ 46 480 (§29) · v2.7 @ 46 520 (§30) ·
|
|
9
|
-
v2.3 @ 52 000 (§26) · v2.8 @ 60 000 (§31) · v2.9 @ 88 000 (§32
|
|
9
|
+
v2.3 @ 52 000 (§26) · v2.8 @ 60 000 (§31) · v2.9 @ 88 000 (§32; its replay hash is pinned in `test/vectors/replay-hashes.json`).
|
|
10
10
|
Sections §19–§32 are the normative semantics for v1.6–v2.9; §5.1 is the byte-level canonical-JSON contract that binds all of them.
|
|
11
|
+
§33 is the rule that turns the chain's blocks into the events every version replays; §34 defines the two hashes
|
|
12
|
+
replicas compare. §35 and §36 are for other applications (their domains, the profile-key registry), §37 states what
|
|
13
|
+
a result proves, §38 how a replica conforms, §39 how the rules change and §40 the reason codes of the applied log
|
|
14
|
+
and of record validation; none of §33 to §40 has a gate.
|
|
11
15
|
Activation order is by HEIGHT, not by version number (v1.8 activated after v2.0; v2.3 activates after v2.4–v2.7): a
|
|
12
16
|
replayer gates each rule on its own height constant, never on "version X implies version Y is active".
|
|
13
17
|
|
|
@@ -17,18 +21,19 @@ replayer gates each rule on its own height constant, never on "version X implies
|
|
|
17
21
|
> recorded history replays byte-identically. Replayers built from this spec MUST use the re-pinned heights above.
|
|
18
22
|
|
|
19
23
|
> **Canonical copy.** This spec ships in the published `@inversealtruism/cairnx-core` package; the source of
|
|
20
|
-
> truth is `csd-sdk/packages/cairnx/CONVENTION.md`.
|
|
21
|
-
>
|
|
22
|
-
> it is the one that must never lag the code.
|
|
24
|
+
> truth is `csd-sdk/packages/cairnx/CONVENTION.md`. The `cairnx` app repo keeps no copy: its `CONVENTION.md`
|
|
25
|
+
> is a pointer to this file and to the copy in the installed package. A third-party implementer fetches the
|
|
26
|
+
> *published* copy, so it is the one that must never lag the code.
|
|
23
27
|
|
|
24
28
|
CairnX is a meta-asset and exchange convention on Compute Substrate (CSD). It defines fungible
|
|
25
|
-
tokens and
|
|
29
|
+
tokens and trades, one transaction paying and recording each fill, using **only** the chain's existing `Propose`
|
|
26
30
|
and `Attest` transactions: no fork, no new transaction types, no custodian. Token semantics are
|
|
27
31
|
enforced by a **pure, deterministic resolver** that any party can run; independent resolvers
|
|
28
32
|
replaying the same chain converge on identical state.
|
|
29
33
|
|
|
30
|
-
This document is normative. The reference resolver (`src/resolve.ts`)
|
|
31
|
-
|
|
34
|
+
This document is normative. The reference resolver (`src/resolve.ts`), the reference rule of §33
|
|
35
|
+
(`src/events.ts`), the hashes of §34 (`src/hashes.ts`), the reason codes of §40 (`src/codes.ts`) and their conformance
|
|
36
|
+
suites implement exactly what is written here.
|
|
32
37
|
|
|
33
38
|
---
|
|
34
39
|
|
|
@@ -39,7 +44,9 @@ Verified against the node source (`compute-substrate` @ v1.x, 2026-06-10):
|
|
|
39
44
|
- **C1.** Every input of a tx signs the same global sighash; tx validity requires all signatures.
|
|
40
45
|
- **C2.** A `Propose`/`Attest` tx's value outputs are unrestricted (only fee floors apply:
|
|
41
46
|
≥ 0.25 CSD propose, ≥ 0.05 CSD attest). One tx can pay arbitrary addresses *and* carry an app payload.
|
|
42
|
-
- **C3.** `proposer` / `attester` = `hash160(input[0].pubkey)`, stored by consensus.
|
|
47
|
+
- **C3.** `proposer` / `attester` = `hash160(input[0].pubkey)`, stored by consensus. The node accepts input 0
|
|
48
|
+
only when that hash equals the `script_pubkey` of the coin it spends, so for a mined tx it is that coin's
|
|
49
|
+
owner. The txid does not commit the signature script; a reader takes the author from the spent coin (§33.5).
|
|
43
50
|
- **C4.** `Propose.uri` is a consensus-stored string ≤ **512 bytes** (non-empty); `payload_hash`
|
|
44
51
|
is a consensus-stored 32-byte value (non-zero).
|
|
45
52
|
- **C5.** An `Attest` referencing proposal `P` is **consensus-rejected** once
|
|
@@ -70,8 +77,8 @@ signatures in v1: anchoring *from your key* is the authorization.
|
|
|
70
77
|
- **Tickers** match `^[A-Z][A-Z0-9]{2,11}$`.
|
|
71
78
|
- **Addresses** are `0x` + 40 lowercase hex.
|
|
72
79
|
- **Apply order:** events are replayed in consensus order: by block height; within a block,
|
|
73
|
-
all `cairnx:v1` proposals in tx order (`pos`), then all attestations on CairnX
|
|
74
|
-
order. (Mirrors the node’s propose/attest phases, C5.) Remaining ties (same height, phase, pos:
|
|
80
|
+
all `cairnx:v1` proposals in tx order (`pos`), then all attestations on CairnX proposals in tx
|
|
81
|
+
order (the events of §33). (Mirrors the node’s propose/attest phases, C5.) Remaining ties (same height, phase, pos:
|
|
75
82
|
possible only across indexer quirks, never on a real chain) break by **ordinal (code-unit)
|
|
76
83
|
comparison of the lowercase `0x`-hex txid**. Ordinal comparison is the ONLY string ordering
|
|
77
84
|
used anywhere in resolution and serialization: locale-aware collation (e.g. JavaScript's
|
|
@@ -79,8 +86,9 @@ signatures in v1: anchoring *from your key* is the authorization.
|
|
|
79
86
|
- **Invalid = no-op.** A record that fails any check (schema, balance, state) has **no effect**.
|
|
80
87
|
Unknown `t` values and `v ≠ 1` are no-ops (forward compatibility). Invalidity never poisons
|
|
81
88
|
later records.
|
|
82
|
-
- **Activation:** anchors below height **29 860** are ignored
|
|
83
|
-
protocol traffic: the domain had no prior use; the
|
|
89
|
+
- **Activation:** anchors below height **29 860** are ignored, and are not events (§33); neither is an
|
|
90
|
+
Attest on such an anchor. (Set just before the first protocol traffic: the domain had no prior use; the
|
|
91
|
+
live X2 e2e records ARE the genesis.)
|
|
84
92
|
- **Finality:** state derived from blocks < 6 confirmations is provisional (display threshold
|
|
85
93
|
3, final 6, matching Cairn's site conventions).
|
|
86
94
|
|
|
@@ -149,7 +157,7 @@ CairnX meaning for deploys. The **deployer** is the anchoring proposer.
|
|
|
149
157
|
- `memo` (64 UTF-16 units max) and `ts` are optional free fields with the same rules as
|
|
150
158
|
`transfer` (4.3); `ts` MUST be a JS-safe integer (A8).
|
|
151
159
|
|
|
152
|
-
### 4.5 `fill`:
|
|
160
|
+
### 4.5 `fill`: payment and record in one transaction (an Attest, not a Propose)
|
|
153
161
|
|
|
154
162
|
A fill is an **`Attest` transaction** referencing the offer's proposal id with **`score = 100`**,
|
|
155
163
|
whose **own outputs** pay the seller:
|
|
@@ -159,10 +167,12 @@ whose **own outputs** pay the seller:
|
|
|
159
167
|
- `Σ(outputs of the attesting tx paying want.payto) ≥ want.value`;
|
|
160
168
|
- on apply: the locked `give.amount` moves to the **attester**, the offer closes.
|
|
161
169
|
|
|
162
|
-
Because payment outputs and the attestation are one transaction (C2), **
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
170
|
+
Because payment outputs and the attestation are one transaction (C2), **one transaction pays and
|
|
171
|
+
records the fill**, and the replay then decides delivery by the rules above. A CSD-paid fill the replay
|
|
172
|
+
refuses keeps the payment: CairnX rejecting the fill does not undo or refund the transaction's CSD outputs,
|
|
173
|
+
which stand as the chain keeps them (subject to reorganization). A token-for-token fill
|
|
174
|
+
(§11) is atomic: the replay moves both sides or neither. The seller's tokens were already
|
|
175
|
+
convention-locked. The fill costs only the attest fee floor (0.05 CSD) plus the payment.
|
|
166
176
|
|
|
167
177
|
The **first valid fill in apply order wins**. For a **CSD-priced** fill `confidence` is ignored
|
|
168
178
|
(set 100); a **token-priced** fill (§11) additionally requires the `confidence = 1 000 000` opt-in
|
|
@@ -185,14 +195,14 @@ balances: ticker → address → { available, locked }
|
|
|
185
195
|
offers: offerId → { seller, give, want, taker?, status: open|filled|cancelled|expired,
|
|
186
196
|
expiresEpoch, height, fill?: { buyer, txid, height, paid } }
|
|
187
197
|
events: ordered log of applied/no-op decisions (for explorers & audit; INFORMATIONAL,
|
|
188
|
-
excluded from the canonical surface;
|
|
198
|
+
excluded from the canonical surface; each entry's `code` is stable (§40), its `note` text a diagnostic)
|
|
189
199
|
```
|
|
190
200
|
|
|
191
201
|
**Canonical state (format 2, normative):** the canonical surface is
|
|
192
202
|
`{tipHeight, tokens, balances, names, offers, bids, feesPaid}`: the event log is excluded.
|
|
193
203
|
Serialization is **canonical JSON**: object keys sorted in ordinal (code-unit) order at every
|
|
194
204
|
depth, no insignificant whitespace, UTF-8, all amounts as decimal strings (no floats anywhere),
|
|
195
|
-
booleans/numbers in their shortest JS form. Two resolvers fed the same chain prefix MUST produce
|
|
205
|
+
booleans/numbers in their shortest JS form. Two resolvers fed the events of §33 for the same chain prefix MUST produce
|
|
196
206
|
byte-identical canonical state; `sha256(canonicalState)` at the activation heights is pinned in
|
|
197
207
|
`test/vectors/replay-hashes.json`, and `test/vectors/cases.json` carries language-neutral replay
|
|
198
208
|
vectors a third-party implementation must reproduce. (Format 1, pre-2026-06-12, included the
|
|
@@ -375,8 +385,9 @@ owned purely on-chain: register, hold, point it at an address, transfer, or sell
|
|
|
375
385
|
|
|
376
386
|
- **Charset:** lowercase ASCII only: `^[a-z0-9](?:[a-z0-9-]{0,30}[a-z0-9])?$`, **1–32 chars**,
|
|
377
387
|
no leading/trailing hyphen (single- and double-character premium names are valid and priced at
|
|
378
|
-
the top of the fee curve). ASCII-only
|
|
379
|
-
|
|
388
|
+
the top of the fee curve). ASCII-only removes the mixed-script homograph class (no Unicode, so
|
|
389
|
+
no Cyrillic U+0430 in place of a Latin `a`) and is trivially deterministic for every indexer. It
|
|
390
|
+
does not remove look-alikes within ASCII: `paypa1` and `paypal` are distinct, valid names.
|
|
380
391
|
Reserved: `csd treasury admin official root www support` (`cairn`/`cairnx` are deliberately
|
|
381
392
|
NOT reserved: the operator registered them as ordinary, tradeable names).
|
|
382
393
|
- **`name` (claim):** `{v:1,t:"name",name,salt?}`. Owner = anchoring proposer. **Lowest
|
|
@@ -673,10 +684,12 @@ From height **32 000** every name is a **lease**:
|
|
|
673
684
|
## 18. `tmeta`: issuer token metadata via the content layer (v1.5)
|
|
674
685
|
|
|
675
686
|
`{v:1,t:"tmeta",ticker,hash}`: **issuer-only**, last write wins, no fee beyond the anchor.
|
|
676
|
-
`hash` is a
|
|
677
|
-
`{logo, description, links}` document: self-certifying content, so the record stays tiny
|
|
678
|
-
(the 512-byte `uri` cap is untouched) and the
|
|
679
|
-
|
|
687
|
+
`hash` is a CSD Content Convention v1 hash (0x + 64 hex; `payloadHash` in csd-codec) pointing at
|
|
688
|
+
the token's `{logo, description, links}` document: self-certifying content, so the record stays tiny
|
|
689
|
+
(the 512-byte `uri` cap is untouched) and any copy of the document can be checked against the hash
|
|
690
|
+
on read (`verifyContentBytes` in csd-codec). The csd-swarm content service this section was written
|
|
691
|
+
for is retired; the convention names no host for the document. State: `tokens[t].tmeta`. Records
|
|
692
|
+
before v1.5 are no-ops.
|
|
680
693
|
|
|
681
694
|
---
|
|
682
695
|
|
|
@@ -1134,10 +1147,13 @@ audit flags such a burn.
|
|
|
1134
1147
|
**Client policy (not consensus, does not affect canonical state).** A filler waits a value-scaled
|
|
1135
1148
|
`requiredClaimDepth` (§20 reorg note) on BOTH the offer and the fclaim (and, for a partial tail-fill, on the
|
|
1136
1149
|
offer's earlier fill-basis events) before signing, and refuses to broadcast a fill within `FILL_TIP_MARGIN`
|
|
1137
|
-
(`=
|
|
1138
|
-
height and `expires_epoch`.
|
|
1139
|
-
`GAP_NEEDED = EPOCH_LEN*(FCLAIM_MAX_EPOCH_AHEAD + 1) - 1 + CLAIM_COOLDOWN_BLOCKS` (`= 104`) blocks
|
|
1140
|
-
|
|
1150
|
+
(`= 4`) blocks of `holdEnd` (a stranded no-op, never a fund risk), computed from the fclaim's actual confirmed
|
|
1151
|
+
height and `expires_epoch`. Whether an fclaim was granted depends on the holds granted in the
|
|
1152
|
+
`GAP_NEEDED = EPOCH_LEN*(FCLAIM_MAX_EPOCH_AHEAD + 1) - 1 + CLAIM_COOLDOWN_BLOCKS` (`= 104`) blocks before it and on
|
|
1153
|
+
its proposer's live holds on other offers. A client replaying a window of blocks it read completely therefore
|
|
1154
|
+
decides an fclaim only when the window reaches `GAP_NEEDED` below it and the fclaims in that span are decided as
|
|
1155
|
+
well; an fclaim in the window's lowest `GAP_NEEDED` blocks, and a fill older than the window, are not decided by
|
|
1156
|
+
it. cairnx-core's `verifyFillSpv` replays such a window and names these as known limits.
|
|
1141
1157
|
|
|
1142
1158
|
- **Adoption note:** at/above V28 the fill's referenced proposal changes (offer id becomes fclaim txid) and
|
|
1143
1159
|
`SCORE_CLAIM` is rejected, so v2.8 is BOTH a relaxation (an fclaim fill a fresh core accepts, a stale core
|
|
@@ -1157,10 +1173,13 @@ so a double-fed transaction (an overlapping scanner page delivered verbatim) app
|
|
|
1157
1173
|
partial-fill path that double-credits `paid` / `delivered`. A transaction has ONE identity: a `Propose`'s
|
|
1158
1174
|
`id`, an `Attest`'s `txid`. At an event height `>= V29_HEIGHT` the FIRST occurrence in consensus order
|
|
1159
1175
|
(§3: height, propose-before-attest, pos, ordinal id/txid) is kept and every later occurrence of the same
|
|
1160
|
-
identity is dropped BEFORE apply. Below the gate nothing is dropped.
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1176
|
+
identity is dropped BEFORE apply. Below the gate nothing is dropped. Two copies of one event that a feed
|
|
1177
|
+
delivers twice share one txid, height and position, so they land on the same side of the gate. A
|
|
1178
|
+
transaction can also be mined again: coinbase txids are not unique on this chain, so a spent coin can be
|
|
1179
|
+
created again and the same spending transaction mined in a later block. Those copies sit in two blocks,
|
|
1180
|
+
possibly on both sides of the gate, and `resolve()` fed both drops the later copy only when both are at or
|
|
1181
|
+
above the gate. §33 keeps the first occurrence, so a feed built by its rule holds neither kind of duplicate;
|
|
1182
|
+
the drop above stays the rule for a feed that is not built by it.
|
|
1164
1183
|
|
|
1165
1184
|
**M5: the concurrent-hold cap counts only OPEN holds (relaxation).** §20/§31 cap an address at
|
|
1166
1185
|
`MAX_ACTIVE_CLAIMS` (= 3) live holds, counted as `claimedBy === who && claimHeld(o, h)`. A FILLED offer
|
|
@@ -1186,3 +1205,605 @@ divergence height is pinned by the fork-lens vector set (`cases-v29.json`).
|
|
|
1186
1205
|
before the tip crosses 88 000, never "publish and hope". The `replay-hashes.json` V29 entry is pinned
|
|
1187
1206
|
only POST-crossing from the live chain (see CONSENSUS_CHANGES.md); a pre-crossing V29 hash would be an
|
|
1188
1207
|
invented pin and is forbidden.
|
|
1208
|
+
|
|
1209
|
+
---
|
|
1210
|
+
|
|
1211
|
+
# CairnX chain input (no gate)
|
|
1212
|
+
|
|
1213
|
+
## 33. From a block to events
|
|
1214
|
+
|
|
1215
|
+
`resolve()` (§3, §5) replays a list of events. This section is the rule that makes that list from the chain's
|
|
1216
|
+
blocks; two readers that apply it to the same blocks feed `resolve()` the same events. It has no activation gate:
|
|
1217
|
+
it is the input form the reference service has always replayed (§33.2), and where other readers used other forms
|
|
1218
|
+
(an expiry above 2^53 - 1, a `uri` holding U+0000), `resolve()` derives the same state from both forms (§33.4).
|
|
1219
|
+
|
|
1220
|
+
The rule has two parameters: a domain D and an activation height A. CairnX uses D = `cairnx:v1` and A = 29 860
|
|
1221
|
+
(`DOMAIN` and `ACTIVATION_HEIGHT`, together `CAIRNX_EVENT_RULE`). D is a non-empty, well-formed string holding
|
|
1222
|
+
neither U+0000 nor U+0001; A is an integer >= 0. Another application may apply the rule with its own D and A.
|
|
1223
|
+
|
|
1224
|
+
### 33.1 Membership
|
|
1225
|
+
|
|
1226
|
+
A transaction at height h and position p (its index in the block; the coinbase is at 0) is an event when h >= A and
|
|
1227
|
+
|
|
1228
|
+
- it is a `Propose` whose domain equals D, code unit for code unit, or
|
|
1229
|
+
- it is an `Attest` whose proposal id is the id of a `Propose` event of this rule at a height <= h. A `Propose`
|
|
1230
|
+
event in the same block counts at any position, before or after the `Attest`: the node applies a block's
|
|
1231
|
+
proposals before its attestations (C5).
|
|
1232
|
+
|
|
1233
|
+
Nothing below A is an event, and nothing below A is read: an `Attest` at or above A on a `Propose` mined below A is
|
|
1234
|
+
not an event. A transaction without an app payload is not an event. The coinbase is never an event: consensus
|
|
1235
|
+
refuses a block whose first transaction is not the coinbase or whose coinbase carries an app payload, so a list
|
|
1236
|
+
with an app payload at position 0 is not a block of the chain, and a reader refuses it.
|
|
1237
|
+
|
|
1238
|
+
A reader may apply the rule to a sparse block: a list in strictly increasing position order, each transaction at
|
|
1239
|
+
its true position, that holds every transaction of the block that carries an app payload. A complete block is one
|
|
1240
|
+
such list. The rule cannot see whether a list is complete; establishing that is the reader's. A complete block
|
|
1241
|
+
whose transactions hash to the merkle root of a header the reader verified establishes it; a feed (a node's events
|
|
1242
|
+
route, a recorded fixture) establishes it only on the feed's word.
|
|
1243
|
+
|
|
1244
|
+
### 33.2 First occurrence
|
|
1245
|
+
|
|
1246
|
+
A transaction id is one event, at the lowest height at or above A at which the chain holds it. A block holds a
|
|
1247
|
+
transaction id at most once (consensus refuses a block that repeats one), so a reader refuses a list that repeats
|
|
1248
|
+
one. A transaction id can still sit in two blocks: coinbase transaction ids are not unique on this chain, so a
|
|
1249
|
+
spent coin can be created again and the same spending transaction mined in a later block. Its later copies are not
|
|
1250
|
+
events. Occurrences below A are never read, so a transaction mined below A and again at or above A is an event at
|
|
1251
|
+
its first height at or above A, when it is a member there. This fixes the input form the reference service has
|
|
1252
|
+
always replayed (csd-indexer keeps the first occurrence of a transaction id at every height, and the service reads
|
|
1253
|
+
that feed), so a reader that feeds `resolve()` every copy of a re-mined transaction can differ from the reference
|
|
1254
|
+
when a copy lies below V29, where §32's M4 drop does not apply.
|
|
1255
|
+
|
|
1256
|
+
A reader that applies the rule a block at a time keeps two sets, derived from the events it holds and rolled back
|
|
1257
|
+
with them on a reorganisation: the ids of all its events (a `Propose`'s id, an `Attest`'s transaction id) and the
|
|
1258
|
+
ids of the `Propose` events among them.
|
|
1259
|
+
|
|
1260
|
+
### 33.3 Order
|
|
1261
|
+
|
|
1262
|
+
A block's events are listed in apply order: its `Propose` events by position, then its `Attest` events by
|
|
1263
|
+
position; blocks follow by height. This is the order of §3.
|
|
1264
|
+
The reference comparator is `applyOrder` (with `eventId`, the id it compares last), the function `resolve()` sorts with.
|
|
1265
|
+
|
|
1266
|
+
### 33.4 Field forms
|
|
1267
|
+
|
|
1268
|
+
Each event is a `ProposeEvent` or an `AttestEvent` (`src/types.ts`). Transaction ids, hashes and addresses are
|
|
1269
|
+
written `0x` and lowercase hex: 64 digits for 32 bytes, 40 for 20 bytes. An output's address is its 20-byte
|
|
1270
|
+
`script_pubkey`. The fields are taken from the transaction as decoded from its consensus bytes or its node JSON,
|
|
1271
|
+
with u64 values exact. In JavaScript a u64 input (an expiry, an output value) is a bigint in [0, 2^64), or a number
|
|
1272
|
+
that is an integer in [0, 2^53]: 2^53 is accepted as a number because it is the rule's own form of a clamped expiry,
|
|
1273
|
+
and a number above 2^53 is refused, because such a double no longer identifies one u64. The rule does not check
|
|
1274
|
+
again what the node checked (fee floors, `uri` length, expiry at creation).
|
|
1275
|
+
|
|
1276
|
+
| Field | Value |
|
|
1277
|
+
|---|---|
|
|
1278
|
+
| `kind` | `"propose"` or `"attest"` |
|
|
1279
|
+
| `id` (Propose), `txid` (Attest) | the transaction id |
|
|
1280
|
+
| `proposer`, `attester` | the author (§33.5) |
|
|
1281
|
+
| `uri` | the consensus text with each U+0000 written as U+0001, the form csd-indexer keeps from 0.3.8 on. JSON admits neither character unescaped, so a `uri` holding either is no record in both forms |
|
|
1282
|
+
| `payloadHash`, `proposalId` | the consensus 32 bytes |
|
|
1283
|
+
| `expiresEpoch` | the consensus u64 when it is at most 2^53 - 1, otherwise 2^53 (9007199254740992). `resolve()` reads it only for offers, bids and fclaims, and refuses each of those above 2^53 - 1 |
|
|
1284
|
+
| `score`, `confidence` | the consensus u32 values |
|
|
1285
|
+
| `height`, `pos` | the block height; the position in the block |
|
|
1286
|
+
| `paidTo` | for each address paid by an output whose value is at most 2^53 - 1, the sum of those outputs' values as a decimal string (an output of value 0 lists its address with `"0"`); an output above 2^53 - 1 is left out, since the total supply can exceed 2^53 - 1 |
|
|
1287
|
+
|
|
1288
|
+
### 33.5 The author
|
|
1289
|
+
|
|
1290
|
+
The author of an event (`proposer`, `attester`) is the owner of the output that the transaction's first input
|
|
1291
|
+
spends: that output's `script_pubkey`. The node accepts the first input only when hash160 of the public key in its
|
|
1292
|
+
signature script equals that `script_pubkey` (C3), so for a mined transaction the two are one address. The
|
|
1293
|
+
transaction id does not commit the signature script, so a copy of a mined transaction can carry another key's
|
|
1294
|
+
valid signature and still match its merkle root. The rule therefore takes the author as an input the reader binds:
|
|
1295
|
+
the spent output is read from its source transaction after that transaction's id is recomputed, and csd-crypto
|
|
1296
|
+
`authorOf(tx, scriptPubkey)` returns the owner only when the first input's signature is the owner's. A copy for
|
|
1297
|
+
which it returns null is a damaged copy, to be read again from another source, never an event of another author. A
|
|
1298
|
+
reader that cannot bind the author of a member has no events for that block; it never leaves the event out.
|
|
1299
|
+
|
|
1300
|
+
### 33.6 The byte form of an event list
|
|
1301
|
+
|
|
1302
|
+
The bytes of an event list are csd-codec `canonicalJson` of the array of events in the order of §33.3 (keys in
|
|
1303
|
+
code-unit order at every depth, §5.1). No event key and no `paidTo` key is an array index, so §5.1 A2 does not
|
|
1304
|
+
arise.
|
|
1305
|
+
|
|
1306
|
+
### 33.7 Reference functions and vectors
|
|
1307
|
+
|
|
1308
|
+
cairnx-core exports the rule as `eventOfTx`, `blockMembers`, `blockEvents` and `CAIRNX_EVENT_RULE`;
|
|
1309
|
+
`conformance/cairnx_ref.py` implements the same three functions independently.
|
|
1310
|
+
|
|
1311
|
+
- `eventOfTx(t, height, author, rule?)` maps one transaction (`{pos, txid, tx: {app, outputs}}`) to its event, or to
|
|
1312
|
+
null when it carries no app payload, lies below A, or is a `Propose` in another domain. It does not decide `Attest`
|
|
1313
|
+
membership, which needs the block: a caller that reads single transactions (a wallet proving one fill, a scanner
|
|
1314
|
+
reading a feed that joins attestations to their proposals) decides it itself. An `Attest` on a proposal that is
|
|
1315
|
+
not an event changes no state: `resolve()` ignores it.
|
|
1316
|
+
- `blockMembers(height, txs, sofar, rule?)` returns the members of one block (§33.1, §33.2) in position order, so a
|
|
1317
|
+
reader binds authors for those alone; `sofar` holds the two sets of §33.2. `txs` is a list as §33.1 describes.
|
|
1318
|
+
- `blockEvents(height, txs, sofar, authors, rule?)` returns the block's events in the order of §33.3, with
|
|
1319
|
+
`authors[i]` the author of the i-th member. It selects the members again, so a list of authors one short is
|
|
1320
|
+
refused.
|
|
1321
|
+
|
|
1322
|
+
Each refuses (throws; `ValueError` in Python) input that is not a block of the chain or not in the forms of
|
|
1323
|
+
§33.4: positions that are not integers >= 0 in strictly increasing order, a transaction id repeated in a block, an
|
|
1324
|
+
app payload at position 0, a field outside its consensus type (hex of the wrong length, an integer out of range,
|
|
1325
|
+
text that is not well-formed), a member without an author, and a rule whose domain or activation height is not
|
|
1326
|
+
in the form above. Hex input may carry a `0x` prefix or none, with its digits in either case. An integer field (a
|
|
1327
|
+
height, the activation height, a position, a score, a confidence) may come in any JSON spelling of its value (`1`,
|
|
1328
|
+
`1.0`, `1e0`); a boolean is not an integer.
|
|
1329
|
+
`eventOfTx` checks the height, position, transaction id and app type of any transaction; of one below A it reads
|
|
1330
|
+
nothing more, and it checks the remaining fields and the author only of an event. `blockMembers` checks the
|
|
1331
|
+
position, transaction id and app type of every listed transaction, the domain of every `Propose` and the proposal
|
|
1332
|
+
id of every `Attest`; `blockEvents` checks in addition what `eventOfTx` checks of each member. Neither reads
|
|
1333
|
+
anything of a block below A.
|
|
1334
|
+
|
|
1335
|
+
`test/vectors/events.json` holds the language-neutral vectors, `{format: 1, rule, tx, blocks}`, one case per line.
|
|
1336
|
+
A `tx` case gives `input` (`txid`, `height`, `pos`, `app`, `outputs`, field names as in csd-codec's `Tx`, u64 values
|
|
1337
|
+
as decimal strings), `author`, and `expect`: the event, null, or `"error"`. A `blocks` case gives a sequence of
|
|
1338
|
+
blocks (`{height, txs}`), the authors by transaction id, and `expect`: the members' positions per block and the
|
|
1339
|
+
events of the whole sequence, or `{"error": i}` with i the first block refused. The two sets carry across a case's
|
|
1340
|
+
blocks, and a member whose author is not listed is given null. A conformant reader reproduces every case, each
|
|
1341
|
+
event list as the bytes of §33.6.
|
|
1342
|
+
|
|
1343
|
+
Feeds are not this rule's output. csd-indexer's chain-order feed of a domain's attestations includes attestations
|
|
1344
|
+
on proposals below A, which `resolve()` ignores; a node's events route can list every copy of a re-mined
|
|
1345
|
+
transaction, and §32's M4 drop removes only the copies at heights at or above V29.
|
|
1346
|
+
|
|
1347
|
+
---
|
|
1348
|
+
|
|
1349
|
+
# Comparing replicas (no gate)
|
|
1350
|
+
|
|
1351
|
+
## 34. State hash and events hash
|
|
1352
|
+
|
|
1353
|
+
Two replicas that replay the same chain compare two hashes at one block: the events hash commits what they read, the
|
|
1354
|
+
state hash what they derived. Neither enters a record or the canonical state, so defining them moves no state; both
|
|
1355
|
+
are fixed byte for byte here so that every replica computes them alike.
|
|
1356
|
+
|
|
1357
|
+
### 34.1 The state hash
|
|
1358
|
+
|
|
1359
|
+
The state hash of a resolver state is sha256 of the UTF-8 bytes of its canonical state (§5, §5.1, with the
|
|
1360
|
+
integer-key order of A2), written `0x` and 64 lowercase hex digits. Besides the seven keys of §5's surface, a
|
|
1361
|
+
`resolve()` result carries three diagnostic fields that the canonical state leaves out: `events` (the applied log),
|
|
1362
|
+
`recaptures` (§29) and `fclaims` (§31); the state hash of a complete result is the hash of its surface alone. At
|
|
1363
|
+
height h it is the state hash of `resolve()` over the events at heights <= h with tip h;
|
|
1364
|
+
`test/vectors/replay-hashes.json` pins that digest, without the `0x`.
|
|
1365
|
+
|
|
1366
|
+
### 34.2 The events hash
|
|
1367
|
+
|
|
1368
|
+
The events hash runs over the events of §33 block by block. For a block at height h that holds at least one event:
|
|
1369
|
+
|
|
1370
|
+
```
|
|
1371
|
+
b = sha256( h as 8 bytes big endian || row_1 || ... || row_n )
|
|
1372
|
+
row_i = position as 4 bytes big endian || transaction id (32 bytes) || author (20 bytes)
|
|
1373
|
+
```
|
|
1374
|
+
|
|
1375
|
+
with one row per event of the block, in ascending position. The transaction id is a `Propose`'s `id` or an
|
|
1376
|
+
`Attest`'s `txid`, the author its `proposer` or `attester`. The order is position order, not the apply order of
|
|
1377
|
+
§33.3, which lists `Propose` events first; positions within a block are distinct. The running value e is 32 zero
|
|
1378
|
+
bytes before the first block at or above A, and each block that holds an event, in ascending height, replaces it:
|
|
1379
|
+
|
|
1380
|
+
```
|
|
1381
|
+
e = sha256( e_prev || b )
|
|
1382
|
+
```
|
|
1383
|
+
|
|
1384
|
+
A block without events leaves e as it is. The events hash at height h is e after the last block at or below h that
|
|
1385
|
+
holds an event, written `0x` and 64 lowercase hex digits.
|
|
1386
|
+
|
|
1387
|
+
Height and position are in the hash because the resolver compares positions of records in different blocks (the
|
|
1388
|
+
name contests of §9 and §28). The transaction id commits every other field of the transaction, and the author, which
|
|
1389
|
+
it does not commit (§33.5), is in the row, so no JSON form, number form or text storage enters the hash.
|
|
1390
|
+
|
|
1391
|
+
### 34.3 Comparing two replicas
|
|
1392
|
+
|
|
1393
|
+
Two replicas compare (height, block hash, events hash, state hash) at one height. The comparison means something only
|
|
1394
|
+
at a height both treat as final (§38 names the depth): near the tip two honest replicas can hold different blocks
|
|
1395
|
+
for a while.
|
|
1396
|
+
|
|
1397
|
+
- Another block hash at the height: the replicas follow different branches. Wait and compare again; this is a
|
|
1398
|
+
branch difference, never a divergence.
|
|
1399
|
+
- The same block hash, another events hash: the replicas read different events from the same blocks, so their record
|
|
1400
|
+
sources differ (a source left out or added a transaction, or recorded another author, height or position).
|
|
1401
|
+
- The same events hash, another state hash: the replicas read the same transactions at the same places with the same
|
|
1402
|
+
authors and apply different rules to them: the resolver (§3 to §32), or the field forms of §33.4, which the events
|
|
1403
|
+
hash does not see.
|
|
1404
|
+
|
|
1405
|
+
The running value carries every earlier block, so the first block whose events differ lies after the last height at
|
|
1406
|
+
which the events hashes agree.
|
|
1407
|
+
|
|
1408
|
+
### 34.4 Reference functions and vectors
|
|
1409
|
+
|
|
1410
|
+
cairnx-core exports `stateHash`, `eventsHashStep`, `eventsHash` and `EVENTS_HASH_START` (the 32 zero bytes);
|
|
1411
|
+
`conformance/cairnx_ref.py` implements them independently.
|
|
1412
|
+
|
|
1413
|
+
- `stateHash(state)` is the state hash of a `resolve()` result.
|
|
1414
|
+
- `eventsHashStep(prev, height, events)` is e after one block from the value `prev`, with `events` the block's
|
|
1415
|
+
events in any order; for no events it is `prev`.
|
|
1416
|
+
- `eventsHash(events)` is e over a list from the start value. The list is in the order of §33.3 or in an order that
|
|
1417
|
+
differs from it only within a block, so each height forms one run. Unlike `resolve()`, it does not sort across
|
|
1418
|
+
heights: a list in another order is sorted by height first.
|
|
1419
|
+
|
|
1420
|
+
Values, transaction ids and authors are `0x` and lowercase hex, the forms of §33.4; a height is an integer in
|
|
1421
|
+
[0, 2^53 - 1], a position an integer in [0, 2^32 - 1], either in any JSON spelling of its value (`100000.0` and `1e5`
|
|
1422
|
+
are 100000); a boolean is not an integer. Each function refuses (throws; `ValueError` in Python) a
|
|
1423
|
+
previous value, transaction id or author in another form (upper case or without `0x` included), a height or position
|
|
1424
|
+
out of its range, an event whose kind is neither `propose` nor `attest`, an event whose height is not the step's, and
|
|
1425
|
+
a position repeated in a block; `eventsHash` refuses a height below the one before it. `eventsHashStep` sees no
|
|
1426
|
+
earlier height, so a caller that steps block by block keeps the blocks in order. Neither reads any other field.
|
|
1427
|
+
|
|
1428
|
+
`test/vectors/hashes.json` (`conformance/gen-hashes-vectors.mjs`) holds the vectors, `{format: 1, start, cases,
|
|
1429
|
+
corpus}`, one case per line. A case gives `blocks` (`{height, events}`, each event with the five fields above), may
|
|
1430
|
+
give `prev`, and gives `expect`: `steps`, `eventsHashStep` applied to the blocks in turn from `prev` or the start
|
|
1431
|
+
value, as the value or `{"error": i}` with i the first block refused; and, without `prev`, `list`, `eventsHash` over
|
|
1432
|
+
the blocks' events in turn, as the value or `"error"`. `corpus` gives both hashes over
|
|
1433
|
+
`test/vectors/replay-corpus.json` at each height of `replay-hashes.json`, the events at heights <= h in a stable sort
|
|
1434
|
+
by height.
|
|
1435
|
+
|
|
1436
|
+
---
|
|
1437
|
+
|
|
1438
|
+
# CairnX for other applications (no gate)
|
|
1439
|
+
|
|
1440
|
+
## 35. Other applications
|
|
1441
|
+
|
|
1442
|
+
This section and §36 bind an application that is not CairnX and reads or writes on the same chain. Neither has an
|
|
1443
|
+
activation gate: they state what the reference already does and reserve names for later, so they move no state.
|
|
1444
|
+
|
|
1445
|
+
### 35.1 Record types under `cairnx:v1` are reserved
|
|
1446
|
+
|
|
1447
|
+
Every record type under `cairnx:v1` belongs to this convention. A record whose `t` this version does not define is a
|
|
1448
|
+
no-op today (§3), and a later gate may give that type a meaning; from the gate's height on, a record of that type is
|
|
1449
|
+
read by the new rule, whoever anchored it and for whatever purpose. A record of a defined type with a key its schema
|
|
1450
|
+
does not list is a no-op too (§5.1 A8). An application therefore must not anchor its own records under `cairnx:v1`,
|
|
1451
|
+
neither as a new type nor as extra keys on a defined one.
|
|
1452
|
+
|
|
1453
|
+
### 35.2 An application's own domain
|
|
1454
|
+
|
|
1455
|
+
An application's own records go in its own domain, named `<app>:<major>`: `<app>` names the application and `<major>`
|
|
1456
|
+
is the major version of its record format. A domain is a string of the form §33 requires of D. Domains whose text
|
|
1457
|
+
begins with `cairnx`, `csd` or `cairn` are reserved to this convention and its maintainers; an application uses none
|
|
1458
|
+
of them.
|
|
1459
|
+
|
|
1460
|
+
A domain is a label and not an authority. Anyone can anchor a `Propose` under any domain, a reserved one included,
|
|
1461
|
+
and reserving a prefix gives no one control of it. An application decides which authors it accepts under its domain,
|
|
1462
|
+
with the author of §33.5.
|
|
1463
|
+
|
|
1464
|
+
The rule of §33 takes the domain and the activation height as parameters (`EventRule`; `CAIRNX_EVENT_RULE` is
|
|
1465
|
+
CairnX's), so an application reads its own domain with the same functions (`eventOfTx`, `blockMembers`,
|
|
1466
|
+
`blockEvents`) and its own D and A. `resolve()` reads only CairnX records; the meaning of an application's records is
|
|
1467
|
+
the application's to define.
|
|
1468
|
+
|
|
1469
|
+
### 35.3 Data for readers of a name: the profile
|
|
1470
|
+
|
|
1471
|
+
Data an application publishes for the readers of a name (a site, a node address, a pointer to its own data) goes in
|
|
1472
|
+
the name's profile, the `nprofile` record of §22, under the keys of §36.
|
|
1473
|
+
|
|
1474
|
+
- A write replaces the whole map: the resolver stores the record's `p` as the profile, and `{}` clears it (§22). A
|
|
1475
|
+
writer therefore reads the current profile first and writes the merged map, with every key it did not set kept at
|
|
1476
|
+
its current value.
|
|
1477
|
+
- A reader ignores the profile of a name that is expired or pending. In the state of §5 these are a name with
|
|
1478
|
+
`expired: true` (its lease and grace have lapsed, §17) and a name with `pending: true` (a reservation of §28 not yet
|
|
1479
|
+
finalized). An expired name keeps its last profile in state until the name is claimed again; that profile is
|
|
1480
|
+
history, not the word of a current owner.
|
|
1481
|
+
|
|
1482
|
+
Known limit: only the owner writes a profile (§22), and two writers for one owner (two applications, or two devices)
|
|
1483
|
+
that read the same profile and both write within one block interval lose one write: the later in apply order (§3)
|
|
1484
|
+
replaces the map, and the keys only the earlier write carried are gone. The convention has no per-key write; a writer
|
|
1485
|
+
that needs its write kept reads the profile again once its record is mined.
|
|
1486
|
+
|
|
1487
|
+
## 36. The profile-key registry
|
|
1488
|
+
|
|
1489
|
+
This is the registry of profile keys, the first version. The resolver validates keys by their form alone and keeps no
|
|
1490
|
+
list of them (§22), so the registry binds writers and readers, not replay.
|
|
1491
|
+
|
|
1492
|
+
### 36.1 The caps
|
|
1493
|
+
|
|
1494
|
+
From `src/types.ts`; a record that breaks one is a no-op (§22).
|
|
1495
|
+
|
|
1496
|
+
| Cap | Constant | Value |
|
|
1497
|
+
|---|---|---|
|
|
1498
|
+
| keys in one profile | `PROFILE_MAX_KEYS` | 16 |
|
|
1499
|
+
| UTF-8 bytes of one value | `PROFILE_MAX_VALUE_BYTES` | 256 |
|
|
1500
|
+
| UTF-8 bytes of the whole record, its `uri` | `MAX_RECORD_BYTES` (the node's `uri` cap, C4) | 512 |
|
|
1501
|
+
| the form of a key | `PKEY` | `^[a-z0-9](?:[a-z0-9.-]{0,30}[a-z0-9])?$`: 1 to 32 characters, lowercase letters and digits, with dots and hyphens inside |
|
|
1502
|
+
|
|
1503
|
+
Each value is a string. The resolver accepts any well-formed string within the byte cap (§5.1 A7), the empty string
|
|
1504
|
+
included; the forms below are what a reader accepts as the value of a registered key.
|
|
1505
|
+
|
|
1506
|
+
### 36.2 The keys
|
|
1507
|
+
|
|
1508
|
+
| Key | Value |
|
|
1509
|
+
|---|---|
|
|
1510
|
+
| `display`, `description`, `avatar`, `header`, `url`, `email`, `location`, `com.twitter`, `com.github`, `com.discord`, `org.telegram`, `com.linkedin`, `com.reddit` | the 13 keys the reference site's profile editor writes, registered as they are: a display name, a short text, an image URL (`avatar`, `header`, `https://` only), a link (`url`, below), an email address, a place, and six handles on the named services |
|
|
1511
|
+
| `url` | an `https://` link |
|
|
1512
|
+
| `contenthash` | a URI: `ipfs://<CIDv1>`, with nothing after the CID. Not ENS's binary encoding. A later revision of this registry may add `ipns://`; it is not valid now |
|
|
1513
|
+
| `csd.*` | reserved to this convention for keys about the chain itself; only the keys below are defined |
|
|
1514
|
+
| `csd.p2p` | a peer of the chain's own network: a libp2p multiaddr that ends with its peer id (`/p2p/<peer id>`) |
|
|
1515
|
+
| `csd.rpc` | an address through which a page reaches a node's API: an `https://` base URL without credentials, query or fragment, or the multiaddr of a gateway that carries that API, ending with the gateway's peer id |
|
|
1516
|
+
| an application's keys | under a reverse-DNS prefix of a domain the application controls, for example `org.example.app` for the application at `app.example.org`; the whole key matches `PKEY` |
|
|
1517
|
+
|
|
1518
|
+
The six service keys of the editor (`com.twitter` to `com.reddit`) are reverse-DNS names of domains this convention
|
|
1519
|
+
does not control. They are registered as the editor writes them and are the only such keys.
|
|
1520
|
+
|
|
1521
|
+
### 36.3 Reader rules
|
|
1522
|
+
|
|
1523
|
+
- Accept only the schemes and forms stated in §36.2, and treat any other value of a registered key as absent.
|
|
1524
|
+
- `csd.p2p` and `csd.rpc`: never use an address that is loopback, link-local or private, whether it is written as an
|
|
1525
|
+
address or reached through a name that resolves to one. A multiaddr ends with a peer id, and a reader dials that
|
|
1526
|
+
peer only with its peer id checked.
|
|
1527
|
+
- An address that a name's profile publishes is that name owner's node. What is read through it is at most single
|
|
1528
|
+
records, each proven for inclusion with its author bound to the coin it spent (§33.5; the record proof of §37),
|
|
1529
|
+
never a complete history, and never what marks any name, that one or another, as verified.
|
|
1530
|
+
- A profile is never a send target (§22): the address a name pays to is `addr`, set by `nset`.
|
|
1531
|
+
- The profile of an expired or pending name is ignored (§35.3).
|
|
1532
|
+
|
|
1533
|
+
### 36.4 The byte budget
|
|
1534
|
+
|
|
1535
|
+
For a 32-character name, each row is the record `nameProfile` builds, measured with `canonicalJson`, in UTF-8 bytes
|
|
1536
|
+
against `MAX_RECORD_BYTES`. `node scripts/profile-budget.mjs` in the csd-sdk repository prints every figure, and its
|
|
1537
|
+
test keeps this table equal to that output. The example values are of a realistic length: `contenthash` a CIDv1 in
|
|
1538
|
+
base32, 66 bytes; `csd.p2p` a DNS multiaddr with an Ed25519 peer id, 89 bytes; `csd.rpc` an https base URL, 24
|
|
1539
|
+
bytes, or a WebRTC gateway multiaddr with a certificate hash and a peer id, 158 bytes; each editor key 12 bytes.
|
|
1540
|
+
|
|
1541
|
+
| Profile | Keys | Record bytes | Left of 512 |
|
|
1542
|
+
|---|---|---|---|
|
|
1543
|
+
| empty | 0 | 71 | 441 |
|
|
1544
|
+
| `contenthash` | 1 | 153 | 359 |
|
|
1545
|
+
| `contenthash`, `csd.p2p` | 2 | 255 | 257 |
|
|
1546
|
+
| `contenthash`, `csd.p2p`, `csd.rpc` (https URL) | 3 | 292 | 220 |
|
|
1547
|
+
| `contenthash`, `csd.p2p`, `csd.rpc` (gateway multiaddr) | 3 | 426 | 86 |
|
|
1548
|
+
| 13 editor keys, `contenthash`, `csd.p2p` | 15 | 601 | 89 over: `nameProfile` refuses it |
|
|
1549
|
+
|
|
1550
|
+
The 13 editor keys and the three registered keys `contenthash`, `csd.p2p` and `csd.rpc` are 16 keys, the key cap
|
|
1551
|
+
exactly, yet the last row, with 15 of them and 12-byte values, is already over the byte cap. The byte cap binds
|
|
1552
|
+
before the key cap, so an application uses one key that points at its own data rather than one key per field.
|
|
1553
|
+
|
|
1554
|
+
### 36.5 Adding a key
|
|
1555
|
+
|
|
1556
|
+
A key is added to the registry by a change to this file: a row in §36.2 with its value form, and its reader rules in
|
|
1557
|
+
§36.3 when it needs any. It needs no gate, since the resolver keeps no list of keys. A key under an application's own
|
|
1558
|
+
reverse-DNS prefix needs no registration.
|
|
1559
|
+
|
|
1560
|
+
---
|
|
1561
|
+
|
|
1562
|
+
# What a result proves (no gate)
|
|
1563
|
+
|
|
1564
|
+
## 37. The three levels
|
|
1565
|
+
|
|
1566
|
+
A result says which of three levels it is.
|
|
1567
|
+
|
|
1568
|
+
1. Display. An answer read from someone's API. It is worth the trust placed in that API.
|
|
1569
|
+
2. Record proof. One record was mined in a block under valid proof of work, and its author is the owner of the coin
|
|
1570
|
+
its first input spends (§33.5). It does not prove that the record is the latest for its name or token, and it
|
|
1571
|
+
decides nothing about a name whose state depends on records outside the name's own history (a fill that depends
|
|
1572
|
+
on the buyer's other claims or balance, a registration that depends on the registrant's other reservations).
|
|
1573
|
+
3. Replica. `resolve()` over every event of §33. It is exact for names and tokens when its event list is complete;
|
|
1574
|
+
§33.1 states what establishes that. What it proves depends on its source:
|
|
1575
|
+
- blocks from one's own node: the trust is one's own node;
|
|
1576
|
+
- complete blocks checked against headers: a block cannot be thinned, because its transactions must hash to the
|
|
1577
|
+
merkle root of the header and each author is bound to the coin it spent; what remains to trust is that the
|
|
1578
|
+
header source serves the chain with the most work;
|
|
1579
|
+
- a record log fixed in a release, plus complete blocks above the height it ends at: below that height the trust
|
|
1580
|
+
is the release;
|
|
1581
|
+
- a feed: a node's events route, csd-indexer's feeds, or any other list of records. A feed is complete only on its
|
|
1582
|
+
word, so a replay fed from one gives display, or a record proof for each record it proves, and says so. From
|
|
1583
|
+
one's own node the events route is the node software's word, which a replica makes equal to the first source by
|
|
1584
|
+
a recount from blocks at the boundaries of §38.
|
|
1585
|
+
|
|
1586
|
+
---
|
|
1587
|
+
|
|
1588
|
+
# Conformance and rule changes (no gate)
|
|
1589
|
+
|
|
1590
|
+
## 38. Conformance
|
|
1591
|
+
|
|
1592
|
+
A replica conforms at three levels.
|
|
1593
|
+
|
|
1594
|
+
1. The vectors: `test/vectors/cases.json`, `cases-v29.json` and `cases-rules.json` (replay, §5), `events.json`
|
|
1595
|
+
(§33.7) and `hashes.json` (§34.4). A conformant implementation reproduces every case byte for byte.
|
|
1596
|
+
2. The pinned replay hashes: `test/vectors/replay-hashes.json`, the state hash (§34.1) of the live chain at each
|
|
1597
|
+
pinned height.
|
|
1598
|
+
3. A running comparison: two replicas compare the tuple (height, block hash, events hash, state hash) of §34.3 at
|
|
1599
|
+
finalized epoch boundaries. An epoch is `EPOCH_LEN` = 30 blocks (csd-codec, re-exported by cairnx-core); a
|
|
1600
|
+
boundary is a height that is a multiple of `EPOCH_LEN`, and a finalized boundary is one that both replicas hold at
|
|
1601
|
+
least `FINAL_DEPTH` = 12 blocks below their tips (cairnx-core `FINAL_DEPTH`). The thresholds of §3 (3 and 6) are
|
|
1602
|
+
display conventions and are not this depth; neither is a bound on how deep a reorganisation can reach.
|
|
1603
|
+
|
|
1604
|
+
What a difference means is in §34.3. The operating rule: a difference is reported, never acted on automatically. A
|
|
1605
|
+
replica that credits value stops crediting only when a difference at one block hash persists over three consecutive
|
|
1606
|
+
boundaries and its own recount from complete blocks (§37) gives the same difference.
|
|
1607
|
+
|
|
1608
|
+
A form of the tuple recorded on chain is reserved under the reserved prefixes of §35.2 and is not defined by this
|
|
1609
|
+
version.
|
|
1610
|
+
|
|
1611
|
+
`test/vectors/codes.json` (§40.7) is not a level: the reason codes move no state. A replica that publishes codes
|
|
1612
|
+
reproduces it.
|
|
1613
|
+
|
|
1614
|
+
## 39. Rule changes
|
|
1615
|
+
|
|
1616
|
+
- This specification is normative for the future. Pinned history stands: every height below a gate replays as it
|
|
1617
|
+
did, and the pinned replay hashes do not move. Behaviour changes only at a gate, an activation height in
|
|
1618
|
+
`src/types.ts`; a section without a gate, such as §33 to §40, moves no state.
|
|
1619
|
+
- `CONSENSUS_CHANGES.md` in the csd-sdk repository is the ledger of every change. Each gate after v2.9 also has its
|
|
1620
|
+
own file, `docs/gates/<gate>.md`, written from `docs/gates/TEMPLATE.md` and linked from its ledger entry. It
|
|
1621
|
+
states the motivation, the rule text, the class of the change (reject-more: an input the earlier rule applied
|
|
1622
|
+
becomes a no-op; accept-different: an input is applied where it was not, or applied otherwise), the height, the
|
|
1623
|
+
vectors that pin it, and a rollout table of every consumer with how its adoption is observed.
|
|
1624
|
+
`scripts/check-consensus-citations.mjs` checks the citations of the ledger and of every gate file, and that each
|
|
1625
|
+
gate file is linked from the ledger.
|
|
1626
|
+
- A published height never moves earlier. (The v2.4 to v2.7 heights were moved earlier once, on 2026-07-03, before
|
|
1627
|
+
this rule; see the note at the top of this file.)
|
|
1628
|
+
- Rule changes ride gates within `cairnx:v1`. A second domain is only for a deliberate restart of state: its records
|
|
1629
|
+
are not events of `cairnx:v1` (§33.1), so it starts from no tokens, no balances and no names.
|
|
1630
|
+
|
|
1631
|
+
---
|
|
1632
|
+
|
|
1633
|
+
# Reason codes (no gate)
|
|
1634
|
+
|
|
1635
|
+
## 40. Reason codes
|
|
1636
|
+
|
|
1637
|
+
Every entry of the applied log (§5) carries `code`, the rule that decided the record, beside its `note`. A record that
|
|
1638
|
+
does not parse is refused with a record code, which `explainRecord(uri, payloadHash)` returns and a record builder's
|
|
1639
|
+
`RecordError` carries. The log stays outside canonical state, so codes move no state, and a replica that writes no
|
|
1640
|
+
codes conforms at every level of §38.
|
|
1641
|
+
|
|
1642
|
+
### 40.1 What a code is
|
|
1643
|
+
|
|
1644
|
+
- A code names one rule. A rule that several record kinds or gate eras share has one code; the entry's `kind` names
|
|
1645
|
+
the record (`invalid` for one that does not parse).
|
|
1646
|
+
- Each code has one outcome, applied or refused, and an entry's `ok` is true exactly when its code is applied.
|
|
1647
|
+
- A code is upper snake case of at most 40 characters with a family prefix: RECORD, GATE, TOKEN, NAME, OFFER, BID,
|
|
1648
|
+
FILL, CLAIM, EXPIRY, TREASURY, CAP or INVARIANT.
|
|
1649
|
+
- Where a record breaks more than one rule, its code is that of the first rule in the reference implementation's order
|
|
1650
|
+
(`src/resolve/`, `src/records.ts`); `test/vectors/codes.json` pins the order where two rules meet.
|
|
1651
|
+
- An event that writes no entry has no code: an event below activation (§3); a repeated event at V29 or above (§32);
|
|
1652
|
+
an Attest on a proposal that is not an offer, except a cancel of a bid and a fill of a known fclaim; an Attest on an
|
|
1653
|
+
offer with a reserved score (any but 0, 50 and 100, and 50 below V17); and every expiry the sweep applies.
|
|
1654
|
+
|
|
1655
|
+
### 40.2 Stability
|
|
1656
|
+
|
|
1657
|
+
A code in a release keeps its meaning: it is never renamed, never reused for another meaning and never removed; a code
|
|
1658
|
+
that is no longer written is marked retired and stays reserved. Codes may be added in any release, and a reason may be
|
|
1659
|
+
split into a new code only with a line in the changelog. The note text is a diagnostic and may change in any release.
|
|
1660
|
+
A consumer must treat an unknown code by its outcome (`ok`), since codes are added in any release.
|
|
1661
|
+
|
|
1662
|
+
### 40.3 Caps
|
|
1663
|
+
|
|
1664
|
+
The caps are the per-address rules that count the proposer's other names or offers: CAP_PENDING_RESERVATIONS and
|
|
1665
|
+
CAP_PENDING_RECAPTURES (`MAX_PENDING_REG`), and CAP_LIVE_HOLDS (`MAX_ACTIVE_CLAIMS`, for fclaims and legacy claims).
|
|
1666
|
+
`CAP_CODES` lists them, for an alarm on any cap refusal. A bound on one record or one token is not a cap:
|
|
1667
|
+
TOKEN_SUPPLY_EXHAUSTED, EXPIRY_TOO_LONG, CLAIM_TOO_FAR_AHEAD, RECORD_TOO_LARGE and the profile limits.
|
|
1668
|
+
|
|
1669
|
+
### 40.4 The table
|
|
1670
|
+
|
|
1671
|
+
Four codes guard a state no event reaches, so no vector holds them: NAME_RECLAIMED, NAME_RESERVATION_EXPIRED,
|
|
1672
|
+
NAME_NOT_LAPSED and INVARIANT_BROKEN (their rows say why).
|
|
1673
|
+
|
|
1674
|
+
| Code | Outcome | Cap | Meaning |
|
|
1675
|
+
|---|---|---|---|
|
|
1676
|
+
| TOKEN_DEPLOYED | applied | | a ticker is created |
|
|
1677
|
+
| TOKEN_MINTED | applied | | supply is credited to the minter (note: the amount) |
|
|
1678
|
+
| TOKEN_TRANSFERRED | applied | | tokens move |
|
|
1679
|
+
| TOKEN_META_SET | applied | | the issuer sets the metadata hash |
|
|
1680
|
+
| NAME_COMMITTED | applied | | a commit is recorded (its earliest height is kept) |
|
|
1681
|
+
| NAME_REGISTERED | applied | | a pay-now registration below V25, the name free |
|
|
1682
|
+
| NAME_REGISTERED_DISPLACED | applied | | a pay-now registration that displaces a holder with a later anchor |
|
|
1683
|
+
| NAME_RESERVED | applied | | a reservation (V25 and above) of a free name |
|
|
1684
|
+
| NAME_RESERVED_DISPLACED | applied | | a reservation that displaces a reservation with a later anchor |
|
|
1685
|
+
| NAME_RECAPTURE_RESERVED | applied | | a recapture reservation (V26 and above) of a lapsed name |
|
|
1686
|
+
| NAME_RECAPTURE_RESERVED_DISPLACED | applied | | a recapture reservation that displaces a later one |
|
|
1687
|
+
| NAME_RECLAIMED | applied | | a pay-now reclaim of a lapsed name below V26; no event reaches it, since the earliest lapse falls far above V26 |
|
|
1688
|
+
| NAME_FINALIZED | applied | | a registration is finalized and its fee paid |
|
|
1689
|
+
| NAME_RECAPTURE_FINALIZED | applied | | a recapture is finalized and its premium paid |
|
|
1690
|
+
| NAME_TRANSFERRED | applied | | the name has a new owner |
|
|
1691
|
+
| NAME_ADDR_SET | applied | | the address is set, or cleared by the zero address at V23 and above |
|
|
1692
|
+
| NAME_PROFILE_SET | applied | | the profile is set, or cleared by an empty `p` |
|
|
1693
|
+
| NAME_RENEWED | applied | | one term is added (note: the new paid-through epoch) |
|
|
1694
|
+
| OFFER_CREATED | applied | | an offer opens and its give is locked |
|
|
1695
|
+
| OFFER_BULK_CANCELLED | applied | | an ocancel applies (note: the count, which may be 0) |
|
|
1696
|
+
| OFFER_CANCELLED | applied | | a seller's cancel applies |
|
|
1697
|
+
| BID_CREATED | applied | | a bid opens |
|
|
1698
|
+
| BID_CANCELLED | applied | | a bidder's cancel applies |
|
|
1699
|
+
| FILL_APPLIED | applied | | a whole fill delivers (token-priced or CSD-priced) |
|
|
1700
|
+
| FILL_PARTIAL | applied | | a partial fill delivers, the one that completes the offer included (note: paid/want) |
|
|
1701
|
+
| CLAIM_GRANTED | applied | | an fclaim (kind fclaim) or a legacy claim (kind claim) holds the offer |
|
|
1702
|
+
| GATE_NOT_ACTIVE | refused | | the record type or shape is not active at this height |
|
|
1703
|
+
| CLAIM_LEGACY_SUNSET | refused | | a legacy claim attest at V28 or above |
|
|
1704
|
+
| TOKEN_TICKER_TAKEN | refused | | an earlier deploy holds the ticker |
|
|
1705
|
+
| TOKEN_UNKNOWN | refused | | the ticker, or an offer's want ticker, was never deployed |
|
|
1706
|
+
| TOKEN_NOT_ISSUER | refused | | an issuer-only mint or metadata record from another address |
|
|
1707
|
+
| TOKEN_SUPPLY_EXHAUSTED | refused | | nothing is left to mint |
|
|
1708
|
+
| TOKEN_MINT_AMOUNT_REQUIRED | refused | | an issuer mint without `amount` |
|
|
1709
|
+
| TOKEN_BALANCE_LOW | refused | | the available balance is short (a transfer, an offer's give, a token fill's price and fee) |
|
|
1710
|
+
| TREASURY_FEE_UNPAID | refused | | the output to the treasury is below the fee or premium |
|
|
1711
|
+
| NAME_NO_COMMIT | refused | | no commit for this reveal below its height and inside the window |
|
|
1712
|
+
| NAME_SALT_REQUIRED | refused | | a `name` without salt at V25 and above (registration) or V26 and above (recapture) |
|
|
1713
|
+
| NAME_TAKEN_EARLIER | refused | | an earlier (effective height, position, id) holds the name or its reservation |
|
|
1714
|
+
| NAME_TAKEN_PURCHASED | refused | | the holder bought the name in a fill and cannot be displaced |
|
|
1715
|
+
| NAME_SALT_MISMATCH | refused | | the finalize's salt does not re-derive the reservation's commit |
|
|
1716
|
+
| NAME_FINALIZE_TOO_EARLY | refused | | a finalize before the displacement freeze ends |
|
|
1717
|
+
| NAME_RESERVATION_EXPIRED | refused | | a finalize after finalizeBy; no event reaches it, since the sweep before each event drops the reservation and the late finalize gets NAME_NO_RESERVATION |
|
|
1718
|
+
| NAME_NOT_LAPSED | refused | | a recapture finalize of a name no longer lapsed; no event reaches it, since nothing makes a lapsed record live again before that finalize |
|
|
1719
|
+
| NAME_NO_RESERVATION | refused | | no reservation or recapture of this name owned by the proposer |
|
|
1720
|
+
| NAME_NOT_OWNER | refused | | the proposer does not own the name |
|
|
1721
|
+
| NAME_PENDING | refused | | the name is a reservation not yet finalized |
|
|
1722
|
+
| NAME_LAPSED | refused | | the lease and its grace are over |
|
|
1723
|
+
| NAME_NO_LIVE_LEASE | refused | | a renewal of an unknown or lapsed name |
|
|
1724
|
+
| NAME_GRACE_OWNER_ONLY | refused | | a renewal in grace by another address |
|
|
1725
|
+
| NAME_LOCKED | refused | | an open offer holds the name |
|
|
1726
|
+
| NAME_TOO_YOUNG | refused | | the sale embargo is not over |
|
|
1727
|
+
| OFFER_LEASE_TOO_SHORT | refused | | the lease ends before the offer expires |
|
|
1728
|
+
| OFFER_TAKER_REQUIRED | refused | | an open CSD-priced offer in [V13, V17) |
|
|
1729
|
+
| OFFER_PAYTO_TREASURY | refused | | the payto is the treasury |
|
|
1730
|
+
| OFFER_UNKNOWN | refused | | the fclaim names no known offer |
|
|
1731
|
+
| OFFER_NOT_OPEN | refused | | the offer is filled, cancelled or expired (note: the status) |
|
|
1732
|
+
| OFFER_NOT_SELLER | refused | | a cancel by another address |
|
|
1733
|
+
| OFFER_FIRM_QUOTE | refused | | a cancel of a taker-bound offer created at V28 or above |
|
|
1734
|
+
| OFFER_CANCEL_HOLD_LIVE | refused | | at the block boundary a deferred cancel meets a live fclaim hold |
|
|
1735
|
+
| OFFER_CLOSED_BEFORE_CANCEL | refused | | at the block boundary the offer is already closed (by a fill, or by an earlier cancel) |
|
|
1736
|
+
| BID_NOT_BIDDER | refused | | a bid cancel by another address |
|
|
1737
|
+
| BID_NOT_OPEN | refused | | the bid is cancelled, expired or done |
|
|
1738
|
+
| EXPIRY_UNSAFE | refused | | the expires_epoch is at or above 2^53 |
|
|
1739
|
+
| EXPIRY_PAST | refused | | the expiry epoch is before the inclusion epoch |
|
|
1740
|
+
| EXPIRY_TOO_LONG | refused | | the v2.1 duration cap (anchors in [V21, V22)) |
|
|
1741
|
+
| FILL_FCLAIM_NOT_CURRENT | refused | | a fill attests a denied or superseded fclaim: the payment moves, nothing is delivered |
|
|
1742
|
+
| FILL_NOT_TAKER | refused | | the filler is not the bound taker |
|
|
1743
|
+
| FILL_NO_TOKEN_MARKER | refused | | a token-priced fill without confidence `CONF_TOKEN_FILL` |
|
|
1744
|
+
| FILL_OPEN_LANE_CLOSED | refused | | an open CSD fill in [V13, V17) |
|
|
1745
|
+
| FILL_WRONG_TARGET | refused | | an offer-id fill during an fclaim hold |
|
|
1746
|
+
| FILL_NO_LIVE_CLAIM | refused | | an open CSD fill without the filler's live hold |
|
|
1747
|
+
| FILL_BELOW_MIN | refused | | a partial payment below the effective minimum |
|
|
1748
|
+
| FILL_ZERO_DELIVERY | refused | | the payment delivers no unit |
|
|
1749
|
+
| FILL_UNDERPAID | refused | | the payment to payto is below want.value |
|
|
1750
|
+
| FILL_REBATE_UNPAID | refused | | the maker rebate output is short |
|
|
1751
|
+
| CLAIM_TAKER_BOUND | refused | | a taker-bound offer takes no claim |
|
|
1752
|
+
| CLAIM_TOKEN_PRICED | refused | | claims are for CSD-priced offers |
|
|
1753
|
+
| CLAIM_HOLD_LIVE | refused | | a hold (window and grace) is live, whoever holds it |
|
|
1754
|
+
| CLAIM_COOLDOWN | refused | | the last holder within `CLAIM_COOLDOWN_BLOCKS` of its hold's end |
|
|
1755
|
+
| CLAIM_OUTLIVES_OFFER | refused | | the hold's expiry is after the offer's |
|
|
1756
|
+
| CLAIM_TOO_FAR_AHEAD | refused | | the hold's expiry is more than `FCLAIM_MAX_EPOCH_AHEAD` epochs ahead |
|
|
1757
|
+
| CAP_PENDING_RESERVATIONS | refused | yes | the proposer holds `MAX_PENDING_REG` other live reservations |
|
|
1758
|
+
| CAP_PENDING_RECAPTURES | refused | yes | the proposer holds `MAX_PENDING_REG` other live recapture reservations |
|
|
1759
|
+
| CAP_LIVE_HOLDS | refused | yes | the proposer holds `MAX_ACTIVE_CLAIMS` live holds |
|
|
1760
|
+
| INVARIANT_BROKEN | refused | | an open offer's name or give lock is missing; no event reaches it |
|
|
1761
|
+
| RECORD_TOO_LARGE | refused | | the uri is over `MAX_RECORD_BYTES` UTF-8 bytes |
|
|
1762
|
+
| RECORD_NOT_OBJECT | refused | | the uri is not JSON, or not a JSON object |
|
|
1763
|
+
| RECORD_NOT_CANONICAL | refused | | the uri is not the canonical JSON of its object |
|
|
1764
|
+
| RECORD_HASH_MISMATCH | refused | | the payload hash does not commit to the uri |
|
|
1765
|
+
| RECORD_LONE_SURROGATE | refused | | a string holds a lone surrogate |
|
|
1766
|
+
| RECORD_NOT_V1 | refused | | `v` is not 1, or `t` is not a string |
|
|
1767
|
+
| RECORD_UNKNOWN_TYPE | refused | | an unknown `t` |
|
|
1768
|
+
| RECORD_EXTRA_KEY | refused | | a key outside the record's set |
|
|
1769
|
+
| RECORD_BAD_SHAPE | refused | | the fields form none of the record's allowed shapes |
|
|
1770
|
+
| RECORD_SAME_TOKEN | refused | | the give and the want are one ticker |
|
|
1771
|
+
| RECORD_BAD_TICKER | refused | | a ticker is missing or does not match `TICKER_RE` |
|
|
1772
|
+
| RECORD_BAD_NAME | refused | | a name is missing or does not match `NAME_RE` |
|
|
1773
|
+
| RECORD_NAME_RESERVED | refused | | a name in `RESERVED_NAMES` |
|
|
1774
|
+
| RECORD_BAD_ADDRESS | refused | | an address is missing or does not match `ADDR_RE` |
|
|
1775
|
+
| RECORD_BAD_AMOUNT | refused | | an amount is missing or not a canonical decimal string |
|
|
1776
|
+
| RECORD_AMOUNT_TOO_LARGE | refused | | an amount at or above 2^96 |
|
|
1777
|
+
| RECORD_AMOUNT_ZERO | refused | | an amount of 0 where zero is refused |
|
|
1778
|
+
| RECORD_MIN_ABOVE_WANT | refused | | the offer's `min` is above want.value |
|
|
1779
|
+
| RECORD_BAD_HASH | refused | | a hash is missing or does not match `HASH_RE` |
|
|
1780
|
+
| RECORD_BAD_SALT | refused | | a salt does not match `SALT_RE` |
|
|
1781
|
+
| RECORD_BAD_DECIMALS | refused | | the decimals are not an integer from 0 to `MAX_TOKEN_DECIMALS` |
|
|
1782
|
+
| RECORD_BAD_MINT_MODE | refused | | the mint is neither open nor issuer |
|
|
1783
|
+
| RECORD_BAD_TEXT | refused | | a memo or token name is not a string or is too long (in UTF-16 units) |
|
|
1784
|
+
| RECORD_BAD_TS | refused | | the ts is not a safe integer |
|
|
1785
|
+
| RECORD_PROFILE_TOO_MANY_KEYS | refused | | a profile over `PROFILE_MAX_KEYS` keys |
|
|
1786
|
+
| RECORD_PROFILE_BAD_KEY | refused | | a profile key that does not match `PKEY` |
|
|
1787
|
+
| RECORD_PROFILE_BAD_VALUE | refused | | a profile value that is not a string |
|
|
1788
|
+
| RECORD_PROFILE_VALUE_TOO_LONG | refused | | a profile value over `PROFILE_MAX_VALUE_BYTES` UTF-8 bytes |
|
|
1789
|
+
|
|
1790
|
+
### 40.5 Records and builders
|
|
1791
|
+
|
|
1792
|
+
`explainRecord(uri, payloadHash)` answers `{ ok: true, record }` or `{ ok: false, code }`, and `parseRecord` answers
|
|
1793
|
+
null exactly when it answers a code. A record builder that refuses throws `RecordError`, an `Error` whose `code` is the
|
|
1794
|
+
record code and whose message is `record does not validate against CONVENTION.md (<code>)`. A builder input that is not
|
|
1795
|
+
JSON data throws the codec's own error before any rule is checked.
|
|
1796
|
+
|
|
1797
|
+
### 40.6 The client helpers' reasons
|
|
1798
|
+
|
|
1799
|
+
`previewFill` and `fillOutputPlan` keep their own reasons: `not-open` is OFFER_NOT_OPEN, `zero-delivery` is
|
|
1800
|
+
FILL_ZERO_DELIVERY, and `below-min` is FILL_BELOW_MIN on a partial fill and FILL_UNDERPAID on a whole one.
|
|
1801
|
+
|
|
1802
|
+
### 40.7 Reference and vectors
|
|
1803
|
+
|
|
1804
|
+
`src/codes.ts` holds the table: `REASON_CODES`, `REASON_CODE_OUTCOME`, `CAP_CODES` and the types `ReasonCode`,
|
|
1805
|
+
`AppliedCode`, `RefusalCode` and `RecordCode`; a test requires it equal to §40.4. `test/vectors/codes.json` holds 145
|
|
1806
|
+
resolve cases (the events, the tip and the expected entries as `[id, kind, ok, code]`, compared as a set) and 50 record
|
|
1807
|
+
cases (the uri, the payload hash and the expected code, or null for a record that parses), with every expectation
|
|
1808
|
+
written by hand in `conformance/gen-codes-vectors.mjs`. A replica that publishes codes reproduces it. The Python
|
|
1809
|
+
reference of `conformance/` writes no codes.
|