@optimystic/db-p2p 0.13.5 → 0.14.0

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 (342) hide show
  1. package/README.md +6 -6
  2. package/dist/src/cluster/block-transfer-service.d.ts +67 -8
  3. package/dist/src/cluster/block-transfer-service.d.ts.map +1 -1
  4. package/dist/src/cluster/block-transfer-service.js +101 -62
  5. package/dist/src/cluster/block-transfer-service.js.map +1 -1
  6. package/dist/src/cluster/client.d.ts +18 -1
  7. package/dist/src/cluster/client.d.ts.map +1 -1
  8. package/dist/src/cluster/client.js +55 -39
  9. package/dist/src/cluster/client.js.map +1 -1
  10. package/dist/src/cluster/cluster-error.d.ts +38 -0
  11. package/dist/src/cluster/cluster-error.d.ts.map +1 -0
  12. package/dist/src/cluster/cluster-error.js +51 -0
  13. package/dist/src/cluster/cluster-error.js.map +1 -0
  14. package/dist/src/cluster/cluster-repo.d.ts +135 -3
  15. package/dist/src/cluster/cluster-repo.d.ts.map +1 -1
  16. package/dist/src/cluster/cluster-repo.js +333 -58
  17. package/dist/src/cluster/cluster-repo.js.map +1 -1
  18. package/dist/src/cluster/commit-cert.d.ts +63 -0
  19. package/dist/src/cluster/commit-cert.d.ts.map +1 -0
  20. package/dist/src/cluster/commit-cert.js +108 -0
  21. package/dist/src/cluster/commit-cert.js.map +1 -0
  22. package/dist/src/cluster/service.d.ts +46 -11
  23. package/dist/src/cluster/service.d.ts.map +1 -1
  24. package/dist/src/cluster/service.js +97 -33
  25. package/dist/src/cluster/service.js.map +1 -1
  26. package/dist/src/cluster/spread-on-churn.d.ts +13 -0
  27. package/dist/src/cluster/spread-on-churn.d.ts.map +1 -1
  28. package/dist/src/cluster/spread-on-churn.js +34 -4
  29. package/dist/src/cluster/spread-on-churn.js.map +1 -1
  30. package/dist/src/cohort-topic/bootstrap-evidence-builder.d.ts +59 -0
  31. package/dist/src/cohort-topic/bootstrap-evidence-builder.d.ts.map +1 -0
  32. package/dist/src/cohort-topic/bootstrap-evidence-builder.js +79 -0
  33. package/dist/src/cohort-topic/bootstrap-evidence-builder.js.map +1 -0
  34. package/dist/src/cohort-topic/bootstrap-evidence-verifiers.d.ts +81 -0
  35. package/dist/src/cohort-topic/bootstrap-evidence-verifiers.d.ts.map +1 -0
  36. package/dist/src/cohort-topic/bootstrap-evidence-verifiers.js +93 -0
  37. package/dist/src/cohort-topic/bootstrap-evidence-verifiers.js.map +1 -0
  38. package/dist/src/cohort-topic/bootstrap-parent-reference.d.ts +108 -0
  39. package/dist/src/cohort-topic/bootstrap-parent-reference.d.ts.map +1 -0
  40. package/dist/src/cohort-topic/bootstrap-parent-reference.js +108 -0
  41. package/dist/src/cohort-topic/bootstrap-parent-reference.js.map +1 -0
  42. package/dist/src/cohort-topic/change-bridge.d.ts +65 -0
  43. package/dist/src/cohort-topic/change-bridge.d.ts.map +1 -0
  44. package/dist/src/cohort-topic/change-bridge.js +76 -0
  45. package/dist/src/cohort-topic/change-bridge.js.map +1 -0
  46. package/dist/src/cohort-topic/cohort-gossip-driver.d.ts +74 -0
  47. package/dist/src/cohort-topic/cohort-gossip-driver.d.ts.map +1 -0
  48. package/dist/src/cohort-topic/cohort-gossip-driver.js +87 -0
  49. package/dist/src/cohort-topic/cohort-gossip-driver.js.map +1 -0
  50. package/dist/src/cohort-topic/cohort-gossip-transport.d.ts +42 -0
  51. package/dist/src/cohort-topic/cohort-gossip-transport.d.ts.map +1 -0
  52. package/dist/src/cohort-topic/cohort-gossip-transport.js +57 -0
  53. package/dist/src/cohort-topic/cohort-gossip-transport.js.map +1 -0
  54. package/dist/src/cohort-topic/fret-trust-anchor.d.ts +100 -0
  55. package/dist/src/cohort-topic/fret-trust-anchor.d.ts.map +1 -0
  56. package/dist/src/cohort-topic/fret-trust-anchor.js +115 -0
  57. package/dist/src/cohort-topic/fret-trust-anchor.js.map +1 -0
  58. package/dist/src/cohort-topic/host.d.ts +573 -0
  59. package/dist/src/cohort-topic/host.d.ts.map +1 -0
  60. package/dist/src/cohort-topic/host.js +1460 -0
  61. package/dist/src/cohort-topic/host.js.map +1 -0
  62. package/dist/src/cohort-topic/index.d.ts +14 -0
  63. package/dist/src/cohort-topic/index.d.ts.map +1 -0
  64. package/dist/src/cohort-topic/index.js +14 -0
  65. package/dist/src/cohort-topic/index.js.map +1 -0
  66. package/dist/src/cohort-topic/membership-publish-sink.d.ts +14 -0
  67. package/dist/src/cohort-topic/membership-publish-sink.d.ts.map +1 -0
  68. package/dist/src/cohort-topic/membership-publish-sink.js +17 -0
  69. package/dist/src/cohort-topic/membership-publish-sink.js.map +1 -0
  70. package/dist/src/cohort-topic/membership-source.d.ts +36 -0
  71. package/dist/src/cohort-topic/membership-source.d.ts.map +1 -0
  72. package/dist/src/cohort-topic/membership-source.js +58 -0
  73. package/dist/src/cohort-topic/membership-source.js.map +1 -0
  74. package/dist/src/cohort-topic/peer-codec.d.ts +18 -0
  75. package/dist/src/cohort-topic/peer-codec.d.ts.map +1 -0
  76. package/dist/src/cohort-topic/peer-codec.js +26 -0
  77. package/dist/src/cohort-topic/peer-codec.js.map +1 -0
  78. package/dist/src/cohort-topic/peer-sig.d.ts +52 -0
  79. package/dist/src/cohort-topic/peer-sig.d.ts.map +1 -0
  80. package/dist/src/cohort-topic/peer-sig.js +83 -0
  81. package/dist/src/cohort-topic/peer-sig.js.map +1 -0
  82. package/dist/src/cohort-topic/protocols.d.ts +49 -0
  83. package/dist/src/cohort-topic/protocols.d.ts.map +1 -0
  84. package/dist/src/cohort-topic/protocols.js +58 -0
  85. package/dist/src/cohort-topic/protocols.js.map +1 -0
  86. package/dist/src/cohort-topic/reactivity-membership-gate.d.ts +49 -0
  87. package/dist/src/cohort-topic/reactivity-membership-gate.d.ts.map +1 -0
  88. package/dist/src/cohort-topic/reactivity-membership-gate.js +42 -0
  89. package/dist/src/cohort-topic/reactivity-membership-gate.js.map +1 -0
  90. package/dist/src/cohort-topic/size-estimator.d.ts +16 -0
  91. package/dist/src/cohort-topic/size-estimator.d.ts.map +1 -0
  92. package/dist/src/cohort-topic/size-estimator.js +16 -0
  93. package/dist/src/cohort-topic/size-estimator.js.map +1 -0
  94. package/dist/src/cohort-topic/stream-util.d.ts +19 -0
  95. package/dist/src/cohort-topic/stream-util.d.ts.map +1 -0
  96. package/dist/src/cohort-topic/stream-util.js +76 -0
  97. package/dist/src/cohort-topic/stream-util.js.map +1 -0
  98. package/dist/src/cohort-topic/threshold-crypto.d.ts +94 -0
  99. package/dist/src/cohort-topic/threshold-crypto.d.ts.map +1 -0
  100. package/dist/src/cohort-topic/threshold-crypto.js +178 -0
  101. package/dist/src/cohort-topic/threshold-crypto.js.map +1 -0
  102. package/dist/src/cohort-topic/topic-router.d.ts +41 -0
  103. package/dist/src/cohort-topic/topic-router.d.ts.map +1 -0
  104. package/dist/src/cohort-topic/topic-router.js +63 -0
  105. package/dist/src/cohort-topic/topic-router.js.map +1 -0
  106. package/dist/src/dispute/cascade.d.ts +179 -0
  107. package/dist/src/dispute/cascade.d.ts.map +1 -0
  108. package/dist/src/dispute/cascade.js +315 -0
  109. package/dist/src/dispute/cascade.js.map +1 -0
  110. package/dist/src/dispute/client.d.ts +2 -1
  111. package/dist/src/dispute/client.d.ts.map +1 -1
  112. package/dist/src/dispute/client.js +12 -3
  113. package/dist/src/dispute/client.js.map +1 -1
  114. package/dist/src/dispute/dispute-service.d.ts +41 -1
  115. package/dist/src/dispute/dispute-service.d.ts.map +1 -1
  116. package/dist/src/dispute/dispute-service.js +147 -21
  117. package/dist/src/dispute/dispute-service.js.map +1 -1
  118. package/dist/src/dispute/index.d.ts +2 -0
  119. package/dist/src/dispute/index.d.ts.map +1 -1
  120. package/dist/src/dispute/index.js +2 -0
  121. package/dist/src/dispute/index.js.map +1 -1
  122. package/dist/src/dispute/invalidation.d.ts +266 -0
  123. package/dist/src/dispute/invalidation.d.ts.map +1 -0
  124. package/dist/src/dispute/invalidation.js +405 -0
  125. package/dist/src/dispute/invalidation.js.map +1 -0
  126. package/dist/src/dispute/types.d.ts +14 -0
  127. package/dist/src/dispute/types.d.ts.map +1 -1
  128. package/dist/src/dispute/types.js.map +1 -1
  129. package/dist/src/index.d.ts +4 -0
  130. package/dist/src/index.d.ts.map +1 -1
  131. package/dist/src/index.js +4 -0
  132. package/dist/src/index.js.map +1 -1
  133. package/dist/src/libp2p-key-network.d.ts +7 -0
  134. package/dist/src/libp2p-key-network.d.ts.map +1 -1
  135. package/dist/src/libp2p-key-network.js +49 -5
  136. package/dist/src/libp2p-key-network.js.map +1 -1
  137. package/dist/src/libp2p-node-base.d.ts +45 -3
  138. package/dist/src/libp2p-node-base.d.ts.map +1 -1
  139. package/dist/src/libp2p-node-base.js +522 -5
  140. package/dist/src/libp2p-node-base.js.map +1 -1
  141. package/dist/src/matchmaking/aggregate-counts.d.ts +67 -0
  142. package/dist/src/matchmaking/aggregate-counts.d.ts.map +1 -0
  143. package/dist/src/matchmaking/aggregate-counts.js +60 -0
  144. package/dist/src/matchmaking/aggregate-counts.js.map +1 -0
  145. package/dist/src/matchmaking/index.d.ts +20 -0
  146. package/dist/src/matchmaking/index.d.ts.map +1 -0
  147. package/dist/src/matchmaking/index.js +20 -0
  148. package/dist/src/matchmaking/index.js.map +1 -0
  149. package/dist/src/matchmaking/module.d.ts +181 -0
  150. package/dist/src/matchmaking/module.d.ts.map +1 -0
  151. package/dist/src/matchmaking/module.js +221 -0
  152. package/dist/src/matchmaking/module.js.map +1 -0
  153. package/dist/src/matchmaking/protocols.d.ts +37 -0
  154. package/dist/src/matchmaking/protocols.d.ts.map +1 -0
  155. package/dist/src/matchmaking/protocols.js +42 -0
  156. package/dist/src/matchmaking/protocols.js.map +1 -0
  157. package/dist/src/matchmaking/provider-manager.d.ts +52 -0
  158. package/dist/src/matchmaking/provider-manager.d.ts.map +1 -0
  159. package/dist/src/matchmaking/provider-manager.js +74 -0
  160. package/dist/src/matchmaking/provider-manager.js.map +1 -0
  161. package/dist/src/matchmaking/query-handler.d.ts +34 -0
  162. package/dist/src/matchmaking/query-handler.d.ts.map +1 -0
  163. package/dist/src/matchmaking/query-handler.js +62 -0
  164. package/dist/src/matchmaking/query-handler.js.map +1 -0
  165. package/dist/src/matchmaking/query-transport.d.ts +180 -0
  166. package/dist/src/matchmaking/query-transport.d.ts.map +1 -0
  167. package/dist/src/matchmaking/query-transport.js +315 -0
  168. package/dist/src/matchmaking/query-transport.js.map +1 -0
  169. package/dist/src/matchmaking/seeker-manager.d.ts +39 -0
  170. package/dist/src/matchmaking/seeker-manager.d.ts.map +1 -0
  171. package/dist/src/matchmaking/seeker-manager.js +49 -0
  172. package/dist/src/matchmaking/seeker-manager.js.map +1 -0
  173. package/dist/src/matchmaking/seeker-walk-client.d.ts +127 -0
  174. package/dist/src/matchmaking/seeker-walk-client.d.ts.map +1 -0
  175. package/dist/src/matchmaking/seeker-walk-client.js +189 -0
  176. package/dist/src/matchmaking/seeker-walk-client.js.map +1 -0
  177. package/dist/src/matchmaking/traffic-validation.d.ts +128 -0
  178. package/dist/src/matchmaking/traffic-validation.d.ts.map +1 -0
  179. package/dist/src/matchmaking/traffic-validation.js +105 -0
  180. package/dist/src/matchmaking/traffic-validation.js.map +1 -0
  181. package/dist/src/network/network-manager-service.d.ts +4 -2
  182. package/dist/src/network/network-manager-service.d.ts.map +1 -1
  183. package/dist/src/network/network-manager-service.js +9 -3
  184. package/dist/src/network/network-manager-service.js.map +1 -1
  185. package/dist/src/protocol-client.d.ts +13 -0
  186. package/dist/src/protocol-client.d.ts.map +1 -1
  187. package/dist/src/protocol-client.js +74 -2
  188. package/dist/src/protocol-client.js.map +1 -1
  189. package/dist/src/reactivity/forwarder-host.d.ts +198 -0
  190. package/dist/src/reactivity/forwarder-host.d.ts.map +1 -0
  191. package/dist/src/reactivity/forwarder-host.js +355 -0
  192. package/dist/src/reactivity/forwarder-host.js.map +1 -0
  193. package/dist/src/reactivity/index.d.ts +19 -0
  194. package/dist/src/reactivity/index.d.ts.map +1 -0
  195. package/dist/src/reactivity/index.js +19 -0
  196. package/dist/src/reactivity/index.js.map +1 -0
  197. package/dist/src/reactivity/notify-transport.d.ts +70 -0
  198. package/dist/src/reactivity/notify-transport.d.ts.map +1 -0
  199. package/dist/src/reactivity/notify-transport.js +111 -0
  200. package/dist/src/reactivity/notify-transport.js.map +1 -0
  201. package/dist/src/reactivity/origination-manager.d.ts +110 -0
  202. package/dist/src/reactivity/origination-manager.d.ts.map +1 -0
  203. package/dist/src/reactivity/origination-manager.js +129 -0
  204. package/dist/src/reactivity/origination-manager.js.map +1 -0
  205. package/dist/src/reactivity/protocols.d.ts +43 -0
  206. package/dist/src/reactivity/protocols.d.ts.map +1 -0
  207. package/dist/src/reactivity/protocols.js +50 -0
  208. package/dist/src/reactivity/protocols.js.map +1 -0
  209. package/dist/src/reactivity/push-state-gossip.d.ts +132 -0
  210. package/dist/src/reactivity/push-state-gossip.d.ts.map +1 -0
  211. package/dist/src/reactivity/push-state-gossip.js +231 -0
  212. package/dist/src/reactivity/push-state-gossip.js.map +1 -0
  213. package/dist/src/reactivity/recover-transport.d.ts +167 -0
  214. package/dist/src/reactivity/recover-transport.d.ts.map +1 -0
  215. package/dist/src/reactivity/recover-transport.js +308 -0
  216. package/dist/src/reactivity/recover-transport.js.map +1 -0
  217. package/dist/src/reactivity/rotation-rereg-scheduler.d.ts +142 -0
  218. package/dist/src/reactivity/rotation-rereg-scheduler.d.ts.map +1 -0
  219. package/dist/src/reactivity/rotation-rereg-scheduler.js +223 -0
  220. package/dist/src/reactivity/rotation-rereg-scheduler.js.map +1 -0
  221. package/dist/src/reactivity/subscriber-registry.d.ts +47 -0
  222. package/dist/src/reactivity/subscriber-registry.d.ts.map +1 -0
  223. package/dist/src/reactivity/subscriber-registry.js +87 -0
  224. package/dist/src/reactivity/subscriber-registry.js.map +1 -0
  225. package/dist/src/reactivity/subscription-manager.d.ts +221 -0
  226. package/dist/src/reactivity/subscription-manager.d.ts.map +1 -0
  227. package/dist/src/reactivity/subscription-manager.js +302 -0
  228. package/dist/src/reactivity/subscription-manager.js.map +1 -0
  229. package/dist/src/reactivity/topic-bytes.d.ts +32 -0
  230. package/dist/src/reactivity/topic-bytes.d.ts.map +1 -0
  231. package/dist/src/reactivity/topic-bytes.js +34 -0
  232. package/dist/src/reactivity/topic-bytes.js.map +1 -0
  233. package/dist/src/repo/client.d.ts.map +1 -1
  234. package/dist/src/repo/client.js +51 -23
  235. package/dist/src/repo/client.js.map +1 -1
  236. package/dist/src/repo/service.d.ts +46 -1
  237. package/dist/src/repo/service.d.ts.map +1 -1
  238. package/dist/src/repo/service.js +79 -45
  239. package/dist/src/repo/service.js.map +1 -1
  240. package/dist/src/rpc-deadline.d.ts +37 -0
  241. package/dist/src/rpc-deadline.d.ts.map +1 -0
  242. package/dist/src/rpc-deadline.js +31 -0
  243. package/dist/src/rpc-deadline.js.map +1 -0
  244. package/dist/src/storage/block-storage.d.ts +2 -0
  245. package/dist/src/storage/block-storage.d.ts.map +1 -1
  246. package/dist/src/storage/block-storage.js +95 -2
  247. package/dist/src/storage/block-storage.js.map +1 -1
  248. package/dist/src/storage/i-block-storage.d.ts +25 -0
  249. package/dist/src/storage/i-block-storage.d.ts.map +1 -1
  250. package/dist/src/storage/storage-repo.d.ts +53 -2
  251. package/dist/src/storage/storage-repo.d.ts.map +1 -1
  252. package/dist/src/storage/storage-repo.js +193 -9
  253. package/dist/src/storage/storage-repo.js.map +1 -1
  254. package/dist/src/sync/client.d.ts +4 -1
  255. package/dist/src/sync/client.d.ts.map +1 -1
  256. package/dist/src/sync/client.js +5 -2
  257. package/dist/src/sync/client.js.map +1 -1
  258. package/dist/src/testing/cohort-topic-mesh-harness.d.ts +219 -0
  259. package/dist/src/testing/cohort-topic-mesh-harness.d.ts.map +1 -0
  260. package/dist/src/testing/cohort-topic-mesh-harness.js +467 -0
  261. package/dist/src/testing/cohort-topic-mesh-harness.js.map +1 -0
  262. package/dist/src/testing/matchmaking-mesh-harness.d.ts +187 -0
  263. package/dist/src/testing/matchmaking-mesh-harness.d.ts.map +1 -0
  264. package/dist/src/testing/matchmaking-mesh-harness.js +358 -0
  265. package/dist/src/testing/matchmaking-mesh-harness.js.map +1 -0
  266. package/dist/src/testing/mesh-harness.d.ts.map +1 -1
  267. package/dist/src/testing/mesh-harness.js +23 -1
  268. package/dist/src/testing/mesh-harness.js.map +1 -1
  269. package/dist/src/testing/reactivity-mesh-harness.d.ts +298 -0
  270. package/dist/src/testing/reactivity-mesh-harness.d.ts.map +1 -0
  271. package/dist/src/testing/reactivity-mesh-harness.js +663 -0
  272. package/dist/src/testing/reactivity-mesh-harness.js.map +1 -0
  273. package/package.json +7 -4
  274. package/src/cluster/block-transfer-service.ts +133 -68
  275. package/src/cluster/client.ts +64 -45
  276. package/src/cluster/cluster-error.ts +64 -0
  277. package/src/cluster/cluster-repo.ts +405 -55
  278. package/src/cluster/commit-cert.ts +139 -0
  279. package/src/cluster/service.ts +116 -44
  280. package/src/cluster/spread-on-churn.ts +328 -285
  281. package/src/cohort-topic/bootstrap-evidence-builder.ts +122 -0
  282. package/src/cohort-topic/bootstrap-evidence-verifiers.ts +132 -0
  283. package/src/cohort-topic/bootstrap-parent-reference.ts +159 -0
  284. package/src/cohort-topic/change-bridge.ts +109 -0
  285. package/src/cohort-topic/cohort-gossip-driver.ts +144 -0
  286. package/src/cohort-topic/cohort-gossip-transport.ts +74 -0
  287. package/src/cohort-topic/fret-trust-anchor.ts +153 -0
  288. package/src/cohort-topic/host.ts +2175 -0
  289. package/src/cohort-topic/index.ts +13 -0
  290. package/src/cohort-topic/membership-publish-sink.ts +20 -0
  291. package/src/cohort-topic/membership-source.ts +68 -0
  292. package/src/cohort-topic/peer-codec.ts +31 -0
  293. package/src/cohort-topic/peer-sig.ts +86 -0
  294. package/src/cohort-topic/protocols.ts +71 -0
  295. package/src/cohort-topic/reactivity-membership-gate.ts +77 -0
  296. package/src/cohort-topic/size-estimator.ts +16 -0
  297. package/src/cohort-topic/stream-util.ts +87 -0
  298. package/src/cohort-topic/threshold-crypto.ts +239 -0
  299. package/src/cohort-topic/topic-router.ts +77 -0
  300. package/src/dispute/cascade.ts +517 -0
  301. package/src/dispute/client.ts +12 -2
  302. package/src/dispute/dispute-service.ts +171 -24
  303. package/src/dispute/index.ts +42 -0
  304. package/src/dispute/invalidation.ts +587 -0
  305. package/src/dispute/types.ts +14 -0
  306. package/src/index.ts +4 -0
  307. package/src/libp2p-key-network.ts +49 -6
  308. package/src/libp2p-node-base.ts +620 -12
  309. package/src/matchmaking/aggregate-counts.ts +104 -0
  310. package/src/matchmaking/index.ts +20 -0
  311. package/src/matchmaking/module.ts +363 -0
  312. package/src/matchmaking/protocols.ts +51 -0
  313. package/src/matchmaking/provider-manager.ts +95 -0
  314. package/src/matchmaking/query-handler.ts +88 -0
  315. package/src/matchmaking/query-transport.ts +483 -0
  316. package/src/matchmaking/seeker-manager.ts +64 -0
  317. package/src/matchmaking/seeker-walk-client.ts +293 -0
  318. package/src/matchmaking/traffic-validation.ts +195 -0
  319. package/src/network/network-manager-service.ts +9 -2
  320. package/src/protocol-client.ts +64 -3
  321. package/src/reactivity/forwarder-host.ts +438 -0
  322. package/src/reactivity/index.ts +19 -0
  323. package/src/reactivity/notify-transport.ts +144 -0
  324. package/src/reactivity/origination-manager.ts +192 -0
  325. package/src/reactivity/protocols.ts +61 -0
  326. package/src/reactivity/push-state-gossip.ts +291 -0
  327. package/src/reactivity/recover-transport.ts +408 -0
  328. package/src/reactivity/rotation-rereg-scheduler.ts +256 -0
  329. package/src/reactivity/subscriber-registry.ts +96 -0
  330. package/src/reactivity/subscription-manager.ts +450 -0
  331. package/src/reactivity/topic-bytes.ts +37 -0
  332. package/src/repo/client.ts +54 -23
  333. package/src/repo/service.ts +90 -42
  334. package/src/rpc-deadline.ts +45 -0
  335. package/src/storage/block-storage.ts +106 -3
  336. package/src/storage/i-block-storage.ts +27 -0
  337. package/src/storage/storage-repo.ts +209 -13
  338. package/src/sync/client.ts +5 -2
  339. package/src/testing/cohort-topic-mesh-harness.ts +613 -0
  340. package/src/testing/matchmaking-mesh-harness.ts +475 -0
  341. package/src/testing/mesh-harness.ts +22 -2
  342. package/src/testing/reactivity-mesh-harness.ts +922 -0
@@ -5,13 +5,103 @@ const log = createLogger('storage-repo');
5
5
  export class StorageRepo {
6
6
  createBlockStorage;
7
7
  validatePend;
8
+ /** Per-collection change listeners; empty sets are pruned on unsubscribe. */
9
+ changeListeners = new Map();
10
+ /** Catch-all change listeners — fire for EVERY collection's commit on this node. */
11
+ anyChangeListeners = new Set();
8
12
  constructor(createBlockStorage, options) {
9
13
  this.createBlockStorage = createBlockStorage;
10
14
  this.validatePend = options?.validatePend;
11
15
  }
16
+ /**
17
+ * Subscribe to commits that mutate `collectionId`'s blocks on this node.
18
+ * Returns an idempotent unsubscribe. See {@link IBlockChangeNotifier}.
19
+ */
20
+ onCollectionChange(collectionId, listener) {
21
+ let set = this.changeListeners.get(collectionId);
22
+ if (!set) {
23
+ set = new Set();
24
+ this.changeListeners.set(collectionId, set);
25
+ }
26
+ set.add(listener);
27
+ let unsubscribed = false;
28
+ return () => {
29
+ if (unsubscribed)
30
+ return;
31
+ unsubscribed = true;
32
+ const current = this.changeListeners.get(collectionId);
33
+ if (current) {
34
+ current.delete(listener);
35
+ if (current.size === 0) {
36
+ this.changeListeners.delete(collectionId);
37
+ }
38
+ }
39
+ };
40
+ }
41
+ /**
42
+ * Subscribe to commits mutating ANY collection on this node — the catch-all feed the
43
+ * cohort-topic origination bridge consumes (it cannot enumerate collection ids ahead of time,
44
+ * so a per-collection {@link onCollectionChange} subscription cannot see every commit). Fires for
45
+ * the same `(pending → committed)` transitions as {@link onCollectionChange}, but across every
46
+ * collection. Returns an idempotent unsubscribe; a throwing listener is isolated + logged.
47
+ */
48
+ onAnyCollectionChange(listener) {
49
+ this.anyChangeListeners.add(listener);
50
+ let unsubscribed = false;
51
+ return () => {
52
+ if (unsubscribed)
53
+ return;
54
+ unsubscribed = true;
55
+ this.anyChangeListeners.delete(listener);
56
+ };
57
+ }
58
+ /**
59
+ * Fire one {@link CollectionChangeEvent} per distinct collection that was
60
+ * newly committed. Called AFTER the commit critical section (locks released),
61
+ * fire-and-forget synchronous; a throwing listener is isolated and logged. Each event reaches
62
+ * both that collection's {@link onCollectionChange} subscribers and every
63
+ * {@link onAnyCollectionChange} catch-all subscriber.
64
+ *
65
+ * `tailId` is the `CommitRequest.tailId` on the commit path; `undefined` on read-driven
66
+ * promotions (the get/emitPromotions path has no commit request). A single commit is for one
67
+ * collection's chain in practice, so all events from one commit share the same `tailId`.
68
+ */
69
+ emitCollectionChanges(collectionBlocks, actionId, rev, tailId) {
70
+ const hasCatchAll = this.anyChangeListeners.size > 0;
71
+ for (const [collectionId, blockIds] of collectionBlocks) {
72
+ const listeners = this.changeListeners.get(collectionId);
73
+ if ((!listeners || listeners.size === 0) && !hasCatchAll) {
74
+ continue;
75
+ }
76
+ const event = { collectionId, blockIds, actionId, rev, tailId };
77
+ if (listeners && listeners.size > 0) {
78
+ this.fireChangeListeners(listeners, event);
79
+ }
80
+ if (hasCatchAll) {
81
+ this.fireChangeListeners(this.anyChangeListeners, event);
82
+ }
83
+ }
84
+ }
85
+ /** Dispatch `event` to a snapshot of `listeners` (safe under mid-emit (un)subscribe), isolating + logging any throw. */
86
+ fireChangeListeners(listeners, event) {
87
+ for (const listener of Array.from(listeners)) {
88
+ try {
89
+ listener(event);
90
+ }
91
+ catch (err) {
92
+ log('onCollectionChange listener threw for collection=%s: %o', event.collectionId, err);
93
+ }
94
+ }
95
+ }
12
96
  async get({ blockIds, context }, _options) {
13
97
  const distinctBlockIds = Array.from(new Set(blockIds));
14
98
  log('get blockIds=%d', distinctBlockIds.length);
99
+ // Read-driven promotions that land durably here, captured so we can emit a
100
+ // change event per durable landing after the parallel reads complete (mirrors
101
+ // commit's "emit after the work" ordering). The array is shared across the
102
+ // parallel map closures below — safe because each push happens synchronously
103
+ // between awaits (single-threaded), never concurrently.
104
+ const promotions = [];
15
105
  const results = await Promise.all(distinctBlockIds.map(async (blockId) => {
16
106
  const blockStorage = this.createBlockStorage(blockId);
17
107
  // Ensure that all outstanding transactions in the context are committed
@@ -23,7 +113,10 @@ export class StorageRepo {
23
113
  for (const { actionId, rev } of missing.sort((a, b) => a.rev - b.rev)) {
24
114
  const pending = await blockStorage.getPendingTransaction(actionId);
25
115
  if (pending) {
26
- await this.internalCommit(blockId, actionId, rev, blockStorage);
116
+ const collectionId = await this.internalCommit(blockId, actionId, rev, blockStorage);
117
+ if (collectionId !== undefined) {
118
+ promotions.push({ collectionId, blockId, actionId, rev });
119
+ }
27
120
  }
28
121
  }
29
122
  }
@@ -57,8 +150,38 @@ export class StorageRepo {
57
150
  }
58
151
  }];
59
152
  }));
153
+ // Emit per durable read-driven landing (Option A — emit eagerly). Done after the
154
+ // parallel reads complete so emission stays outside the per-block work, matching
155
+ // commit's ordering. No-op when nothing was promoted.
156
+ this.emitPromotions(promotions);
60
157
  return Object.fromEntries(results);
61
158
  }
159
+ /**
160
+ * Emit a {@link CollectionChangeEvent} for each read-driven promotion that landed
161
+ * during a {@link get}. A single get() can promote multiple distinct actions, each
162
+ * at its own `(actionId, rev)`, so group by `(actionId, rev)` and route each group
163
+ * through {@link emitCollectionChanges} once.
164
+ */
165
+ emitPromotions(promotions) {
166
+ if (promotions.length === 0) {
167
+ return;
168
+ }
169
+ const groups = new Map();
170
+ for (const { collectionId, blockId, actionId, rev } of promotions) {
171
+ const key = `${actionId} ${rev}`;
172
+ let group = groups.get(key);
173
+ if (!group) {
174
+ group = { actionId, rev, collectionBlocks: new Map() };
175
+ groups.set(key, group);
176
+ }
177
+ const list = group.collectionBlocks.get(collectionId) ?? [];
178
+ list.push(blockId);
179
+ group.collectionBlocks.set(collectionId, list);
180
+ }
181
+ for (const { actionId, rev, collectionBlocks } of groups.values()) {
182
+ this.emitCollectionChanges(collectionBlocks, actionId, rev);
183
+ }
184
+ }
62
185
  async pend(request, _options) {
63
186
  // Validate transaction if present and validation hook is configured
64
187
  if (this.validatePend && request.transaction && request.operationsHash) {
@@ -158,6 +281,14 @@ export class StorageRepo {
158
281
  log('commit actionId=%s rev=%d blockIds=%d', request.actionId, request.rev, request.blockIds.length);
159
282
  const uniqueBlockIds = Array.from(new Set(request.blockIds)).sort();
160
283
  const releases = [];
284
+ // Collects the blocks newly committed in this call, grouped by collection,
285
+ // so we can emit change events once locks are released. Blocks that land before
286
+ // a mid-loop failure stay here and are still emitted (Option A — emit eagerly):
287
+ // they are durably committed and a retry rolls the remainder forward.
288
+ const collectionBlocks = new Map();
289
+ // Captured when internalCommit throws mid-loop; we break (rather than return)
290
+ // so locks release and accumulated landings still emit before we report failure.
291
+ let failure;
161
292
  try {
162
293
  // Acquire locks sequentially based on sorted IDs to prevent deadlocks
163
294
  for (const id of uniqueBlockIds) {
@@ -229,15 +360,20 @@ export class StorageRepo {
229
360
  for (const { blockId, storage } of toCommit) {
230
361
  try {
231
362
  // internalCommit will throw if it encounters an issue
232
- await this.internalCommit(blockId, request.actionId, request.rev, storage);
363
+ const collectionId = await this.internalCommit(blockId, request.actionId, request.rev, storage);
364
+ if (collectionId !== undefined) {
365
+ const list = collectionBlocks.get(collectionId) ?? [];
366
+ list.push(blockId);
367
+ collectionBlocks.set(collectionId, list);
368
+ }
233
369
  }
234
370
  catch (err) {
235
- // Partial-commit recovery: a retry with the same (actionId, rev) will treat
236
- // already-done blocks as idempotent no-ops and advance the remainder.
237
- return {
238
- success: false,
239
- reason: err instanceof Error ? err.message : 'Unknown error during commit'
240
- };
371
+ // Partial-commit recovery: blocks already in collectionBlocks DID land
372
+ // durably and must still emit; a retry with the same (actionId, rev)
373
+ // treats them as idempotent no-ops and advances the remainder. Break
374
+ // instead of returning so locks release and those landings emit below.
375
+ failure = { reason: err instanceof Error ? err.message : 'Unknown error during commit' };
376
+ break;
241
377
  }
242
378
  }
243
379
  }
@@ -245,7 +381,11 @@ export class StorageRepo {
245
381
  // Release locks in reverse order of acquisition
246
382
  releases.reverse().forEach(release => release());
247
383
  }
248
- return { success: true };
384
+ // Notify after the critical section, for every block newly committed here —
385
+ // including those that landed before a mid-loop failure (alreadyDone / stale
386
+ // partitions never reach `collectionBlocks`).
387
+ this.emitCollectionChanges(collectionBlocks, request.actionId, request.rev, request.tailId);
388
+ return failure ? { success: false, reason: failure.reason } : { success: true };
249
389
  }
250
390
  /**
251
391
  * Reconciles `metadata.latest` for a single block with the highest contiguous
@@ -259,6 +399,45 @@ export class StorageRepo {
259
399
  const storage = this.createBlockStorage(blockId);
260
400
  await storage.recover();
261
401
  }
402
+ /**
403
+ * Persist a replica of a block received out-of-band (churn re-replication) into
404
+ * local storage. Distinct from the {@link IRepo} commit funnel: the block arrives
405
+ * already materialized from a departing owner, not as a pend/commit. See
406
+ * {@link IBlockStorage.saveReplica} for the durability/monotonicity contract.
407
+ *
408
+ * Held under the same `StorageRepo.commit:<id>` latch as {@link commit} so the
409
+ * replica's read-modify-write of `latest` is mutually exclusive with a concurrent
410
+ * local commit on the same block — otherwise `saveReplica`'s monotonic guard could
411
+ * read a stale `latest` and clobber a commit that advanced it in between.
412
+ */
413
+ async saveReplicatedBlock(blockId, block, source) {
414
+ log('saveReplicatedBlock blockId=%s rev=%s', blockId, source?.rev);
415
+ const storage = this.createBlockStorage(blockId);
416
+ const release = await Latches.acquire(`StorageRepo.commit:${blockId}`);
417
+ // Captured under the latch; emitted after release to match commit's ordering.
418
+ let landed;
419
+ try {
420
+ const priorLatest = await storage.getLatest();
421
+ const effective = await storage.saveReplica(block, source);
422
+ // Advanced iff there was no prior revision or the effective rev moved past it. On the
423
+ // monotonic no-op, saveReplica returns the held latest unchanged → effective.rev === priorLatest.rev.
424
+ const advanced = priorLatest === undefined || effective.rev > priorLatest.rev;
425
+ const collectionId = block.header?.collectionId;
426
+ if (advanced && collectionId !== undefined) {
427
+ landed = { collectionId, actionId: effective.actionId, rev: effective.rev };
428
+ }
429
+ }
430
+ finally {
431
+ release();
432
+ }
433
+ // Replica-persist has no CommitRequest, hence no tailId — like a read-driven promotion,
434
+ // this wakes local onCollectionChange watchers but is cert-gated out of cohort-topic
435
+ // re-origination downstream (change-bridge selfIsCohortMember treats a tail-less event as
436
+ // never a member).
437
+ if (landed) {
438
+ this.emitCollectionChanges(new Map([[landed.collectionId, [blockId]]]), landed.actionId, landed.rev);
439
+ }
440
+ }
262
441
  async internalCommit(blockId, actionId, rev, storage) {
263
442
  // Note: This method is called within the locked critical section of commit()
264
443
  // So, operations like getPendingTransaction, getLatest, getBlock, saveMaterializedBlock,
@@ -288,6 +467,11 @@ export class StorageRepo {
288
467
  await storage.promotePendingTransaction(actionId);
289
468
  // Update latest revision *last*
290
469
  await storage.setLatest({ actionId, rev });
470
+ // Report the affected collection for change-event routing. For a delete the
471
+ // materialized block is undefined, so fall back to the prior block's header.
472
+ // Either may be absent only for a malformed/headerless block — return
473
+ // undefined so the caller skips it rather than emitting a bogus event.
474
+ return newBlock?.header.collectionId ?? priorBlock?.header.collectionId;
291
475
  }
292
476
  }
293
477
  /** Converts list of missing actions per block into a list of missing actions across blocks. */
@@ -1 +1 @@
1
- {"version":3,"file":"storage-repo.js","sourceRoot":"","sources":["../../../src/storage/storage-repo.ts"],"names":[],"mappings":"AAMA,OAAO,EACN,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe,EACvF,qBAAqB,EAAE,uBAAuB,EAC9C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,GAAG,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAOzC,MAAM,OAAO,WAAW;IAIL;IAHD,YAAY,CAAsB;IAEnD,YACkB,kBAAuD,EACxE,OAA4B;QADX,uBAAkB,GAAlB,kBAAkB,CAAqC;QAGxE,IAAI,CAAC,YAAY,GAAG,OAAO,EAAE,YAAY,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,OA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AAE,CAClE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;QAC5C,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC9D,OAAO,GAAG,CAAC;IACZ,CAAC,EAAE;QACF,QAAQ,EAAE,QAAoB;QAC9B,GAAG,EAAE,KAAK,CAAC,CAAC,CAAE,CAAC,SAAS,CAAC,GAAG,EAAE,4DAA4D;QAC1F,UAAU,EAAE,eAAe,EAAE;KAC7B,CAAC,CACF,CAAC;AACH,CAAC"}
@@ -2,6 +2,7 @@ import type { PeerId } from '@libp2p/interface';
2
2
  import type { IPeerNetwork } from '@optimystic/db-core';
3
3
  import { ProtocolClient } from '../protocol-client.js';
4
4
  import { type SyncRequest, type SyncResponse } from './protocol.js';
5
+ import { type RpcDeadlineOptions } from '../rpc-deadline.js';
5
6
  /**
6
7
  * Client for sending sync requests to remote peers.
7
8
  *
@@ -15,10 +16,12 @@ export declare class SyncClient extends ProtocolClient {
15
16
  * Request a block from the remote peer.
16
17
  *
17
18
  * @param request - Sync request specifying block and options
19
+ * @param options - Optional per-call deadlines/cancellation. Absent keys fall
20
+ * back to the client-level defaults so a silent peer can't hang the caller.
18
21
  * @returns Response with archive if successful
19
22
  * @throws Error if request fails or times out
20
23
  */
21
- requestBlock(request: SyncRequest): Promise<SyncResponse>;
24
+ requestBlock(request: SyncRequest, options?: RpcDeadlineOptions): Promise<SyncResponse>;
22
25
  /**
23
26
  * Get the protocol string used by this client.
24
27
  */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/sync/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAqB,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAEvF;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,cAAc;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAGjC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,YAAY,EACzB,cAAc,GAAE,MAAW;IAM5B;;;;;;OAMG;IACG,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAI/D;;OAEG;IACH,WAAW,IAAI,MAAM;CAGrB"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/sync/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAqB,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAA2B,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtF;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,cAAc;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAGjC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,YAAY,EACzB,cAAc,GAAE,MAAW;IAM5B;;;;;;;;OAQG;IACG,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAI7F;;OAEG;IACH,WAAW,IAAI,MAAM;CAGrB"}
@@ -1,5 +1,6 @@
1
1
  import { ProtocolClient } from '../protocol-client.js';
2
2
  import { buildSyncProtocol } from './protocol.js';
3
+ import { withRpcDeadlineDefaults } from '../rpc-deadline.js';
3
4
  /**
4
5
  * Client for sending sync requests to remote peers.
5
6
  *
@@ -16,11 +17,13 @@ export class SyncClient extends ProtocolClient {
16
17
  * Request a block from the remote peer.
17
18
  *
18
19
  * @param request - Sync request specifying block and options
20
+ * @param options - Optional per-call deadlines/cancellation. Absent keys fall
21
+ * back to the client-level defaults so a silent peer can't hang the caller.
19
22
  * @returns Response with archive if successful
20
23
  * @throws Error if request fails or times out
21
24
  */
22
- async requestBlock(request) {
23
- return await this.processMessage(request, this.protocol);
25
+ async requestBlock(request, options) {
26
+ return await this.processMessage(request, this.protocol, withRpcDeadlineDefaults(options));
24
27
  }
25
28
  /**
26
29
  * Get the protocol string used by this client.
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/sync/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAuC,MAAM,eAAe,CAAC;AAEvF;;;;;GAKG;AACH,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC5B,QAAQ,CAAS;IAElC,YACC,MAAc,EACd,WAAyB,EACzB,iBAAyB,EAAE;QAE3B,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,YAAY,CAAC,OAAoB;QACtC,OAAO,MAAM,IAAI,CAAC,cAAc,CAAe,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,WAAW;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;CACD"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/sync/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAuC,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAA2B,MAAM,oBAAoB,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC5B,QAAQ,CAAS;IAElC,YACC,MAAc,EACd,WAAyB,EACzB,iBAAyB,EAAE;QAE3B,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,YAAY,CAAC,OAAoB,EAAE,OAA4B;QACpE,OAAO,MAAM,IAAI,CAAC,cAAc,CAAe,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1G,CAAC;IAED;;OAEG;IACH,WAAW;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;CACD"}
@@ -0,0 +1,219 @@
1
+ /**
2
+ * Cohort-topic **mock-transport mesh harness** — the in-process, many-logical-node test substrate for
3
+ * the cohort-topic layer (`docs/cohort-topic.md`). It stands up an `N`-node mesh of real-Ed25519-keyed
4
+ * {@link CohortTopicHost}s over a mock libp2p transport and a shared FRET facade that routes the five
5
+ * cohort-topic protocols (`register`, `cohort-gossip`, `promote`, `membership`, `sign`) plus FRET's
6
+ * `routeAct` / `assembleCohort` directly between the in-process node engines — no real sockets, so a
7
+ * 50–200-node mesh runs fast and deterministically.
8
+ *
9
+ * This is the extracted, generalized form of the harness first written inline in
10
+ * `test/cohort-topic/live-tier.spec.ts`; that milestone spec and the at-scale suites
11
+ * (`cohort-topic-scale-*.spec.ts`) both drive it. It is a *sibling* of the cluster
12
+ * {@link import("./mesh-harness.js")} (which builds `ClusterMember` / coordinator-repo nodes over a
13
+ * different mock transport) — the two share no infrastructure, so they stay separate modules under
14
+ * `src/testing/` rather than one file.
15
+ *
16
+ * **What it is NOT.** It is not a wall-clock simulator. TTL eviction, renewal touches, gossip rounds,
17
+ * and demotion hysteresis are all driven by an *explicit* `now` passed to the engine methods
18
+ * (`handleRegister(reg, ctx, now)`, `gossipRound(now)`, `sweepStale(now)`, `demotionTick(now)`), so a
19
+ * suite advances virtual time by choosing timestamps — never by sleeping. The only real-time waits are
20
+ * the tiny async-settle polls ({@link waitFor}) the in-process gossip handlers need to drain.
21
+ */
22
+ import type { PrivateKey, PeerId } from '@libp2p/interface';
23
+ import { type PromotionConfig, type RegisterResult, type RegisterV1, type RenewV1, type RingCoord, type WalkTrace } from '@optimystic/db-core';
24
+ import { type CohortTopicAntiDosOptions, type CohortTopicHost, type CoordEngine } from '../cohort-topic/host.js';
25
+ import { DEFAULT_COHORT_TOPIC_PROTOCOLS as PROTOCOLS } from '../cohort-topic/protocols.js';
26
+ export { PROTOCOLS };
27
+ export declare const delay: (ms: number) => Promise<void>;
28
+ /** Poll `predicate` until true or `timeoutMs` elapses (deterministic-but-not-flaky async settle). */
29
+ export declare function waitFor(predicate: () => boolean, timeoutMs?: number, intervalMs?: number): Promise<boolean>;
30
+ /** A real cohort node identity: its libp2p key, peer-id, peer-id string, dialable member bytes, ring position. */
31
+ export interface Member {
32
+ readonly key: PrivateKey;
33
+ readonly peerId: PeerId;
34
+ readonly idStr: string;
35
+ /** Dialable member id (UTF-8 of the peer-id string) — the `participantCoord` / signer wire form. */
36
+ readonly bytes: Uint8Array;
37
+ /** Ring position `H(peerId)` — what FRET routes / assembles around. */
38
+ readonly ringPos: RingCoord;
39
+ }
40
+ export declare function makeMember(): Promise<Member>;
41
+ export declare function makeMembers(n: number): Promise<Member[]>;
42
+ /**
43
+ * One end of an in-memory duplex pipe. `send` enqueues a frame onto the *peer's* inbox; `close`
44
+ * (half-close-write) signals EOF to the peer's reader. The async iterator yields this end's inbox until
45
+ * the peer closed its write and the buffer drains — so `p2p-fret`'s `readAllBounded` reads exactly the
46
+ * frames the other end wrote, then completes promptly on EOF (no idle-timeout wait).
47
+ */
48
+ export declare class MockStreamEnd {
49
+ private readonly inbox;
50
+ private inboundClosed;
51
+ private waiter;
52
+ peer: MockStreamEnd;
53
+ send(frame: Uint8Array): void;
54
+ close(): Promise<void>;
55
+ abort(_err?: unknown): void;
56
+ private accept;
57
+ private endInbound;
58
+ private wake;
59
+ [Symbol.asyncIterator](): AsyncGenerator<Uint8Array>;
60
+ }
61
+ export declare function streamPair(): [MockStreamEnd, MockStreamEnd];
62
+ type ProtocolHandler = (stream: MockStreamEnd, connection: {
63
+ remotePeer: PeerId;
64
+ }) => void;
65
+ /**
66
+ * A minimal libp2p node the cohort-topic host runs on. `dialProtocol` resolves the target node in the
67
+ * shared registry, hands its protocol handler one end of a fresh duplex, and returns the other — so a
68
+ * `requestResponse` / `sendOneWay` from one host drives the target host's real protocol handler. A node
69
+ * in the shared `down` set rejects inbound dials (crash / unreachable simulation).
70
+ */
71
+ export declare class MockNode {
72
+ readonly peerId: PeerId;
73
+ private readonly registry;
74
+ private readonly down;
75
+ readonly handlers: Map<string, ProtocolHandler>;
76
+ constructor(peerId: PeerId, registry: Map<string, MockNode>, down: Set<string>);
77
+ handle(protocol: string | string[], handler: ProtocolHandler): Promise<void>;
78
+ unhandle(protocol: string | string[]): Promise<void>;
79
+ getConnections(_peer?: PeerId): unknown[];
80
+ dialProtocol(peer: PeerId, protocols: string | string[]): Promise<MockStreamEnd>;
81
+ /** Inject a one-way frame as if `from` had sent it over `protocol` (the inbound transport seam). */
82
+ receive(protocol: string, frame: Uint8Array, from: PeerId): void;
83
+ }
84
+ export interface HostNode {
85
+ readonly member: Member;
86
+ readonly node: MockNode;
87
+ readonly host: CohortTopicHost;
88
+ }
89
+ export interface MeshOptions {
90
+ readonly wantK: number;
91
+ readonly minSigs: number;
92
+ /** Lowered `cap_promote` to drive promotion with a small participant count (live-tier / promotion suites). */
93
+ readonly capPromote?: number;
94
+ /**
95
+ * Extra {@link PromotionConfig} fields merged onto every node's lifecycle (alongside {@link capPromote}).
96
+ * Lets a virtual-time harness neutralise the wall-clock-rate heuristics (e.g. `tPromoteLookaheadMs: 0`
97
+ * to disable slope-based pre-promotion, which is meaningless when `now` is a fixed virtual instant).
98
+ */
99
+ readonly promotion?: Partial<PromotionConfig>;
100
+ /** Peers that reject inbound dials (crash / unreachable). They stay in FRET assembly (epoch unchanged). */
101
+ readonly downNodes?: readonly string[];
102
+ /** FRET network-size estimate (drives the walk start tier `d_max`). Default 256 → `d_max = 1`. */
103
+ readonly sizeEstimate?: number;
104
+ /** Per-node tier profile by index. Default all {@link coreProfile}. `'edge'` → {@link edgeProfile} (T0/T1 only). */
105
+ readonly profiles?: readonly ('edge' | 'core')[];
106
+ /** Gossip-driver cadence (ms). Default parks the timer far out so suites pump gossip deterministically. */
107
+ readonly gossipIntervalMs?: number;
108
+ /** Anti-DoS wiring applied to every node (e.g. a reputation view to force cold-root bootstrap denial). */
109
+ readonly antiDos?: CohortTopicAntiDosOptions;
110
+ }
111
+ /** One routed probe: the coord key it was issued at and the reply classification the walk saw. */
112
+ export interface RouteTraceEntry {
113
+ readonly key: string;
114
+ readonly result: RegisterResult;
115
+ }
116
+ export declare class CohortMesh {
117
+ private readonly members;
118
+ private readonly sizeEstimate;
119
+ readonly nodes: HostNode[];
120
+ /** Coords every `routeAct` was keyed at (a walk's probe trail); a test clears + inspects it. */
121
+ readonly routeKeys: string[];
122
+ /** Per-probe (key, reply-result) trace — richer than {@link routeKeys} for anti-flood walk assertions. */
123
+ readonly routeTrace: RouteTraceEntry[];
124
+ private readonly registry;
125
+ private readonly activity;
126
+ private readonly down;
127
+ /** Members removed from FRET assembly (a membership change for rotation tests). They stay dialable. */
128
+ private readonly excluded;
129
+ constructor(members: Member[], sizeEstimate: number, down: readonly string[]);
130
+ /**
131
+ * Drop `idStr` from FRET cohort assembly — the cohort serving any coord that included it now resolves to
132
+ * a different member set (a new `cohortEpoch`), which is the membership change that drives an epoch
133
+ * rotation. Unlike {@link crashNode}, the node stays dialable (it still answers `/sign`), so the outgoing
134
+ * cohort can co-sign the hand-off. Used by the rotation-attestation tests.
135
+ */
136
+ excludeFromAssembly(idStr: string): void;
137
+ /** Restore `idStr` to FRET cohort assembly. */
138
+ includeInAssembly(idStr: string): void;
139
+ /** Deterministic FRET assembly: live (non-excluded) members sorted by XOR distance of ring position to `coord`. */
140
+ private sortedByDistance;
141
+ assembleCohort(coord: Uint8Array, wants: number): string[];
142
+ /** The single node nearest `coord` — where `routeAct` runs the activity (the routed primary). */
143
+ nearest(coord: Uint8Array): Member;
144
+ nodeNearest(coord: Uint8Array): HostNode;
145
+ nodeOf(idStr: string): HostNode;
146
+ /** Crash `idStr`: it rejects inbound dials but stays in FRET assembly, so `cohortEpoch` is unchanged. */
147
+ crashNode(idStr: string): void;
148
+ /** Revive a previously-crashed node. */
149
+ reviveNode(idStr: string): void;
150
+ private routeAct;
151
+ /** A FRET facade for one node, delegating routing/assembly to the shared mesh. */
152
+ fretFor(idStr: string): unknown;
153
+ registerNode(member: Member): MockNode;
154
+ clearRouteLog(): void;
155
+ stop(): Promise<void>;
156
+ }
157
+ /** Compare XOR distance of `a` vs `b` to `target` (big-endian) — a total order over distinct ring positions. */
158
+ export declare function xorCompare(a: Uint8Array, b: Uint8Array, target: Uint8Array): number;
159
+ /** Build and start an N-node cohort mesh: one real-keyed node + FRET facade + cohort-topic host each. */
160
+ export declare function buildMesh(members: Member[], opts: MeshOptions): Promise<CohortMesh>;
161
+ export declare function signedWillingness(from: Member, coord: Uint8Array, epoch: Uint8Array, now: number, willingnessBits?: string): Promise<Uint8Array>;
162
+ export interface SignedRegisterOptions {
163
+ readonly tier?: number;
164
+ readonly treeTier?: number;
165
+ readonly bootstrap?: boolean;
166
+ readonly ttl?: number;
167
+ }
168
+ export declare function signedRegister(participant: Member, topic: Uint8Array, now: number, correlationId: string, opts?: SignedRegisterOptions): Promise<RegisterV1>;
169
+ /** A plain ping (no `reattach`) — touches `lastPing` only when it lands on the computed primary / override. */
170
+ export declare function signedPing(participant: Member, topic: Uint8Array, now: number, correlationId: string): Promise<RenewV1>;
171
+ /** A signed crash-failover re-attach (`reattach: true` in the signed body) — promotes a backup. */
172
+ export declare function signedReattach(participant: Member, topic: Uint8Array, now: number, correlationId?: string): Promise<RenewV1>;
173
+ export declare const slots: import("@optimystic/db-core").SlotAssigner;
174
+ export declare const addressing: import("@optimystic/db-core").TierAddressing;
175
+ /**
176
+ * Map each tier coordinate `coord_d(participant, topic)` for `d ∈ [0, dMax]` to its tier `d` (base64url
177
+ * key → tier). A real walk's routed keys are matched against this map to recover the per-probe tier, so
178
+ * the {@link import("@optimystic/db-core").WalkTrace}-shaped trace can be fed to `outwardMovesArePromoted`
179
+ * / `inwardStepsFollowNoState` / `retriesRestartAtDMax`. `coord_0` is participant-independent (it equals
180
+ * `coord0(topic)`); the bootstrap re-issue at the root reuses that same key, so both root probes map to 0.
181
+ */
182
+ export declare function coordTierMap(participant: Member, topic: Uint8Array, dMax: number, tierAddr?: import("@optimystic/db-core").TierAddressing): Map<string, number>;
183
+ /** Reconstruct a {@link WalkTrace} from the mesh's recorded `routeTrace`, keeping only this walk's coords. */
184
+ export declare function walkTraceFrom(routeTrace: readonly RouteTraceEntry[], tierMap: Map<string, number>, dMax: number): WalkTrace;
185
+ /**
186
+ * Generate a real-keyed participant whose deterministic slot-**primary** (under `engine`'s cohort epoch
187
+ * + member set) is `primaryNode`. The cohort-side renewal only serves a plain ping / `reattach` with
188
+ * `ok` (the path that touches the record into the gossip deltas) when it lands on the participant's
189
+ * computed primary or a backup; for an arbitrary participant the node nearest `coord_0` is that primary
190
+ * only ~1/k of the time, so seeding/replication via a fixed deciding node is non-deterministic without
191
+ * pinning the participant to it.
192
+ */
193
+ export declare function participantPrimaryAt(primaryNode: HostNode, engine: CoordEngine): Promise<Member>;
194
+ /**
195
+ * Generate a real-keyed participant whose computed primary is `primaryNode` **and** whose `backups[0]`
196
+ * is `backupNode` (under `engine`'s epoch + member set). The crash-failover suite needs a participant
197
+ * whose first warm backup is a known sibling so a `reattach` landing there promotes deterministically.
198
+ */
199
+ export declare function participantPrimaryBackupAt(primaryNode: HostNode, backupNode: HostNode, engine: CoordEngine): Promise<Member>;
200
+ export interface TopicSetup {
201
+ readonly coord0: RingCoord;
202
+ /** Engine on every coord-0 cohort member, keyed by member id string. */
203
+ readonly engines: Map<string, CoordEngine>;
204
+ /** The routed primary for `coord_0` (where `routeAct` lands a bootstrap register). */
205
+ readonly deciding: HostNode;
206
+ readonly decidingEngine: CoordEngine;
207
+ /** The coord-0 cohort member id strings (the `wantK` nearest to `coord_0`). */
208
+ readonly cohortIds: readonly string[];
209
+ }
210
+ /**
211
+ * Instantiate the tier-0 coord engine for `topic` on every **coord-0 cohort member** and seed each one's
212
+ * coord-0 gossip view with every *other* cohort member's willingness, so any cohort member (in
213
+ * particular the routed primary) meets the willingness quorum and can admit. Mirrors the willingness
214
+ * bootstrap the gossip-cadence tests do — an idle engine builds no willingness frame, so the first
215
+ * registration needs a seed. Operating on the cohort (not all `N` nodes) keeps setup `O(wantK²)` at
216
+ * scale; for a whole-network cohort (`wantK = N`) it covers every node, matching the live-tier milestone.
217
+ */
218
+ export declare function setupTopic(mesh: CohortMesh, topic: Uint8Array, tierAddr?: import("@optimystic/db-core").TierAddressing): Promise<TopicSetup>;
219
+ //# sourceMappingURL=cohort-topic-mesh-harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cohort-topic-mesh-harness.d.ts","sourceRoot":"","sources":["../../../src/testing/cohort-topic-mesh-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAiBN,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,SAAS,EAEd,KAAK,SAAS,EACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAyB,KAAK,yBAAyB,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MA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