@inversealtruism/cairnx-core 0.1.44 → 0.2.1
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 +62 -0
- package/CONVENTION.md +150 -150
- package/MAKERS.md +4 -7
- package/README.md +7 -6
- package/dist/index.cjs +1025 -886
- package/dist/index.d.cts +31 -23
- package/dist/index.d.ts +31 -23
- package/dist/index.js +1026 -887
- package/package.json +4 -3
package/CONVENTION.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Status:** v2.9 (normative; v2.9 pending activation at `V29_HEIGHT`, see §32; v2.8 activated at 60 000, crossed 2026-07-23; supersedes the 2026-06-10 v1.0 draft) · **Domain:** `cairnx:v1` · **Base activation:** 29 860
|
|
4
4
|
|
|
5
|
-
**Version ladder** (each gate non-retroactive
|
|
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) ·
|
|
@@ -18,12 +18,12 @@ replayer gates each rule on its own height constant, never on "version X implies
|
|
|
18
18
|
|
|
19
19
|
> **Canonical copy.** This spec ships in the published `@inversealtruism/cairnx-core` package; the source of
|
|
20
20
|
> truth is `csd-sdk/packages/cairnx/CONVENTION.md`. Any in-repo mirror (e.g. the `cairnx` app repo) MUST be
|
|
21
|
-
> kept **byte-identical** to it on every change
|
|
21
|
+
> kept **byte-identical** to it on every change: a third-party implementer fetches the *published* copy, so
|
|
22
22
|
> it is the one that must never lag the code. Keep the two in lockstep when editing.
|
|
23
23
|
|
|
24
24
|
CairnX is a meta-asset and exchange convention on Compute Substrate (CSD). It defines fungible
|
|
25
25
|
tokens and atomic delivery-versus-payment trades using **only** the chain's existing `Propose`
|
|
26
|
-
and `Attest` transactions
|
|
26
|
+
and `Attest` transactions: no fork, no new transaction types, no custodian. Token semantics are
|
|
27
27
|
enforced by a **pure, deterministic resolver** that any party can run; independent resolvers
|
|
28
28
|
replaying the same chain converge on identical state.
|
|
29
29
|
|
|
@@ -50,15 +50,15 @@ Verified against the node source (`compute-substrate` @ v1.x, 2026-06-10):
|
|
|
50
50
|
|
|
51
51
|
## 2. Encoding: records live on-chain in `uri`
|
|
52
52
|
|
|
53
|
-
Every CairnX record is a **canonical JSON** object (UTF-8, recursively sorted keys, compact
|
|
53
|
+
Every CairnX record is a **canonical JSON** object (UTF-8, recursively sorted keys, compact:
|
|
54
54
|
exactly `canonicalJson` from `@inversealtruism/csd-codec`) whose serialized form MUST be
|
|
55
55
|
≤ 512 bytes. It is anchored by a `Propose` to domain **`cairnx:v1`** with:
|
|
56
56
|
|
|
57
57
|
- `uri` = the canonical JSON string itself (the record is **fully on-chain**, replicated by
|
|
58
|
-
every node, forever
|
|
58
|
+
every node, forever: there is no off-chain content-availability problem);
|
|
59
59
|
- `payload_hash` = `sha256(uri bytes)` (`payloadHash` of the record). Resolvers MUST verify
|
|
60
60
|
`sha256(uri) == payload_hash` and treat mismatching anchors as no-ops;
|
|
61
|
-
- `expires_epoch
|
|
61
|
+
- `expires_epoch`: see per-record semantics (for offers it is the consensus-enforced fill window).
|
|
62
62
|
|
|
63
63
|
A record's **actor** is the anchoring tx's consensus `proposer` (C3). There are no off-chain
|
|
64
64
|
signatures in v1: anchoring *from your key* is the authorization.
|
|
@@ -69,24 +69,24 @@ signatures in v1: anchoring *from your key* is the authorization.
|
|
|
69
69
|
arbitrary-precision integers. `decimals` (0–8) is display-only.
|
|
70
70
|
- **Tickers** match `^[A-Z][A-Z0-9]{2,11}$`.
|
|
71
71
|
- **Addresses** are `0x` + 40 lowercase hex.
|
|
72
|
-
- **Apply order:** events are replayed in consensus order
|
|
72
|
+
- **Apply order:** events are replayed in consensus order: by block height; within a block,
|
|
73
73
|
all `cairnx:v1` proposals in tx order (`pos`), then all attestations on CairnX offers in tx
|
|
74
|
-
order. (Mirrors the node’s propose/attest phases, C5.) Remaining ties (same height, phase, pos
|
|
74
|
+
order. (Mirrors the node’s propose/attest phases, C5.) Remaining ties (same height, phase, pos:
|
|
75
75
|
possible only across indexer quirks, never on a real chain) break by **ordinal (code-unit)
|
|
76
76
|
comparison of the lowercase `0x`-hex txid**. Ordinal comparison is the ONLY string ordering
|
|
77
|
-
used anywhere in resolution and serialization
|
|
77
|
+
used anywhere in resolution and serialization: locale-aware collation (e.g. JavaScript's
|
|
78
78
|
`localeCompare`) is forbidden, since it is ICU-dependent and non-reproducible across runtimes.
|
|
79
79
|
- **Invalid = no-op.** A record that fails any check (schema, balance, state) has **no effect**.
|
|
80
80
|
Unknown `t` values and `v ≠ 1` are no-ops (forward compatibility). Invalidity never poisons
|
|
81
81
|
later records.
|
|
82
82
|
- **Activation:** anchors below height **29 860** are ignored. (Set just before the first
|
|
83
|
-
protocol traffic
|
|
83
|
+
protocol traffic: the domain had no prior use; the live X2 e2e records ARE the genesis.)
|
|
84
84
|
- **Finality:** state derived from blocks < 6 confirmations is provisional (display threshold
|
|
85
|
-
3, final 6
|
|
85
|
+
3, final 6, matching Cairn's site conventions).
|
|
86
86
|
|
|
87
87
|
## 4. Records
|
|
88
88
|
|
|
89
|
-
### 4.1 `deploy
|
|
89
|
+
### 4.1 `deploy`: create a token
|
|
90
90
|
|
|
91
91
|
```json
|
|
92
92
|
{"v":1,"t":"deploy","ticker":"DUST","name":"Dust","decimals":2,
|
|
@@ -100,12 +100,12 @@ signatures in v1: anchoring *from your key* is the authorization.
|
|
|
100
100
|
| `decimals` | integer 0–8 |
|
|
101
101
|
| `supply` | max total supply, amount-string |
|
|
102
102
|
| `mint` | `"open"` (anyone) or `"issuer"` (only the deployer) |
|
|
103
|
-
| `mintLimit` | required iff `mint:"open"
|
|
103
|
+
| `mintLimit` | required iff `mint:"open"`: max amount credited per mint record |
|
|
104
104
|
|
|
105
105
|
The deploy's `expires_epoch` SHOULD be far future (e.g. tip-epoch + 100 000); expiry has no
|
|
106
106
|
CairnX meaning for deploys. The **deployer** is the anchoring proposer.
|
|
107
107
|
|
|
108
|
-
### 4.2 `mint
|
|
108
|
+
### 4.2 `mint`: issue supply
|
|
109
109
|
|
|
110
110
|
```json
|
|
111
111
|
{"v":1,"t":"mint","ticker":"DUST","amount":"100000"}
|
|
@@ -117,7 +117,7 @@ CairnX meaning for deploys. The **deployer** is the anchoring proposer.
|
|
|
117
117
|
- `mint:"issuer"`: proposer MUST equal the deployer; credited `min(amount, remaining)`; `amount` required.
|
|
118
118
|
- Credited to the **proposer**.
|
|
119
119
|
|
|
120
|
-
### 4.3 `transfer
|
|
120
|
+
### 4.3 `transfer`: move tokens
|
|
121
121
|
|
|
122
122
|
```json
|
|
123
123
|
{"v":1,"t":"transfer","ticker":"DUST","to":"0x…40","amount":"2500","memo":"…","ts":1781387000}
|
|
@@ -126,10 +126,10 @@ CairnX meaning for deploys. The **deployer** is the anchoring proposer.
|
|
|
126
126
|
- Sender = **proposer**. Valid iff sender's *unlocked* balance ≥ `amount` at apply time.
|
|
127
127
|
- `to` may be any address (including sender). `memo` ≤ 64 chars and `ts` are optional
|
|
128
128
|
free fields (also serve to differentiate otherwise-identical records; note two anchors of
|
|
129
|
-
byte-identical transfer content by the same sender are **two transfers
|
|
129
|
+
byte-identical transfer content by the same sender are **two transfers**: each anchor is an
|
|
130
130
|
independent authorization by C3).
|
|
131
131
|
|
|
132
|
-
### 4.4 `offer
|
|
132
|
+
### 4.4 `offer`: on-chain sell order (locks tokens)
|
|
133
133
|
|
|
134
134
|
```json
|
|
135
135
|
{"v":1,"t":"offer","give":{"ticker":"DUST","amount":"1000"},
|
|
@@ -138,18 +138,18 @@ CairnX meaning for deploys. The **deployer** is the anchoring proposer.
|
|
|
138
138
|
|
|
139
139
|
- Seller = **proposer**. Valid iff seller's unlocked balance ≥ `give.amount`; on apply, that
|
|
140
140
|
amount is **locked** (cannot be transferred or re-offered).
|
|
141
|
-
- `want.value
|
|
141
|
+
- `want.value`: CSD price in base units (string; `"0"` allowed = giveaway). `want.payto`
|
|
142
142
|
defaults to the seller.
|
|
143
|
-
- `taker` (optional)
|
|
143
|
+
- `taker` (optional): if present, only this address can fill. **Taker-bound offers are the
|
|
144
144
|
protected path** (see §6).
|
|
145
|
-
- The anchoring proposal's **`expires_epoch` is the offer's validity window
|
|
145
|
+
- The anchoring proposal's **`expires_epoch` is the offer's validity window**: after it, the
|
|
146
146
|
chain itself rejects fill attempts (C5), and the resolver releases the lock. Offers SHOULD
|
|
147
147
|
use short windows (e.g. tip-epoch + 24 ≈ 1 day).
|
|
148
148
|
- An offer is identified by its **proposal id (txid)**.
|
|
149
149
|
- `memo` (64 UTF-16 units max) and `ts` are optional free fields with the same rules as
|
|
150
150
|
`transfer` (4.3); `ts` MUST be a JS-safe integer (A8).
|
|
151
151
|
|
|
152
|
-
### 4.5 `fill
|
|
152
|
+
### 4.5 `fill`: atomic delivery-versus-payment (an Attest, not a Propose)
|
|
153
153
|
|
|
154
154
|
A fill is an **`Attest` transaction** referencing the offer's proposal id with **`score = 100`**,
|
|
155
155
|
whose **own outputs** pay the seller:
|
|
@@ -168,13 +168,13 @@ The **first valid fill in apply order wins**. For a **CSD-priced** fill `confide
|
|
|
168
168
|
(set 100); a **token-priced** fill (§11) additionally requires the `confidence = 1 000 000` opt-in
|
|
169
169
|
marker or it is a no-op.
|
|
170
170
|
|
|
171
|
-
### 4.6 `cancel
|
|
171
|
+
### 4.6 `cancel`: close an offer (an Attest)
|
|
172
172
|
|
|
173
173
|
`Attest` on the offer with **`score = 0`**, valid only when `attester == seller`. Releases the
|
|
174
174
|
lock, closes the offer. (Cancel and fill race in apply order like everything else.)
|
|
175
175
|
|
|
176
176
|
Other `score` values on CairnX offers are reserved (no-ops). The **claim-to-fill** exclusivity
|
|
177
|
-
extension shipped at v1.7 (height 34 000) and uses **`score = 50`** (`SCORE_CLAIM`)
|
|
177
|
+
extension shipped at v1.7 (height 34 000) and uses **`score = 50`** (`SCORE_CLAIM`), *not* `score = 1`
|
|
178
178
|
(an earlier draft placeholder that was never implemented). See §20.
|
|
179
179
|
|
|
180
180
|
## 5. Resolver state (normative output)
|
|
@@ -184,24 +184,24 @@ tokens: ticker → { deployId, deployer, name, decimals, supply, minted, mint,
|
|
|
184
184
|
balances: ticker → address → { available, locked }
|
|
185
185
|
offers: offerId → { seller, give, want, taker?, status: open|filled|cancelled|expired,
|
|
186
186
|
expiresEpoch, height, fill?: { buyer, txid, height, paid } }
|
|
187
|
-
events: ordered log of applied/no-op decisions (for explorers & audit
|
|
187
|
+
events: ordered log of applied/no-op decisions (for explorers & audit; INFORMATIONAL,
|
|
188
188
|
excluded from the canonical surface; its reason strings are diagnostics, not protocol)
|
|
189
189
|
```
|
|
190
190
|
|
|
191
191
|
**Canonical state (format 2, normative):** the canonical surface is
|
|
192
|
-
`{tipHeight, tokens, balances, names, offers, bids, feesPaid}
|
|
192
|
+
`{tipHeight, tokens, balances, names, offers, bids, feesPaid}`: the event log is excluded.
|
|
193
193
|
Serialization is **canonical JSON**: object keys sorted in ordinal (code-unit) order at every
|
|
194
194
|
depth, no insignificant whitespace, UTF-8, all amounts as decimal strings (no floats anywhere),
|
|
195
195
|
booleans/numbers in their shortest JS form. Two resolvers fed the same chain prefix MUST produce
|
|
196
196
|
byte-identical canonical state; `sha256(canonicalState)` at the activation heights is pinned in
|
|
197
197
|
`test/vectors/replay-hashes.json`, and `test/vectors/cases.json` carries language-neutral replay
|
|
198
|
-
vectors a third-party implementation must reproduce. (Format 1
|
|
198
|
+
vectors a third-party implementation must reproduce. (Format 1, pre-2026-06-12, included the
|
|
199
199
|
event log and used locale collation; it is retired.)
|
|
200
200
|
|
|
201
201
|
Determinism requirement: the conformance suite enforces byte-identity, including
|
|
202
202
|
shuffle-invariance of inputs that consensus ordering re-sorts.
|
|
203
203
|
|
|
204
|
-
### 5.1 The byte-level canonical-JSON contract (normative
|
|
204
|
+
### 5.1 The byte-level canonical-JSON contract (normative: pin before a 2nd implementation exists)
|
|
205
205
|
|
|
206
206
|
"Canonical JSON" above is only as portable as these rules. They document exactly what the reference
|
|
207
207
|
canonicalizer (`@inversealtruism/csd-codec` `canonicalJson`, which bottoms out in ECMA-262
|
|
@@ -209,22 +209,22 @@ canonicalizer (`@inversealtruism/csd-codec` `canonicalJson`, which bottoms out i
|
|
|
209
209
|
record-acceptance gate and/or the canonical-state hash on valid mainnet data. These are unmigratable
|
|
210
210
|
once a replay hash is pinned over data that exercises them, so they are stated here verbatim.
|
|
211
211
|
|
|
212
|
-
- **A1
|
|
212
|
+
- **A1: String escaping.** Escape **only** `"` → `\"`, `\` → `\\`, and the C0 controls U+0000–U+001F
|
|
213
213
|
(using the short escapes `\b \f \n \r \t`, otherwise lowercase `\u00XX`). Emit **every other**
|
|
214
|
-
codepoint as **raw UTF-8
|
|
214
|
+
codepoint as **raw UTF-8**: in particular do **NOT** escape `/` (solidus) and do **NOT** `\u`-escape
|
|
215
215
|
any non-ASCII codepoint (U+0080 and above). A token `name` of `"Café"` serializes the `é` as the raw
|
|
216
216
|
2-byte UTF-8 `0xC3 0xA9`, never `é`; an emoji serializes as its raw 4-byte UTF-8, never an
|
|
217
217
|
escaped surrogate pair. (Note: `memo` fields on transfer/offer/bid carry the same free-Unicode
|
|
218
218
|
surface inside the record `uri`, so they obey A1 too even though they are not in canonical state.)
|
|
219
219
|
**A1 is unsatisfiable for a lone/unpaired UTF-16 surrogate** (it has no valid UTF-8 form): V8 escapes
|
|
220
220
|
it to ASCII `\uXXXX` while a raw-UTF-8 resolver rejects/mangles it, so such a string is rejected
|
|
221
|
-
outright by **A7** before it can reach A1
|
|
222
|
-
- **A2
|
|
221
|
+
outright by **A7** before it can reach A1; see A7.
|
|
222
|
+
- **A2: Key ordering is UTF-16 code-unit order, NOT Unicode codepoint / UTF-8 byte order.** Sort object
|
|
223
223
|
keys by comparing their UTF-16 code units. These two orders are identical for all-BMP strings but
|
|
224
224
|
**diverge for non-BMP characters (U+10000+)**: a leading surrogate `0xD800–0xDBFF` sorts *below* BMP
|
|
225
225
|
chars `0xE000–0xFFFF` under UTF-16, but *above* all BMP chars under codepoint order. **Rust
|
|
226
226
|
`str::cmp` / Go `<` on `string` compare by UTF-8 bytes = codepoint order and are therefore WRONG** for
|
|
227
|
-
a non-BMP key
|
|
227
|
+
a non-BMP key: implementers MUST compare UTF-16 code units (JS `localeCompare` is also wrong; use the
|
|
228
228
|
default `<`/`>` on the JS string, i.e. code-unit order, which is what the resolver's `ord()` does).
|
|
229
229
|
**The numeric-key trap, and it points in OPPOSITE directions for the two hashes we compute, so read
|
|
230
230
|
carefully.** Nprofile maps (and all-digit names) can carry numeric-looking keys like `"2"`/`"10"`:
|
|
@@ -240,15 +240,15 @@ once a replay hash is pinned over data that exercises them, so they are stated h
|
|
|
240
240
|
(or who ignores the integer-first enumeration) forks `sha256(canonicalState)` the first time a profile
|
|
241
241
|
carries two numeric keys. The reference Python mirror encodes exactly this split (`canonicalJson` vs
|
|
242
242
|
`_js_obj_key_order`/`_js_stringify` in `conformance/cairnx_ref.py`); a third impl MUST reproduce both.
|
|
243
|
-
- **A3
|
|
243
|
+
- **A3: Field types (bare number/boolean vs decimal string vs identity string).** Canonical state mixes
|
|
244
244
|
raw JSON integers and booleans with decimal-string amounts and raw identity strings. Emit as **bare
|
|
245
245
|
integers**: `decimals, height, effectiveHeight, expiresEpoch, feeBps, tipHeight, paidThroughEpoch`, and
|
|
246
246
|
(v1.7) `claimUntilHeight` (all JS-safe, < 2^53). Emit as **bare booleans**: `locked, viaFill, expired`.
|
|
247
247
|
Emit as **decimal strings**: `supply, minted, mintLimit, feesPaid`, every `balances.*.available`/`.locked`,
|
|
248
248
|
`want.value`, `want.amount`, `min`, `paid`, `delivered`, and each fill's `paid`/`.fee` (plus `.got` ONLY on
|
|
249
|
-
a partial `fills[]` entry
|
|
249
|
+
a partial `fills[]` entry; see the fill shapes below). Emit as **raw 0x-hex identity strings**: the offer
|
|
250
250
|
`id` (32-byte txid), the name `claimId` (32-byte anchor txid, present on **every** name), and (v1.7) the
|
|
251
|
-
offer `claimedBy` (20-byte addr). Emit as a nested **object**: the name `profile` (v1.9 nprofile
|
|
251
|
+
offer `claimedBy` (20-byte addr). Emit as a nested **object**: the name `profile` (v1.9 nprofile: a flat
|
|
252
252
|
string→string map). **Two distinct fill shapes (the `got`-presence rule):** a whole-offer fill is the
|
|
253
253
|
singular object `fill` = `{buyer, txid, height, paid, fee}` and **OMITS `got`**; a partial-fillable (`min`)
|
|
254
254
|
offer instead carries an **array** `fills`, each entry `{buyer, txid, height, paid, fee, got}` **WITH
|
|
@@ -257,23 +257,23 @@ once a replay hash is pinned over data that exercises them, so they are stated h
|
|
|
257
257
|
amount as a number or an `f64`; never stringify an integer field.
|
|
258
258
|
> **⚠ v1.7/v1.9 are part of this byte contract on every live tip past their gate** (`V17_HEIGHT=34000`
|
|
259
259
|
> claims, `V19_HEIGHT=36700` profiles). A second-language resolver built to an earlier copy of this list
|
|
260
|
-
>
|
|
260
|
+
> (omitting `claimedBy`/`claimUntilHeight`/`claimId`/`profile`/`fills`) **forks `sha256(canonicalState)`
|
|
261
261
|
> the moment any offer is claimed or any name carries a profile.** (Pinned on live data by
|
|
262
|
-
> `replay-hashes.json` at **every activation height through V20
|
|
262
|
+
> `replay-hashes.json` at **every activation height through V20**: incl. 34 000 claims, 36 700 profiles,
|
|
263
263
|
> 38 400 grace; V18/V21 auto-pin once the chain tip crosses them. The static `cases.json` bar additionally
|
|
264
264
|
> pins the V20/V21/nprofile/name-op/lapse byte-contract with no live node required.)
|
|
265
|
-
- **A4
|
|
265
|
+
- **A4: Optional fields are OMITTED, never `null`.** A key whose value is absent is dropped entirely
|
|
266
266
|
(`addr, viaFill, min, bid, taker, paidThroughEpoch, expired`, token `name`/`mintLimit`/`tmeta`, and the
|
|
267
267
|
v1.7/v1.9 optionals `claimedBy`/`claimUntilHeight` (omitted unless the offer is claimed), `fill`
|
|
268
268
|
(omitted until first filled), `fills` (only on a `min` offer), `profile` (only when an nprofile is set)).
|
|
269
269
|
Never emit `"addr":null`.
|
|
270
|
-
- **A5
|
|
270
|
+
- **A5: The acceptance gate is a byte-exact round-trip (stronger than the hash check).** A record anchor
|
|
271
271
|
is accepted iff **both** `canonicalJson(JSON.parse(uri)) === uri` (byte-for-byte) **and**
|
|
272
272
|
`sha256(uri) === payload_hash`. The round-trip is what rejects duplicate keys, leading-zero amounts,
|
|
273
273
|
`+` signs, and insignificant whitespace; a record failing either check is a no-op and never enters
|
|
274
274
|
replay. The round-trip does **not** catch a lone surrogate (it survives `JSON.parse`→`canonicalJson`
|
|
275
|
-
identically as ASCII `\uXXXX`)
|
|
276
|
-
- **A6
|
|
275
|
+
identically as ASCII `\uXXXX`); that class is rejected by **A7**, which every resolver MUST apply.
|
|
276
|
+
- **A6: Integer grammar + the exact expressions.** Amounts match `^(0|[1-9][0-9]*)$` with
|
|
277
277
|
`MAX_AMOUNT = 2^96 − 1`. The taker fee is `tradeFee(want) = (want·FEE_BPS + 9999) / 10000` (integer
|
|
278
278
|
division = ceil of 1%). `epochOf(height) = floor(height / 30)`. Constants: `COMMIT_MAX_BLOCKS = 240`,
|
|
279
279
|
`NAME_TERM_EPOCHS = 8760`, `NAME_GRACE_EPOCHS = 720`. Tickers match `^[A-Z][A-Z0-9]{2,11}$`
|
|
@@ -281,17 +281,17 @@ once a replay hash is pinned over data that exercises them, so they are stated h
|
|
|
281
281
|
codepoints or UTF-8 bytes: the free-text token `name` ≤ **32** units and `memo` ≤ **64** units. An
|
|
282
282
|
astral codepoint (U+10000+) is **2** units, so a 16-emoji name is exactly 32 units (accepted) and a
|
|
283
283
|
17-emoji name is 34 (a no-op). A resolver counting `chars`/codepoints (Rust `str::chars().count()`)
|
|
284
|
-
or bytes would FORK at this boundary
|
|
284
|
+
or bytes would FORK at this boundary: implementers MUST count UTF-16 units (Rust
|
|
285
285
|
`s.encode_utf16().count()`). Pinned by the `determinism-name-length-utf16-boundary` vector.
|
|
286
|
-
- **A7
|
|
287
|
-
UTF-16 string
|
|
288
|
-
bare `0xDC00–0xDFFF`) in **any** key or value at any depth
|
|
286
|
+
- **A7: String well-formedness (UTF-16).** A record whose decoded JSON contains **any non-well-formed
|
|
287
|
+
UTF-16 string**, a lone/unpaired surrogate (`0xD800–0xDBFF` not followed by `0xDC00–0xDFFF`, or a
|
|
288
|
+
bare `0xDC00–0xDFFF`) in **any** key or value at any depth, is an **INVALID no-op for every
|
|
289
289
|
conformant resolver**, rejected before schema validation. Rationale: such a string has no defined
|
|
290
290
|
raw-UTF-8 canonical form (A1), so accepting it would credit on a V8 resolver and reject on a
|
|
291
|
-
raw-UTF-8 one
|
|
291
|
+
raw-UTF-8 one: a cross-language fork on identical chain bytes. Reference: `parseRecord`'s
|
|
292
292
|
`isWellFormedDeep` gate (records.ts), which runs immediately after the A5 round-trip. Implementers
|
|
293
293
|
MUST reproduce it (e.g. JS `String.prototype.isWellFormed`, Rust `str` is already well-formed so a
|
|
294
|
-
`serde_json` parse that surfaces the escape and re-encodes will reject
|
|
294
|
+
`serde_json` parse that surfaces the escape and re-encodes will reject; assert it explicitly).
|
|
295
295
|
- **A8. The closed record schema and the `ts` bound.** Every record type's key set is CLOSED
|
|
296
296
|
(records.ts `onlyKeys` exact-key allowlists, mirrored by `_only_keys` in the Python reference):
|
|
297
297
|
an unknown key anywhere in a record makes it an invalid no-op, never a tolerated extra. The
|
|
@@ -316,37 +316,37 @@ rebate on resting liquidity; v1.7 (`V17_HEIGHT=34000`) added claim-to-fill (`SCO
|
|
|
316
316
|
v1.8 (`V18_HEIGHT=40000`, dormant) retiers the name registration fee; v1.9 (`V19_HEIGHT=36700`) added the
|
|
317
317
|
`nprofile` record + the name `profile` map (`PROFILE_MAX_KEYS`/`PROFILE_MAX_VALUE_BYTES`, the `PKEY`
|
|
318
318
|
charset). *(Still genuinely future / not implemented: pooled `pools`/`shares` value and a `MAX_RESERVE`
|
|
319
|
-
cap
|
|
319
|
+
cap: ecosystem doc 16 §4; these are NOT in canonical state today.)*
|
|
320
320
|
|
|
321
321
|
## 6. Honest limits & safety
|
|
322
322
|
|
|
323
323
|
- **Convention-enforced, not consensus-enforced.** The chain knows nothing about tokens; it
|
|
324
324
|
enforces (a) record immutability/ordering, (b) payment+attest atomicity in one tx, (c) the
|
|
325
325
|
offer fill window (C5). Everything else is this convention, enforced identically by every
|
|
326
|
-
honest resolver
|
|
326
|
+
honest resolver: the trust class of BRC-20/Runes, stated plainly.
|
|
327
327
|
- **Open-offer fill races:** if two buyers fill the same untaken offer, the first in apply
|
|
328
328
|
order wins; the loser's payment still reached the seller. Buyer software MUST default to
|
|
329
329
|
taker-bound (RFQ) flows or warn loudly on open-offer fills. Note the miner orders same-block
|
|
330
|
-
txs **by feerate DESC, then txid ASC** (verified in chain/mine.rs)
|
|
330
|
+
txs **by feerate DESC, then txid ASC** (verified in chain/mine.rs): a same-block race is
|
|
331
331
|
therefore a fee auction, not arrival order; takers can bid up their fill's fee to win
|
|
332
332
|
deterministically. **v1.3 closes this structurally:** from height 31 100, CSD-priced offers
|
|
333
|
-
must be taker-bound (§15)
|
|
333
|
+
must be taker-bound (§15): a warning cannot hold users back from a full-payment loss, and a
|
|
334
334
|
no-escrow chain has nothing to refund from, so the unsafe shape is removed rather than warned
|
|
335
335
|
about. (A claim window was first dismissed here as impossible because a *payment-bearing*
|
|
336
|
-
reservation has nothing to refund
|
|
336
|
+
reservation has nothing to refund, but v1.7's claim is **payment-free** (an `Attest`, not a
|
|
337
337
|
payment), so a losing claimer forfeits only the 0.05 CSD attest fee. On that basis v1.7 safely
|
|
338
|
-
**re-opens** untaken CSD offers via claim-to-fill
|
|
338
|
+
**re-opens** untaken CSD offers via claim-to-fill (§20), and v2.0/§23 bounds its late-fill edge.)
|
|
339
339
|
- **No unconfirmed chaining (no CPFP).** The mempool only accepts txs whose inputs exist in the
|
|
340
|
-
confirmed UTXO set
|
|
340
|
+
confirmed UTXO set: you cannot spend change that hasn't been mined. Sequential CairnX actions
|
|
341
341
|
from one key require one confirmation between them; client software must serialize and surface
|
|
342
342
|
this ("next action available after 1 conf").
|
|
343
343
|
- **No native-CSD pools.** CSD itself cannot be locked by convention (real UTXOs obey only
|
|
344
344
|
keys). CairnX trades CSD↔token atomically per-trade; it does not and cannot pool CSD.
|
|
345
345
|
- **Reorgs:** state is a pure function of the chain; resolvers recompute (or roll back) on
|
|
346
346
|
reorg. Treat sub-final fills accordingly.
|
|
347
|
-
- **Spam/squatting:** every record costs ≥ 0.25 CSD (anchor fee floor)
|
|
347
|
+
- **Spam/squatting:** every record costs ≥ 0.25 CSD (anchor fee floor): sybil-priced, like
|
|
348
348
|
everything on this chain. Ticker squatting is priced, not prevented; names are
|
|
349
|
-
first-anchored-wins
|
|
349
|
+
first-anchored-wins (§9).
|
|
350
350
|
|
|
351
351
|
## 7. Wire-level summary for implementers
|
|
352
352
|
|
|
@@ -355,7 +355,7 @@ cap — ecosystem doc 16 §4; these are NOT in canonical state today.)*
|
|
|
355
355
|
| deploy/mint/transfer/offer/bid/name-ops | Propose | `cairnx:v1` | `uri` = record JSON, `payload_hash` = sha256(uri), `expires_epoch` per §4 | fee/payment outputs per §10/§19 + change |
|
|
356
356
|
| fill (CSD-priced) | Attest | offer proposal id | `score=100` (confidence ignored) | payment to `want.payto` + treasury fee + maker rebate (§19) + change |
|
|
357
357
|
| fill (token-priced) | Attest | offer proposal id | `score=100, confidence=1 000 000` | change only (debit + in-kind fee are convention-side, §11) |
|
|
358
|
-
| claim (v1.7, untaken CSD offer) | Attest | offer proposal id | `score=50` | change only
|
|
358
|
+
| claim (v1.7, untaken CSD offer) | Attest | offer proposal id | `score=50` | change only: payment-free reservation (§20) |
|
|
359
359
|
| cancel | Attest | offer proposal id | `score=0` | change only |
|
|
360
360
|
| ocancel | Propose | `cairnx:v1` | `uri` = `{t:"ocancel",…}` | change only |
|
|
361
361
|
|
|
@@ -365,45 +365,45 @@ Fee floors: Propose ≥ 25 000 000, Attest ≥ 5 000 000 base units. 1 CSD = 100
|
|
|
365
365
|
|
|
366
366
|
# CairnX Convention v1.1 (names + protocol fees)
|
|
367
367
|
|
|
368
|
-
**Activation height: 29 960** (non-retroactive
|
|
368
|
+
**Activation height: 29 960** (non-retroactive: pre-29 960 token offers/deploys remain fee-free).
|
|
369
369
|
|
|
370
|
-
## 9. Names
|
|
370
|
+
## 9. Names: an on-chain-native namespace (ENS/BNS class)
|
|
371
371
|
|
|
372
372
|
CairnX names are a **tradeable, on-chain-native namespace**, distinct from `csd:identity` (which
|
|
373
373
|
binds a handle to a real-world identity via external proof and is NOT for sale). A name here is
|
|
374
|
-
owned purely on-chain
|
|
374
|
+
owned purely on-chain: register, hold, point it at an address, transfer, or sell it.
|
|
375
375
|
|
|
376
|
-
- **Charset:** lowercase ASCII only
|
|
376
|
+
- **Charset:** lowercase ASCII only: `^[a-z0-9](?:[a-z0-9-]{0,30}[a-z0-9])?$`, **1–32 chars**,
|
|
377
377
|
no leading/trailing hyphen (single- and double-character premium names are valid and priced at
|
|
378
378
|
the top of the fee curve). ASCII-only **eliminates the entire homograph/confusable attack
|
|
379
379
|
class** (no Unicode → no look-alikes) and is trivially deterministic for every indexer.
|
|
380
380
|
Reserved: `csd treasury admin official root www support` (`cairn`/`cairnx` are deliberately
|
|
381
|
-
NOT reserved
|
|
381
|
+
NOT reserved: the operator registered them as ordinary, tradeable names).
|
|
382
382
|
- **`name` (claim):** `{v:1,t:"name",name,salt?}`. Owner = anchoring proposer. **Lowest
|
|
383
383
|
effective-anchor (height, pos, id) wins.** Requires the registration fee (§ below).
|
|
384
384
|
- **Direct claim** (no `salt`): effective height = claim height. Simple, instant; front-runnable.
|
|
385
385
|
- **Commit-reveal** (`salt` present): a prior `ncommit` of `sha256({t:"cairnx:name:commit:v1",
|
|
386
386
|
name,salt,owner})` must exist at a strictly lower height within `COMMIT_MAX_BLOCKS` (8 epochs).
|
|
387
|
-
The reveal **back-dates** its effective height to the commit height
|
|
387
|
+
The reveal **back-dates** its effective height to the commit height, so a committer beats any
|
|
388
388
|
direct-claim squatter who acts in between (the reveal **displaces** them). This is the
|
|
389
389
|
front-run defense (ENS/Namecoin/Runes pattern adapted to a fee-ordered chain).
|
|
390
|
-
- **`ncommit`:** `{v:1,t:"ncommit",commit}
|
|
390
|
+
- **`ncommit`:** `{v:1,t:"ncommit",commit}`: the commit hash (binds name+salt+owner, so it can't
|
|
391
391
|
be reused by another address). Cheap; the reg fee is paid at reveal.
|
|
392
|
-
- **`nxfer`:** `{v:1,t:"nxfer",name,to}
|
|
392
|
+
- **`nxfer`:** `{v:1,t:"nxfer",name,to}`: owner gifts the name. Clears the resolver record. Fails
|
|
393
393
|
while the name is locked by an open offer.
|
|
394
|
-
- **`nset`:** `{v:1,t:"nset",name,addr}
|
|
394
|
+
- **`nset`:** `{v:1,t:"nset",name,addr}`: owner points the name at an address (the resolver
|
|
395
395
|
record). Reverse resolution (address → names owned) is computed by the resolver.
|
|
396
396
|
- **Selling a name:** an `offer` with `give:{name}` (instead of `{ticker,amount}`). Anchoring it
|
|
397
397
|
**locks** the name (can't transfer/re-offer); a `fill` transfers ownership to the buyer and pays
|
|
398
398
|
the seller (+ protocol fee), atomically, in one tx; cancel/expiry release the lock.
|
|
399
399
|
- **Honest limits (v1.1, superseded):** names were **perpetual** through v1.4 (the registration fee
|
|
400
|
-
was the only anti-squat measure). **Since v1.5 @ height 32 000 every name is a lease
|
|
400
|
+
was the only anti-squat measure). **Since v1.5 @ height 32 000 every name is a lease**: renewal,
|
|
401
401
|
grace period, and decaying-premium recapture are normative in **§17**. Displacement can unwind a transfer made by a wrongful holder within the commit window
|
|
402
402
|
(rare; deterministic).
|
|
403
403
|
|
|
404
404
|
## 10. Protocol fees → the CairnX treasury
|
|
405
405
|
|
|
406
|
-
The chain can't enforce a fee in consensus, so
|
|
406
|
+
The chain can't enforce a fee in consensus, so, like everything here, fees are **convention-
|
|
407
407
|
enforced via same-tx outputs** (consensus F4: Propose/Attest outputs are unrestricted). A fee-
|
|
408
408
|
bearing action is a **no-op unless its own transaction pays the fee to the treasury address**
|
|
409
409
|
`0x6b09ce74e6070ebc982ab0fb793a211c4d24f016`. Fees accrue as ordinary UTXOs the operator controls.
|
|
@@ -417,16 +417,16 @@ bearing action is a **no-op unless its own transaction pays the fee to the treas
|
|
|
417
417
|
Mint, transfer, name-xfer, name-set, offer, commit and cancel pay only the chain's own anchor fee
|
|
418
418
|
(to miners), not a protocol fee. An offer's `want.payto` may not be the treasury (keeps the
|
|
419
419
|
payment and fee output buckets distinct). The resolver tracks `feesPaid` (total observed to the
|
|
420
|
-
treasury)
|
|
420
|
+
treasury), recomputable by anyone, like all CairnX state.
|
|
421
421
|
|
|
422
422
|
---
|
|
423
423
|
|
|
424
424
|
# CairnX Convention v1.2 (token⇄token swaps + partial fills + bids)
|
|
425
425
|
|
|
426
|
-
**Activation height: 30 300** (non-retroactive
|
|
426
|
+
**Activation height: 30 300** (non-retroactive: records using v1.2 shapes anchored below it are
|
|
427
427
|
no-ops; all v1/v1.1 records behave exactly as before at every height).
|
|
428
428
|
|
|
429
|
-
## 11. Token-priced offers
|
|
429
|
+
## 11. Token-priced offers: token⇄token swaps
|
|
430
430
|
|
|
431
431
|
An offer's `want` may now be a **token amount** instead of a CSD value:
|
|
432
432
|
|
|
@@ -446,14 +446,14 @@ An offer's `want` may now be a **token amount** instead of a CSD value:
|
|
|
446
446
|
`amount + fee`; credit `payto` `amount`; credit the treasury `fee`; deliver `give` to the
|
|
447
447
|
attester; close the offer.
|
|
448
448
|
- **Why the `confidence = 1 000 000` marker:** attestation is this chain's native signaling
|
|
449
|
-
mechanism
|
|
449
|
+
mechanism: people attest proposals to score them. A plain `score=100` attest on a
|
|
450
450
|
token-priced offer must NOT silently spend the attester's tokens. The magic confidence value
|
|
451
451
|
(impossible in normal signaling, which uses 0–100) makes a token-debiting fill an explicit,
|
|
452
452
|
signed opt-in. CSD-priced fills don't need it: their payment outputs already prove intent.
|
|
453
453
|
- Insufficient balance / missing marker / taker mismatch → **no-op, offer stays open**.
|
|
454
454
|
- Token-priced offers are **whole-fill only** in v1.2 (an Attest carries no amount channel;
|
|
455
455
|
partial fills below use the CSD payment itself as the amount signal).
|
|
456
|
-
- The buyer's tokens are **not pre-locked
|
|
456
|
+
- The buyer's tokens are **not pre-locked**: only the maker locks inventory. A fill that races
|
|
457
457
|
the buyer's own same-block transfer resolves deterministically by apply order (proposals
|
|
458
458
|
before attests, §3).
|
|
459
459
|
|
|
@@ -466,60 +466,60 @@ A CSD-priced **token** offer may opt into partial fills with `min`:
|
|
|
466
466
|
"want":{"value":"50000000"},"min":"5000000"}
|
|
467
467
|
```
|
|
468
468
|
|
|
469
|
-
- `min` (amount-string, `1 ≤ min ≤ want.value`) = the smallest payment a fill may make
|
|
469
|
+
- `min` (amount-string, `1 ≤ min ≤ want.value`) = the smallest payment a fill may make:
|
|
470
470
|
the maker's anti-dust/anti-grief floor. Presence of `min` ⇒ the offer is partially fillable.
|
|
471
471
|
`min` is invalid on name offers and on token-priced offers.
|
|
472
472
|
- A partial fill is a normal fill (Attest `score=100` + same-tx payment of `X` to `payto` +
|
|
473
|
-
fee) where `min ≤ X`. Let `x = min(X, wantRemaining)` (overpayment is capped
|
|
473
|
+
fee) where `min ≤ X`. Let `x = min(X, wantRemaining)` (overpayment is capped: it buys no
|
|
474
474
|
more than what remains). Exception: when `wantRemaining < min`, `X ≥ wantRemaining` is
|
|
475
475
|
allowed (the tail is always buyable).
|
|
476
476
|
- **Delivery (cumulative pro-rata, no rounding loss):**
|
|
477
|
-
`deliveredCum' = floor(give.amount × paidCum' / want.value)
|
|
477
|
+
`deliveredCum' = floor(give.amount × paidCum' / want.value)`: each fill delivers
|
|
478
478
|
`deliveredCum' − deliveredCum`. The final fill (`paidCum' = want.value`) therefore delivers
|
|
479
479
|
exactly the undelivered remainder; rounding dust never strands in the lock.
|
|
480
480
|
- `fee = ceil(1% × x)` to the treasury in the same tx, per fill.
|
|
481
481
|
- The offer stays `open` until `paidCum = want.value` → `filled`. Cancel/expiry release the
|
|
482
482
|
undelivered remainder to the seller; completed partial fills stand.
|
|
483
483
|
- Each fill is appended to the offer's `fills[]` (buyer, txid, height, paid, got, fee).
|
|
484
|
-
- Open partially-fillable offers race like v1 open offers (fee auction, §6)
|
|
484
|
+
- Open partially-fillable offers race like v1 open offers (fee auction, §6), but losing a
|
|
485
485
|
race now only costs the loser the *overlap*: their payment still buys whatever remained.
|
|
486
486
|
Wallets must still warn on open-offer fills.
|
|
487
487
|
|
|
488
|
-
## 12b. `ocancel
|
|
488
|
+
## 12b. `ocancel`: mass-cancel (maker's kill switch)
|
|
489
489
|
|
|
490
490
|
```json
|
|
491
491
|
{"v":1,"t":"ocancel","ticker":"DUST"}
|
|
492
492
|
```
|
|
493
493
|
|
|
494
494
|
Cancels **all of the proposer's open offers anchored strictly earlier in apply order**, releasing
|
|
495
|
-
their locks
|
|
495
|
+
their locks, optionally filtered to one `give` asset (`ticker` or `name`, at most one). Without
|
|
496
496
|
cheap mass-cancel a market maker cannot keep a ladder of quotes honest (per-offer cancel = one tx
|
|
497
|
-
each
|
|
497
|
+
each: the 0x `minValidSalt` lesson). Anchor an `ocancel`, then re-post the fresh ladder, even in
|
|
498
498
|
the same block (proposals apply in tx order, so a later-pos ladder survives an earlier-pos cancel).
|
|
499
499
|
|
|
500
|
-
**Self-fills** (attester == seller) are **valid** and pay the protocol fee like any fill
|
|
500
|
+
**Self-fills** (attester == seller) are **valid** and pay the protocol fee like any fill: wash
|
|
501
501
|
trading is self-punishing, and a no-op rule would just complicate determinism. **Fill races on
|
|
502
|
-
open offers** (§6) keep their v1 semantics; note that partial fills soften the loss
|
|
502
|
+
open offers** (§6) keep their v1 semantics; note that partial fills soften the loss: a racing
|
|
503
503
|
fill is clamped to whatever remainder exists, so its payment is only fully wasted when the
|
|
504
504
|
remainder is zero. Takers who need atomic certainty use whole-fill offers and taker-binding.
|
|
505
505
|
|
|
506
|
-
## 13. Bids
|
|
506
|
+
## 13. Bids: non-binding buy-side intents
|
|
507
507
|
|
|
508
|
-
CSD cannot be locked by convention (§6), so a *binding* buy order is impossible
|
|
508
|
+
CSD cannot be locked by convention (§6), so a *binding* buy order is impossible: the buy side
|
|
509
509
|
of the book is instead built from **bids**, on-chain discovery records:
|
|
510
510
|
|
|
511
511
|
```json
|
|
512
512
|
{"v":1,"t":"bid","want":{"ticker":"DUST","amount":"1000"},"give":{"value":"40000000"},"memo":"…"}
|
|
513
513
|
```
|
|
514
514
|
|
|
515
|
-
- "I will pay `give.value` CSD (>0) for `want`"
|
|
515
|
+
- "I will pay `give.value` CSD (>0) for `want`": `want` is a token amount or `{name}`.
|
|
516
516
|
The **bidder** = proposer. `expires_epoch` = the bid's validity window. Cancel = Attest
|
|
517
517
|
`score=0` by the bidder. **Non-binding**: nothing is locked; honoring it is reputational.
|
|
518
518
|
- `memo` (64 UTF-16 units max) and `ts` are optional free fields, same rules as 4.3; `ts` MUST
|
|
519
519
|
be a JS-safe integer (A8).
|
|
520
520
|
- **Fulfillment** is the two-step RFQ: the asset owner anchors a **taker-bound offer**
|
|
521
521
|
(`taker = bidder`, price ≤ bid) optionally tagged `"bid":"<bidId>"`; the bidder's client
|
|
522
|
-
detects the responding offer and fills it atomically. Two anchors + one fill
|
|
522
|
+
detects the responding offer and fills it atomically. Two anchors + one fill: the
|
|
523
523
|
scriptless ceiling for buy-side flow.
|
|
524
524
|
- The resolver tracks `bids` (open/cancelled/expired) and links responding offers
|
|
525
525
|
(`offer.bid` → `bid.offers[]`). A bid whose linked offer is **filled by the bidder** is
|
|
@@ -543,7 +543,7 @@ continues to count only CSD fees. The treasury spends its token balances like an
|
|
|
543
543
|
|
|
544
544
|
# CairnX Convention v1.3 (mandatory taker-binding for CSD-priced offers)
|
|
545
545
|
|
|
546
|
-
**Activation height: 31 100** (non-retroactive
|
|
546
|
+
**Activation height: 31 100** (non-retroactive: all records and fills below it behave exactly
|
|
547
547
|
as before at every height).
|
|
548
548
|
|
|
549
549
|
## 15. CSD-priced offers must be taker-bound
|
|
@@ -551,11 +551,11 @@ as before at every height).
|
|
|
551
551
|
The open (non-taker-bound) CSD-quoted fill was the **one structurally unsafe shape** in the
|
|
552
552
|
convention: a fill pays `want.value` as a real, irreversible CSD output to the seller in the
|
|
553
553
|
same tx that attests. If two buyers fill the same offer in one block, the apply-order winner
|
|
554
|
-
gets the asset and the **loser's full payment is already confirmed to the seller
|
|
554
|
+
gets the asset and the **loser's full payment is already confirmed to the seller**: the seller
|
|
555
555
|
is paid twice and delivers once. The substrate has no escrow (§6), so no claim window, partial
|
|
556
556
|
fill, or warning can refund the loser. The only safe shapes are the two that already exist:
|
|
557
|
-
**taker-bound (RFQ) fills**
|
|
558
|
-
losing payment
|
|
557
|
+
**taker-bound (RFQ) fills** (the resolver rejects non-takers, so a wallet never builds the
|
|
558
|
+
losing payment) and **token⇄token fills**, where both legs are convention-ledger debits and a
|
|
559
559
|
lost race is a guaranteed no-op.
|
|
560
560
|
|
|
561
561
|
From height **31 100**:
|
|
@@ -563,38 +563,38 @@ From height **31 100**:
|
|
|
563
563
|
- **`offer` anchor rule:** a CSD-priced offer (`want.value`, token *or* name give) without a
|
|
564
564
|
`taker` field is a **no-op** (`v1.3: CSD-priced offers must be taker-bound`). Token-priced
|
|
565
565
|
(token⇄token) offers are unaffected and remain open to any filler.
|
|
566
|
-
- **`fill` rule:** a `SCORE_FILL` attest on **any** CSD-priced offer with no `taker
|
|
567
|
-
offers anchored before activation
|
|
566
|
+
- **`fill` rule:** a `SCORE_FILL` attest on **any** CSD-priced offer with no `taker`, including
|
|
567
|
+
offers anchored before activation, is a no-op. Pre-v1.3 open CSD offers therefore become
|
|
568
568
|
unfillable at activation (sellers cancel/`ocancel` or let them expire; locked give releases as
|
|
569
569
|
usual). This is deliberately strict: the loser-pays race is only dead if no open CSD fill can
|
|
570
570
|
ever succeed.
|
|
571
571
|
- **Buy-side flow for CSD pricing** is the v1.2 RFQ loop (§13): bid → seller answers with a
|
|
572
572
|
taker-bound offer (partial-fillable allowed; `min` works as in §12) → bidder fills race-free.
|
|
573
573
|
One extra anchor versus v1, in exchange for "a buyer can never lose more than the anchor fee."
|
|
574
|
-
- **Name sales are displacement-proof
|
|
574
|
+
- **Name sales are displacement-proof, two rules acting together:**
|
|
575
575
|
1. **Age gate (offer anchor):** a name `offer` (CSD- *or* token-priced) is a no-op unless the
|
|
576
576
|
name's basis is a fill (`viaFill`, below) or its effective claim is **strictly older than
|
|
577
577
|
`COMMIT_MAX_BLOCKS`**. Every dangerous commit (one back-dating below the current claim) has
|
|
578
578
|
a reveal deadline of `commitHeight + COMMIT_MAX_BLOCKS < claimEffHeight + COMMIT_MAX_BLOCKS`,
|
|
579
|
-
so by the earliest legal offer
|
|
579
|
+
so by the earliest legal offer, and therefore any fill, every lurking back-dated reveal
|
|
580
580
|
has either fired (displacing the *claimant*, which IS the §9 front-run defense, loss
|
|
581
581
|
bounded to the registration fee) or expired.
|
|
582
582
|
2. **Fill immunity:** a name `fill` (CSD- or token-priced) marks the record **`viaFill`** and
|
|
583
583
|
re-stamps `claimId/height/effectiveHeight/pos` to the fill itself. Displacement arbitrates
|
|
584
|
-
**claim-vs-claim only
|
|
584
|
+
**claim-vs-claim only**: a `viaFill` record can never be displaced by any reveal. (Without
|
|
585
585
|
the age gate, immunity alone would let a front-run squatter launder a name through a quick
|
|
586
586
|
flip; the gate makes that impossible, so the two rules are sound only together.)
|
|
587
587
|
|
|
588
588
|
Net effect: an innocent buyer of a completed sale can never lose the name to a back-dated
|
|
589
589
|
commit-reveal, and the §9 claim-time front-run defense is fully preserved. Residuals
|
|
590
|
-
(documented): a **claim-based** record younger than the commit window is still displaceable
|
|
590
|
+
(documented): a **claim-based** record younger than the commit window is still displaceable;
|
|
591
591
|
that is the defense working as designed; `nxfer` (a gift, no payment) does **not** re-stamp or
|
|
592
|
-
immunize
|
|
592
|
+
immunize: the recipient inherits the giver's basis; and `viaFill` records re-sell with no
|
|
593
593
|
aging delay (their basis cannot be back-dated under). Offers anchored *before* v1.3 that fill
|
|
594
594
|
after it are not age-gated (one-time activation edge; all current open offers are
|
|
595
595
|
operator-controlled).
|
|
596
596
|
|
|
597
|
-
## 16. Fill-before-cancel
|
|
597
|
+
## 16. Fill-before-cancel: cancels defer to the block boundary
|
|
598
598
|
|
|
599
599
|
§15 killed the buyer-vs-buyer race, but the same apply-order semantics left one **malicious-
|
|
600
600
|
seller** variant: the **cancel snipe**. Within a block the resolver applies **all proposals
|
|
@@ -602,7 +602,7 @@ seller** variant: the **cancel snipe**. Within a block the resolver applies **al
|
|
|
602
602
|
(always applies first); a plain `cancel` is an attest whose pos the seller can lower by paying
|
|
603
603
|
a higher fee (miners order feerate-DESC). So a seller who sees a buyer's fill in the mempool
|
|
604
604
|
could broadcast a cheap `ocancel` (or a higher-fee `cancel`) in the same block: the cancel
|
|
605
|
-
applied first, the offer was no longer `open`, the fill no-op'd
|
|
605
|
+
applied first, the offer was no longer `open`, the fill no-op'd, **but the fill tx's payment
|
|
606
606
|
is a real confirmed output to the seller.** Seller paid, delivers nothing, cost ≈ one anchor
|
|
607
607
|
fee. That breaks §15's guarantee ("a buyer can never lose more than the anchor fee") the moment
|
|
608
608
|
a non-operator seller answers an RFQ.
|
|
@@ -610,18 +610,18 @@ a non-operator seller answers an RFQ.
|
|
|
610
610
|
From height **31 400**:
|
|
611
611
|
|
|
612
612
|
- **Rule:** a `cancel` or `ocancel`'s **effect** (releasing the give, flipping the offer to
|
|
613
|
-
`cancelled`) is **deferred to the end of its block
|
|
613
|
+
`cancelled`) is **deferred to the end of its block**: it applies only to offers still `open`
|
|
614
614
|
after every same-block fill has settled. A same-block fill therefore **always wins**: a fill
|
|
615
615
|
that lands means the seller got paid in that very tx, so it is a completed, fair sale; the
|
|
616
616
|
late cancel then no-ops on the now-filled offer (noted
|
|
617
|
-
`superseded by same-block fill (v1.4)`). An honest cancel
|
|
617
|
+
`superseded by same-block fill (v1.4)`). An honest cancel (no competing same-block fill)
|
|
618
618
|
lands exactly as before, one block-boundary later in effect but in the same block.
|
|
619
619
|
- **Guards still fire at apply time:** only-the-seller and offer-must-be-open are checked when
|
|
620
620
|
the cancel is applied in order (a cancel on an already-filled/cancelled offer fails
|
|
621
621
|
immediately, as pre-v1.4). Only the *effect* of a passing cancel is deferred.
|
|
622
622
|
- **`ocancel` snapshot:** the target set (the proposer's open offers matching the filter) is
|
|
623
|
-
computed at apply time
|
|
624
|
-
same-block offers are not yet applied
|
|
623
|
+
computed at apply time (correctly capturing only strictly-earlier offers, since higher-pos
|
|
624
|
+
same-block offers are not yet applied) and at the flush only the targets **still open** are
|
|
625
625
|
cancelled (partial fills in between deliver first; the flush releases the remainder).
|
|
626
626
|
- **Partial fills:** a same-block partial fill on a being-cancelled offer delivers its pro-rata
|
|
627
627
|
amount; the deferred cancel then releases only the unsold remainder. The buyer keeps what
|
|
@@ -631,8 +631,8 @@ From height **31 400**:
|
|
|
631
631
|
after the flush.
|
|
632
632
|
- **Why deferral, not reordering:** moving cancels after fills in the sort would break the
|
|
633
633
|
global ordered loop and the "offers settle before fills" invariant for every other record
|
|
634
|
-
type. Deferring only the effect keeps apply order intact. The one non-physical edge
|
|
635
|
-
same-key `ocancel`-then-relist in one block observing pre-flush lock state
|
|
634
|
+
type. Deferring only the effect keeps apply order intact. The one non-physical edge (a
|
|
635
|
+
same-key `ocancel`-then-relist in one block observing pre-flush lock state) **cannot occur
|
|
636
636
|
on-chain**: anchor inputs must be confirmed (no CPFP), so one key cannot chain two anchors
|
|
637
637
|
into a single block.
|
|
638
638
|
- **Determinism:** the deferred-cancel list is built and flushed in apply order, so the state
|
|
@@ -640,41 +640,41 @@ From height **31 400**:
|
|
|
640
640
|
blocks never defer, so all historical replay is byte-identical.
|
|
641
641
|
|
|
642
642
|
With §15 + §16 together the invariant holds against **both** failure modes: a buyer can never
|
|
643
|
-
lose more than the anchor fee
|
|
643
|
+
lose more than the anchor fee: not to another buyer (race), and not to the seller (snipe).
|
|
644
644
|
|
|
645
|
-
## 17. Name leasing
|
|
645
|
+
## 17. Name leasing: names are paid-through, renewable, recapturable (v1.5)
|
|
646
646
|
|
|
647
647
|
§9's perpetual names were the registry's known economic gap: a 10+-char name costs 0.1 CSD
|
|
648
|
-
**once, forever
|
|
648
|
+
**once, forever**: squatting is free to carry, and lapsed projects strand names permanently.
|
|
649
649
|
From height **32 000** every name is a **lease**:
|
|
650
650
|
|
|
651
651
|
- **Term:** a claim (or premium re-claim) is paid through `claimEpoch + 8 760` epochs (≈ 1 year).
|
|
652
652
|
Names claimed before v1.5 are **grandfathered** one full term from activation
|
|
653
|
-
(`epochOf(32 000) + 8 760`)
|
|
653
|
+
(`epochOf(32 000) + 8 760`), computed lazily, no state rewrite at the boundary.
|
|
654
654
|
- **`nrenew` `{v:1,t:"nrenew",name}`:** extends the lease one term from its CURRENT end. Valid
|
|
655
655
|
from **anyone** while the lease is live (third-party gifting, ENS-style) iff the same tx pays
|
|
656
656
|
`nameRegFee(name)` to the treasury. A renewal never changes ownership.
|
|
657
|
-
- **Grace (720 epochs ≈ 30 days):** past `paidThroughEpoch`, only the **owner** may renew
|
|
657
|
+
- **Grace (720 epochs ≈ 30 days):** past `paidThroughEpoch`, only the **owner** may renew;
|
|
658
658
|
otherwise a squatter could extend a lapsing name they intend to take.
|
|
659
659
|
- **Lapse → decaying-premium recapture:** past grace the name is unowned again. Anyone may claim
|
|
660
660
|
it by paying `expiredClaimFee(name, epochsPastGraceEnd)`: `nameRegFee × 20` linearly decaying
|
|
661
|
-
to `× 1` over 720 epochs (pure integer function
|
|
661
|
+
to `× 1` over 720 epochs (pure integer function: deterministic everywhere). The re-claim is a
|
|
662
662
|
**fresh basis**: prior `viaFill` immunity is void (immunity protects a *paid* basis; an unpaid
|
|
663
663
|
lease is an abandoned one), and any still-open offer on the name is voided with its lock freed.
|
|
664
664
|
- **Guards:** `nxfer`/`nset` on a lapsed lease are no-ops. A name **offer** is a no-op unless the
|
|
665
|
-
lease covers the offer's ENTIRE fill window (`paidThroughEpoch ≥ expiresEpoch`)
|
|
665
|
+
lease covers the offer's ENTIRE fill window (`paidThroughEpoch ≥ expiresEpoch`), so a fill can
|
|
666
666
|
never hit a mid-window lapse; the alternative (a no-op'd CSD fill whose payment already
|
|
667
667
|
confirmed to the seller) would be a fund-loss shape, so it is made unrepresentable. Offers
|
|
668
668
|
anchored before v1.5 are exempt (their windows all end long before any grandfathered lease).
|
|
669
669
|
- **State:** at v1.5+ tips `names[x]` carries `paidThroughEpoch` (and `expired: true` once
|
|
670
670
|
lapsed; the record is kept for history until re-claimed). Pre-v1.5 canonical hashes are
|
|
671
|
-
unchanged
|
|
671
|
+
unchanged: the fields exist only at v1.5+ tips.
|
|
672
672
|
|
|
673
|
-
## 18. `tmeta
|
|
673
|
+
## 18. `tmeta`: issuer token metadata via the content layer (v1.5)
|
|
674
674
|
|
|
675
|
-
`{v:1,t:"tmeta",ticker,hash}
|
|
675
|
+
`{v:1,t:"tmeta",ticker,hash}`: **issuer-only**, last write wins, no fee beyond the anchor.
|
|
676
676
|
`hash` is a csd-swarm Content Convention v1 hash (0x + 64 hex) pointing at the token's
|
|
677
|
-
`{logo, description, links}` document
|
|
677
|
+
`{logo, description, links}` document: self-certifying content, so the record stays tiny
|
|
678
678
|
(the 512-byte `uri` cap is untouched) and the metadata inherits the swarm's verify-on-read
|
|
679
679
|
property. State: `tokens[t].tmeta`. Records before v1.5 are no-ops.
|
|
680
680
|
|
|
@@ -682,14 +682,14 @@ property. State: `tokens[t].tmeta`. Records before v1.5 are no-ops.
|
|
|
682
682
|
|
|
683
683
|
# CairnX Convention v1.6 (fee update + maker rebate)
|
|
684
684
|
|
|
685
|
-
**Activation height: 33 600** (`V16_HEIGHT`; non-retroactive
|
|
685
|
+
**Activation height: 33 600** (`V16_HEIGHT`; non-retroactive: pre-v1.6 offers keep the 1% fee and earn no rebate).
|
|
686
686
|
|
|
687
687
|
## 19. Taker fee 1% → 1.5%, and a maker rebate on resting liquidity
|
|
688
688
|
|
|
689
689
|
- **Fee bump.** The taker fee becomes `FEE_BPS_V16 = 150` (1.5%, `ceil`) instead of `FEE_BPS = 100` (1%).
|
|
690
690
|
The rate is **captured per-offer at creation height** into `offers[id].feeBps` (a bare-int canonical field,
|
|
691
691
|
§5.1-A3): an offer anchored ≥ 33 600 carries `feeBps = 150`, an earlier one keeps `100`. Every fill of that
|
|
692
|
-
offer (whole, partial, token-priced) uses the offer's own `feeBps
|
|
692
|
+
offer (whole, partial, token-priced) uses the offer's own `feeBps`, so pre-v1.6 offers are byte-identical
|
|
693
693
|
forever. A third-party resolver MUST select the fee by **offer-creation height**, not by fill height.
|
|
694
694
|
- **Maker rebate (whole CSD-priced fills only).** On a whole fill of a **resting-liquidity** CSD-priced offer,
|
|
695
695
|
the taker additionally pays the **maker** (`offers[id].seller`) a rebate, as an extra output **in the same
|
|
@@ -697,55 +697,55 @@ property. State: `tokens[t].tmeta`. Records before v1.5 are no-ops.
|
|
|
697
697
|
`makerRebate(want) = REBATE_FLAT + ceil(REBATE_BPS × want / 10000)` with `REBATE_FLAT = 25 000 000`
|
|
698
698
|
(0.25 CSD) and `REBATE_BPS = 50` (0.5%).
|
|
699
699
|
- **`restingLiquidity` predicate (normative):** an offer qualifies iff
|
|
700
|
-
`(offer.taker !== undefined && offer.bid !== undefined)
|
|
701
|
-
**OR** `(offer.height ≥ V17_HEIGHT && offer.taker === undefined)
|
|
700
|
+
`(offer.taker !== undefined && offer.bid !== undefined)`, a taker-bound answer to a bid (the RFQ/MM lane),
|
|
701
|
+
**OR** `(offer.height ≥ V17_HEIGHT && offer.taker === undefined)`, a v1.7 open ask (claim-to-fill).
|
|
702
702
|
Partial fills and token⇄token fills earn **no** rebate. (Keying on `bid` alone was a closed self-mint hole:
|
|
703
703
|
a maker could self-attach an unanchored bid to an open offer; the open-ask lane now earns it via `taker
|
|
704
704
|
=== undefined && height ≥ V17` regardless of `bid`, and a bid-answer rebate requires a real consenting taker.)
|
|
705
705
|
- **Same-tx output gate (the SUM rule).** The fill's required outputs are accumulated **per recipient**:
|
|
706
706
|
`want.payto += want.value`, `TREASURY += tradeFee(want, feeBps)`, and (if rebate applies) `seller += rebate`.
|
|
707
|
-
When `want.payto == seller` (the common default) the two amounts **SUM
|
|
707
|
+
When `want.payto == seller` (the common default) the two amounts **SUM**: a resolver MUST check each
|
|
708
708
|
recipient against the summed requirement, never satisfy by `max()`. (`payto` can never be the treasury, so
|
|
709
709
|
those buckets never collide.) For a pre-v1.6 offer the rebate is 0 and this reduces to the two original checks.
|
|
710
710
|
|
|
711
711
|
---
|
|
712
712
|
|
|
713
|
-
# CairnX Convention v1.7 (claim-to-fill
|
|
713
|
+
# CairnX Convention v1.7 (claim-to-fill: race-safe open CSD offers)
|
|
714
714
|
|
|
715
|
-
**Activation height: 34 000** (`V17_HEIGHT`; non-retroactive
|
|
715
|
+
**Activation height: 34 000** (`V17_HEIGHT`; non-retroactive: in `[V13, V17)` open CSD fills stay banned, §15).
|
|
716
716
|
|
|
717
|
-
## 20. Claim-to-fill
|
|
717
|
+
## 20. Claim-to-fill: an untaken CSD offer is reserved before it is paid
|
|
718
718
|
|
|
719
719
|
v1.3 (§15) removed open CSD offers because the loser of a payment-bearing fill race loses a real payment.
|
|
720
720
|
v1.7 re-opens them safely by moving the race to a **payment-free reservation**: a losing claimer forfeits only
|
|
721
721
|
the 0.05 CSD attest fee, never a payment.
|
|
722
722
|
|
|
723
723
|
- **Claim** = an `Attest` on the offer with **`score = SCORE_CLAIM = 50`** (∉ {fill 100, cancel 0}, so it is an
|
|
724
|
-
inert no-op below V17
|
|
724
|
+
inert no-op below V17, non-retroactive). It grants the attester an **exclusive hold** of the offer for
|
|
725
725
|
`CLAIM_WINDOW_BLOCKS = 15` blocks: on grant the resolver records `offers[id].claimedBy = attester` and
|
|
726
726
|
`offers[id].claimUntilHeight = grantHeight + 15` (both canonical fields, §5.1-A3, present only while claimed).
|
|
727
727
|
- **Fill gate.** A `SCORE_FILL` fill on an **untaken** (`taker === undefined`) CSD-priced offer at height ≥ V17
|
|
728
728
|
is valid **only if** the offer is currently held **and the filler is the holder**: `claimHeld(o, h) &&
|
|
729
729
|
attester === o.claimedBy`, where `claimHeld(o, h) = (o.claimedBy !== undefined) && (h < o.claimUntilHeight)`
|
|
730
|
-
(v2.0 widens this
|
|
730
|
+
(v2.0 widens this: §23). A fill by anyone else, or with no live claim, is a no-op (offer stays open).
|
|
731
731
|
- **No new claim while held.** A `claim` on an offer that is already held (`claimHeld`) is a no-op.
|
|
732
732
|
- **`MAX_ACTIVE_CLAIMS = 3` per address.** A claim is rejected if the attester already holds 3 offers
|
|
733
733
|
(`liveN = count of offers x where x.claimedBy === attester && claimHeld(x, h)`). Anti-squat.
|
|
734
734
|
- **`CLAIM_COOLDOWN_BLOCKS = 15`.** The address whose hold just lapsed (`o.claimedBy === attester`) may not
|
|
735
735
|
immediately re-grab the **same** offer until `h ≥ o.claimUntilHeight + CLAIM_COOLDOWN_BLOCKS` (in v2.0, the
|
|
736
736
|
cooldown runs from the end of the hold = window + grace). Known bound (identical in the Python reference, so
|
|
737
|
-
not a fork): the cooldown keys on the last claimer, so a colluding A→B→A pair can recycle one offer
|
|
737
|
+
not a fork): the cooldown keys on the last claimer, so a colluding A→B→A pair can recycle one offer: a
|
|
738
738
|
payment-free liveness nuisance on a single offer, never value loss.
|
|
739
739
|
- **Reorg note (client, not consensus):** claim→fill is two txs, so the payment has a reorg exposure a single-tx
|
|
740
740
|
fill lacks. Buyer software MUST wait a value-scaled confirmation depth (gambler's-ruin sized) on the claim
|
|
741
|
-
before broadcasting the fill
|
|
741
|
+
before broadcasting the fill; this is a client policy, not a resolver rule, and does not affect canonical state.
|
|
742
742
|
- Taker-bound offers need no claim (they were never in the race). Token⇄token offers are no-op-safe and ignore claims.
|
|
743
743
|
|
|
744
744
|
---
|
|
745
745
|
|
|
746
746
|
# CairnX Convention v1.8 (two-tier name registration fee)
|
|
747
747
|
|
|
748
|
-
**Activation height: 40 000** (`V18_HEIGHT`; non-retroactive
|
|
748
|
+
**Activation height: 40 000** (`V18_HEIGHT`; non-retroactive: below it the §10 ENS curve applies unchanged).
|
|
749
749
|
|
|
750
750
|
## 21. Flat two-tier name fee
|
|
751
751
|
|
|
@@ -755,44 +755,44 @@ lapsed-premium) becomes a flat **two-tier** schedule, replacing the §10 length
|
|
|
755
755
|
- name length **≤ 4** chars → `NAME_FEE_SHORT_V18 = 670 000 000` (6.7 CSD);
|
|
756
756
|
- name length **≥ 5** chars → `NAME_FEE_V18 = 300 000 000` (3 CSD).
|
|
757
757
|
|
|
758
|
-
Below 40 000 the original 5-tier curve (§10: ≤3→5, 4→2, 5→1, 6–9→0.5, 10+→0.1 CSD) still applies
|
|
758
|
+
Below 40 000 the original 5-tier curve (§10: ≤3→5, 4→2, 5→1, 6–9→0.5, 10+→0.1 CSD) still applies: the fee is
|
|
759
759
|
selected by **anchor height**, so all historical replay is byte-identical. (Client builders should price a fee
|
|
760
760
|
output built within a few blocks *below* V18 at the V18 rate, since overpay is always accepted but underpay is a
|
|
761
761
|
no-op that forfeits the treasury output.)
|
|
762
762
|
|
|
763
763
|
---
|
|
764
764
|
|
|
765
|
-
# CairnX Convention v1.9 (nprofile
|
|
765
|
+
# CairnX Convention v1.9 (nprofile: ENS-class identity)
|
|
766
766
|
|
|
767
|
-
**Activation height: 36 700** (`V19_HEIGHT`; non-retroactive
|
|
767
|
+
**Activation height: 36 700** (`V19_HEIGHT`; non-retroactive: `nprofile` below it is a forward-compat no-op).
|
|
768
768
|
|
|
769
|
-
## 22. `nprofile
|
|
769
|
+
## 22. `nprofile`: owner-set identity metadata on a name
|
|
770
770
|
|
|
771
771
|
```json
|
|
772
772
|
{"v":1,"t":"nprofile","name":"alice","p":{"url":"https://alice.example","eth.address":"0x…"}}
|
|
773
773
|
```
|
|
774
774
|
|
|
775
775
|
- **Inert metadata.** `p` is a flat string→string map. It carries **no fee, no value, and is never a send
|
|
776
|
-
target
|
|
776
|
+
target**: the address a name resolves to for payment stays in `nset` (`names[x].addr`). A resolver keeps
|
|
777
777
|
no reserved keys; the app layer keeps send targets out of `p`.
|
|
778
778
|
- **Owner-gated, last-write-wins.** Valid iff the proposer is the current name owner and the lease is not
|
|
779
779
|
lapsed (§17). The new `p` **replaces** the prior profile; an **empty `p` (`{}`) clears it**.
|
|
780
|
-
- **Cleared on every ownership change
|
|
780
|
+
- **Cleared on every ownership change**: `nxfer`, a name `fill`, and a lapsed-premium re-claim all clear
|
|
781
781
|
`profile` exactly as they clear `addr`.
|
|
782
782
|
- **Shape limits (deterministic):** keys match `PKEY = ^[a-z0-9](?:[a-z0-9.-]{0,30}[a-z0-9])?$` (ASCII only,
|
|
783
|
-
so the canonical key sort is invariant across UTF-16/codepoint/byte impls
|
|
783
|
+
so the canonical key sort is invariant across UTF-16/codepoint/byte impls, future-proof vs a third-language
|
|
784
784
|
resolver); at most `PROFILE_MAX_KEYS = 16` keys; each value is a string of ≤ `PROFILE_MAX_VALUE_BYTES = 256`
|
|
785
785
|
**UTF-8 bytes**. Any violation → the record is a no-op.
|
|
786
|
-
- **State:** `names[x].profile` is a nested object, materialized **only at v1.9+ tips** and **only when set
|
|
786
|
+
- **State:** `names[x].profile` is a nested object, materialized **only at v1.9+ tips** and **only when set**,
|
|
787
787
|
so every pre-v1.9 canonical hash is byte-unchanged, and a name with no profile omits the key (§5.1-A4).
|
|
788
788
|
|
|
789
789
|
---
|
|
790
790
|
|
|
791
|
-
# CairnX Convention v2.0 (claim grace
|
|
791
|
+
# CairnX Convention v2.0 (claim grace: the bounded late-fill fix)
|
|
792
792
|
|
|
793
|
-
**Activation height: 38 400** (`V20_HEIGHT`; non-retroactive
|
|
793
|
+
**Activation height: 38 400** (`V20_HEIGHT`; non-retroactive: below it the strict 15-block window of §20 stands).
|
|
794
794
|
|
|
795
|
-
## 23. Bounded claim grace
|
|
795
|
+
## 23. Bounded claim grace: a slightly-late in-window fill still delivers
|
|
796
796
|
|
|
797
797
|
v1.7's claim-to-fill had a fund-loss edge: a fill submitted inside the window but **mining at the window
|
|
798
798
|
boundary** (`height == claimUntilHeight`) was rejected by the resolver while its CSD payment was already
|
|
@@ -800,14 +800,14 @@ UTXO-final → the buyer paid and received nothing (the live `69.csd` incident).
|
|
|
800
800
|
|
|
801
801
|
- At/above V20 the claim window widens to `CLAIM_WINDOW_BLOCKS_V20 = 40`, and a **bounded fill grace** of
|
|
802
802
|
`CLAIM_FILL_GRACE_BLOCKS = 5` is added. The **hold = window + grace = 45 blocks** is exclusive on **both**
|
|
803
|
-
sides
|
|
803
|
+
sides: within it the claimer's fill is honored **AND** no other address may claim. So a slightly-late
|
|
804
804
|
in-window fill still delivers, and there is **no displacement race** (the holder is exclusive for the whole
|
|
805
|
-
hold; below the grace a new claim is rejected). Past the hold the offer **reopens
|
|
805
|
+
hold; below the grace a new claim is rejected). Past the hold the offer **reopens**: the hold is **bounded,
|
|
806
806
|
not "until displaced."** `claimHeld(o, h)` becomes `h < o.claimUntilHeight + grace(o)`.
|
|
807
807
|
- **Era inference (no new stored field).** The grace is derived from the claim's era so its inverse is
|
|
808
808
|
unambiguous: a claim granted at ≥ V20 has `claimUntilHeight = grantHeight + 40 ≥ V20 + 40`; a pre-V20 claim
|
|
809
809
|
has `claimUntilHeight ≤ V20 + 14`; the range `[V20+15, V20+40)` is **unreachable**. Therefore
|
|
810
|
-
`grace(o) = (o.claimUntilHeight − 40 ≥ V20_HEIGHT) ? 5 : 0`. Below V20 the window is 15 and the grace is 0
|
|
810
|
+
`grace(o) = (o.claimUntilHeight − 40 ≥ V20_HEIGHT) ? 5 : 0`. Below V20 the window is 15 and the grace is 0:
|
|
811
811
|
byte-identical history.
|
|
812
812
|
- The `MAX_ACTIVE_CLAIMS` count and the `CLAIM_COOLDOWN_BLOCKS` both use the **hold** (window + grace), so the
|
|
813
813
|
grace can neither expand an address's concurrent reach past the cap nor be used to dodge the cooldown.
|
|
@@ -820,9 +820,9 @@ UTXO-final → the buyer paid and received nothing (the live `69.csd` incident).
|
|
|
820
820
|
|
|
821
821
|
# CairnX Convention v2.1 (offer/bid duration cap)
|
|
822
822
|
|
|
823
|
-
**Activation height: 40 100** (`V21_HEIGHT`; non-retroactive
|
|
823
|
+
**Activation height: 40 100** (`V21_HEIGHT`; non-retroactive: below it the effective expiry is the raw `expires_epoch`).
|
|
824
824
|
|
|
825
|
-
## 24. Maximum offer/bid lifetime
|
|
825
|
+
## 24. Maximum offer/bid lifetime: `MAX_OFFER_EPOCHS = 168` (≈ 7 days)
|
|
826
826
|
|
|
827
827
|
To keep resting inventory shallow (so an in-browser SPV light client's checkpoint stays near the tip rather
|
|
828
828
|
than being dragged back to the oldest open offer), an offer or bid may rest at most `MAX_OFFER_EPOCHS = 168`
|
|
@@ -835,7 +835,7 @@ epochs from its anchor:
|
|
|
835
835
|
over-cap offer/bid created **before** V21 (which was validly accepted at creation) auto-expires the moment a
|
|
836
836
|
sweep first runs at a height ≥ V21 past its capped expiry. The cap is gated by the **current sweep height**
|
|
837
837
|
(deterministic across replayers), so existing over-cap inventory expires at exactly the same height for
|
|
838
|
-
everyone. Below V21, `effExpiry = expires_epoch
|
|
838
|
+
everyone. Below V21, `effExpiry = expires_epoch`: byte-identical history.
|
|
839
839
|
- **Client expiry-height closed form** (mirrors the resolver's height-gated sweep, for buy-safety guards):
|
|
840
840
|
`offerExpiryHeight = min( (expires_epoch+1)·30 , max( V21_HEIGHT , (epochOf(anchor)+168+1)·30 ) )`.
|
|
841
841
|
|
|
@@ -889,7 +889,7 @@ The §24 lifetime cap proved to be an infrastructure symptom, not a market need,
|
|
|
889
889
|
# CairnX Convention v2.4 (length-graded registration fee increase)
|
|
890
890
|
|
|
891
891
|
**Activation height: 46 400** (`V24_HEIGHT`; non-retroactive; keyed on the FEE-BEARING event's height;
|
|
892
|
-
re-pinned 2026-07-03 from the originally published 49 200
|
|
892
|
+
re-pinned 2026-07-03 from the originally published 49 200; see the height re-pin history note at the top).
|
|
893
893
|
|
|
894
894
|
## 27. The fee curve
|
|
895
895
|
|
|
@@ -916,7 +916,7 @@ reveal below v2.5, the winner's `nfinalize` at/after v2.5 (§28), and every rene
|
|
|
916
916
|
# CairnX Convention v2.5 (sealed-reservation registration)
|
|
917
917
|
|
|
918
918
|
**Activation height: 46 440** (`V25_HEIGHT`; non-retroactive; keyed on the reveal event height;
|
|
919
|
-
re-pinned 2026-07-03 from the originally published 51 000
|
|
919
|
+
re-pinned 2026-07-03 from the originally published 51 000; see the height re-pin history note at the top).
|
|
920
920
|
|
|
921
921
|
Root fix for the reveal fee-burn: pre-v2.5, every losing racer in a §9 commit-reveal race paid the FULL
|
|
922
922
|
registration fee for nothing (payment-without-delivery). At/after v2.5 the reveal is payment-free; only
|
|
@@ -964,7 +964,7 @@ the settled winner ever pays.
|
|
|
964
964
|
# CairnX Convention v2.6 (sealed-reservation recapture)
|
|
965
965
|
|
|
966
966
|
**Activation height: 46 480** (`V26_HEIGHT`; non-retroactive; keyed on the reveal event height;
|
|
967
|
-
re-pinned 2026-07-03 from the originally published 51 200
|
|
967
|
+
re-pinned 2026-07-03 from the originally published 51 200; see the height re-pin history note at the top).
|
|
968
968
|
|
|
969
969
|
The §28 cure applied to LAPSED-name recapture (§17), whose losing racer previously forfeited the full
|
|
970
970
|
decaying premium (up to hundreds of CSD).
|
|
@@ -994,7 +994,7 @@ decaying premium (up to hundreds of CSD).
|
|
|
994
994
|
# CairnX Convention v2.7 (young-name sale embargo shrinks)
|
|
995
995
|
|
|
996
996
|
**Activation height: 46 520** (`V27_HEIGHT`; non-retroactive; keyed on the OFFER event height;
|
|
997
|
-
re-pinned 2026-07-03 from the originally published 52 500
|
|
997
|
+
re-pinned 2026-07-03 from the originally published 52 500; see the height re-pin history note at the top).
|
|
998
998
|
|
|
999
999
|
## 30. Sale embargo: 240 blocks becomes 8
|
|
1000
1000
|
|