@inversealtruism/cairnx-core 0.2.7 → 0.2.9
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 +82 -0
- package/CONVENTION.md +281 -89
- package/README.md +24 -6
- package/dist/index.cjs +140 -29
- package/dist/index.d.cts +77 -3
- package/dist/index.d.ts +77 -3
- package/dist/index.js +136 -29
- package/package.json +1 -1
- package/test/vectors/cases-convention.json +2202 -0
- package/test/vectors/forward.json +16 -0
- package/test/vectors/moves.json +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,87 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
- The replay runs as a fold (one step per event, an end at the tip that alone reads the tip) and its expiry sweep
|
|
6
|
+
applies each expiry at the first height it is due, one batch per such height in ascending order, where 0.2.8 applied
|
|
7
|
+
every due expiry in one batch before each event; it does so only while each event height and the tip it has read is
|
|
8
|
+
a safe integer, and from the first value outside that domain (an input no chain produces) it runs one batch per
|
|
9
|
+
sweep, as 0.2.8 does. No rule changed. For inputs made of plain values (what JSON carries) 0.2.9 returns what 0.2.8
|
|
10
|
+
returns, and throws where 0.2.8 throws: derived in CONVENTION.md section 5 and checked by
|
|
11
|
+
`scripts/seal-differential.mjs`, which finds the whole result, codes and moves included, identical to npm's 0.2.8 on
|
|
12
|
+
each input of its differential, among them 3,000 sequences built so that offers, bids, reservations and recapture
|
|
13
|
+
reservations end between events, 3,000 whose heights, expiries and tips no chain produces (numbers that are not safe
|
|
14
|
+
integers, strings, null, booleans, arrays, objects, and also undefined and BigInts) and a dense walk of 1,699,031
|
|
15
|
+
tips. Outside plain values two inputs are known to differ: an event whose `height` is a getter that answers
|
|
16
|
+
differently on later reads (0.2.8 applies the event, 0.2.9 skips it, since the fold reads the height once more), and
|
|
17
|
+
an events array with an `undefined` entry after an event whose handler throws (both throw a TypeError, with another
|
|
18
|
+
text; `test/fold.test.ts`). Heights and the tip are consensus only as a chain produces them, non-negative integers
|
|
19
|
+
below 2^53: outside that, released cores answer differently (0.2.4 and 0.2.7 on a string height), so a caller checks
|
|
20
|
+
them before the call. No export changed. `conformance/fuzz-resolve.mjs` checks the property of section 5 in the
|
|
21
|
+
Python reference by adding events that write nothing, and gains `--expiry` and `--malformed` with a floor per kind
|
|
22
|
+
and per type; `test/sweep.test.ts` pins twelve constructed streams; check mode asserts that each expiry lands at the
|
|
23
|
+
first height it is due.
|
|
24
|
+
|
|
25
|
+
## 0.2.8
|
|
26
|
+
|
|
27
|
+
- Token moves in the applied log (CONVENTION section 41, no gate): an applied mint, transfer or fill that moved tokens
|
|
28
|
+
carries `moves`, each `{ leg, ticker, from, to, amount }` (`TokenMove`, legs `mint`, `xfer`, `sale`, `fee` and
|
|
29
|
+
`fill`), written by the line that applies the balance change in `src/resolve/tokens.ts` and `src/resolve/attest.ts`.
|
|
30
|
+
A server that credits token deposits, or a replica that lists transfers, reads a capped mint's credit, a partial
|
|
31
|
+
fill's delivered units, a sale and its fee from the log instead of restating the rules that decide them. A zero
|
|
32
|
+
amount writes no move, a refused entry none, and `moves` is an entry's last key. No rule changed: canonical state,
|
|
33
|
+
`stateHash`, `eventsHash`, every pinned vector and `replay-hashes.json` are unchanged, and the log with `moves` left
|
|
34
|
+
out is 0.2.7's (`scripts/seal-differential.mjs` against npm's 0.2.7 and 0.2.4). `test/vectors/moves.json` (13 cases,
|
|
35
|
+
`conformance/gen-moves-vectors.mjs`, expectations written by hand) pins them; `conformance/moves-check.mjs` checks,
|
|
36
|
+
from the input events and the result, the identity (for every ticker and address, received less sent equals
|
|
37
|
+
available plus locked), each transfer's and mint's move against its own record and each fill's moves against its
|
|
38
|
+
fill record, run by `test/moves.test.ts` over the replay corpus at every pinned height and every case file, and by
|
|
39
|
+
the seal over every input of its differential.
|
|
40
|
+
- `CAIRNX_CORE_VERSION` (`src/version.ts`), this package's version, kept equal to package.json's by
|
|
41
|
+
`test/version.test.ts`: a host hands it to cairnx-api's `prepareView` without reading the manifest at run time.
|
|
42
|
+
- `GATE_HEIGHTS` (`src/gates.ts`), the gate table as frozen data: `ACTIVATION_HEIGHT` and every `V<n>_HEIGHT` by its
|
|
43
|
+
exported name, built from the constants of `types.ts`, which are unchanged; `test/gates.test.ts` keeps it equal to
|
|
44
|
+
the individual exports and complete. A reader that compares gate tables (the replica, a witness) imports it.
|
|
45
|
+
- Forward resolution is a root export, moved from the reference service without a change to its body: `resolveNameIn(names,
|
|
46
|
+
name)` answers `{ name, addr, via, lapsed, owner }` for the name's `nset` address, else its owner, with `lapsed` from
|
|
47
|
+
the name's `expired`, and null for an absent name or a pending reservation; `nameView(names, name)` gives the class a
|
|
48
|
+
reader shows (`held`, `pending`, `lapsed`, `free`, `reserved`), the owner, and a held name's address and profile
|
|
49
|
+
(CONVENTION section 35.3), or null for a string that is not a name. Both live in `src/forward.ts` and read `names`
|
|
50
|
+
only; that change left `resolve.ts`, `resolve/`, `records.ts` and `types.ts` as they were in 0.2.7. CONVENTION.md section 35.4
|
|
51
|
+
states the rule, and section 36.3 now says a name pays to its `addr`, else its owner, which is what the reference
|
|
52
|
+
service answers. `test/vectors/forward.json` (14 cases, `conformance/gen-forward-vectors.mjs`, expectations written
|
|
53
|
+
by hand) pins both functions; `test/forward.test.ts` replays it and compares the service's call shape with an oracle
|
|
54
|
+
over every name of the replay corpus at each pinned height.
|
|
55
|
+
- CONVENTION.md corrected to match the implementation; no behaviour changed (that change touched neither `src/` nor
|
|
56
|
+
`dist/`; every pinned replay hash and existing vector byte-identical). It now states: what a pending reservation refuses and how
|
|
57
|
+
it is materialized (sections 9, 17, 22, 28); the expiry sweep before each event and at `tipHeight + 1`, and that a
|
|
58
|
+
name's `expired` is read at the tip's epoch (section 5); the zero-delivery partial fill (12); the commit height as
|
|
59
|
+
the first anchoring of its hash, the salt form and the reveal's own position and id as the contest key (9, 28, 29);
|
|
60
|
+
the lowercase form of record hashes (3, 13, 18); the bid link and `done` (13); a token-priced offer's `"0"` price
|
|
61
|
+
(3, 11); the recapture premium as the integer staircase `1 + floor(19 * (720 - e) / 720)` and the recaptured
|
|
62
|
+
record's anchor (17, 29). Corrected sentences: `feesPaid` counts the fees applied records owed (10); a whole fill's
|
|
63
|
+
`paid` is what it paid to payto, and a completed partial offer's `fill` carries `got` (5, A3); the claim fields stay
|
|
64
|
+
after the hold and the offer end (20, A4); offers below 29 960 carry `feeBps` 0 (19); a same-block re-post of what
|
|
65
|
+
an `ocancel` releases is refused from V14, and section 16 no longer says the case cannot occur on chain (12b, 16);
|
|
66
|
+
the fclaim grant checks the expiry's 2^53 bound first and its order decides only the reason code (31); a list
|
|
67
|
+
holding a transaction id at two places with the first copy below V29 is not a list section 33 produces, no
|
|
68
|
+
conformance level covers it and the two reference implementations differ there (32); an un-finalized reservation
|
|
69
|
+
is gone from the state at a tip equal to `finalizeBy` (28); one key can anchor several records in one block (6,
|
|
70
|
+
16); the state's key order puts array-index keys first (5), the field lists of section 5 and A3/A4 are complete,
|
|
71
|
+
and `FILL_UNDERPAID`, `FILL_REBATE_UNPAID` and `TREASURY_FEE_UNPAID` say what they mean on the rebate lane (40.4).
|
|
72
|
+
README.md gives the recapture premium as 19x stepping down to 1x over about 28 days, where it said 20x to 1x over
|
|
73
|
+
about 30.
|
|
74
|
+
- `test/vectors/cases-convention.json` (16 vectors, `conformance/gen-convention-vectors.mjs`) pins those rules and
|
|
75
|
+
three the text stated that no vector pinned (`feeBps` 0 below 29 960, a CSD-priced offer wanting `"0"`, and a bid
|
|
76
|
+
anchored after the offer that names it ending `done` with empty `offers`), each in a vector an implementation of
|
|
77
|
+
the earlier text fails; replayed by `test/vectors.test.ts`, against the Python
|
|
78
|
+
reference by `conformance/crosscheck-resolve.mjs`, and by the seal, which pins the file's sha256. A file of its own
|
|
79
|
+
keeps the three case files the seal freezes at their bytes.
|
|
80
|
+
- `test/holdcount.test.ts`: the honest path of `countOtherHoldsAtGrant`'s skip of the buyer's closed holds, with the
|
|
81
|
+
call shape the site and wallet send (`closed` from `myProvenFillClosedOffer`, the count into `verifyFillSpv`): three
|
|
82
|
+
completed fclaim buys inside one hold window, then a fourth, counted 0 and safe to fill. No test passed `closed`
|
|
83
|
+
before.
|
|
84
|
+
|
|
3
85
|
## 0.2.7
|
|
4
86
|
|
|
5
87
|
- No state change; replay cost. `resolve()` no longer copies and walks every open offer, open bid, pending reservation
|