@inversealtruism/cairnx-core 0.2.4 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/CONVENTION.md +640 -24
- package/README.md +40 -14
- package/dist/index.cjs +1105 -390
- package/dist/index.d.cts +227 -3
- package/dist/index.d.ts +227 -3
- package/dist/index.js +1080 -381
- package/package.json +2 -1
- package/test/vectors/codes.json +200 -0
- package/test/vectors/events.json +70 -0
- package/test/vectors/hashes.json +47 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.7
|
|
4
|
+
|
|
5
|
+
- No state change; replay cost. `resolve()` no longer copies and walks every open offer, open bid, pending reservation
|
|
6
|
+
and recapture reservation before each event, nor every name or recapture reservation at each reveal for the
|
|
7
|
+
per-address reservation caps, nor every offer at each claim for the live-hold cap, at each bulk cancel and at each
|
|
8
|
+
displacement or recapture that voids a name's offers. `src/resolve/store.ts` holds those maps with private expiry
|
|
9
|
+
queues (`minqueue.ts`) and candidate sets (per owner, per holder, per seller and give asset, per name), and is the
|
|
10
|
+
only writer of the fields they key on (readonly to the handlers by type); each read evaluates the old walk's own
|
|
11
|
+
predicate over its candidates and applies a batch in the walk's order. The first sweep at V21 or above re-keys the
|
|
12
|
+
offers and bids anchored below V22 at their capped expiry. A sweep or a hold count at a height below an earlier
|
|
13
|
+
one's (only NaN heights reorder the replay) takes the old walk, which also serves as the reference of a check mode
|
|
14
|
+
the tests and the seal run. Nothing of it reaches the resolved state or the root exports.
|
|
15
|
+
- New root exports `applyOrder(a, b)`, the apply order of CONVENTION.md sections 3 and 33.3 (height, a block's Proposes
|
|
16
|
+
before its Attests, position, the ordinal order of the id), and `eventId(e)`, a Propose's id or an Attest's txid.
|
|
17
|
+
`resolve()` sorts with `applyOrder` and drops section 32's duplicates by `eventId`: the same comparison it made
|
|
18
|
+
before, moved out of its body, so a reader that must list events in apply order (the replica) imports it instead of
|
|
19
|
+
copying it.
|
|
20
|
+
- One run on the seal's streams on a loaded host, cairnx-core 0.2.4 against this release, in ms: 16,000 registrations
|
|
21
|
+
5,061 / 1,000; 20,000 open bids 3,494 / 364; 20,000 offers with holds 31,683 / 887; 20,000 live reservations
|
|
22
|
+
15,600 / 618; 20,000 live recaptures 22,508 / 1,872; 2,000 bulk cancels over 20,000 offers 14,230 / 523; 2,000
|
|
23
|
+
displacements over 20,000 offers 20,636 / 567. Entries visited per event stay flat as a stream doubles.
|
|
24
|
+
- Kept as 0.2.4 has them: a bulk cancel still visits the seller's matching offers a live fclaim hold freezes, on each
|
|
25
|
+
cancel while the hold lasts; below V29 a duplicated offer id applied after a same-block bulk cancel leaves the new
|
|
26
|
+
copy open with its id out of the open set, so it never expires (only a feed that repeats an event can produce it).
|
|
27
|
+
- The output does not move: `scripts/seal-differential.mjs cairnx-core-0.2.4 fc6e081` finds `canonicalState`
|
|
28
|
+
byte-identical to 0.2.4 and the whole result identical once `code` is left out, and identical to 0.2.6 with `code`,
|
|
29
|
+
over every input it had and the streams of `conformance/growth-streams.mjs` at full size.
|
|
30
|
+
|
|
31
|
+
## 0.2.6
|
|
32
|
+
|
|
33
|
+
- Stable reason codes, CONVENTION.md section 40: each entry of the applied log gains `code`, the rule that decided the
|
|
34
|
+
record, from a table of 113 (26 applied, 87 refused, 28 of them record codes; 3 caps). A code is never renamed,
|
|
35
|
+
reused or removed; the note text beside it may change, and a reader treats a code it does not know by the entry's
|
|
36
|
+
`ok`. New root exports `REASON_CODES`, `REASON_CODE_OUTCOME`, `CAP_CODES` and the types `ReasonCode`, `AppliedCode`,
|
|
37
|
+
`RefusalCode`, `RecordCode` (`src/codes.ts`). Every entry `resolve()` writes carries a code; an unparseable record's
|
|
38
|
+
entry carries its record code. Four codes guard states no event reaches (section 40.4 says why). The note texts are
|
|
39
|
+
unchanged, so a consumer that matches them keeps working; `provenOfferRefusal` returns the same strings as before.
|
|
40
|
+
- `test/vectors/codes.json`: 145 resolve cases and 50 record cases whose expected codes are written by hand in
|
|
41
|
+
`conformance/gen-codes-vectors.mjs`; together they reach the 109 codes an event can reach. The Python reference
|
|
42
|
+
writes no codes.
|
|
43
|
+
- `explainRecord(uri, payloadHash)`: `{ ok: true, record }` or `{ ok: false, code }`, the first record rule the uri
|
|
44
|
+
breaks. `parseRecord` keeps its signature and answers and shares one implementation with it. A builder that refuses
|
|
45
|
+
throws `RecordError`, an `Error` with `code`; its message is "record does not validate against CONVENTION.md (<code>)",
|
|
46
|
+
which until now ended at "CONVENTION.md".
|
|
47
|
+
- No state moves: `scripts/seal-differential.mjs` against cairnx-core 0.2.4 finds `canonicalState` byte-identical, the
|
|
48
|
+
whole result identical once `code` is left out, and `parseRecord` accepting exactly what it accepted.
|
|
49
|
+
|
|
50
|
+
## 0.2.5
|
|
51
|
+
|
|
52
|
+
- CONVENTION.md section 33, "From a block to events": the rule that turns the chain's blocks into the events
|
|
53
|
+
`resolve()` replays (membership from the activation height, first occurrence, order, field forms, the author as the
|
|
54
|
+
owner of the coin the first input spends, the byte form of an event list). It also accepts a sparse block: every
|
|
55
|
+
transaction with an app payload at its true position. Section 32's "there is no straddle case" is corrected (a
|
|
56
|
+
transaction can be mined again, in two blocks), and C3, section 3 and section 5 point at section 33.
|
|
57
|
+
- New root exports `eventOfTx`, `blockMembers`, `blockEvents` and `CAIRNX_EVENT_RULE`, with
|
|
58
|
+
`test/vectors/events.json` (40 transaction and 25 block vectors, `conformance/gen-events-vectors.mjs`), checked by
|
|
59
|
+
`test/events.test.ts` and against the Python reference by `conformance/events-crosslang.mjs`. In JavaScript a u64
|
|
60
|
+
input is a bigint in [0, 2^64) or a number that is an integer in [0, 2^53]; a number above 2^53 is refused.
|
|
61
|
+
- `resolve()`, `records.ts` and `types.ts` are unchanged, and every pinned vector and replay hash is byte-identical.
|
|
62
|
+
Section 33.2 makes normative the input form the reference service's feed has always had: the first occurrence of a
|
|
63
|
+
transaction id at every height. A reader that feeds `resolve()` every copy of a re-mined transaction can differ from
|
|
64
|
+
the reference when a copy lies below V29: a transaction mined at 87,999 and again at 88,001 is one event under
|
|
65
|
+
section 33 and two applied records under `resolve()` fed both copies. For history the case is empty: a scan of every
|
|
66
|
+
block from 29,860 to 144,400 (block hash 0x0000000000001874564bd8df5a5893040b0981d96c646e132e3598488d0411b5) on
|
|
67
|
+
2026-11-18 read 114,541 blocks and 148,395 transactions with 148,395 distinct transaction ids, so no transaction id
|
|
68
|
+
has been mined twice since activation. The script for that scan ships with the block fixture in the next slice
|
|
69
|
+
(events-rule-b).
|
|
70
|
+
- A reader that switches to `eventOfTx` sees two forms change, neither of which moves state: an expiry above 2^53 - 1
|
|
71
|
+
becomes 2^53 (resolve() refuses both alike for offers, bids and fclaims, and reads it for nothing else), and a `uri`
|
|
72
|
+
holding U+0000 has it written as U+0001 (neither form is JSON, so neither is a record).
|
|
73
|
+
- CONVENTION.md section 34, "State hash and events hash": the two hashes replicas compare at one block, and what a
|
|
74
|
+
difference in each means. New root exports `stateHash` (sha256 of `canonicalState`'s UTF-8 bytes, the digest
|
|
75
|
+
`replay-hashes.json` already pins), `eventsHashStep`, `eventsHash` and `EVENTS_HASH_START`: a running sha256 over
|
|
76
|
+
each event-holding block's height and its events' positions, transaction ids and authors. Vectors in
|
|
77
|
+
`test/vectors/hashes.json` (43 cases, and both hashes over the replay corpus at its 21 pinned heights,
|
|
78
|
+
`conformance/gen-hashes-vectors.mjs`), checked by `test/hashes.test.ts` and against the Python reference by
|
|
79
|
+
`conformance/hashes-crosslang.mjs`; the replay-hash test and `replay-corpus-crosslang.mjs` call `stateHash`.
|
|
80
|
+
- New root export `FINAL_DEPTH` = 12: how far below its tip a replica holds an epoch boundary before it publishes or
|
|
81
|
+
compares the tuple of section 34.3 there. Section 38 names it; the thresholds of section 3 (3 and 6) are display
|
|
82
|
+
conventions and are not this depth.
|
|
83
|
+
- CONVENTION.md sections 35 to 39, with no gate: other applications (record types under `cairnx:v1` reserved, an
|
|
84
|
+
application's own domain, the profile as the place for data about a name), the profile-key registry with its caps,
|
|
85
|
+
keys, reader rules and byte budget (`scripts/profile-budget.mjs` prints it), what a result proves at each of the
|
|
86
|
+
three levels, conformance, and how the rules change. No package code and no state change.
|
|
87
|
+
- cairnx-core now declares `@noble/hashes` 1.8.0, the release csd-codec already pins, for its sha256 (csd-codec
|
|
88
|
+
exports none): no new package enters an install.
|
|
89
|
+
|
|
3
90
|
## 0.2.4
|
|
4
91
|
|
|
5
92
|
- `verifyFillSpv`'s contract and comments say what its window replay decides. A grant depends on the holds granted
|