@inversealtruism/cairnx-core 0.1.32 → 0.1.33

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 CHANGED
@@ -1,11 +1,15 @@
1
1
  # CairnX Convention v1
2
2
 
3
- **Status:** v2.1 (normative; supersedes the 2026-06-10 v1.0 draft) · **Domain:** `cairnx:v1` · **Base activation:** 29 860
3
+ **Status:** v2.7 (normative; 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
- 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
- Sections §19–§24 are the normative semantics for v1.6–v2.1; §5.1 is the byte-level canonical-JSON contract that binds all of them.
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 @ 49 200 (§27) · v2.5 @ 51 000 (§28) · v2.6 @ 51 200 (§29) · v2.3 @ 52 000 (§26) ·
9
+ v2.7 @ 52 500 (§30).
10
+ Sections §19–§30 are the normative semantics for v1.6–v2.7; §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.6): a
12
+ replayer gates each rule on its own height constant, never on "version X implies version Y is active".
9
13
 
10
14
  > **Canonical copy.** This spec ships in the published `@inversealtruism/cairnx-core` package; the source of
11
15
  > truth is `csd-sdk/packages/cairnx/CONVENTION.md`. Any in-repo mirror (e.g. the `cairnx` app repo) MUST be
@@ -815,3 +819,172 @@ epochs from its anchor:
815
819
  everyone. Below V21, `effExpiry = expires_epoch` — byte-identical history.
816
820
  - **Client expiry-height closed form** (mirrors the resolver's height-gated sweep, for buy-safety guards):
817
821
  `offerExpiryHeight = min( (expires_epoch+1)·30 , max( V21_HEIGHT , (epochOf(anchor)+168+1)·30 ) )`.
822
+
823
+ ---
824
+
825
+ # CairnX Convention v2.2 (offer/bid duration cap removed, anchor-keyed)
826
+
827
+ **Activation height: 41 300** (`V22_HEIGHT`; non-retroactive; keyed on the offer/bid ANCHOR height, not the sweep height).
828
+
829
+ ## 25. The §24 cap applies only to the [V21, V22) anchor era
830
+
831
+ The §24 lifetime cap proved to be an infrastructure symptom, not a market need, and was lifted:
832
+
833
+ - **Anchor ≥ 41 300:** the raw `expires_epoch` binds. No creation gate, no capped `effExpiry`. The 1-week
834
+ suggestion survives only as CLIENT policy (the reference UI defaults to it); it is not consensus.
835
+ - **Anchor in [40 100, 41 300):** the §24 rules apply to that offer/bid FOREVER (creation gate at its
836
+ anchor, capped `effExpiry` in every later sweep). Era membership is fixed by the anchor, so every
837
+ replayer ages the same record identically regardless of when it replays.
838
+ - **Anchor < 40 100:** raw `expires_epoch` binds (pre-V21 history, unchanged).
839
+ - **Client closed form:** for anchor ≥ V22, `offerExpiryHeight = (expires_epoch+1)·30`; for the [V21, V22)
840
+ era use the §24 formula; below V21 use the raw form.
841
+ - **Adoption note:** a relaxation. A v2.1-only replayer rejects (no-ops) a long-dated offer the chain
842
+ accepts, so its book diverges from the canonical one from the first over-cap anchor onward. Every
843
+ replayer must run the v2.2 core before the tip crosses 41 300 (already long past; stated for the record).
844
+
845
+ ---
846
+
847
+ # CairnX Convention v2.3 (`nset` to the zero address clears the record)
848
+
849
+ **Activation height: 52 000** (`V23_HEIGHT`; non-retroactive; keyed on the `nset` event height).
850
+
851
+ ## 26. Clearing a name's payment target
852
+
853
+ `ZERO_ADDR = 0x` + 40 hex zeros.
854
+
855
+ - **Event height ≥ 52 000:** an owner `nset` whose `addr` equals `ZERO_ADDR` CLEARS the record: the
856
+ canonical state materializes the name with NO `addr` key (absent, not `null`). A cleared name resolves
857
+ to its OWNER address (the §9 fallback) and drops out of the reverse-resolution / primary-name candidate
858
+ set. This is the supported way to switch which of several names is an address's primary.
859
+ - **Event height < 52 000:** the identical record literally sets `addr` to the zero address (historical
860
+ behavior, byte-identical replay). The zero address has always been a VALID `addr`, so there is no
861
+ parser change in either direction.
862
+ - **Guards unchanged:** `nset` on a lapsed lease stays a no-op (§17); owner-only as before.
863
+ - **Adoption note (fund safety, the harder direction):** a stale (pre-v2.3) replayer shows a cleared name
864
+ still pointing at `0x000...0`. A payer trusting that stale view burns funds to the zero address. Wallets
865
+ MUST refuse to pay `0x000...0` regardless (the reference wallet hard-blocks it), and every replayer must
866
+ run the v2.3 core before the tip crosses 52 000.
867
+
868
+ ---
869
+
870
+ # CairnX Convention v2.4 (length-graded registration fee increase)
871
+
872
+ **Activation height: 49 200** (`V24_HEIGHT`; non-retroactive; keyed on the FEE-BEARING event's height).
873
+
874
+ ## 27. The fee curve
875
+
876
+ `nameRegFee(name, height)` selects the regime by the height of the event that carries the fee: the `name`
877
+ reveal below v2.5, the winner's `nfinalize` at/after v2.5 (§28), and every renewal at its own event height.
878
+
879
+ | name length | < 40 000 | ≥ 40 000 (v1.8) | ≥ 49 200 (v2.4) |
880
+ |---|---|---|---|
881
+ | ≤ 3 chars | 5 CSD | 6.7 CSD | 15 CSD |
882
+ | 4 chars | 2 CSD | 6.7 CSD | 10 CSD |
883
+ | 5 chars | 1 CSD | 3 CSD | 5 CSD |
884
+ | 6 - 9 chars | 0.5 CSD | 3 CSD | 5 CSD |
885
+ | ≥ 10 chars | 0.1 CSD | 3 CSD | 3 CSD |
886
+
887
+ - Underpayment is a **no-op** (`name registration fee unpaid`), and the §10 warning applies with force:
888
+ 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-49 200
890
+ registration the chain rejects (it shows a phantom owner), and a stale wallet ATTACHES the old fee and
891
+ burns it. Every replayer and every fee-quoting client must run the v2.4 core before the tip crosses
892
+ 49 200.
893
+
894
+ ---
895
+
896
+ # CairnX Convention v2.5 (sealed-reservation registration)
897
+
898
+ **Activation height: 51 000** (`V25_HEIGHT`; non-retroactive; keyed on the reveal event height).
899
+
900
+ Root fix for the reveal fee-burn: pre-v2.5, every losing racer in a §9 commit-reveal race paid the FULL
901
+ registration fee for nothing (payment-without-delivery). At/after v2.5 the reveal is payment-free; only
902
+ the settled winner ever pays.
903
+
904
+ ## 28. Commit, payment-free reveal, freeze, winner-only finalize
905
+
906
+ - **Commit (unchanged):** a prior `ncommit` per §9. Back-dating is unchanged: the reveal's effective
907
+ anchor `effHeight` is its commit's height.
908
+ - **Reveal window shrinks:** at/after v2.5 a reveal must land within `REG_COMMIT_MAX_BLOCKS = 8` blocks
909
+ of its commit (below v2.5: 240). One constant serves as BOTH the reveal window and the displacement
910
+ freeze, so no back-dated challenger can appear after the freeze has passed. Direct no-salt registration
911
+ is rejected at/after v2.5 (`v2.5: registration requires a commit-reveal (salt)`): an unsealed
912
+ registration could not be finalized.
913
+ - **Reveal (`name` record, height ≥ 51 000):** carries NO registration fee. Creates a PENDING reservation,
914
+ materialized in canonical state as the name with `pending: true` and
915
+ `finalizeBy = effHeight + 8 + 20` (`REG_COMMIT_MAX_BLOCKS + REG_FINALIZE_GRACE_BLOCKS`).
916
+ - **Contest while pending:** a rival reveal with a strictly earlier `(effHeight, pos, id)` (numeric on
917
+ `effHeight` and `pos`, ordinal code-unit on `id`; earliest wins) DISPLACES the reservation; the displaced party has lost only its
918
+ ~0.25 CSD anchor. A FINALIZED name can never be displaced: any window-valid challenger has an
919
+ `effHeight` within 8 blocks of the current height, which is strictly later than a finalized name's
920
+ (its freeze has passed). Names owned `viaFill` are likewise never displaced.
921
+ - **Per-address cap:** at most `MAX_PENDING_REG = 3` concurrent un-finalized reservations per owner
922
+ (expired ones and a re-reveal of the same name do not count); excess reveals are no-ops.
923
+ - **Finalize (`nfinalize` record):** `{v:1, t:"nfinalize", name, salt}`. Valid iff ALL of: the name is
924
+ pending and owned by the sender; `salt` re-derives the SAME commit that anchored the reservation
925
+ (`sha256` per §9, binding name + salt + owner, and the commit's height must equal the reservation's
926
+ `effHeight`); the freeze has passed (`ev.height > effHeight + 8`); the reservation has not expired
927
+ (`ev.height ≤ finalizeBy`); and the payment to the treasury covers `nameRegFee(name, ev.height)`
928
+ (§27, priced at the FINALIZE height). On success the `pending`/`finalizeBy` keys become ABSENT, the
929
+ lease starts (`paidThroughEpoch = epochOf(ev.height) + NAME_TERM_EPOCHS`), and the name is NOT
930
+ `viaFill`.
931
+ - **Reservation expiry (lazy):** past `finalizeBy` an un-finalized reservation is swept exactly like a
932
+ lapsed lease (at each event height and at the tip+1 closing sweep): the name record is DELETED and the
933
+ name reopens. The would-be winner has lost only anchors, never the registration fee.
934
+ - **Client timing rule** (`FINALIZE_TIP_MARGIN = 2`, client-side only): sign the finalize at
935
+ `effHeight + 8 + 2` or later so one reorg cannot un-freeze the contest under a fee-bearing tx. The
936
+ 20-block grace exists so a slow inclusion still lands before `finalizeBy`.
937
+ - **Adoption note (hard gate):** a stale (pre-v2.5) wallet crossing 51 000 attaches the registration fee
938
+ 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 51 000.
940
+
941
+ ---
942
+
943
+ # CairnX Convention v2.6 (sealed-reservation recapture)
944
+
945
+ **Activation height: 51 200** (`V26_HEIGHT`; non-retroactive; keyed on the reveal event height).
946
+
947
+ The §28 cure applied to LAPSED-name recapture (§17), whose losing racer previously forfeited the full
948
+ decaying premium (up to hundreds of CSD).
949
+
950
+ ## 29. Recapture through the same sealed machinery
951
+
952
+ - **Reveal on a lapsed name (height ≥ 51 200):** payment-free. Creates a recapture reservation in an
953
+ INTERNAL `recaptures` map. The reservation is NOT materialized in canonical state, and the lapsed
954
+ record in `names` is left untouched (it is the premium basis; an abandoned reservation can never
955
+ bypass the premium). Below v2.6, recapture stays pay-now at reveal (§17, byte-identical).
956
+ - **Same windows and contest:** reveal window and freeze are `REG_COMMIT_MAX_BLOCKS = 8`;
957
+ `finalizeBy = effHeight + 8 + 20`; lowest `(effHeight, pos, id)` displaces among reservations; its own
958
+ `MAX_PENDING_REG = 3` per-address cap; overdue reservations are lazily swept.
959
+ - **Finalize:** the same `nfinalize` record, salt-bound to the recapture commit. The winner pays the §17
960
+ decaying premium priced at the FINALIZE height (slightly more decayed than at reveal: rounding favors
961
+ the payer). On success the name becomes a normal fresh lease under the new owner, NOT `viaFill`
962
+ (displacement-immune by the same freeze arithmetic as §28).
963
+ - **Replayer note:** because the reservation map is internal, pre-v2.6 canonical hashes are untouched,
964
+ but a third-party resolver MUST still replicate the map (reveal, displacement, expiry) to agree on
965
+ which later `nfinalize` succeeds. The map is defined by this section plus the reference resolver and
966
+ its Python mirror; the v2.6 conformance vectors pin it.
967
+ - **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 51 200.
969
+
970
+ ---
971
+
972
+ # CairnX Convention v2.7 (young-name sale embargo shrinks)
973
+
974
+ **Activation height: 52 500** (`V27_HEIGHT`; non-retroactive; keyed on the OFFER event height).
975
+
976
+ ## 30. Sale embargo: 240 blocks becomes 8
977
+
978
+ A name `offer` (§17 sale path) whose event height `H` satisfies `H − effHeight ≤ embargo` is a no-op
979
+ (`name too young to sell (must out-age the reveal window)`), where `effHeight` is the name's effective
980
+ anchor. `viaFill` names were never embargoed.
981
+
982
+ - **`H` < 52 500:** `embargo = COMMIT_MAX_BLOCKS` (240 blocks, ≈ 8 h). The pre-sealed rule: a fresh name
983
+ had to out-age every lurking back-dated reveal before it could be sold.
984
+ - **`H` ≥ 52 500:** `embargo = REG_COMMIT_MAX_BLOCKS` (8 blocks, ≈ 16 min). Under §28/§29 a finalized
985
+ name is displacement-immune the moment its freeze passes, so out-aging the old 240-block window is
986
+ redundant; 8 matches the freeze itself.
987
+ - The gate keys on the OFFER's height, so the same young name can be unsellable at 52 499 and sellable
988
+ at 52 501. Deterministic for every replayer; no name-age era bookkeeping is needed.
989
+ - **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 52 500.
package/dist/index.cjs CHANGED
@@ -181,7 +181,7 @@ var DEPLOY_FEE = 1e8;
181
181
  var V18_HEIGHT = 4e4;
182
182
  var NAME_FEE_SHORT_V18 = 670000000n;
183
183
  var NAME_FEE_V18 = 300000000n;
184
- var V24_HEIGHT = 49200;
184
+ var V24_HEIGHT = 46400;
185
185
  var NAME_FEE_LEN3_V24 = 1500000000n;
186
186
  var NAME_FEE_LEN4_V24 = 1000000000n;
187
187
  var NAME_FEE_MID_V24 = 500000000n;
@@ -222,13 +222,13 @@ var HASH_RE = /^0x[0-9a-f]{64}$/;
222
222
  var SALT_RE = /^[0-9a-fA-F]{16,128}$/;
223
223
  var RESERVED_NAMES = /* @__PURE__ */ new Set(["csd", "treasury", "admin", "official", "root", "www", "support"]);
224
224
  var COMMIT_MAX_BLOCKS = 8 * import_csd_codec.EPOCH_LEN;
225
- var V25_HEIGHT = 51e3;
225
+ var V25_HEIGHT = 46440;
226
226
  var REG_COMMIT_MAX_BLOCKS = 8;
227
227
  var REG_FINALIZE_GRACE_BLOCKS = 20;
228
228
  var MAX_PENDING_REG = 3;
229
229
  var FINALIZE_TIP_MARGIN = 2;
230
- var V26_HEIGHT = 51200;
231
- var V27_HEIGHT = 52500;
230
+ var V26_HEIGHT = 46480;
231
+ var V27_HEIGHT = 46520;
232
232
  var epochOf = (height) => Math.floor(height / import_csd_codec.EPOCH_LEN);
233
233
  var claimWindowAt = (height) => height >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
234
234
  var claimWindowOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
package/dist/index.d.cts CHANGED
@@ -37,7 +37,7 @@ declare const DEPLOY_FEE = 100000000;
37
37
  declare const V18_HEIGHT = 40000;
38
38
  declare const NAME_FEE_SHORT_V18 = 670000000n;
39
39
  declare const NAME_FEE_V18 = 300000000n;
40
- declare const V24_HEIGHT = 49200;
40
+ declare const V24_HEIGHT = 46400;
41
41
  declare const NAME_FEE_LEN3_V24 = 1500000000n;
42
42
  declare const NAME_FEE_LEN4_V24 = 1000000000n;
43
43
  declare const NAME_FEE_MID_V24 = 500000000n;
@@ -63,13 +63,13 @@ declare const HASH_RE: RegExp;
63
63
  declare const SALT_RE: RegExp;
64
64
  declare const RESERVED_NAMES: Set<string>;
65
65
  declare const COMMIT_MAX_BLOCKS: number;
66
- declare const V25_HEIGHT = 51000;
66
+ declare const V25_HEIGHT = 46440;
67
67
  declare const REG_COMMIT_MAX_BLOCKS = 8;
68
68
  declare const REG_FINALIZE_GRACE_BLOCKS = 20;
69
69
  declare const MAX_PENDING_REG = 3;
70
70
  declare const FINALIZE_TIP_MARGIN = 2;
71
- declare const V26_HEIGHT = 51200;
72
- declare const V27_HEIGHT = 52500;
71
+ declare const V26_HEIGHT = 46480;
72
+ declare const V27_HEIGHT = 46520;
73
73
  declare const epochOf: (height: number) => number;
74
74
  declare const claimWindowAt: (height: number) => number;
75
75
  declare const claimWindowOf: (claimUntilHeight: number) => number;
package/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ declare const DEPLOY_FEE = 100000000;
37
37
  declare const V18_HEIGHT = 40000;
38
38
  declare const NAME_FEE_SHORT_V18 = 670000000n;
39
39
  declare const NAME_FEE_V18 = 300000000n;
40
- declare const V24_HEIGHT = 49200;
40
+ declare const V24_HEIGHT = 46400;
41
41
  declare const NAME_FEE_LEN3_V24 = 1500000000n;
42
42
  declare const NAME_FEE_LEN4_V24 = 1000000000n;
43
43
  declare const NAME_FEE_MID_V24 = 500000000n;
@@ -63,13 +63,13 @@ declare const HASH_RE: RegExp;
63
63
  declare const SALT_RE: RegExp;
64
64
  declare const RESERVED_NAMES: Set<string>;
65
65
  declare const COMMIT_MAX_BLOCKS: number;
66
- declare const V25_HEIGHT = 51000;
66
+ declare const V25_HEIGHT = 46440;
67
67
  declare const REG_COMMIT_MAX_BLOCKS = 8;
68
68
  declare const REG_FINALIZE_GRACE_BLOCKS = 20;
69
69
  declare const MAX_PENDING_REG = 3;
70
70
  declare const FINALIZE_TIP_MARGIN = 2;
71
- declare const V26_HEIGHT = 51200;
72
- declare const V27_HEIGHT = 52500;
71
+ declare const V26_HEIGHT = 46480;
72
+ declare const V27_HEIGHT = 46520;
73
73
  declare const epochOf: (height: number) => number;
74
74
  declare const claimWindowAt: (height: number) => number;
75
75
  declare const claimWindowOf: (claimUntilHeight: number) => number;
package/dist/index.js CHANGED
@@ -40,7 +40,7 @@ var DEPLOY_FEE = 1e8;
40
40
  var V18_HEIGHT = 4e4;
41
41
  var NAME_FEE_SHORT_V18 = 670000000n;
42
42
  var NAME_FEE_V18 = 300000000n;
43
- var V24_HEIGHT = 49200;
43
+ var V24_HEIGHT = 46400;
44
44
  var NAME_FEE_LEN3_V24 = 1500000000n;
45
45
  var NAME_FEE_LEN4_V24 = 1000000000n;
46
46
  var NAME_FEE_MID_V24 = 500000000n;
@@ -81,13 +81,13 @@ var HASH_RE = /^0x[0-9a-f]{64}$/;
81
81
  var SALT_RE = /^[0-9a-fA-F]{16,128}$/;
82
82
  var RESERVED_NAMES = /* @__PURE__ */ new Set(["csd", "treasury", "admin", "official", "root", "www", "support"]);
83
83
  var COMMIT_MAX_BLOCKS = 8 * EPOCH_LEN;
84
- var V25_HEIGHT = 51e3;
84
+ var V25_HEIGHT = 46440;
85
85
  var REG_COMMIT_MAX_BLOCKS = 8;
86
86
  var REG_FINALIZE_GRACE_BLOCKS = 20;
87
87
  var MAX_PENDING_REG = 3;
88
88
  var FINALIZE_TIP_MARGIN = 2;
89
- var V26_HEIGHT = 51200;
90
- var V27_HEIGHT = 52500;
89
+ var V26_HEIGHT = 46480;
90
+ var V27_HEIGHT = 46520;
91
91
  var epochOf = (height) => Math.floor(height / EPOCH_LEN);
92
92
  var claimWindowAt = (height) => height >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
93
93
  var claimWindowOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inversealtruism/cairnx-core",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },