@optimystic/db-core 0.14.1 → 0.16.2

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.
Files changed (301) hide show
  1. package/dist/src/blocks/block-store.d.ts +18 -1
  2. package/dist/src/blocks/block-store.d.ts.map +1 -1
  3. package/dist/src/blocks/helpers.d.ts +2 -2
  4. package/dist/src/blocks/helpers.d.ts.map +1 -1
  5. package/dist/src/blocks/helpers.js +2 -2
  6. package/dist/src/blocks/helpers.js.map +1 -1
  7. package/dist/src/btree/btree.d.ts +27 -6
  8. package/dist/src/btree/btree.d.ts.map +1 -1
  9. package/dist/src/btree/btree.js +104 -61
  10. package/dist/src/btree/btree.js.map +1 -1
  11. package/dist/src/chain/chain.d.ts.map +1 -1
  12. package/dist/src/chain/chain.js +11 -1
  13. package/dist/src/chain/chain.js.map +1 -1
  14. package/dist/src/cluster/index.d.ts +1 -0
  15. package/dist/src/cluster/index.d.ts.map +1 -1
  16. package/dist/src/cluster/index.js +1 -0
  17. package/dist/src/cluster/index.js.map +1 -1
  18. package/dist/src/cluster/membership.d.ts +49 -0
  19. package/dist/src/cluster/membership.d.ts.map +1 -0
  20. package/dist/src/cluster/membership.js +75 -0
  21. package/dist/src/cluster/membership.js.map +1 -0
  22. package/dist/src/cluster/structs.d.ts +50 -1
  23. package/dist/src/cluster/structs.d.ts.map +1 -1
  24. package/dist/src/cluster/structs.js +9 -1
  25. package/dist/src/cluster/structs.js.map +1 -1
  26. package/dist/src/cohort-topic/addressing.d.ts +8 -2
  27. package/dist/src/cohort-topic/addressing.d.ts.map +1 -1
  28. package/dist/src/cohort-topic/addressing.js +11 -3
  29. package/dist/src/cohort-topic/addressing.js.map +1 -1
  30. package/dist/src/cohort-topic/antidos/bootstrap-evidence.d.ts +13 -7
  31. package/dist/src/cohort-topic/antidos/bootstrap-evidence.d.ts.map +1 -1
  32. package/dist/src/cohort-topic/antidos/bootstrap-evidence.js +17 -6
  33. package/dist/src/cohort-topic/antidos/bootstrap-evidence.js.map +1 -1
  34. package/dist/src/cohort-topic/antidos/replay-guard.d.ts +17 -0
  35. package/dist/src/cohort-topic/antidos/replay-guard.d.ts.map +1 -1
  36. package/dist/src/cohort-topic/antidos/replay-guard.js +33 -0
  37. package/dist/src/cohort-topic/antidos/replay-guard.js.map +1 -1
  38. package/dist/src/cohort-topic/antidos/topic-budget.d.ts +7 -0
  39. package/dist/src/cohort-topic/antidos/topic-budget.d.ts.map +1 -1
  40. package/dist/src/cohort-topic/antidos/topic-budget.js +8 -2
  41. package/dist/src/cohort-topic/antidos/topic-budget.js.map +1 -1
  42. package/dist/src/cohort-topic/coldstart.d.ts +34 -14
  43. package/dist/src/cohort-topic/coldstart.d.ts.map +1 -1
  44. package/dist/src/cohort-topic/coldstart.js +25 -11
  45. package/dist/src/cohort-topic/coldstart.js.map +1 -1
  46. package/dist/src/cohort-topic/gossip/bus.d.ts +12 -1
  47. package/dist/src/cohort-topic/gossip/bus.d.ts.map +1 -1
  48. package/dist/src/cohort-topic/gossip/bus.js +27 -1
  49. package/dist/src/cohort-topic/gossip/bus.js.map +1 -1
  50. package/dist/src/cohort-topic/gossip/view.d.ts +8 -0
  51. package/dist/src/cohort-topic/gossip/view.d.ts.map +1 -1
  52. package/dist/src/cohort-topic/gossip/view.js +17 -1
  53. package/dist/src/cohort-topic/gossip/view.js.map +1 -1
  54. package/dist/src/cohort-topic/member-engine.d.ts +10 -3
  55. package/dist/src/cohort-topic/member-engine.d.ts.map +1 -1
  56. package/dist/src/cohort-topic/member-engine.js +29 -14
  57. package/dist/src/cohort-topic/member-engine.js.map +1 -1
  58. package/dist/src/cohort-topic/membership/publisher.d.ts +14 -7
  59. package/dist/src/cohort-topic/membership/publisher.d.ts.map +1 -1
  60. package/dist/src/cohort-topic/membership/publisher.js +15 -27
  61. package/dist/src/cohort-topic/membership/publisher.js.map +1 -1
  62. package/dist/src/cohort-topic/membership/verifier.d.ts +35 -0
  63. package/dist/src/cohort-topic/membership/verifier.d.ts.map +1 -1
  64. package/dist/src/cohort-topic/membership/verifier.js +88 -3
  65. package/dist/src/cohort-topic/membership/verifier.js.map +1 -1
  66. package/dist/src/cohort-topic/promotion.d.ts +7 -0
  67. package/dist/src/cohort-topic/promotion.d.ts.map +1 -1
  68. package/dist/src/cohort-topic/promotion.js +16 -2
  69. package/dist/src/cohort-topic/promotion.js.map +1 -1
  70. package/dist/src/cohort-topic/registration/renewal.d.ts +18 -0
  71. package/dist/src/cohort-topic/registration/renewal.d.ts.map +1 -1
  72. package/dist/src/cohort-topic/registration/renewal.js +54 -0
  73. package/dist/src/cohort-topic/registration/renewal.js.map +1 -1
  74. package/dist/src/cohort-topic/registration/types.d.ts +12 -0
  75. package/dist/src/cohort-topic/registration/types.d.ts.map +1 -1
  76. package/dist/src/cohort-topic/registration/types.js +14 -0
  77. package/dist/src/cohort-topic/registration/types.js.map +1 -1
  78. package/dist/src/cohort-topic/service.d.ts +4 -3
  79. package/dist/src/cohort-topic/service.d.ts.map +1 -1
  80. package/dist/src/cohort-topic/service.js +38 -12
  81. package/dist/src/cohort-topic/service.js.map +1 -1
  82. package/dist/src/cohort-topic/sig/payloads.d.ts +23 -7
  83. package/dist/src/cohort-topic/sig/payloads.d.ts.map +1 -1
  84. package/dist/src/cohort-topic/sig/payloads.js +22 -6
  85. package/dist/src/cohort-topic/sig/payloads.js.map +1 -1
  86. package/dist/src/cohort-topic/traffic.d.ts +6 -0
  87. package/dist/src/cohort-topic/traffic.d.ts.map +1 -1
  88. package/dist/src/cohort-topic/traffic.js +16 -1
  89. package/dist/src/cohort-topic/traffic.js.map +1 -1
  90. package/dist/src/cohort-topic/walk.d.ts +22 -7
  91. package/dist/src/cohort-topic/walk.d.ts.map +1 -1
  92. package/dist/src/cohort-topic/walk.js +78 -18
  93. package/dist/src/cohort-topic/walk.js.map +1 -1
  94. package/dist/src/cohort-topic/wire/codec.d.ts +3 -1
  95. package/dist/src/cohort-topic/wire/codec.d.ts.map +1 -1
  96. package/dist/src/cohort-topic/wire/codec.js +7 -1
  97. package/dist/src/cohort-topic/wire/codec.js.map +1 -1
  98. package/dist/src/cohort-topic/wire/index.d.ts +1 -1
  99. package/dist/src/cohort-topic/wire/index.d.ts.map +1 -1
  100. package/dist/src/cohort-topic/wire/index.js +1 -1
  101. package/dist/src/cohort-topic/wire/index.js.map +1 -1
  102. package/dist/src/cohort-topic/wire/payloads.d.ts +5 -4
  103. package/dist/src/cohort-topic/wire/payloads.d.ts.map +1 -1
  104. package/dist/src/cohort-topic/wire/payloads.js +14 -5
  105. package/dist/src/cohort-topic/wire/payloads.js.map +1 -1
  106. package/dist/src/cohort-topic/wire/primitives.d.ts +65 -0
  107. package/dist/src/cohort-topic/wire/primitives.d.ts.map +1 -0
  108. package/dist/src/cohort-topic/wire/primitives.js +173 -0
  109. package/dist/src/cohort-topic/wire/primitives.js.map +1 -0
  110. package/dist/src/cohort-topic/wire/types.d.ts +132 -5
  111. package/dist/src/cohort-topic/wire/types.d.ts.map +1 -1
  112. package/dist/src/cohort-topic/wire/validate.d.ts +15 -5
  113. package/dist/src/cohort-topic/wire/validate.d.ts.map +1 -1
  114. package/dist/src/cohort-topic/wire/validate.js +146 -123
  115. package/dist/src/cohort-topic/wire/validate.js.map +1 -1
  116. package/dist/src/collection/collection.d.ts +23 -12
  117. package/dist/src/collection/collection.d.ts.map +1 -1
  118. package/dist/src/collection/collection.js +111 -35
  119. package/dist/src/collection/collection.js.map +1 -1
  120. package/dist/src/collection/struct.d.ts +37 -2
  121. package/dist/src/collection/struct.d.ts.map +1 -1
  122. package/dist/src/collection/struct.js +16 -1
  123. package/dist/src/collection/struct.js.map +1 -1
  124. package/dist/src/collections/tree/tree.d.ts +18 -1
  125. package/dist/src/collections/tree/tree.d.ts.map +1 -1
  126. package/dist/src/collections/tree/tree.js +36 -6
  127. package/dist/src/collections/tree/tree.js.map +1 -1
  128. package/dist/src/index.d.ts +1 -0
  129. package/dist/src/index.d.ts.map +1 -1
  130. package/dist/src/index.js +1 -0
  131. package/dist/src/index.js.map +1 -1
  132. package/dist/src/log/log.d.ts +26 -3
  133. package/dist/src/log/log.d.ts.map +1 -1
  134. package/dist/src/log/log.js +34 -7
  135. package/dist/src/log/log.js.map +1 -1
  136. package/dist/src/log/struct.d.ts +5 -4
  137. package/dist/src/log/struct.d.ts.map +1 -1
  138. package/dist/src/log/struct.js.map +1 -1
  139. package/dist/src/matchmaking/wire.d.ts +2 -1
  140. package/dist/src/matchmaking/wire.d.ts.map +1 -1
  141. package/dist/src/matchmaking/wire.js +13 -92
  142. package/dist/src/matchmaking/wire.js.map +1 -1
  143. package/dist/src/network/i-key-network.d.ts +9 -0
  144. package/dist/src/network/i-key-network.d.ts.map +1 -1
  145. package/dist/src/network/i-repo.d.ts +8 -0
  146. package/dist/src/network/i-repo.d.ts.map +1 -1
  147. package/dist/src/network/struct.d.ts +10 -0
  148. package/dist/src/network/struct.d.ts.map +1 -1
  149. package/dist/src/reactivity/push-state.d.ts.map +1 -1
  150. package/dist/src/reactivity/push-state.js +4 -33
  151. package/dist/src/reactivity/push-state.js.map +1 -1
  152. package/dist/src/reactivity/wire-validate.d.ts +7 -22
  153. package/dist/src/reactivity/wire-validate.d.ts.map +1 -1
  154. package/dist/src/reactivity/wire-validate.js +7 -73
  155. package/dist/src/reactivity/wire-validate.js.map +1 -1
  156. package/dist/src/reactivity/wire.js +3 -3
  157. package/dist/src/reactivity/wire.js.map +1 -1
  158. package/dist/src/testing/async-wait.d.ts +23 -0
  159. package/dist/src/testing/async-wait.d.ts.map +1 -0
  160. package/dist/src/testing/async-wait.js +42 -0
  161. package/dist/src/testing/async-wait.js.map +1 -0
  162. package/dist/src/testing/index.d.ts +3 -0
  163. package/dist/src/testing/index.d.ts.map +1 -0
  164. package/dist/src/testing/index.js +3 -0
  165. package/dist/src/testing/index.js.map +1 -0
  166. package/dist/src/testing/test-transactor.d.ts +44 -0
  167. package/dist/src/testing/test-transactor.d.ts.map +1 -0
  168. package/dist/src/testing/test-transactor.js +423 -0
  169. package/dist/src/testing/test-transactor.js.map +1 -0
  170. package/dist/src/transaction/actions-engine.d.ts +6 -3
  171. package/dist/src/transaction/actions-engine.d.ts.map +1 -1
  172. package/dist/src/transaction/actions-engine.js +8 -7
  173. package/dist/src/transaction/actions-engine.js.map +1 -1
  174. package/dist/src/transaction/coordinator.d.ts +43 -22
  175. package/dist/src/transaction/coordinator.d.ts.map +1 -1
  176. package/dist/src/transaction/coordinator.js +443 -178
  177. package/dist/src/transaction/coordinator.js.map +1 -1
  178. package/dist/src/transaction/errors.d.ts +82 -0
  179. package/dist/src/transaction/errors.d.ts.map +1 -0
  180. package/dist/src/transaction/errors.js +93 -0
  181. package/dist/src/transaction/errors.js.map +1 -0
  182. package/dist/src/transaction/index.d.ts +6 -3
  183. package/dist/src/transaction/index.d.ts.map +1 -1
  184. package/dist/src/transaction/index.js +4 -2
  185. package/dist/src/transaction/index.js.map +1 -1
  186. package/dist/src/transaction/operations-hash.d.ts +119 -0
  187. package/dist/src/transaction/operations-hash.d.ts.map +1 -0
  188. package/dist/src/transaction/operations-hash.js +180 -0
  189. package/dist/src/transaction/operations-hash.js.map +1 -0
  190. package/dist/src/transaction/read-dependency-collector.d.ts +43 -0
  191. package/dist/src/transaction/read-dependency-collector.d.ts.map +1 -0
  192. package/dist/src/transaction/read-dependency-collector.js +69 -0
  193. package/dist/src/transaction/read-dependency-collector.js.map +1 -0
  194. package/dist/src/transaction/session.d.ts +12 -3
  195. package/dist/src/transaction/session.d.ts.map +1 -1
  196. package/dist/src/transaction/session.js +35 -9
  197. package/dist/src/transaction/session.js.map +1 -1
  198. package/dist/src/transaction/transaction.d.ts +162 -1
  199. package/dist/src/transaction/transaction.d.ts.map +1 -1
  200. package/dist/src/transaction/transaction.js +85 -3
  201. package/dist/src/transaction/transaction.js.map +1 -1
  202. package/dist/src/transaction/validator.d.ts +3 -11
  203. package/dist/src/transaction/validator.d.ts.map +1 -1
  204. package/dist/src/transaction/validator.js +69 -28
  205. package/dist/src/transaction/validator.js.map +1 -1
  206. package/dist/src/transactor/network-transactor.d.ts +35 -0
  207. package/dist/src/transactor/network-transactor.d.ts.map +1 -1
  208. package/dist/src/transactor/network-transactor.js +146 -40
  209. package/dist/src/transactor/network-transactor.js.map +1 -1
  210. package/dist/src/transactor/transactor-source.d.ts +19 -5
  211. package/dist/src/transactor/transactor-source.d.ts.map +1 -1
  212. package/dist/src/transactor/transactor-source.js +43 -11
  213. package/dist/src/transactor/transactor-source.js.map +1 -1
  214. package/dist/src/transform/atomic-proxy.d.ts +35 -5
  215. package/dist/src/transform/atomic-proxy.d.ts.map +1 -1
  216. package/dist/src/transform/atomic-proxy.js +39 -7
  217. package/dist/src/transform/atomic-proxy.js.map +1 -1
  218. package/dist/src/transform/cache-source.d.ts +36 -5
  219. package/dist/src/transform/cache-source.d.ts.map +1 -1
  220. package/dist/src/transform/cache-source.js +84 -8
  221. package/dist/src/transform/cache-source.js.map +1 -1
  222. package/dist/src/transform/helpers.d.ts.map +1 -1
  223. package/dist/src/transform/helpers.js +8 -2
  224. package/dist/src/transform/helpers.js.map +1 -1
  225. package/dist/src/transform/tracker.d.ts +17 -2
  226. package/dist/src/transform/tracker.d.ts.map +1 -1
  227. package/dist/src/transform/tracker.js +66 -11
  228. package/dist/src/transform/tracker.js.map +1 -1
  229. package/dist/src/utility/backoff.d.ts +48 -0
  230. package/dist/src/utility/backoff.d.ts.map +1 -0
  231. package/dist/src/utility/backoff.js +60 -0
  232. package/dist/src/utility/backoff.js.map +1 -0
  233. package/dist/src/utility/pending.d.ts +1 -0
  234. package/dist/src/utility/pending.d.ts.map +1 -1
  235. package/dist/src/utility/pending.js +3 -1
  236. package/dist/src/utility/pending.js.map +1 -1
  237. package/package.json +4 -4
  238. package/src/blocks/block-store.ts +19 -1
  239. package/src/blocks/helpers.ts +3 -3
  240. package/src/btree/btree.ts +108 -63
  241. package/src/chain/chain.ts +11 -1
  242. package/src/cluster/index.ts +1 -0
  243. package/src/cluster/membership.ts +85 -0
  244. package/src/cluster/structs.ts +51 -1
  245. package/src/cohort-topic/addressing.ts +12 -4
  246. package/src/cohort-topic/antidos/bootstrap-evidence.ts +21 -9
  247. package/src/cohort-topic/antidos/replay-guard.ts +37 -0
  248. package/src/cohort-topic/antidos/topic-budget.ts +17 -2
  249. package/src/cohort-topic/coldstart.ts +48 -15
  250. package/src/cohort-topic/gossip/bus.ts +39 -2
  251. package/src/cohort-topic/gossip/view.ts +26 -1
  252. package/src/cohort-topic/member-engine.ts +36 -15
  253. package/src/cohort-topic/membership/publisher.ts +25 -33
  254. package/src/cohort-topic/membership/verifier.ts +119 -3
  255. package/src/cohort-topic/promotion.ts +23 -2
  256. package/src/cohort-topic/registration/renewal.ts +73 -1
  257. package/src/cohort-topic/registration/types.ts +15 -0
  258. package/src/cohort-topic/service.ts +41 -15
  259. package/src/cohort-topic/sig/payloads.ts +29 -9
  260. package/src/cohort-topic/traffic.ts +23 -1
  261. package/src/cohort-topic/walk.ts +95 -24
  262. package/src/cohort-topic/wire/codec.ts +12 -0
  263. package/src/cohort-topic/wire/index.ts +2 -0
  264. package/src/cohort-topic/wire/payloads.ts +14 -5
  265. package/src/cohort-topic/wire/primitives.ts +188 -0
  266. package/src/cohort-topic/wire/types.ts +136 -4
  267. package/src/cohort-topic/wire/validate.ts +168 -134
  268. package/src/collection/collection.ts +123 -40
  269. package/src/collection/struct.ts +44 -2
  270. package/src/collections/tree/tree.ts +42 -5
  271. package/src/index.ts +1 -0
  272. package/src/log/log.ts +37 -9
  273. package/src/log/struct.ts +5 -4
  274. package/src/matchmaking/wire.ts +25 -102
  275. package/src/network/i-key-network.ts +10 -0
  276. package/src/network/i-repo.ts +8 -0
  277. package/src/network/struct.ts +10 -0
  278. package/src/reactivity/push-state.ts +4 -37
  279. package/src/reactivity/wire-validate.ts +7 -81
  280. package/src/reactivity/wire.ts +3 -3
  281. package/src/testing/async-wait.ts +65 -0
  282. package/src/testing/index.ts +2 -0
  283. package/src/testing/test-transactor.ts +468 -0
  284. package/src/transaction/actions-engine.ts +8 -6
  285. package/src/transaction/coordinator.ts +498 -229
  286. package/src/transaction/errors.ts +91 -0
  287. package/src/transaction/index.ts +23 -3
  288. package/src/transaction/operations-hash.ts +196 -0
  289. package/src/transaction/read-dependency-collector.ts +78 -0
  290. package/src/transaction/session.ts +37 -9
  291. package/src/transaction/transaction.ts +211 -4
  292. package/src/transaction/validator.ts +73 -48
  293. package/src/transactor/network-transactor.ts +164 -49
  294. package/src/transactor/transactor-source.ts +47 -12
  295. package/src/transform/atomic-proxy.ts +92 -49
  296. package/src/transform/cache-source.ts +87 -9
  297. package/src/transform/helpers.ts +8 -2
  298. package/src/transform/tracker.ts +69 -11
  299. package/src/utility/backoff.ts +95 -0
  300. package/src/utility/pending.ts +3 -1
  301. package/src/transaction/context.ts +0 -103
@@ -27,6 +27,20 @@ export interface RegisterV1 {
27
27
  ttl: number;
28
28
  /** True on a root cold-start request. */
29
29
  bootstrap?: boolean;
30
+ /**
31
+ * Follow-on cold-start request: set on the **dedicated re-issue** the participant sends after a
32
+ * `Promoted` redirect target answered {@link RegisterResult} `no_state` (the redirect points at a
33
+ * tier-`(d+1)` child cohort that does not exist yet). It tells that cold child "I am here because
34
+ * your parent redirected me — instantiate", which drives the cold-start gate
35
+ * (`shouldInstantiate({ followOn, … })`) exactly as `bootstrap` drives it at the root. Constraints:
36
+ * always `treeTier >= 1` (a follow-on is a deeper-than-root growth point, never the root); mutually
37
+ * exclusive with {@link bootstrap} and {@link probe} (the walk sets at most one). Because a wire flag is
38
+ * participant-forgeable, safety does NOT come from its provenance: a `followOn: true` register is gated
39
+ * by the **same** `bootstrapEvidence` policy a `bootstrap: true` cold-root register passes (§Anti-DoS),
40
+ * so it carries the identical proof in {@link bootstrapEvidence} and pays the identical anti-abuse cost.
41
+ * Covered by `signature` (appended to `registerSigningPayload`) so a MITM cannot strip or flip it.
42
+ */
43
+ followOn?: boolean;
30
44
  /**
31
45
  * Read-only lookup probe: classify + return the cohort snapshot without admitting (no record, no
32
46
  * arrival, no promotion trigger, no topic-budget touch, and **never** a cold-start instantiation /
@@ -41,9 +55,11 @@ export interface RegisterV1 {
41
55
  appPayload?: string;
42
56
  /**
43
57
  * Cold-start bootstrap-evidence envelope, base64url (a `BootstrapEvidenceEnvelopeV1` — see
44
- * `../antidos/bootstrap-evidence-envelope.js`). Present only on a `bootstrap: true` root register;
45
- * carries the tier-dependent proof a cold root demands (proof-of-work / reputation endorsement /
46
- * signed parent reference — §Anti-DoS). This is a **dedicated** field, NOT `appPayload`: the cohort
58
+ * `../antidos/bootstrap-evidence-envelope.js`). Present on a `bootstrap: true` root register **or** a
59
+ * `followOn: true` deeper-tier re-issue both are cold-start requests gated by the identical evidence
60
+ * policy (§Anti-DoS), so both carry this proof; carries the tier-dependent proof a cold cohort demands
61
+ * (proof-of-work / reputation endorsement / signed parent reference — §Anti-DoS). This is a
62
+ * **dedicated** field, NOT `appPayload`: the cohort
47
63
  * copies `appPayload` verbatim into the registration's `appState` and replicates it cluster-wide,
48
64
  * whereas the bootstrap evidence is parsed-and-checked by the substrate, **covered by `signature`**
49
65
  * (so a MITM cannot strip or swap it), and never stored as appState. Empty string is treated as
@@ -126,6 +142,51 @@ export interface RenewReplyV1 {
126
142
  newBackups?: string[];
127
143
  cohortEpoch?: string;
128
144
  }
145
+ /**
146
+ * Child cohort → parent cohort link: "I am the tier-`d` cohort at {@link childCohortCoord}; record me as
147
+ * your child." A freshly cold-started deeper forwarder sends this to its tier-`(d − 1)` parent (routed the
148
+ * same way a participant register is, over `routeAndAct` to the parent coord) so the parent authenticates,
149
+ * records the child, and acks — replacing the interim plain participant-register the child used to send.
150
+ */
151
+ export interface ChildLinkV1 {
152
+ v: 1;
153
+ /** Topic id, 32 bytes, base64url. */
154
+ topicId: string;
155
+ /**
156
+ * The child cohort's served coord `coord_d(childParticipantCoord, topicId)`, 32 bytes base64url — the
157
+ * coord the parent verifies the threshold signature against (it looks up the child cohort's
158
+ * {@link MembershipCertV1} at this coord).
159
+ */
160
+ childCohortCoord: string;
161
+ /**
162
+ * A representative participant coord in the child's prefix-shard (the seed the child engine was
163
+ * instantiated at). Lets the parent *deterministically bind the parent-child relationship*: it recomputes
164
+ * `coord_childTier(childParticipantCoord, topicId) == childCohortCoord` AND
165
+ * `coord_(childTier-1)(childParticipantCoord, topicId) == this parent's served coord`. Any participant
166
+ * sharing the child's `d·log₂F`-bit prefix yields the same pair, so it is a representative, not an
167
+ * identity. 32 bytes base64url.
168
+ */
169
+ childParticipantCoord: string;
170
+ /** Child tree tier `d` (always ≥ 1 — the root has no parent to link to). Parent serves `d − 1`. */
171
+ childTier: number;
172
+ /** Op capacity tier T0..T3 (stamped so a real parent validates the frame's tier). */
173
+ tier: number;
174
+ /** Unix ms; the parent's per-child freshness/ordering key (strictly-newer wins). */
175
+ effectiveAt: number;
176
+ /** Child cohort threshold signature over `childLinkSigningPayload`, base64url. Empty in the key-less interim. */
177
+ thresholdSig: string;
178
+ /** Signing members' PeerIds, `>= minSigs`, base64url. Empty in the key-less interim. */
179
+ signers: string[];
180
+ /** Child cohort epoch, 32 bytes base64url (the epoch the threshold sig was collected under). */
181
+ cohortEpoch: string;
182
+ }
183
+ /** Parent → child ack. `linked` flips the child `awaiting_parent → serving`; `rejected` keeps it awaiting. */
184
+ export interface ChildLinkReplyV1 {
185
+ v: 1;
186
+ result: "linked" | "rejected";
187
+ /** Human-readable, optional. */
188
+ reason?: string;
189
+ }
129
190
  /** Threshold-signed promotion notice. */
130
191
  export interface PromotionNoticeV1 {
131
192
  v: 1;
@@ -133,6 +194,15 @@ export interface PromotionNoticeV1 {
133
194
  fromTier: number;
134
195
  /** Typically `fromTier + 1`. */
135
196
  toTier: number;
197
+ /**
198
+ * The served coord `coord_d(participantCoord, topicId)` the deciding cohort sits at, 32 bytes, base64url
199
+ * — the same value as that cohort's {@link MembershipCertV1.cohortCoord}, which the threshold signature
200
+ * verifies against. The receiver routes the notice to the local engine for exactly this coord rather than
201
+ * scanning for the first engine matching `(topic, tier)`, so a node serving several sibling cohorts for
202
+ * one `(topic, tier)` (possible at `d ≥ 1`, where each cohort has its own served coord) applies the notice
203
+ * to the cohort that actually produced it. Covered by the threshold signature — rewriting it breaks verification.
204
+ */
205
+ cohortCoord: string;
136
206
  /** Unix ms. */
137
207
  effectiveAt: number;
138
208
  /** Cohort threshold signature, base64url. */
@@ -148,6 +218,13 @@ export interface DemotionNoticeV1 {
148
218
  tier: number;
149
219
  /** 32 bytes, base64url. */
150
220
  parentCohortCoord: string;
221
+ /**
222
+ * The served coord `coord_d(participantCoord, topicId)` the deciding cohort sits at, 32 bytes, base64url —
223
+ * the same served-coord concept as {@link PromotionNoticeV1.cohortCoord}. Distinct from
224
+ * {@link parentCohortCoord} (the tier-`(d − 1)` parent this demotion hands off to): `cohortCoord` names the
225
+ * *demoting* cohort and is what the receiver routes + verifies by. Covered by the threshold signature.
226
+ */
227
+ cohortCoord: string;
151
228
  effectiveAt: number;
152
229
  thresholdSig: string;
153
230
  signers: string[];
@@ -183,6 +260,32 @@ export interface GossipRecordRefV1 {
183
260
  topicId: string;
184
261
  /** Participant peer id, base64url. */
185
262
  participantId: string;
263
+ /**
264
+ * Unix ms of the evicted record's most-recent ping (mirrors {@link GossipRecordV1.lastPing}). The
265
+ * receiver's freshness guard for the delete: a held record newer than this stamp is a re-registration
266
+ * that arrived after the eviction was produced, so the stale eviction is ignored rather than deleting
267
+ * the fresh record. Required — every real eviction has this on hand from the held record.
268
+ */
269
+ lastPing: number;
270
+ }
271
+ /**
272
+ * A child-cohort link/unlink advertised in cohort gossip, for cross-member convergence of the child set.
273
+ *
274
+ * FRET routes a {@link ChildLinkV1} to a **single** parent member, so only that member's child registry
275
+ * records the child; siblings would read `childCohortCount == 0`. Gossiping the child **set** (a converged
276
+ * union) closes that gap: a `childLinks` ref replicates a recorded child to every parent member, and a
277
+ * `childUnlinks` ref replicates a released (demoted) child. Merge is **last-writer-wins by
278
+ * {@link effectiveAt}** per `(topicId, childCohortCoord)` — a link and a later unlink converge regardless of
279
+ * arrival order, and re-delivery is idempotent. The child set is keyed by child coord, not the parent's
280
+ * epoch, so a parent membership rotation never drops it.
281
+ */
282
+ export interface ChildLinkRefV1 {
283
+ /** Topic id, 32 bytes, base64url. */
284
+ topicId: string;
285
+ /** The child cohort's served coord, 32 bytes, base64url. */
286
+ childCohortCoord: string;
287
+ /** Unix ms — the link/unlink effectiveAt; last-writer-wins per `(topicId, childCohortCoord)`. */
288
+ effectiveAt: number;
186
289
  }
187
290
  /** Intra-cohort gossip: willingness vector, load barometer, exact per-topic summaries, record deltas. */
188
291
  export interface CohortGossipV1 {
@@ -196,6 +299,14 @@ export interface CohortGossipV1 {
196
299
  */
197
300
  coord: string;
198
301
  cohortEpoch: string;
302
+ /**
303
+ * The tree tier `d` the originating cohort sits at (the coord encodes the tier-shard, but a coord is a
304
+ * hash and cannot be inverted to recover `d`). Carried so a cold sibling that instantiates its engine
305
+ * off a co-member's frame (§Cold-start instantiation) adopts the right tier. Always well-defined: the
306
+ * only members that originate a frame already know their `treeTier`, and every member of a coord shares
307
+ * one `treeTier` by construction. Covered by {@link signature} so it cannot be spoofed.
308
+ */
309
+ treeTier: number;
199
310
  /** 4 bits T0..T3, hex. */
200
311
  willingnessBits: string;
201
312
  /** 4 entries, 0..7 per tier. */
@@ -211,6 +322,19 @@ export interface CohortGossipV1 {
211
322
  records?: GossipRecordV1[];
212
323
  /** Registrations this member evicted (stale), so all members converge on the active set. */
213
324
  evicted?: GossipRecordRefV1[];
325
+ /**
326
+ * Child cohorts this member freshly recorded (links), replicated so every parent member converges on the
327
+ * same child set. Absent when this gossip carries no child-link changes. Merge is last-writer-wins by
328
+ * {@link ChildLinkRefV1.effectiveAt} per `(topicId, childCohortCoord)`; a link sets the child linked.
329
+ */
330
+ childLinks?: ChildLinkRefV1[];
331
+ /**
332
+ * Child cohorts this member released (a demoted child unrecorded), replicated so every parent member drops
333
+ * it and can shrink in turn. Absent when this gossip carries no child-unlink changes. Same last-writer-wins
334
+ * merge as {@link childLinks}; an unlink sets the child unlinked. A link@t1 then unlink@t2 (t2 > t1)
335
+ * converges to unlinked regardless of arrival order.
336
+ */
337
+ childUnlinks?: ChildLinkRefV1[];
214
338
  timestamp: number;
215
339
  signature: string;
216
340
  }
@@ -234,8 +358,11 @@ export interface CohortTopicSummary {
234
358
  * - `rotation` — an epoch hand-off: the endorser attests it was a member of the cohort at the **prior**
235
359
  * epoch carried as `cohortEpoch` (the predecessor cohort threshold-signs the successor cert's payload),
236
360
  * so the gate checks *prior*-epoch membership rather than current. See `cohort-topic-trust-anchor-rotation-production`.
361
+ * - `childlink` — a child cohort signs a {@link ChildLinkV1} over its **own** served coord at its current
362
+ * epoch (identical endorsement shape to `promotion`/`demotion`: share the current cohort + epoch around
363
+ * `coord`); the parent verifies it against the child cohort's cert before recording the child.
237
364
  */
238
- export type SignKind = "membership" | "promotion" | "demotion" | "rotation";
365
+ export type SignKind = "membership" | "promotion" | "demotion" | "rotation" | "childlink";
239
366
  /**
240
367
  * Intra-cohort sign request (`/optimystic/cohort-topic/1.0.0/sign`). A member assembling a `k − x`
241
368
  * threshold signature dials each cohort member with this; the member endorses by Ed25519-signing the
@@ -300,5 +427,5 @@ export interface MembershipCertV1 {
300
427
  rotationSigners?: string[];
301
428
  }
302
429
  /** Discriminated union over every V1 message carried by the cohort-topic protocols. */
303
- export type CohortMessageV1 = RegisterV1 | RegisterReplyV1 | RenewV1 | RenewReplyV1 | PromotionNoticeV1 | DemotionNoticeV1 | CohortGossipV1 | MembershipCertV1 | SignRequestV1 | SignReplyOkV1 | SignReplyRefusedV1;
430
+ export type CohortMessageV1 = RegisterV1 | RegisterReplyV1 | RenewV1 | RenewReplyV1 | ChildLinkV1 | ChildLinkReplyV1 | PromotionNoticeV1 | DemotionNoticeV1 | CohortGossipV1 | MembershipCertV1 | SignRequestV1 | SignReplyOkV1 | SignReplyRefusedV1;
304
431
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","s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CAAC;CACf;AAED,0HAA0H;AAC1H,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAE7D,2CAA2C;AAC3C,MAAM,WAAW,gBAAgB;IAChC,CAAC,EAAE,CAAC,CAAC;IACL,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;OAQG;IACH,yGAAyG;IACzG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2GAA2G;IAC3G,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uGAAuG;IACvG,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,uFAAuF;AACvF,MAAM,MAAM,eAAe,GACxB,UAAU,GACV,eAAe,GACf,OAAO,GACP,YAAY,GACZ,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,kBAAkB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/cohort-topic/wire/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,UAAU;IAC1B,CAAC,EAAE,CAAC,CAAC;IACL,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,gBAAgB,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ,yCAAyC;IACzC,SAA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;IAClB,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;OAQG;IACH,yGAAyG;IACzG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2GAA2G;IAC3G,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uGAAuG;IACvG,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,uFAAuF;AACvF,MAAM,MAAM,eAAe,GACxB,UAAU,GACV,eAAe,GACf,OAAO,GACP,YAAY,GACZ,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,kBAAkB,CAAC"}
@@ -7,17 +7,27 @@
7
7
  * as base64url, or an out-of-range numeric. Validators never return partial data — they either
8
8
  * narrow cleanly or throw.
9
9
  */
10
- import type { CohortGossipV1, DemotionNoticeV1, MembershipCertV1, PromotionNoticeV1, RegisterReplyV1, RegisterV1, RenewReplyV1, RenewV1, SignRequestV1, SignReplyV1 } from "./types.js";
11
- /** Thrown for any malformed, oversized, or structurally invalid cohort-topic frame. */
12
- export declare class CohortWireError extends Error {
13
- constructor(message: string);
14
- }
10
+ import type { ChildLinkReplyV1, ChildLinkV1, CohortGossipV1, DemotionNoticeV1, MembershipCertV1, PromotionNoticeV1, RegisterReplyV1, RegisterV1, RenewReplyV1, RenewV1, SignRequestV1, SignReplyV1 } from "./types.js";
11
+ export { CohortWireError } from "./primitives.js";
15
12
  export declare function validateRegisterV1(value: unknown): RegisterV1;
16
13
  export declare function validateRegisterReplyV1(value: unknown): RegisterReplyV1;
17
14
  export declare function validateRenewV1(value: unknown): RenewV1;
18
15
  export declare function validateRenewReplyV1(value: unknown): RenewReplyV1;
19
16
  export declare function validatePromotionNoticeV1(value: unknown): PromotionNoticeV1;
20
17
  export declare function validateDemotionNoticeV1(value: unknown): DemotionNoticeV1;
18
+ /**
19
+ * Validate a {@link ChildLinkV1}. Enforces `childTier >= 1` (the root never links), `tier` in 0..3, and
20
+ * well-formed base64url on every byte field. The hash-derived fields (`topicId` / `childCohortCoord` /
21
+ * `cohortEpoch`) are additionally length-checked to exactly 32 bytes (each is a SHA-256 truncation); the
22
+ * `childParticipantCoord` follows the lenient `RegisterV1` convention (base64url only — a participant
23
+ * coord is not always 32 raw bytes, e.g. a multihash-encoded peer id in tests). When `minSigs`
24
+ * is supplied AND the frame carries a threshold signature (`thresholdSig` non-empty), `signers.length` must
25
+ * be `>= minSigs`; a key-less-interim frame carries neither, so that cross-field bound is skipped. `minSigs`
26
+ * is optional so a bare structural decode (no quorum context) still narrows the frame.
27
+ */
28
+ export declare function validateChildLinkV1(value: unknown, minSigs?: number): ChildLinkV1;
29
+ /** Validate a {@link ChildLinkReplyV1}: `result` in `linked | rejected`, optional human-readable `reason`. */
30
+ export declare function validateChildLinkReplyV1(value: unknown): ChildLinkReplyV1;
21
31
  export declare function validateCohortGossipV1(value: unknown): CohortGossipV1;
22
32
  export declare function validateSignRequestV1(value: unknown): SignRequestV1;
23
33
  export declare function validateSignReplyV1(value: unknown): SignReplyV1;
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/cohort-topic/wire/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EACX,cAAc,EAEd,gBAAgB,EAGhB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EAEf,UAAU,EACV,YAAY,EACZ,OAAO,EAEP,aAAa,EACb,WAAW,EAEX,MAAM,YAAY,CAAC;AAEpB,uFAAuF;AACvF,qBAAa,eAAgB,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM;CAI3B;AAmID,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAmC7D;AAcD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAuBvE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAA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