@inversealtruism/cairnx-core 0.1.35 → 0.1.37
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/CONVENTION.md +153 -22
- package/MAKERS.md +5 -1
- package/README.md +17 -6
- package/dist/index.cjs +266 -30
- package/dist/index.d.cts +105 -10
- package/dist/index.d.ts +105 -10
- package/dist/index.js +245 -22
- package/package.json +2 -2
- package/test/vectors/cases.json +787 -1
package/CONVENTION.md
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
# CairnX Convention v1
|
|
2
2
|
|
|
3
|
-
**Status:** v2.
|
|
3
|
+
**Status:** v2.8 (normative; v2.8 pending activation at `V28_HEIGHT`, see §31; supersedes the 2026-06-10 v1.0 draft) · **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
|
-
v2.2 @ 41 300 (§25) · v2.4 @
|
|
9
|
-
v2.
|
|
10
|
-
Sections §19–§
|
|
11
|
-
Activation order is by HEIGHT, not by version number (v1.8 activated after v2.0; v2.3 activates after v2.
|
|
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 @ `V28_HEIGHT` (§31, PENDING activation).
|
|
10
|
+
Sections §19–§31 are the normative semantics for v1.6–v2.8; §5.1 is the byte-level canonical-JSON contract that binds all of them.
|
|
11
|
+
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
12
|
replayer gates each rule on its own height constant, never on "version X implies version Y is active".
|
|
13
13
|
|
|
14
|
+
> **Height re-pin history (2026-07-03).** v2.4–v2.7 originally published as 49 200 / 51 000 / 51 200 / 52 500
|
|
15
|
+
> and were RE-PINNED to 46 400 / 46 440 / 46 480 / 46 520 (`CONSENSUS_CHANGES.md` 0.1.33): an operator-approved,
|
|
16
|
+
> coordinated same-day re-pin of every verifier while the tip (~46 071) was still below every new height, so all
|
|
17
|
+
> recorded history replays byte-identically. Replayers built from this spec MUST use the re-pinned heights above.
|
|
18
|
+
|
|
14
19
|
> **Canonical copy.** This spec ships in the published `@inversealtruism/cairnx-core` package; the source of
|
|
15
20
|
> truth is `csd-sdk/packages/cairnx/CONVENTION.md`. Any in-repo mirror (e.g. the `cairnx` app repo) MUST be
|
|
16
21
|
> kept **byte-identical** to it on every change — a third-party implementer fetches the *published* copy, so
|
|
@@ -869,14 +874,15 @@ The §24 lifetime cap proved to be an infrastructure symptom, not a market need,
|
|
|
869
874
|
|
|
870
875
|
# CairnX Convention v2.4 (length-graded registration fee increase)
|
|
871
876
|
|
|
872
|
-
**Activation height:
|
|
877
|
+
**Activation height: 46 400** (`V24_HEIGHT`; non-retroactive; keyed on the FEE-BEARING event's height;
|
|
878
|
+
re-pinned 2026-07-03 from the originally published 49 200 — see the height re-pin history note at the top).
|
|
873
879
|
|
|
874
880
|
## 27. The fee curve
|
|
875
881
|
|
|
876
882
|
`nameRegFee(name, height)` selects the regime by the height of the event that carries the fee: the `name`
|
|
877
883
|
reveal below v2.5, the winner's `nfinalize` at/after v2.5 (§28), and every renewal at its own event height.
|
|
878
884
|
|
|
879
|
-
| name length | < 40 000 | ≥ 40 000 (v1.8) | ≥
|
|
885
|
+
| name length | < 40 000 | ≥ 40 000 (v1.8) | ≥ 46 400 (v2.4) |
|
|
880
886
|
|---|---|---|---|
|
|
881
887
|
| ≤ 3 chars | 5 CSD | 6.7 CSD | 15 CSD |
|
|
882
888
|
| 4 chars | 2 CSD | 6.7 CSD | 10 CSD |
|
|
@@ -886,16 +892,17 @@ reveal below v2.5, the winner's `nfinalize` at/after v2.5 (§28), and every rene
|
|
|
886
892
|
|
|
887
893
|
- Underpayment is a **no-op** (`name registration fee unpaid`), and the §10 warning applies with force:
|
|
888
894
|
the attached payment outputs still settle on-chain. An underpaid registration or renewal is a burn.
|
|
889
|
-
- **Adoption note (BOTH directions are hard):** a stale replayer ACCEPTS an underpaid post-
|
|
895
|
+
- **Adoption note (BOTH directions are hard):** a stale replayer ACCEPTS an underpaid post-46 400
|
|
890
896
|
registration the chain rejects (it shows a phantom owner), and a stale wallet ATTACHES the old fee and
|
|
891
897
|
burns it. Every replayer and every fee-quoting client must run the v2.4 core before the tip crosses
|
|
892
|
-
|
|
898
|
+
46 400.
|
|
893
899
|
|
|
894
900
|
---
|
|
895
901
|
|
|
896
902
|
# CairnX Convention v2.5 (sealed-reservation registration)
|
|
897
903
|
|
|
898
|
-
**Activation height:
|
|
904
|
+
**Activation height: 46 440** (`V25_HEIGHT`; non-retroactive; keyed on the reveal event height;
|
|
905
|
+
re-pinned 2026-07-03 from the originally published 51 000 — see the height re-pin history note at the top).
|
|
899
906
|
|
|
900
907
|
Root fix for the reveal fee-burn: pre-v2.5, every losing racer in a §9 commit-reveal race paid the FULL
|
|
901
908
|
registration fee for nothing (payment-without-delivery). At/after v2.5 the reveal is payment-free; only
|
|
@@ -910,7 +917,7 @@ the settled winner ever pays.
|
|
|
910
917
|
freeze, so no back-dated challenger can appear after the freeze has passed. Direct no-salt registration
|
|
911
918
|
is rejected at/after v2.5 (`v2.5: registration requires a commit-reveal (salt)`): an unsealed
|
|
912
919
|
registration could not be finalized.
|
|
913
|
-
- **Reveal (`name` record, height ≥
|
|
920
|
+
- **Reveal (`name` record, height ≥ 46 440):** carries NO registration fee. Creates a PENDING reservation,
|
|
914
921
|
materialized in canonical state as the name with `pending: true` and
|
|
915
922
|
`finalizeBy = effHeight + 8 + 20` (`REG_COMMIT_MAX_BLOCKS + REG_FINALIZE_GRACE_BLOCKS`).
|
|
916
923
|
- **Contest while pending:** a rival reveal with a strictly earlier `(effHeight, pos, id)` (numeric on
|
|
@@ -934,22 +941,23 @@ the settled winner ever pays.
|
|
|
934
941
|
- **Client timing rule** (`FINALIZE_TIP_MARGIN = 2`, client-side only): sign the finalize at
|
|
935
942
|
`effHeight + 8 + 2` or later so one reorg cannot un-freeze the contest under a fee-bearing tx. The
|
|
936
943
|
20-block grace exists so a slow inclusion still lands before `finalizeBy`.
|
|
937
|
-
- **Adoption note (hard gate):** a stale (pre-v2.5) wallet crossing
|
|
944
|
+
- **Adoption note (hard gate):** a stale (pre-v2.5) wallet crossing 46 440 attaches the registration fee
|
|
938
945
|
to what is now a payment-free reveal; the resolver ignores the fee and the payment burns. Every
|
|
939
|
-
replayer AND every fee-attaching client must run the v2.5 core before the tip crosses
|
|
946
|
+
replayer AND every fee-attaching client must run the v2.5 core before the tip crosses 46 440.
|
|
940
947
|
|
|
941
948
|
---
|
|
942
949
|
|
|
943
950
|
# CairnX Convention v2.6 (sealed-reservation recapture)
|
|
944
951
|
|
|
945
|
-
**Activation height:
|
|
952
|
+
**Activation height: 46 480** (`V26_HEIGHT`; non-retroactive; keyed on the reveal event height;
|
|
953
|
+
re-pinned 2026-07-03 from the originally published 51 200 — see the height re-pin history note at the top).
|
|
946
954
|
|
|
947
955
|
The §28 cure applied to LAPSED-name recapture (§17), whose losing racer previously forfeited the full
|
|
948
956
|
decaying premium (up to hundreds of CSD).
|
|
949
957
|
|
|
950
958
|
## 29. Recapture through the same sealed machinery
|
|
951
959
|
|
|
952
|
-
- **Reveal on a lapsed name (height ≥
|
|
960
|
+
- **Reveal on a lapsed name (height ≥ 46 480):** payment-free. Creates a recapture reservation in an
|
|
953
961
|
INTERNAL `recaptures` map. The reservation is NOT materialized in canonical state, and the lapsed
|
|
954
962
|
record in `names` is left untouched (it is the premium basis; an abandoned reservation can never
|
|
955
963
|
bypass the premium). Below v2.6, recapture stays pay-now at reveal (§17, byte-identical).
|
|
@@ -965,13 +973,14 @@ decaying premium (up to hundreds of CSD).
|
|
|
965
973
|
which later `nfinalize` succeeds. The map is defined by this section plus the reference resolver and
|
|
966
974
|
its Python mirror; the v2.6 conformance vectors pin it.
|
|
967
975
|
- **Adoption note (hard gate):** same shape as §28. A stale wallet attaches the premium to a
|
|
968
|
-
payment-free recapture reveal and burns it. All replayers and clients on the v2.6 core before
|
|
976
|
+
payment-free recapture reveal and burns it. All replayers and clients on the v2.6 core before 46 480.
|
|
969
977
|
|
|
970
978
|
---
|
|
971
979
|
|
|
972
980
|
# CairnX Convention v2.7 (young-name sale embargo shrinks)
|
|
973
981
|
|
|
974
|
-
**Activation height:
|
|
982
|
+
**Activation height: 46 520** (`V27_HEIGHT`; non-retroactive; keyed on the OFFER event height;
|
|
983
|
+
re-pinned 2026-07-03 from the originally published 52 500 — see the height re-pin history note at the top).
|
|
975
984
|
|
|
976
985
|
## 30. Sale embargo: 240 blocks becomes 8
|
|
977
986
|
|
|
@@ -979,12 +988,134 @@ A name `offer` (§17 sale path) whose event height `H` satisfies `H − effHeigh
|
|
|
979
988
|
(`name too young to sell (must out-age the reveal window)`), where `effHeight` is the name's effective
|
|
980
989
|
anchor. `viaFill` names were never embargoed.
|
|
981
990
|
|
|
982
|
-
- **`H` <
|
|
991
|
+
- **`H` < 46 520:** `embargo = COMMIT_MAX_BLOCKS` (240 blocks, ≈ 8 h). The pre-sealed rule: a fresh name
|
|
983
992
|
had to out-age every lurking back-dated reveal before it could be sold.
|
|
984
|
-
- **`H` ≥
|
|
993
|
+
- **`H` ≥ 46 520:** `embargo = REG_COMMIT_MAX_BLOCKS` (8 blocks, ≈ 16 min). Under §28/§29 a finalized
|
|
985
994
|
name is displacement-immune the moment its freeze passes, so out-aging the old 240-block window is
|
|
986
995
|
redundant; 8 matches the freeze itself.
|
|
987
|
-
- The gate keys on the OFFER's height, so the same young name can be unsellable at
|
|
988
|
-
at
|
|
996
|
+
- The gate keys on the OFFER's height, so the same young name can be unsellable at 46 519 and sellable
|
|
997
|
+
at 46 521. Deterministic for every replayer; no name-age era bookkeeping is needed.
|
|
989
998
|
- **Adoption note:** a relaxation (fresh cores accept a sale a stale core no-ops), so every replayer must
|
|
990
|
-
run the v2.7 core before the tip crosses
|
|
999
|
+
run the v2.7 core before the tip crosses 46 520.
|
|
1000
|
+
|
|
1001
|
+
---
|
|
1002
|
+
|
|
1003
|
+
# CairnX Convention v2.8 (fclaim: atomic open-lane settlement)
|
|
1004
|
+
|
|
1005
|
+
**Activation height: `V28_HEIGHT`** (baked at rollout; non-retroactive; each rule keys on its OWN governed
|
|
1006
|
+
event's height, and Lane B additionally on the offer's anchor era).
|
|
1007
|
+
Below it an `fclaim` record parses to a forward-compatible no-op (like `nprofile` below V19, §22), `SCORE_CLAIM`
|
|
1008
|
+
claims work exactly as §20/§23, and every replay hash is byte-identical.
|
|
1009
|
+
|
|
1010
|
+
## 31. `fclaim`: the open-lane claim becomes a short-expiry proposal, the fill attests it
|
|
1011
|
+
|
|
1012
|
+
v1.7 (§20) moved the open-CSD race to a payment-free claim (`Attest score = 50`), but the resulting hold is an
|
|
1013
|
+
overlay-only deadline invisible to L0: a fill delayed past the hold, or a cancel reordered against the fill, can
|
|
1014
|
+
still burn a paid buyer (the cross-block delivery-versus-payment flaw). v2.8 closes it by making the claim a
|
|
1015
|
+
**short-expiry `Propose`** and the fill an **`Attest` on that proposal**, so L0's own rules (an Attest to an
|
|
1016
|
+
unknown proposal is block-invalid, and an Attest mined in an epoch past the proposal's `expires_epoch` is
|
|
1017
|
+
block-invalid) enforce the SAME hold deadline the overlay uses. Delivery and payment become one
|
|
1018
|
+
consensus-observable quantity.
|
|
1019
|
+
|
|
1020
|
+
**Record.** `fclaim = {v, t:"fclaim", offer}`, where `offer` is the 0x-hex id (`isHash`) of an open,
|
|
1021
|
+
CSD-priced, untaken offer. `FCLAIM_KEYS = {"v","t","offer"}` (exact-key set, §5.1). The expiry rides the
|
|
1022
|
+
carrying `Propose.expires_epoch`; there is no `expiresEpoch` in the record body (matching the `offer` /
|
|
1023
|
+
`OfferRecord` precedent). Parsing is height-agnostic; the resolve handler is `V28_HEIGHT`-gated, so below the
|
|
1024
|
+
gate a parsed fclaim is inert (nfinalize precedent, §28).
|
|
1025
|
+
|
|
1026
|
+
**The two transactions.**
|
|
1027
|
+
- **Claim** = `Propose(uri = the fclaim record, expires_epoch = E)`, with `E` the desired hold-end epoch. The
|
|
1028
|
+
network fee is the propose floor 0.25 CSD (up from the 0.05 attest floor). A client picks
|
|
1029
|
+
`E = min(epochOf(tip + 45), offer.expiresEpoch)` to approximate the legacy 45-block hold while never
|
|
1030
|
+
requesting an `E` the grant would deny.
|
|
1031
|
+
- **Fill** = `Attest(score = SCORE_FILL = 100)` on the **fclaim txid** (not the offer id), paying the SAME
|
|
1032
|
+
§4 / §19 delivery outputs (the CSD `want.value` sum plus the §19 fee and maker rebate). The fill itself
|
|
1033
|
+
stays at the 0.05 attest floor; only the claim rises to the 0.25 propose floor.
|
|
1034
|
+
|
|
1035
|
+
**Grant (the propose handler, at height `h >= V28_HEIGHT`).** A well-formed fclaim grants a hold iff, in order:
|
|
1036
|
+
the referenced offer exists AND is `open` AND untaken (`!taker`) AND CSD-priced; `E <= effExpiry(offer, h)`
|
|
1037
|
+
(§24 / §25, so the hold never outlives the offer); `E <= epochOf(h) + FCLAIM_MAX_EPOCH_AHEAD` (`= 2`, anti-squat,
|
|
1038
|
+
bounding a hold to `EPOCH_LEN*(2 + 1) - 1 = 89` blocks); `epochOf(h) <= E` (lower bound); the offer has no live
|
|
1039
|
+
hold (`!claimHeld`, unifying legacy and fclaim holds so one offer is never double-held); the same-offer cooldown
|
|
1040
|
+
has elapsed (`h >= o.claimUntilHeight + grace + CLAIM_COOLDOWN_BLOCKS` for the last holder, where `grace` is the
|
|
1041
|
+
prior hold's era grace per §20 / §23, i.e. 0 for a prior fclaim hold and `CLAIM_FILL_GRACE_BLOCKS` for a prior
|
|
1042
|
+
legacy hold; the cooldown runs from the END of the prior hold, so a straddling legacy hold and a fresh fclaim
|
|
1043
|
+
never disagree); and the proposer holds fewer than `MAX_ACTIVE_CLAIMS` (`= 3`) live holds. This clause order is
|
|
1044
|
+
normative (the from-spec oracle emits deny reasons in this order). On grant the resolver records `claimedBy = proposer`, `claimUntilHeight = (E + 1)*EPOCH_LEN`, and
|
|
1045
|
+
`claimTxid = fclaimTxid`.
|
|
1046
|
+
|
|
1047
|
+
**Last-write-wins (fund-safety).** All three fields are last-write-wins: a later grant on the same offer (after
|
|
1048
|
+
a prior hold has lapsed) RE-ASSIGNS all three unconditionally. `claimTxid` is never left stale behind an
|
|
1049
|
+
`if (claimTxid === undefined)` guard and is never cleared. (If a later holder's `claimTxid` were left stale,
|
|
1050
|
+
fill-routing (`claimTxid === proposalId`) would fail for that holder while their payment mined on the new
|
|
1051
|
+
fclaim, a burn.) A denied fclaim records `{granted:false}` in the internal `fclaims` map (for the money-safety
|
|
1052
|
+
audit) and grants no hold.
|
|
1053
|
+
|
|
1054
|
+
**Canonical surface (§5.1).** `claimTxid` is a canonical offer field (§5.1-A3, present only once granted at
|
|
1055
|
+
V28+, following the §20 `claimedBy` / `claimUntilHeight` precedent). The `fclaims` map is INTERNAL and is NOT
|
|
1056
|
+
materialized in canonical state (the §29 `recaptures` precedent). So every pre-V28 replay hash is unchanged,
|
|
1057
|
+
and post-V28 canonical hashes cover `claimTxid` only.
|
|
1058
|
+
|
|
1059
|
+
**Hold and grace.** `claimHeld(o, h)` keeps its form, but grace is fclaim-aware: an fclaim hold (`claimTxid`
|
|
1060
|
+
set) has grace 0, so the hold is exactly `[grantHeight, holdEnd]` with `holdEnd = (E + 1)*EPOCH_LEN - 1`, the
|
|
1061
|
+
last L0-minable height for the fill (an attest at `h > holdEnd` is in an epoch `> E` and L0-invalid). The
|
|
1062
|
+
resolver-local grace and the shared `claimGraceOf` selector are made `claimTxid`-aware TOGETHER so the resolver
|
|
1063
|
+
and every client bundle stay in lockstep.
|
|
1064
|
+
|
|
1065
|
+
**Fill routing.** A `SCORE_FILL` attest on an fclaim txid looks up the linked offer and delivers iff: the
|
|
1066
|
+
fclaim was `granted`; the offer is `open`; `claimTxid === fclaimTxid && claimHeld(o, h)`; and
|
|
1067
|
+
`attester === claimedBy`. It then runs the EXISTING §4 / §19 (whole) and §12 (partial) value-and-delivery
|
|
1068
|
+
machinery unchanged (same required outputs, keyed on the offer). Partial fills ride the fclaim lane and the
|
|
1069
|
+
hold PERSISTS across them until `holdEnd` or a whole fill. A granted fclaim's own `paidTo` is
|
|
1070
|
+
allowed-and-ignored (the §28 payment-free-reveal precedent). Any non-`SCORE_FILL` score on an fclaim txid is a
|
|
1071
|
+
no-op (no buyer early-release).
|
|
1072
|
+
|
|
1073
|
+
**Correction 1 (offer-txid fill blocked during a hold).** At `h >= V28`, an open **offer-txid** fill on an
|
|
1074
|
+
offer with `claimTxid !== undefined` is rejected. Without it, an updated buyer (or a stale bundle) could route
|
|
1075
|
+
the payment through the offer id, whose L0 deadline is the offer's far-off expiry, silently reopening the
|
|
1076
|
+
delayed-fill burn. One guard covers both the whole and partial offer-txid fill paths; token-priced fills never
|
|
1077
|
+
carry a `claimTxid`.
|
|
1078
|
+
|
|
1079
|
+
**Correction 2 (cancel-freeze at apply-time, on the cancel's own block).** §16 defers a cancel's effect to the
|
|
1080
|
+
block boundary. At `h >= V28`, both deferred closures (the `ocancel` Propose and the score-0 cancel Attest)
|
|
1081
|
+
SKIP any target with a live fclaim hold: evaluate `claimTxid !== undefined && claimHeld(o, ev.height)` LIVE on
|
|
1082
|
+
the offer object INSIDE the closure, keyed on the cancel's OWN block height. (A same-block higher-pos grant
|
|
1083
|
+
mutates that offer object, so an inside-closure read sees the hold; a value snapshotted at the `ocancel`
|
|
1084
|
+
apply-time target scan would not.) The freeze is scoped to `claimTxid !== undefined`, so pre-V28 legacy holds
|
|
1085
|
+
keep §16 behavior byte-for-byte.
|
|
1086
|
+
|
|
1087
|
+
**Lane B (taker-bound offers become uncancellable at V28).** A taker-bound (RFQ) answer is a firm quote: at
|
|
1088
|
+
`h >= V28`, both cancel paths reject a cancel when `o.taker !== undefined` and the offer was anchored at V28+.
|
|
1089
|
+
The maker exits by letting the answer expire (one epoch, about an hour). This eliminates the cancel-reorder half
|
|
1090
|
+
for the RFQ lane entirely.
|
|
1091
|
+
|
|
1092
|
+
**Name-offer freeze (lease-lapse safety).** A held offer that sells a **name** is also protected from
|
|
1093
|
+
`voidOpenNameOffers`: at `h >= V28`, a recapture or displacement does not void an offer carrying a live
|
|
1094
|
+
`claimTxid` hold (the same predicate as Correction 2). Without this, a name whose lease lapses mid-hold could be
|
|
1095
|
+
recaptured and its offer voided, stranding the buyer's L0-minable fill.
|
|
1096
|
+
|
|
1097
|
+
**`SCORE_CLAIM` sunset.** At `h >= V28` a `SCORE_CLAIM` attest is explicitly rejected (`claims are fclaim
|
|
1098
|
+
proposals now`) so a stale wallet's claim is diagnosable rather than silently inert. Pre-V28 live holds continue
|
|
1099
|
+
to honor legacy `SCORE_FILL` fills until they lapse (all within 45 blocks of the gate); the legacy lane
|
|
1100
|
+
self-sunsets with no height literal in the predicate.
|
|
1101
|
+
|
|
1102
|
+
**Denied-fclaim is an L0-valid fill target (the sharp edge).** L0 stores every mined Propose, and an Attest's
|
|
1103
|
+
existence check only reads storage, so a fill on a resolver-DENIED fclaim (for example on a taken or expired
|
|
1104
|
+
offer) still MINES and, because the resolver denied the hold, BURNS. A client therefore MUST re-derive the
|
|
1105
|
+
entire grant itself over PoW-buried offer + fclaim events before signing a fill, and MUST NOT trust fclaim
|
|
1106
|
+
inclusion or any resolver `granted` assertion. The `fclaims` map records the denied grant so the money-safety
|
|
1107
|
+
audit flags such a burn.
|
|
1108
|
+
|
|
1109
|
+
**Client policy (not consensus, does not affect canonical state).** A filler waits a value-scaled
|
|
1110
|
+
`requiredClaimDepth` (§20 reorg note) on BOTH the offer and the fclaim (and, for a partial tail-fill, on the
|
|
1111
|
+
offer's earlier fill-basis events) before signing, and refuses to broadcast a fill within `FILL_TIP_MARGIN`
|
|
1112
|
+
(`= 2`) blocks of `holdEnd` (a stranded no-op, never a fund risk), computed from the fclaim's actual confirmed
|
|
1113
|
+
height and `expires_epoch`. A clean-start SPV scan must cover
|
|
1114
|
+
`GAP_NEEDED = EPOCH_LEN*(FCLAIM_MAX_EPOCH_AHEAD + 1) - 1 + CLAIM_COOLDOWN_BLOCKS` (`= 104`) blocks so it can
|
|
1115
|
+
never false-accept a denied fclaim.
|
|
1116
|
+
|
|
1117
|
+
- **Adoption note:** at/above V28 the fill's referenced proposal changes (offer id becomes fclaim txid) and
|
|
1118
|
+
`SCORE_CLAIM` is rejected, so v2.8 is BOTH a relaxation (an fclaim fill a fresh core accepts, a stale core
|
|
1119
|
+
no-ops) AND a tightening (a stale core still grants legacy claims a fresh core rejects). Every replayer,
|
|
1120
|
+
resolver, and client bundle MUST run the v2.8 core before the tip crosses `V28_HEIGHT`. Below the gate every
|
|
1121
|
+
rule above is inert and all replay is byte-identical.
|
package/MAKERS.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# Run a CairnX market maker
|
|
2
2
|
|
|
3
|
-
CairnX has **no AMM and no escrow
|
|
3
|
+
CairnX has **no AMM and no escrow**; native CSD can't be pooled (CONVENTION §6). Liquidity is whoever
|
|
4
4
|
runs a *maker loop*. This guide is everything you need to join as a market maker, end to end. Anyone
|
|
5
5
|
may run one, against any token, with their own key. It builds only on the public package
|
|
6
6
|
[`@inversealtruism/cairnx-core`](https://www.npmjs.com/package/@inversealtruism/cairnx-core).
|
|
7
7
|
|
|
8
|
+
> Sibling doc: the `cairnx` app repo ships a repo-centric **Maker Kit** (`cairnx/MAKERS.md`) covering
|
|
9
|
+
> the reference `mm-bot` implementation, its config, and ops runbook. The two are different documents
|
|
10
|
+
> for different audiences by design, not drifted copies of one file.
|
|
11
|
+
|
|
8
12
|
## How the market works (RFQ)
|
|
9
13
|
|
|
10
14
|
Post-v1.3 the CSD-priced market **is** an RFQ loop (CONVENTION §13/§15):
|
package/README.md
CHANGED
|
@@ -131,8 +131,8 @@ stateDiagram-v2
|
|
|
131
131
|
| Lease term | ~1 year (`NAME_TERM_EPOCHS = 8760`) | 1 epoch ≈ 1 h (30 blocks) |
|
|
132
132
|
| Grace window | ~30 days (`NAME_GRACE_EPOCHS = 720`) | owner-only renewal |
|
|
133
133
|
| Recapture premium | **20× → 1×** over ~30 days | decaying Dutch auction on lapsed names |
|
|
134
|
-
| Reveal window | ~
|
|
135
|
-
| Registration fee | **
|
|
134
|
+
| Reveal window | ~16 min (`REG_COMMIT_MAX_BLOCKS = 8`, v2.5+; was 240 blocks below v2.5) | commit-reveal deadline; doubles as the displacement freeze |
|
|
135
|
+
| Registration fee | **15 / 10 / 5 / 3 CSD** by length (≤3 / 4 / 5-9 / ≥10 chars, v2.4) | length-graded (was flat 6.7 / 3 CSD under v1.8); paid to the treasury at finalize (v2.5+) |
|
|
136
136
|
|
|
137
137
|
### 2.4 · How a name resolves, and what's actually *verified*
|
|
138
138
|
|
|
@@ -249,12 +249,23 @@ is bounded in the light client, not the chain.
|
|
|
249
249
|
| v1.8 | 40 000 | flat two-tier name fee (6.7 / 3 CSD) |
|
|
250
250
|
| v2.1 | 40 100 | offer/bid duration cap (`MAX_OFFER_EPOCHS = 168`), *superseded by v2.2* |
|
|
251
251
|
| v2.2 | 41 300 | duration cap **removed from consensus** → UI policy; bound moves to the light client |
|
|
252
|
+
| v2.4 | 46 400 | length-graded registration fee (15 / 10 / 5 / 3 CSD by name length) |
|
|
253
|
+
| v2.5 | 46 440 | sealed-reservation registration: payment-free reveal, winner-only fee at `nfinalize` |
|
|
254
|
+
| v2.6 | 46 480 | sealed-reservation recapture (lapsed-name premium paid by the settled winner only) |
|
|
255
|
+
| v2.7 | 46 520 | young-name sale embargo shrinks 240 → 8 blocks |
|
|
256
|
+
| v2.3 | 52 000 | `nset` to the zero address CLEARS the pointer (*still pending as of 2026-07-06, tip ~48 300*) |
|
|
257
|
+
|
|
258
|
+
v2.4–v2.7 were re-pinned 2026-07-03 from their originally published heights (49 200 / 51 000 / 51 200 /
|
|
259
|
+
52 500) — see the re-pin history note in `CONVENTION.md` and `CONSENSUS_CHANGES.md` 0.1.33.
|
|
252
260
|
|
|
253
261
|
### Package layout
|
|
254
262
|
|
|
255
263
|
`src/resolve.ts` (the ledger) · `src/records.ts` (the parse/validate gate) · `src/types.ts` (constants +
|
|
256
|
-
height-gated client selectors) · `src/client.ts` (reorg-safety helpers a payer applies) · `
|
|
257
|
-
(
|
|
264
|
+
height-gated client selectors) · `src/client.ts` (reorg-safety helpers a payer applies) · `src/preflight.ts`
|
|
265
|
+
(build-side helpers every host must compute identically: `requiredFillOutputs`, `previewFill`/`fillIsSafe`,
|
|
266
|
+
`buildFeeHeight` + `NAME_FEE_GATES`, `finalizeWinnerCheck`) · `src/primary.ts` (`pickPrimaryName` /
|
|
267
|
+
`primaryRankBefore`, the one primary-name selection every host must agree on) · `CONVENTION.md`
|
|
268
|
+
(normative spec, §1–§30) · `test/vectors/` (portable conformance corpus).
|
|
258
269
|
|
|
259
270
|
### Use it
|
|
260
271
|
|
|
@@ -277,8 +288,8 @@ console.log(state.names, state.tokens.CAIRN, state.balances.CAIRN);
|
|
|
277
288
|
|
|
278
289
|
### Write a conformant resolver in another language
|
|
279
290
|
|
|
280
|
-
1. Implement `CONVENTION.md` §1–§
|
|
281
|
-
canonical-state format, ordinal key ordering, data surface only).
|
|
291
|
+
1. Implement `CONVENTION.md` §1–§30 (apply order, every record type, the `V*_HEIGHT` activations — using
|
|
292
|
+
the re-pinned v2.4–v2.7 heights — the canonical-state format, ordinal key ordering, data surface only).
|
|
282
293
|
2. Replay `test/vectors/cases.json`: your canonical state must equal `expectedState` **byte-for-byte**.
|
|
283
294
|
3. Replay the live chain and compare `sha256(canonicalState)` against `test/vectors/replay-hashes.json`.
|
|
284
295
|
|