@optimystic/db-p2p 0.13.4 → 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 (352) 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 +8 -1
  134. package/dist/src/libp2p-key-network.d.ts.map +1 -1
  135. package/dist/src/libp2p-key-network.js +67 -8
  136. package/dist/src/libp2p-key-network.js.map +1 -1
  137. package/dist/src/libp2p-node-base.d.ts +57 -3
  138. package/dist/src/libp2p-node-base.d.ts.map +1 -1
  139. package/dist/src/libp2p-node-base.js +523 -6
  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 +25 -0
  186. package/dist/src/protocol-client.d.ts.map +1 -1
  187. package/dist/src/protocol-client.js +126 -4
  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 -19
  235. package/dist/src/repo/client.js.map +1 -1
  236. package/dist/src/repo/cluster-coordinator.d.ts +9 -0
  237. package/dist/src/repo/cluster-coordinator.d.ts.map +1 -1
  238. package/dist/src/repo/cluster-coordinator.js +65 -22
  239. package/dist/src/repo/cluster-coordinator.js.map +1 -1
  240. package/dist/src/repo/coordinator-repo.d.ts +20 -0
  241. package/dist/src/repo/coordinator-repo.d.ts.map +1 -1
  242. package/dist/src/repo/coordinator-repo.js +101 -16
  243. package/dist/src/repo/coordinator-repo.js.map +1 -1
  244. package/dist/src/repo/service.d.ts +46 -1
  245. package/dist/src/repo/service.d.ts.map +1 -1
  246. package/dist/src/repo/service.js +79 -45
  247. package/dist/src/repo/service.js.map +1 -1
  248. package/dist/src/rpc-deadline.d.ts +37 -0
  249. package/dist/src/rpc-deadline.d.ts.map +1 -0
  250. package/dist/src/rpc-deadline.js +31 -0
  251. package/dist/src/rpc-deadline.js.map +1 -0
  252. package/dist/src/storage/block-storage.d.ts +2 -0
  253. package/dist/src/storage/block-storage.d.ts.map +1 -1
  254. package/dist/src/storage/block-storage.js +95 -2
  255. package/dist/src/storage/block-storage.js.map +1 -1
  256. package/dist/src/storage/i-block-storage.d.ts +25 -0
  257. package/dist/src/storage/i-block-storage.d.ts.map +1 -1
  258. package/dist/src/storage/storage-repo.d.ts +53 -2
  259. package/dist/src/storage/storage-repo.d.ts.map +1 -1
  260. package/dist/src/storage/storage-repo.js +193 -9
  261. package/dist/src/storage/storage-repo.js.map +1 -1
  262. package/dist/src/sync/client.d.ts +4 -1
  263. package/dist/src/sync/client.d.ts.map +1 -1
  264. package/dist/src/sync/client.js +5 -2
  265. package/dist/src/sync/client.js.map +1 -1
  266. package/dist/src/testing/cohort-topic-mesh-harness.d.ts +219 -0
  267. package/dist/src/testing/cohort-topic-mesh-harness.d.ts.map +1 -0
  268. package/dist/src/testing/cohort-topic-mesh-harness.js +467 -0
  269. package/dist/src/testing/cohort-topic-mesh-harness.js.map +1 -0
  270. package/dist/src/testing/matchmaking-mesh-harness.d.ts +187 -0
  271. package/dist/src/testing/matchmaking-mesh-harness.d.ts.map +1 -0
  272. package/dist/src/testing/matchmaking-mesh-harness.js +358 -0
  273. package/dist/src/testing/matchmaking-mesh-harness.js.map +1 -0
  274. package/dist/src/testing/mesh-harness.d.ts.map +1 -1
  275. package/dist/src/testing/mesh-harness.js +23 -1
  276. package/dist/src/testing/mesh-harness.js.map +1 -1
  277. package/dist/src/testing/reactivity-mesh-harness.d.ts +298 -0
  278. package/dist/src/testing/reactivity-mesh-harness.d.ts.map +1 -0
  279. package/dist/src/testing/reactivity-mesh-harness.js +663 -0
  280. package/dist/src/testing/reactivity-mesh-harness.js.map +1 -0
  281. package/package.json +7 -4
  282. package/src/cluster/block-transfer-service.ts +133 -68
  283. package/src/cluster/client.ts +64 -45
  284. package/src/cluster/cluster-error.ts +64 -0
  285. package/src/cluster/cluster-repo.ts +405 -55
  286. package/src/cluster/commit-cert.ts +139 -0
  287. package/src/cluster/service.ts +116 -44
  288. package/src/cluster/spread-on-churn.ts +328 -285
  289. package/src/cohort-topic/bootstrap-evidence-builder.ts +122 -0
  290. package/src/cohort-topic/bootstrap-evidence-verifiers.ts +132 -0
  291. package/src/cohort-topic/bootstrap-parent-reference.ts +159 -0
  292. package/src/cohort-topic/change-bridge.ts +109 -0
  293. package/src/cohort-topic/cohort-gossip-driver.ts +144 -0
  294. package/src/cohort-topic/cohort-gossip-transport.ts +74 -0
  295. package/src/cohort-topic/fret-trust-anchor.ts +153 -0
  296. package/src/cohort-topic/host.ts +2175 -0
  297. package/src/cohort-topic/index.ts +13 -0
  298. package/src/cohort-topic/membership-publish-sink.ts +20 -0
  299. package/src/cohort-topic/membership-source.ts +68 -0
  300. package/src/cohort-topic/peer-codec.ts +31 -0
  301. package/src/cohort-topic/peer-sig.ts +86 -0
  302. package/src/cohort-topic/protocols.ts +71 -0
  303. package/src/cohort-topic/reactivity-membership-gate.ts +77 -0
  304. package/src/cohort-topic/size-estimator.ts +16 -0
  305. package/src/cohort-topic/stream-util.ts +87 -0
  306. package/src/cohort-topic/threshold-crypto.ts +239 -0
  307. package/src/cohort-topic/topic-router.ts +77 -0
  308. package/src/dispute/cascade.ts +517 -0
  309. package/src/dispute/client.ts +12 -2
  310. package/src/dispute/dispute-service.ts +171 -24
  311. package/src/dispute/index.ts +42 -0
  312. package/src/dispute/invalidation.ts +587 -0
  313. package/src/dispute/types.ts +14 -0
  314. package/src/index.ts +4 -0
  315. package/src/libp2p-key-network.ts +67 -9
  316. package/src/libp2p-node-base.ts +633 -14
  317. package/src/matchmaking/aggregate-counts.ts +104 -0
  318. package/src/matchmaking/index.ts +20 -0
  319. package/src/matchmaking/module.ts +363 -0
  320. package/src/matchmaking/protocols.ts +51 -0
  321. package/src/matchmaking/provider-manager.ts +95 -0
  322. package/src/matchmaking/query-handler.ts +88 -0
  323. package/src/matchmaking/query-transport.ts +483 -0
  324. package/src/matchmaking/seeker-manager.ts +64 -0
  325. package/src/matchmaking/seeker-walk-client.ts +293 -0
  326. package/src/matchmaking/traffic-validation.ts +195 -0
  327. package/src/network/network-manager-service.ts +9 -2
  328. package/src/protocol-client.ts +119 -5
  329. package/src/reactivity/forwarder-host.ts +438 -0
  330. package/src/reactivity/index.ts +19 -0
  331. package/src/reactivity/notify-transport.ts +144 -0
  332. package/src/reactivity/origination-manager.ts +192 -0
  333. package/src/reactivity/protocols.ts +61 -0
  334. package/src/reactivity/push-state-gossip.ts +291 -0
  335. package/src/reactivity/recover-transport.ts +408 -0
  336. package/src/reactivity/rotation-rereg-scheduler.ts +256 -0
  337. package/src/reactivity/subscriber-registry.ts +96 -0
  338. package/src/reactivity/subscription-manager.ts +450 -0
  339. package/src/reactivity/topic-bytes.ts +37 -0
  340. package/src/repo/client.ts +54 -19
  341. package/src/repo/cluster-coordinator.ts +66 -26
  342. package/src/repo/coordinator-repo.ts +99 -15
  343. package/src/repo/service.ts +90 -42
  344. package/src/rpc-deadline.ts +45 -0
  345. package/src/storage/block-storage.ts +106 -3
  346. package/src/storage/i-block-storage.ts +27 -0
  347. package/src/storage/storage-repo.ts +209 -13
  348. package/src/sync/client.ts +5 -2
  349. package/src/testing/cohort-topic-mesh-harness.ts +613 -0
  350. package/src/testing/matchmaking-mesh-harness.ts +475 -0
  351. package/src/testing/mesh-harness.ts +22 -2
  352. package/src/testing/reactivity-mesh-harness.ts +922 -0
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-harness.js","sourceRoot":"","sources":["../../../src/testing/mesh-harness.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAiB,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,eAAe,EAA8B,MAAM,6BAA6B,CAAC;AAE1F,OAAO,EAAE,mBAAmB,EAAkB,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,aAAa,CAAC;AA+BrD,MAAM,eAAe;IACpB,KAAK,CAAC,OAAO,CAAC,OAAe,EAAE,SAAiB;QAC/C,OAAO,EAAE,CAAC;IACX,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,kBAAkB;IAEL;IACA;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CAAC,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,WAAW,CAAC;AACpB,CAAC,CAAC"}
@@ -0,0 +1,298 @@
1
+ /**
2
+ * Reactivity **mock-transport mesh harness** — the in-process, many-logical-node substrate for the
3
+ * reactivity *e2e* tier (`docs/reactivity.md`), layered on the cohort-topic mesh harness
4
+ * ({@link import("./cohort-topic-mesh-harness.js")}) rather than forking it (the same relationship the
5
+ * {@link import("./matchmaking-mesh-harness.js").MatchmakingMesh} has to it). It drives the **real**
6
+ * reactivity hot path end-to-end over a network of real-Ed25519-keyed cohort-topic hosts:
7
+ *
8
+ * - **Origination** rides the real {@link makeCohortTopicChangeNotifier} over a real {@link StorageRepo}:
9
+ * a `pend`+`commit` fires the catch-all change feed → the bridge hands the {@link CollectionChangeEvent}
10
+ * + a **real** threshold {@link CommitCert} (each tail-cohort member signs the commit-vote payload with
11
+ * its real Ed25519 key, assembled by {@link buildCommitCert}) to the real
12
+ * {@link ReactivityOriginationManager}, which builds the {@link NotificationV1} reusing the cert's
13
+ * threshold signature **unchanged** — exactly as in production (`local-change-notifier-bridge`).
14
+ * - **Forwarding** runs the real {@link createReactivityForwarder} receive path (verify → dedupe → buffer)
15
+ * over a real {@link PushState} (replay ring + rolling checkpoint + per-subscriber backpressure).
16
+ * - **Delivery** runs the real {@link ReactivitySubscriptionManager} (register at cohort-topic tier **T3**,
17
+ * verify against the cached tail-cohort {@link MembershipCertV1} with **real** collected-multisig crypto,
18
+ * contiguity check, gap → backfill, `(collectionId, revision)` dedupe, surface).
19
+ * - **Recovery** serves real {@link serveBackfill} / {@link serveResume} from the tail `PushState`, applied
20
+ * subscriber-side by the manager's `resume()` / backfill seam.
21
+ * - **Rotation** drives the real {@link BlockFillTracker} / {@link buildRotationHint} /
22
+ * {@link planReRegistrationWave} / {@link buildRotationHandoffCheckpoint} lifecycle; **backpressure**
23
+ * drives the real {@link PushState.enqueueForSubscribers}.
24
+ *
25
+ * **What is real vs. modeled (honest).** Every signature, registration record, replay-buffer entry, dedupe
26
+ * decision, checkpoint fold, and resume classification is the real db-core/db-p2p code. What the harness
27
+ * *models* is the **notification transport** (the application protocol that would dial each subscriber's
28
+ * primary and each child cohort) — it fans the originated notification to the tracked direct subscribers
29
+ * in-process via the real per-subscriber bounded queues — and, like the matchmaking harness, the
30
+ * **single-tier-0 reach**: the cohort-topic substrate serves a single tier-0 cohort (multi-tier *serving*
31
+ * promotion to a tier-`d ≥ 1` forwarder cohort is gated on the cohort-topic follow-ons), so a deep
32
+ * forwarder *tree* fan-out is tagged-unimplemented in the suites, not faked here. The tail cohort fanning
33
+ * to every direct subscriber — the heart of contiguous/verified delivery — is fully real.
34
+ *
35
+ * **Virtual time.** Like the sibling harnesses this is not a wall-clock simulator: `now` is an explicit
36
+ * virtual clock the harness advances ({@link ReactivityMesh.advanceTime}), so `T_drain` / rotation timing
37
+ * resolve deterministically without sleeping. The only real-time waits are the cohort harness's tiny
38
+ * async-settle polls.
39
+ */
40
+ import { PushState, type ForwardDecision, type NotificationV1, type NodeProfile, type RegistrationHandle, type ResumeApplyOutcome, type CheckpointSummary, type ReRegistrationPlan } from "@optimystic/db-core";
41
+ import { ReactivitySubscriptionManager, type RotationNotice } from "../reactivity/subscription-manager.js";
42
+ import { RotationReRegistrationScheduler } from "../reactivity/rotation-rereg-scheduler.js";
43
+ import { addressing, delay, type CohortMesh, type Member } from "./cohort-topic-mesh-harness.js";
44
+ export { addressing, delay };
45
+ export type { Member, NotificationV1 };
46
+ /** Construction inputs for a {@link ReactivityMesh}. */
47
+ export interface ReactivityMeshOptions {
48
+ /** Node count. Default 12. */
49
+ readonly nodeCount?: number;
50
+ /** Cohort size `wantK`. Default `min(nodeCount, 8)`. */
51
+ readonly wantK?: number;
52
+ /** Verifier threshold (notifications are signed by all `wantK` tail members; the verifier needs `>= minSigs`). Default `max(1, wantK - 2)`. */
53
+ readonly minSigs?: number;
54
+ /** FRET network-size estimate (drives the default walk start tier). Default 256 → `d_max = 1`. */
55
+ readonly sizeEstimate?: number;
56
+ /**
57
+ * `cap_promote` applied to every cohort. Default very high so the topic stays a single tier-0 cohort for
58
+ * the life of a test (multi-tier *serving* promotion is a cohort-topic follow-on; see the module note).
59
+ * Lower it to drive the promotion *signal* (the cold-to-hot growth suite).
60
+ */
61
+ readonly capPromote?: number;
62
+ /** Per-node profile by index (Edge nodes never forward T3). Default all Core. */
63
+ readonly profiles?: readonly ("edge" | "core")[];
64
+ }
65
+ /** Per-collection knobs (scaled down so resume/checkpoint suites need only a few dozen commits). */
66
+ export interface CollectionOptions {
67
+ /** Replay-buffer depth `W` (default 256; scale down for fast resume tests). */
68
+ readonly w?: number;
69
+ /** Parent-checkpoint span `W_checkpoint` (default 4096). */
70
+ readonly wCheckpoint?: number;
71
+ /** Per-subscriber bounded-queue depth `queue_max` (default 32). */
72
+ readonly queueMax?: number;
73
+ /** Per-collection delta budget (bytes); default Core `delta_max`. */
74
+ readonly deltaMaxBytes?: number;
75
+ /** Block-fill size driving tail rotation (default 64). */
76
+ readonly blockFillSize?: number;
77
+ /** Anticipatory warm-up threshold (default 8). */
78
+ readonly warmThreshold?: number;
79
+ }
80
+ /** Per-subscription tuning. */
81
+ export interface SubscribeOptions {
82
+ /** Last revision already held; `0` (default) ⇒ fresh subscribe, adopt the first notification as baseline. */
83
+ readonly lastKnownRev?: number;
84
+ /** Node profile for the subscriber (Edge ⇒ shorter TTL, declines deltas, never forwards). Default the node's mesh profile. */
85
+ readonly profile?: NodeProfile;
86
+ /**
87
+ * When `false`, the subscriber does **not** drain its bounded queue after each fan-out — modeling a slow
88
+ * subscriber on a flaky link whose queue fills and drops-oldest. Default `true` (drain immediately).
89
+ */
90
+ readonly autoDrain?: boolean;
91
+ }
92
+ /** A live reactivity subscription in the mesh — the real manager + its delivery bookkeeping. */
93
+ export interface SubscriptionHandle {
94
+ readonly nodeIndex: number;
95
+ readonly member: Member;
96
+ /** Per-subscriber id (its dialable member bytes, base64url) — the backpressure-map key. */
97
+ readonly subId: string;
98
+ /** The real subscription manager (assigned once, immediately after the handle is built). */
99
+ manager: ReactivitySubscriptionManager;
100
+ /** Verified, contiguous, deduped notifications the manager surfaced (in delivery order). */
101
+ readonly delivered: NotificationV1[];
102
+ /** The tail (base64url) this subscriber currently tracks — fan-out targets only current-tail subscribers. */
103
+ attachedTailB64: string;
104
+ readonly collectionName: string;
105
+ /** Whether the subscriber drains its bounded queue automatically (false ⇒ slow-subscriber model). */
106
+ autoDrain: boolean;
107
+ /** Whether the subscriber is asleep (skipped by fan-out; its replay buffer still fills). */
108
+ asleep: boolean;
109
+ /** Registration handle from the real `service.register` walk. */
110
+ registration?: RegistrationHandle;
111
+ /** Number of backfill RPCs the subscriber's gap-detection seam drove. */
112
+ backfills: number;
113
+ /** Set true if a resume escalated to a chain read (out_of_window / untrusted checkpoint). */
114
+ chainRead: boolean;
115
+ /** Set to `[newTailId, newRevisionAtRotation]` if a resume returned tail_rotated. */
116
+ tailRotated?: readonly [string, number];
117
+ /** Checkpoint summaries applied on a checkpoint-window resume (the merged-digest hint). */
118
+ readonly checkpointDigests: CheckpointSummary[];
119
+ /** Rotation notices the manager surfaced from a delivered pre-announce / hard rotation (once per successor). */
120
+ readonly rotationNotices: RotationNotice[];
121
+ /**
122
+ * Per-subscriber re-registration scheduler bound to the manager's `onRotation` observer, driven over the
123
+ * harness virtual clock ({@link ReactivityMesh.advanceTime}). On fire it re-attaches this subscriber under
124
+ * the new tail (the production move the deferred Quereus `Database.watch` factory performs) — so the
125
+ * notify/recover rotation seams run end-to-end (`reactivity-rotation-host-wiring-e2e` §C).
126
+ */
127
+ scheduler: RotationReRegistrationScheduler;
128
+ }
129
+ /** Options for {@link ReactivityMesh.rotateTail}. */
130
+ export interface RotateTailOptions {
131
+ /**
132
+ * When `true` (default) the harness migrates live subscribers to the new tail directly (the wave/handoff
133
+ * continuity model). When `false` it instead models the running node's `ReactivityForwarderHost.markRotated`
134
+ * — arming the outgoing tail's {@link TailDrainGate} — so a subscriber resuming against the old tail is
135
+ * **redirected** to the new tree and re-attaches through its own `onRotation` → scheduler → reRegister path
136
+ * (the transport-driven e2e proof, `reactivity-rotation-host-wiring-e2e` §C).
137
+ */
138
+ readonly autoReattach?: boolean;
139
+ }
140
+ /** The outcome of a {@link ReactivityMesh.rotateTail} — the planned re-registration wave + handoff. */
141
+ export interface RotationResult {
142
+ readonly newTailId: Uint8Array;
143
+ readonly newTailIdB64: string;
144
+ readonly rotationRevision: number;
145
+ readonly plans: readonly ReRegistrationPlan[];
146
+ /** Peak re-registration arrivals in any `T_rejoin_jitter`-long window of the wave (the fast-promote bound). */
147
+ readonly peakWindowArrivals: number;
148
+ /** The buffer-to-checkpoint handoff folded onto the new tail (undefined if the old ring was empty). */
149
+ readonly handoff?: CheckpointSummary;
150
+ }
151
+ /**
152
+ * The reactivity integration mesh. Build with {@link buildReactivityMesh}; register a collection with
153
+ * {@link registerCollection}; drive subscribers/commits/recovery with {@link subscribe} / {@link commit} /
154
+ * {@link resume} / {@link rotateTail}.
155
+ */
156
+ export declare class ReactivityMesh {
157
+ readonly mesh: CohortMesh;
158
+ readonly members: Member[];
159
+ private readonly wantK;
160
+ private readonly minSigs;
161
+ private readonly profiles;
162
+ private readonly collections;
163
+ private vtime;
164
+ private corr;
165
+ /** Pending one-shot timers armed against the virtual clock (the rotation scheduler's `setTimer` binding). */
166
+ private readonly virtualTimers;
167
+ private constructor();
168
+ /** Stand up an N-node reactivity mesh and start every host. */
169
+ static build(opts?: ReactivityMeshOptions): Promise<ReactivityMesh>;
170
+ /** The current virtual time (unix ms). */
171
+ get now(): number;
172
+ /**
173
+ * Advance the virtual clock by `ms` (drives `T_drain` / rotation timing deterministically), then fire any
174
+ * virtual timers now due. A fired timer may arm another (a chained rotation), so fire one-at-a-time until
175
+ * the queue is quiescent — the rotation re-registration scheduler's `setTimer` binding rides this.
176
+ */
177
+ advanceTime(ms: number): void;
178
+ /** Arm a one-shot timer against the virtual clock; the cancel handle drops it (the scheduler's `setTimer`). */
179
+ private armVirtualTimer;
180
+ private profileOf;
181
+ /**
182
+ * Register a collection on the mesh: instantiate its tail-anchored tier-0 cohort (+willingness quorum),
183
+ * install the real origination manager behind the real change-notifier bridge over a fresh `StorageRepo`,
184
+ * build the tail `PushState` (replay ring + rolling checkpoint + backpressure), and cache the tail
185
+ * cohort's `MembershipCertV1` into every node's verifier so end-to-end verification is real Ed25519.
186
+ */
187
+ registerCollection(name: string, opts?: CollectionOptions): Promise<void>;
188
+ /** The reactivity notification verifier over a node's service verifier (real collected-multisig at T3). */
189
+ private notificationVerifierFor;
190
+ private makePushState;
191
+ /** The FRET cohort (the `wantK` nearest members) around a coord. */
192
+ private cohortMembersAround;
193
+ /** Whether the node FRET-routes nearest to `coord` (the cohort's routed primary) is an Edge profile. */
194
+ private nearestIsEdge;
195
+ /**
196
+ * Choose a reactivity tail id derived from `baseTail` whose `coord_0` routes nearest a **Core** node.
197
+ * Reactivity topics serve at tier T3, and an Edge node declines a T3 cold-start by design (it serves no
198
+ * forwarder duty — pinned by `cohort-topic-scale-lifecycle` "Edge serves no T3"), so a topic whose
199
+ * `coord_0` routes nearest an Edge node can never instantiate its tail cohort: the routed primary returns
200
+ * `no_state`, the walk exhausts, and `register` throws `CohortBackoffError`. Because {@link makeMembers}
201
+ * re-randomizes the member ring layout every run, an Edge-profile mesh would otherwise *intermittently*
202
+ * seat the Edge node as a collection's tail primary (~1/nodeCount of runs) and flake. In production a
203
+ * reactivity tail cohort IS the Core cluster that served the tail, so pinning the primary to a Core node
204
+ * models reality. A no-op (returns `utf8(baseTail)` at the first try) when the mesh has no Edge nodes —
205
+ * the common case — so every all-Core suite is byte-for-byte unaffected.
206
+ */
207
+ private pinTailToCore;
208
+ private collection;
209
+ /**
210
+ * Cache the tail cohort's `MembershipCertV1` (over the FRET cohort around the current tail's coord_0) into
211
+ * every node's participant verifier, so a subscriber's notification verify is real Ed25519 against the
212
+ * tail membership — mirroring `reactivity-real-crypto.spec.ts`, now over the mesh's real cohort members.
213
+ */
214
+ private cacheTailCert;
215
+ /** The tail cohort member ids (base64url member bytes) serving a collection's current tail. */
216
+ tailCohortIds(name: string): readonly string[];
217
+ /** This collection's tier-0 cohort registration records carrying a reactivity subscribe payload. */
218
+ cohortSubscriberCount(name: string): number;
219
+ /** The current committed revision for a collection. */
220
+ currentRevision(name: string): number;
221
+ /**
222
+ * Drive the deciding cohort's membership stabilization (publish its `MembershipCertV1`). Promotion is
223
+ * fire-and-forget off the register path; stabilizing publishes the cohort cert so a crossed-`cap_promote`
224
+ * decision lands deterministically (no wall-clock wait) — the same pre-step the cohort-topic scale specs use.
225
+ */
226
+ stabilizeCohort(name: string): Promise<void>;
227
+ /** Whether a collection's tier-0 cohort has promoted (its direct participants crossed `cap_promote`). */
228
+ isPromoted(name: string): boolean;
229
+ /** Whether a node profile may serve as a reactivity forwarder (T3 producer) — Edge never can. */
230
+ mayForward(nodeIndex: number): boolean;
231
+ /**
232
+ * Register node `nodeIndex` as a reactivity subscriber for `collection` via the **real**
233
+ * {@link ReactivitySubscriptionManager} → `CohortTopicService.register` walk at tier T3. The subscribe
234
+ * record lands in the real tier-0 cohort store; the manager owns the real verify/deliver/backfill/resume
235
+ * path. Returns a handle whose `delivered` array accumulates the surfaced notifications.
236
+ */
237
+ subscribe(nodeIndex: number, collection: string, opts?: SubscribeOptions): Promise<SubscriptionHandle>;
238
+ /**
239
+ * Commit `count` transactions to `collection` through the real `StorageRepo` → change-bridge →
240
+ * origination path, then fan the originated notifications out to current-tail subscribers. Returns the
241
+ * new current revision. Each commit pre-signs a **real** threshold {@link CommitCert} with the tail
242
+ * cohort's Ed25519 keys (the bridge's synchronous extractor resolves it by `actionId`).
243
+ */
244
+ commit(collection: string, count?: number): Promise<number>;
245
+ /** Build a real threshold commit cert: every tail-cohort member signs `utf8(commitHash + ":approve")`. */
246
+ private buildTailCert;
247
+ private clusterPeers;
248
+ private insertTransforms;
249
+ /**
250
+ * Run the originated notifications through the real forwarder receive path (populating the tail replay
251
+ * ring + rolling checkpoint + dedupe), then fan each out to every current-tail subscriber via its real
252
+ * per-subscriber bounded queue. A subscriber with `autoDrain` drains immediately; a slow subscriber's
253
+ * queue accumulates (drop-oldest under pressure) until it is woken.
254
+ */
255
+ private drainFanOut;
256
+ /** Drain a subscriber's bounded queue (FIFO) through the real manager delivery path. */
257
+ private drainSubscriber;
258
+ /** Wake a slow subscriber: drain its accumulated (drop-oldest) queue through the delivery path. */
259
+ wakeSubscriber(s: SubscriptionHandle): Promise<void>;
260
+ /** Put a subscriber to sleep: fan-out skips it (its tail replay buffer still fills) until it resumes. */
261
+ sleepSubscriber(s: SubscriptionHandle): void;
262
+ /** The drop counter on a subscriber's bounded queue (drop-oldest under backpressure). */
263
+ droppedFor(s: SubscriptionHandle): number;
264
+ /** Drive the manager's real `resume()` (one `ResumeV1` → `serveResume` → `applyResumeReply`). */
265
+ resume(s: SubscriptionHandle): Promise<ResumeApplyOutcome>;
266
+ /**
267
+ * The re-registration move the scheduler fires on a rotation notice: re-attach the subscriber under the
268
+ * rotated tail so subsequent fan-out targets it. The production factory builds a *fresh* manager under
269
+ * `plan.newTopicId`; the harness keeps the same manager (its `lastRevision` is already contiguous and its
270
+ * `rotationHandledFor` guard dedupes the new-tail deliveries' re-detection), so re-attaching the existing
271
+ * subscriber is the equivalent move with no gap.
272
+ */
273
+ private reAttachToNewTail;
274
+ /**
275
+ * Rotate a collection's tail: advance `tailId` → new `topicId`/coord/cohort, re-establish the new cohort
276
+ * (re-seed willingness so a post-rotation subscribe can register), re-cache the tail cert, rebuild the tail
277
+ * `PushState`, fold the outgoing ring into a handoff checkpoint onto the new tail, and plan the jittered
278
+ * re-registration wave bounded by `cap_promote_fast`. Async because re-forming the new cohort is (the real
279
+ * willingness convergence). With `{ autoReattach: false }` it instead models the running node's
280
+ * `markRotated` (drain gate) so subscribers move via the recover-redirect path. Models §Tail rotation steps 2–5.
281
+ */
282
+ rotateTail(collection: string, opts?: RotateTailOptions): Promise<RotationResult>;
283
+ /** Peak re-registration arrivals in any `T_rejoin_jitter`-long window of a planned wave. */
284
+ private peakWindowArrivals;
285
+ /** A deterministic pseudo-random in [0,1) so the jitter wave is reproducible across runs. */
286
+ private deterministicRandom;
287
+ /**
288
+ * The tail cohort `PushState` for a collection (its live replay ring / checkpoint / backpressure). Exposed
289
+ * so a suite can assert the replay/dedupe/partition state directly.
290
+ */
291
+ pushStateOf(collection: string): PushState;
292
+ /** A real forwarder receive over the tail `PushState` — used to model a forwarder-hop / partition replay. */
293
+ forwarderReceive(collection: string, n: NotificationV1): Promise<ForwardDecision>;
294
+ stop(): Promise<void>;
295
+ }
296
+ /** Build and start a reactivity integration mesh. */
297
+ export declare function buildReactivityMesh(opts?: ReactivityMeshOptions): Promise<ReactivityMesh>;
298
+ //# sourceMappingURL=reactivity-mesh-harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactivity-mesh-harness.d.ts","sourceRoot":"","sources":["../../../src/testing/reactivity-mesh-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,EAKN,SAAS,EA0BT,KAAK,eAAe,EAGpB,KAAK,cAAc,EAEnB,KAAK,WAAW,EAEhB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAIvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAEvB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,6BAA6B,EAAE,KAAK,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAE3G,OAAO,EAAE,+BAA+B,EAA4B,MAAM,2CAA2C,CAAC;AAEtH,OAAO,EACN,UAAU,EAEV,KAAK,EAGL,KAAK,UAAU,EACf,KAAK,MAAM,EAGX,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;AAC7B,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;AAIvC,wDAAwD;AACxD,MAAM,WAAW,qBAAqB;IACrC,8BAA8B;IAC9B,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