@optimystic/db-p2p 0.14.1 → 0.16.3

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 (275) hide show
  1. package/README.md +616 -609
  2. package/dist/src/cluster/block-transfer-service.d.ts.map +1 -1
  3. package/dist/src/cluster/block-transfer-service.js +4 -3
  4. package/dist/src/cluster/block-transfer-service.js.map +1 -1
  5. package/dist/src/cluster/block-transfer.d.ts +52 -3
  6. package/dist/src/cluster/block-transfer.d.ts.map +1 -1
  7. package/dist/src/cluster/block-transfer.js +129 -6
  8. package/dist/src/cluster/block-transfer.js.map +1 -1
  9. package/dist/src/cluster/client.d.ts.map +1 -1
  10. package/dist/src/cluster/client.js +3 -1
  11. package/dist/src/cluster/client.js.map +1 -1
  12. package/dist/src/cluster/cluster-repo.d.ts +182 -11
  13. package/dist/src/cluster/cluster-repo.d.ts.map +1 -1
  14. package/dist/src/cluster/cluster-repo.js +429 -69
  15. package/dist/src/cluster/cluster-repo.js.map +1 -1
  16. package/dist/src/cluster/peer-key-binding.d.ts +25 -0
  17. package/dist/src/cluster/peer-key-binding.d.ts.map +1 -0
  18. package/dist/src/cluster/peer-key-binding.js +39 -0
  19. package/dist/src/cluster/peer-key-binding.js.map +1 -0
  20. package/dist/src/cluster/quorum-restore.d.ts +72 -0
  21. package/dist/src/cluster/quorum-restore.d.ts.map +1 -0
  22. package/dist/src/cluster/quorum-restore.js +0 -0
  23. package/dist/src/cluster/quorum-restore.js.map +1 -0
  24. package/dist/src/cluster/rebalance-monitor.d.ts +23 -1
  25. package/dist/src/cluster/rebalance-monitor.d.ts.map +1 -1
  26. package/dist/src/cluster/rebalance-monitor.js +17 -2
  27. package/dist/src/cluster/rebalance-monitor.js.map +1 -1
  28. package/dist/src/cluster/service.d.ts.map +1 -1
  29. package/dist/src/cluster/service.js +7 -1
  30. package/dist/src/cluster/service.js.map +1 -1
  31. package/dist/src/cluster/spread-on-churn.d.ts +7 -0
  32. package/dist/src/cluster/spread-on-churn.d.ts.map +1 -1
  33. package/dist/src/cluster/spread-on-churn.js +4 -1
  34. package/dist/src/cluster/spread-on-churn.js.map +1 -1
  35. package/dist/src/cluster/supermajority-coupling.d.ts +22 -0
  36. package/dist/src/cluster/supermajority-coupling.d.ts.map +1 -0
  37. package/dist/src/cluster/supermajority-coupling.js +27 -0
  38. package/dist/src/cluster/supermajority-coupling.js.map +1 -0
  39. package/dist/src/cohort-topic/cohort-gossip-driver.d.ts +46 -4
  40. package/dist/src/cohort-topic/cohort-gossip-driver.d.ts.map +1 -1
  41. package/dist/src/cohort-topic/cohort-gossip-driver.js +62 -7
  42. package/dist/src/cohort-topic/cohort-gossip-driver.js.map +1 -1
  43. package/dist/src/cohort-topic/cohort-gossip-transport.d.ts +7 -0
  44. package/dist/src/cohort-topic/cohort-gossip-transport.d.ts.map +1 -1
  45. package/dist/src/cohort-topic/cohort-gossip-transport.js +9 -0
  46. package/dist/src/cohort-topic/cohort-gossip-transport.js.map +1 -1
  47. package/dist/src/cohort-topic/host.d.ts +197 -27
  48. package/dist/src/cohort-topic/host.d.ts.map +1 -1
  49. package/dist/src/cohort-topic/host.js +643 -87
  50. package/dist/src/cohort-topic/host.js.map +1 -1
  51. package/dist/src/dispute/arbitrator-selection.d.ts +68 -7
  52. package/dist/src/dispute/arbitrator-selection.d.ts.map +1 -1
  53. package/dist/src/dispute/arbitrator-selection.js +105 -16
  54. package/dist/src/dispute/arbitrator-selection.js.map +1 -1
  55. package/dist/src/dispute/cascade.d.ts +7 -0
  56. package/dist/src/dispute/cascade.d.ts.map +1 -1
  57. package/dist/src/dispute/cascade.js +1 -1
  58. package/dist/src/dispute/cascade.js.map +1 -1
  59. package/dist/src/dispute/client.d.ts.map +1 -1
  60. package/dist/src/dispute/client.js +3 -2
  61. package/dist/src/dispute/client.js.map +1 -1
  62. package/dist/src/dispute/dispute-service.d.ts +32 -3
  63. package/dist/src/dispute/dispute-service.d.ts.map +1 -1
  64. package/dist/src/dispute/dispute-service.js +82 -9
  65. package/dist/src/dispute/dispute-service.js.map +1 -1
  66. package/dist/src/dispute/index.d.ts +1 -1
  67. package/dist/src/dispute/index.d.ts.map +1 -1
  68. package/dist/src/dispute/index.js +1 -1
  69. package/dist/src/dispute/index.js.map +1 -1
  70. package/dist/src/dispute/invalidation.d.ts +25 -0
  71. package/dist/src/dispute/invalidation.d.ts.map +1 -1
  72. package/dist/src/dispute/invalidation.js +14 -2
  73. package/dist/src/dispute/invalidation.js.map +1 -1
  74. package/dist/src/dispute/service.d.ts.map +1 -1
  75. package/dist/src/dispute/service.js +7 -1
  76. package/dist/src/dispute/service.js.map +1 -1
  77. package/dist/src/index.d.ts +4 -1
  78. package/dist/src/index.d.ts.map +1 -1
  79. package/dist/src/index.js +4 -1
  80. package/dist/src/index.js.map +1 -1
  81. package/dist/src/it-utility.d.ts +1 -1
  82. package/dist/src/it-utility.d.ts.map +1 -1
  83. package/dist/src/it-utility.js +4 -13
  84. package/dist/src/it-utility.js.map +1 -1
  85. package/dist/src/libp2p-key-network.d.ts +98 -1
  86. package/dist/src/libp2p-key-network.d.ts.map +1 -1
  87. package/dist/src/libp2p-key-network.js +272 -17
  88. package/dist/src/libp2p-key-network.js.map +1 -1
  89. package/dist/src/libp2p-node-base.d.ts +12 -0
  90. package/dist/src/libp2p-node-base.d.ts.map +1 -1
  91. package/dist/src/libp2p-node-base.js +441 -89
  92. package/dist/src/libp2p-node-base.js.map +1 -1
  93. package/dist/src/matchmaking/query-transport.d.ts +2 -0
  94. package/dist/src/matchmaking/query-transport.d.ts.map +1 -1
  95. package/dist/src/matchmaking/query-transport.js +6 -0
  96. package/dist/src/matchmaking/query-transport.js.map +1 -1
  97. package/dist/src/matchmaking/traffic-validation.js +1 -0
  98. package/dist/src/matchmaking/traffic-validation.js.map +1 -1
  99. package/dist/src/network/network-manager-service.d.ts +2 -2
  100. package/dist/src/network/network-manager-service.d.ts.map +1 -1
  101. package/dist/src/network/network-manager-service.js +8 -4
  102. package/dist/src/network/network-manager-service.js.map +1 -1
  103. package/dist/src/owned-block-seed.d.ts +27 -0
  104. package/dist/src/owned-block-seed.d.ts.map +1 -0
  105. package/dist/src/owned-block-seed.js +37 -0
  106. package/dist/src/owned-block-seed.js.map +1 -0
  107. package/dist/src/protocol-client.d.ts +1 -0
  108. package/dist/src/protocol-client.d.ts.map +1 -1
  109. package/dist/src/protocol-client.js +9 -2
  110. package/dist/src/protocol-client.js.map +1 -1
  111. package/dist/src/protocol-limits.d.ts +32 -0
  112. package/dist/src/protocol-limits.d.ts.map +1 -0
  113. package/dist/src/protocol-limits.js +32 -0
  114. package/dist/src/protocol-limits.js.map +1 -0
  115. package/dist/src/repo/client.d.ts.map +1 -1
  116. package/dist/src/repo/client.js +3 -0
  117. package/dist/src/repo/client.js.map +1 -1
  118. package/dist/src/repo/cluster-coordinator.d.ts +41 -4
  119. package/dist/src/repo/cluster-coordinator.d.ts.map +1 -1
  120. package/dist/src/repo/cluster-coordinator.js +128 -80
  121. package/dist/src/repo/cluster-coordinator.js.map +1 -1
  122. package/dist/src/repo/coordinator-repo.d.ts +38 -1
  123. package/dist/src/repo/coordinator-repo.d.ts.map +1 -1
  124. package/dist/src/repo/coordinator-repo.js +92 -13
  125. package/dist/src/repo/coordinator-repo.js.map +1 -1
  126. package/dist/src/repo/service.d.ts.map +1 -1
  127. package/dist/src/repo/service.js +7 -1
  128. package/dist/src/repo/service.js.map +1 -1
  129. package/dist/src/reputation/peer-reputation.js +1 -1
  130. package/dist/src/reputation/peer-reputation.js.map +1 -1
  131. package/dist/src/reputation/types.d.ts +3 -1
  132. package/dist/src/reputation/types.d.ts.map +1 -1
  133. package/dist/src/reputation/types.js +3 -0
  134. package/dist/src/reputation/types.js.map +1 -1
  135. package/dist/src/rn.d.ts +5 -1
  136. package/dist/src/rn.d.ts.map +1 -1
  137. package/dist/src/rn.js +7 -1
  138. package/dist/src/rn.js.map +1 -1
  139. package/dist/src/storage/arachnode-fret-adapter.d.ts +30 -1
  140. package/dist/src/storage/arachnode-fret-adapter.d.ts.map +1 -1
  141. package/dist/src/storage/arachnode-fret-adapter.js +15 -2
  142. package/dist/src/storage/arachnode-fret-adapter.js.map +1 -1
  143. package/dist/src/storage/arachnode-partition.d.ts +49 -0
  144. package/dist/src/storage/arachnode-partition.d.ts.map +1 -0
  145. package/dist/src/storage/arachnode-partition.js +61 -0
  146. package/dist/src/storage/arachnode-partition.js.map +1 -0
  147. package/dist/src/storage/block-storage.d.ts +40 -1
  148. package/dist/src/storage/block-storage.d.ts.map +1 -1
  149. package/dist/src/storage/block-storage.js +150 -57
  150. package/dist/src/storage/block-storage.js.map +1 -1
  151. package/dist/src/storage/i-block-storage.d.ts +8 -0
  152. package/dist/src/storage/i-block-storage.d.ts.map +1 -1
  153. package/dist/src/storage/i-raw-storage.d.ts +13 -0
  154. package/dist/src/storage/i-raw-storage.d.ts.map +1 -1
  155. package/dist/src/storage/kv-raw-storage.d.ts +45 -0
  156. package/dist/src/storage/kv-raw-storage.d.ts.map +1 -0
  157. package/dist/src/storage/kv-raw-storage.js +113 -0
  158. package/dist/src/storage/kv-raw-storage.js.map +1 -0
  159. package/dist/src/storage/memory-storage.d.ts +20 -58
  160. package/dist/src/storage/memory-storage.d.ts.map +1 -1
  161. package/dist/src/storage/memory-storage.js +22 -148
  162. package/dist/src/storage/memory-storage.js.map +1 -1
  163. package/dist/src/storage/memory-store-driver.d.ts +39 -0
  164. package/dist/src/storage/memory-store-driver.d.ts.map +1 -0
  165. package/dist/src/storage/memory-store-driver.js +129 -0
  166. package/dist/src/storage/memory-store-driver.js.map +1 -0
  167. package/dist/src/storage/raw-store-codec.d.ts +10 -0
  168. package/dist/src/storage/raw-store-codec.d.ts.map +1 -0
  169. package/dist/src/storage/raw-store-codec.js +36 -0
  170. package/dist/src/storage/raw-store-codec.js.map +1 -0
  171. package/dist/src/storage/raw-store-driver.d.ts +69 -0
  172. package/dist/src/storage/raw-store-driver.d.ts.map +1 -0
  173. package/dist/src/storage/raw-store-driver.js +2 -0
  174. package/dist/src/storage/raw-store-driver.js.map +1 -0
  175. package/dist/src/storage/restoration-coordinator-v2.d.ts.map +1 -1
  176. package/dist/src/storage/restoration-coordinator-v2.js +1 -1
  177. package/dist/src/storage/restoration-coordinator-v2.js.map +1 -1
  178. package/dist/src/storage/restoration-coordinator.d.ts +73 -0
  179. package/dist/src/storage/restoration-coordinator.d.ts.map +1 -0
  180. package/dist/src/storage/restoration-coordinator.js +181 -0
  181. package/dist/src/storage/restoration-coordinator.js.map +1 -0
  182. package/dist/src/storage/ring-selector.d.ts +92 -5
  183. package/dist/src/storage/ring-selector.d.ts.map +1 -1
  184. package/dist/src/storage/ring-selector.js +153 -51
  185. package/dist/src/storage/ring-selector.js.map +1 -1
  186. package/dist/src/storage/ring-shift-coordinator.d.ts +128 -0
  187. package/dist/src/storage/ring-shift-coordinator.d.ts.map +1 -0
  188. package/dist/src/storage/ring-shift-coordinator.js +196 -0
  189. package/dist/src/storage/ring-shift-coordinator.js.map +1 -0
  190. package/dist/src/storage/storage-monitor.d.ts +28 -0
  191. package/dist/src/storage/storage-monitor.d.ts.map +1 -1
  192. package/dist/src/storage/storage-monitor.js +42 -2
  193. package/dist/src/storage/storage-monitor.js.map +1 -1
  194. package/dist/src/storage/storage-repo.d.ts +19 -0
  195. package/dist/src/storage/storage-repo.d.ts.map +1 -1
  196. package/dist/src/storage/storage-repo.js +172 -22
  197. package/dist/src/storage/storage-repo.js.map +1 -1
  198. package/dist/src/sync/client.d.ts.map +1 -1
  199. package/dist/src/sync/client.js +5 -1
  200. package/dist/src/sync/client.js.map +1 -1
  201. package/dist/src/sync/service.d.ts.map +1 -1
  202. package/dist/src/sync/service.js +2 -1
  203. package/dist/src/sync/service.js.map +1 -1
  204. package/dist/src/testing/cohort-topic-mesh-harness.d.ts +28 -4
  205. package/dist/src/testing/cohort-topic-mesh-harness.d.ts.map +1 -1
  206. package/dist/src/testing/cohort-topic-mesh-harness.js +51 -10
  207. package/dist/src/testing/cohort-topic-mesh-harness.js.map +1 -1
  208. package/dist/src/testing/index.d.ts +1 -0
  209. package/dist/src/testing/index.d.ts.map +1 -1
  210. package/dist/src/testing/index.js +1 -0
  211. package/dist/src/testing/index.js.map +1 -1
  212. package/dist/src/testing/mesh-harness.d.ts.map +1 -1
  213. package/dist/src/testing/mesh-harness.js +15 -7
  214. package/dist/src/testing/mesh-harness.js.map +1 -1
  215. package/dist/src/testing/raw-storage-conformance.d.ts +24 -0
  216. package/dist/src/testing/raw-storage-conformance.d.ts.map +1 -0
  217. package/dist/src/testing/raw-storage-conformance.js +313 -0
  218. package/dist/src/testing/raw-storage-conformance.js.map +1 -0
  219. package/package.json +4 -4
  220. package/src/cluster/block-transfer-service.ts +4 -3
  221. package/src/cluster/block-transfer.ts +424 -265
  222. package/src/cluster/client.ts +3 -1
  223. package/src/cluster/cluster-repo.ts +481 -71
  224. package/src/cluster/peer-key-binding.ts +37 -0
  225. package/src/cluster/quorum-restore.ts +0 -0
  226. package/src/cluster/rebalance-monitor.ts +34 -3
  227. package/src/cluster/service.ts +7 -1
  228. package/src/cluster/spread-on-churn.ts +11 -1
  229. package/src/cluster/supermajority-coupling.ts +37 -0
  230. package/src/cohort-topic/cohort-gossip-driver.ts +96 -9
  231. package/src/cohort-topic/cohort-gossip-transport.ts +10 -0
  232. package/src/cohort-topic/host.ts +831 -105
  233. package/src/dispute/arbitrator-selection.ts +138 -28
  234. package/src/dispute/cascade.ts +8 -1
  235. package/src/dispute/client.ts +3 -2
  236. package/src/dispute/dispute-service.ts +94 -9
  237. package/src/dispute/index.ts +7 -1
  238. package/src/dispute/invalidation.ts +40 -2
  239. package/src/dispute/service.ts +7 -1
  240. package/src/index.ts +46 -43
  241. package/src/it-utility.ts +5 -13
  242. package/src/libp2p-key-network.ts +281 -18
  243. package/src/libp2p-node-base.ts +511 -81
  244. package/src/matchmaking/query-transport.ts +9 -0
  245. package/src/network/network-manager-service.ts +8 -2
  246. package/src/owned-block-seed.ts +40 -0
  247. package/src/protocol-client.ts +10 -3
  248. package/src/protocol-limits.ts +33 -0
  249. package/src/repo/client.ts +3 -0
  250. package/src/repo/cluster-coordinator.ts +145 -82
  251. package/src/repo/coordinator-repo.ts +96 -16
  252. package/src/repo/service.ts +7 -1
  253. package/src/reputation/types.ts +3 -0
  254. package/src/rn.ts +7 -1
  255. package/src/storage/arachnode-fret-adapter.ts +33 -2
  256. package/src/storage/arachnode-partition.ts +74 -0
  257. package/src/storage/block-storage.ts +169 -61
  258. package/src/storage/i-block-storage.ts +9 -0
  259. package/src/storage/i-raw-storage.ts +14 -0
  260. package/src/storage/kv-raw-storage.ts +135 -0
  261. package/src/storage/memory-storage.ts +25 -173
  262. package/src/storage/memory-store-driver.ts +157 -0
  263. package/src/storage/raw-store-codec.ts +42 -0
  264. package/src/storage/raw-store-driver.ts +80 -0
  265. package/src/storage/{restoration-coordinator-v2.ts → restoration-coordinator.ts} +43 -37
  266. package/src/storage/ring-selector.ts +317 -176
  267. package/src/storage/ring-shift-coordinator.ts +271 -0
  268. package/src/storage/storage-monitor.ts +70 -3
  269. package/src/storage/storage-repo.ts +710 -558
  270. package/src/sync/client.ts +5 -1
  271. package/src/sync/service.ts +2 -1
  272. package/src/testing/cohort-topic-mesh-harness.ts +61 -11
  273. package/src/testing/index.ts +1 -0
  274. package/src/testing/mesh-harness.ts +14 -6
  275. package/src/testing/raw-storage-conformance.ts +397 -0
@@ -1,4 +1,4 @@
1
- import type { IRepo, ClusterRecord, ITransactionValidator, ClusterConsensusConfig, BlockId, ActionId, ActionRev, CommitCert, InvalidateRequest } from "@optimystic/db-core";
1
+ import type { IRepo, ClusterRecord, ClusterPeers, ITransactionValidator, ClusterConsensusConfig, BlockId, ActionId, ActionRev, CommitCert, InvalidateRequest } from "@optimystic/db-core";
2
2
  import type { ICluster } from "@optimystic/db-core";
3
3
  import type { IPeerNetwork } from "@optimystic/db-core";
4
4
  import { type ArbitratorSetRecompute } from "../dispute/invalidation.js";
@@ -51,6 +51,30 @@ export type InvalidationApplySink = (request: InvalidateRequest) => Promise<void
51
51
  * interim posture (see `tickets/plan/cohort-topic-membership-cert-trust-anchoring.md`).
52
52
  */
53
53
  export type RecomputeArbitratorSetCapability = ArbitratorSetRecompute;
54
+ /**
55
+ * The member's own independently-derived view of a block's responsible cluster, plus FRET's confidence in
56
+ * the underlying network-size estimate (0..1). Returned by {@link DeriveExpectedClusterCallback} and
57
+ * consumed by {@link ClusterMember}'s membership admission gate: the member checks a coordinator-declared
58
+ * peer set against `peers` (its expected set `E`) and gates on `confidence` (low confidence ⇒ fail closed
59
+ * for any downsizing, the partition posture).
60
+ */
61
+ export type ExpectedClusterView = {
62
+ /** The member's own derived responsible-peer set for the block (its view of the legitimate cluster). */
63
+ peers: ClusterPeers;
64
+ /** FRET's confidence in the current network-size estimate (0..1); ≤ threshold ⇒ treated as untrusted. */
65
+ confidence: number;
66
+ };
67
+ /**
68
+ * Independently derive this member's own view of a block's responsible cluster. Injected so
69
+ * {@link ClusterMember} stays transport-agnostic — the composition root supplies it from
70
+ * `IKeyNetwork.findCluster` + FRET (mirroring how the coordinator derives the cluster). Absent on nodes
71
+ * that cannot derive a view (no FRET, unit tests): with no derived view AND no configured full-size
72
+ * reference the gate preserves legacy approve behavior, but a configured `clusterSize` still lets the gate
73
+ * fail closed on an unjustified downsize. See {@link ClusterMember} admission gate.
74
+ */
75
+ export type DeriveExpectedClusterCallback = (blockId: BlockId) => Promise<ExpectedClusterView>;
76
+ /** Stable reject reason a member emits when a declared peer set fails the membership admission gate. */
77
+ export declare const MEMBERSHIP_NOT_ADMITTED = "membership-not-admitted";
54
78
  interface ClusterMemberComponents {
55
79
  storageRepo: IRepo;
56
80
  peerNetwork: IPeerNetwork;
@@ -71,6 +95,8 @@ interface ClusterMemberComponents {
71
95
  onInvalidate?: InvalidationApplySink;
72
96
  /** Layer-2 arbitrator-set recompute for invalidation verification; see {@link RecomputeArbitratorSetCapability}. */
73
97
  recomputeArbitratorSet?: RecomputeArbitratorSetCapability;
98
+ /** Member-side cluster derivation for the membership admission gate; see {@link DeriveExpectedClusterCallback}. */
99
+ deriveExpectedCluster?: DeriveExpectedClusterCallback;
74
100
  }
75
101
  export declare function clusterMember(components: ClusterMemberComponents): ClusterMember;
76
102
  /**
@@ -91,6 +117,7 @@ export declare class ClusterMember implements ICluster {
91
117
  private readonly onCommitCertificate?;
92
118
  private readonly onInvalidate?;
93
119
  private readonly recomputeArbitratorSet?;
120
+ private readonly deriveExpectedCluster?;
94
121
  private activeTransactions;
95
122
  private executedTransactions;
96
123
  private appliedInvalidations;
@@ -98,9 +125,33 @@ export declare class ClusterMember implements ICluster {
98
125
  private pendingUpdates;
99
126
  private readonly expirationInterval;
100
127
  private readonly cleanupInterval;
101
- /** Effective super-majority threshold. Defaults to 1.0 (unanimity) for backward compatibility. */
128
+ /**
129
+ * Confidence floor at/below which FRET's network-size view is treated as untrustworthy for the
130
+ * membership gate. Above it the member trusts its derived view (confident path); at/below it the gate
131
+ * fails closed for downsizing. Matches the coordinator's `validateSmallCluster` confidence gate (> 0.5).
132
+ */
133
+ private static readonly MembershipConfidenceThreshold;
134
+ /**
135
+ * Effective super-majority threshold this member accepts as sufficient for a commit. Defaults to
136
+ * {@link DEFAULT_SUPER_MAJORITY_THRESHOLD} (0.75) when no config is supplied — the SAME default the
137
+ * coordinator uses, so the two can never silently disagree about whether a transaction is final.
138
+ * (Previously defaulted to 1.0/unanimity, which split the member from a coordinator committing at 0.75.)
139
+ */
102
140
  private readonly superMajorityThreshold;
103
- constructor(storageRepo: IRepo, peerNetwork: IPeerNetwork, peerId: PeerId, privateKey: PrivateKey, protocolPrefix?: string | undefined, _partitionDetector?: PartitionDetector, fretService?: FretService | undefined, validator?: ITransactionValidator | undefined, reputation?: IPeerReputation | undefined, consensusConfig?: ClusterConsensusConfig, stateStore?: ITransactionStateStore | undefined, reconcileBlock?: ReconcileBlockCallback | undefined, onCommitCertificate?: CommitCertificateSink | undefined, onInvalidate?: InvalidationApplySink | undefined, recomputeArbitratorSet?: RecomputeArbitratorSetCapability | undefined);
141
+ private readonly minAbsoluteClusterSize;
142
+ private readonly clusterSizeTolerance;
143
+ private readonly membershipAdmissionFraction;
144
+ /** Configured full cluster size, or undefined when unknown (then the gate cannot judge a downsize). */
145
+ private readonly configuredClusterSize;
146
+ private readonly allowUnvalidatedSmallCluster;
147
+ constructor(storageRepo: IRepo, peerNetwork: IPeerNetwork, peerId: PeerId, privateKey: PrivateKey, protocolPrefix?: string | undefined, _partitionDetector?: PartitionDetector, fretService?: FretService | undefined, validator?: ITransactionValidator | undefined, reputation?: IPeerReputation | undefined, consensusConfig?: ClusterConsensusConfig, stateStore?: ITransactionStateStore | undefined, reconcileBlock?: ReconcileBlockCallback | undefined, onCommitCertificate?: CommitCertificateSink | undefined, onInvalidate?: InvalidationApplySink | undefined, recomputeArbitratorSet?: RecomputeArbitratorSetCapability | undefined, deriveExpectedCluster?: DeriveExpectedClusterCallback | undefined);
148
+ /**
149
+ * The resolved super-majority threshold this member runs on. Exposed so the composition root can
150
+ * fail-fast if the member and the coordinator would run different thresholds (see the coupling
151
+ * assertion in `libp2p-node-base.ts`) — a mismatch is a latent phase-disagreement, caught at startup
152
+ * rather than mid-consensus.
153
+ */
154
+ get effectiveSuperMajorityThreshold(): number;
104
155
  /**
105
156
  * Clears all interval and timeout handles and empties active state.
106
157
  * Called during node shutdown to prevent leaked timers.
@@ -131,21 +182,81 @@ export declare class ClusterMember implements ICluster {
131
182
  private detectEquivocation;
132
183
  private validateRecord;
133
184
  /**
134
- * Compute message hash using the same algorithm as the coordinator.
135
- * Must match cluster-coordinator.ts createMessageHash().
185
+ * Compute message hash using the same algorithm as the coordinator. Version-dispatched: a v2 record
186
+ * folds its membership digest into the preimage, a v1 / unversioned record hashes byte-identically to
187
+ * before this change. Must match cluster-coordinator.ts createMessageHash().
136
188
  */
137
189
  private computeMessageHash;
138
190
  private validateSignatures;
139
- /** Deterministic JSON: sorts object keys so hash is order-independent */
191
+ /**
192
+ * Deterministic JSON: sorts object keys so comparisons are order-independent.
193
+ * NOTE: this is a second copy of the canonicalization in db-core `membership.ts` (which feeds the hash
194
+ * preimages). It is used here only for equality checks (message-content / v1-peers compare), and those
195
+ * run *after* a messageHash-equality gate, so a drift between the two can't silently forge agreement —
196
+ * but keep them byte-identical. If a third caller appears, promote to a single exported helper.
197
+ */
140
198
  private static canonicalJson;
141
199
  private computePromiseHash;
142
200
  private computeCommitHash;
143
201
  private computeSigningPayload;
144
202
  private signVote;
203
+ /**
204
+ * Verify one vote signature and classify the outcome (see {@link VerifyOutcome}). Total on hostile
205
+ * input: a missing/empty key, a non-Ed25519 id, a key not bound to `peerId`, or malformed bytes all
206
+ * yield `{ valid:false, penalize:false }` (reject without penalizing an unproven identity) rather
207
+ * than throwing. Only after the key is proven to be the one `peerId` names does a failed
208
+ * cryptographic verify yield `{ valid:false, penalize:true }`.
209
+ *
210
+ * NOTE: the binding check (`peerIdBindsPublicKey`) proves the vote was signed by the key `peerId`
211
+ * names — it does NOT establish that `peerId` is legitimately in the cohort. A coordinator minting
212
+ * fresh keypairs and using each key's own derived id passes this for every one. Sybil/cohort
213
+ * membership is a separate layer (cohort-topic membership certificates), not solved here.
214
+ */
145
215
  private verifySignature;
146
216
  private getTransactionPhase;
147
217
  private hasMajority;
148
218
  private handlePromiseNeeded;
219
+ /**
220
+ * The full promise-phase decision for a record: admit the declared membership FIRST, then (only if
221
+ * admitted) validate its pend operations. Failing either yields a `{ valid:false, reason }` the caller
222
+ * turns into a `reject` vote. Splitting membership from pend validation keeps the reason strings
223
+ * distinct — a `membership-not-admitted` reject is a different signal (feeds the dispute path) than a
224
+ * stale-revision / custom-validator reject.
225
+ */
226
+ private evaluatePromise;
227
+ /**
228
+ * Membership admission gate. Decides whether the coordinator-declared peer set (`record.peers`, call it
229
+ * `D`) is a *legitimate* cluster this member may vote inside, judged against the member's OWN
230
+ * independently-derived view — not against anything the (untrusted) record declares about its size.
231
+ * Evaluated on the promise path before the member signs an approve.
232
+ *
233
+ * The predicate admits `D` iff ALL hold:
234
+ * 1. **Self-membership** — this member's id ∈ `D`; else this block is not its responsibility (and a
235
+ * coordinator must not route a record to a non-member to pad approval counts).
236
+ * 2. **Not a self-shrink below the floor** — with a confident derived view `E`, `|D| ≥ ⌈fraction·|E|⌉`
237
+ * (and ≥ minAbsoluteClusterSize). `|E|` is the member's own confident cluster-size estimate `K_est`,
238
+ * so a minority-partition set (small `D`) is rejected against the member's larger view.
239
+ * 3. **Consistency with the derived view** — `|D △ E|` within `clusterSizeTolerance·|E|`; honest churn
240
+ * of a peer or two is absorbed, a wholesale-disjoint or half-size set is not.
241
+ *
242
+ * **Fail-closed posture.** When the member cannot confidently derive `E` (no capability, low FRET
243
+ * confidence — exactly what a partition induces), it must refuse any *downsizing* decision: a
244
+ * below-full-size `D` is rejected against the configured full `clusterSize`. With NEITHER a confident
245
+ * view NOR a configured full size the gate cannot judge a downsize at all, so it preserves the legacy
246
+ * approve behavior (backward-compatible for nodes/tests with no derivation wired). `allowUnvalidatedSmallCluster`
247
+ * is the explicit opt-in (single-node / local dev knowingly below the safe floor), matching the
248
+ * coordinator's `validateSmallCluster` semantics.
249
+ */
250
+ private admitMembership;
251
+ /**
252
+ * Derive this member's own view of the record's block cluster via the injected capability, or
253
+ * `undefined` when it cannot (no capability, no coordinating block id, or a derivation error — all of
254
+ * which the gate treats as "not confident"). Derived from the record's coordinating block, the same key
255
+ * the coordinator used to select the cluster.
256
+ */
257
+ private deriveExpectedClusterView;
258
+ /** |A △ B| over two id lists (order-independent set symmetric difference). */
259
+ private static symmetricDifferenceSize;
149
260
  /**
150
261
  * Validates pend operations in a cluster record using the transaction validator.
151
262
  * Also checks for stale revisions to prevent consensus on operations that would fail.
@@ -159,9 +270,12 @@ export declare class ClusterMember implements ICluster {
159
270
  * @warning This method executes on ALL cluster peers, not just the coordinator.
160
271
  * Each peer independently applies the operations to its local storage.
161
272
  *
162
- * @pitfall **Check-then-act race** - Must check AND mark as executed atomically
163
- * (before any `await`) to prevent duplicate execution. JavaScript's single-threaded
164
- * nature makes synchronous check-and-set atomic.
273
+ * @pitfall **Check-then-act race** - The in-memory guard must be checked AND set
274
+ * atomically (before any `await`) to prevent duplicate execution; JavaScript's
275
+ * single-threaded nature makes that synchronous check-and-set atomic. The durable
276
+ * marker, by contrast, is persisted only *after* apply succeeds — writing it eagerly
277
+ * would leave a stuck marker on a caught fault or a crash mid-apply, silently dropping
278
+ * the transaction on this member on redelivery.
165
279
  *
166
280
  * @pitfall **Independent node storage** - Each node has its own storage. After consensus,
167
281
  * each node applies operations locally. Nodes must fetch missing blocks from cluster
@@ -249,10 +363,67 @@ export declare class ClusterMember implements ICluster {
249
363
  private setupTimeouts;
250
364
  private hasConflict;
251
365
  /**
252
- * Resolve race between two conflicting transactions.
253
- * Transaction with more promises wins. If tied, higher hash wins.
366
+ * Resolve a race between two conflicting transactions. Total and deterministic, so every honest
367
+ * member computes the identical winner (the Theorem 1 Case-2 premise). Order:
368
+ * 1. more promise signatures wins (progress monotonicity — see safety note below);
369
+ * 2. equal promise counts → higher aged priority wins (fairness — see {@link recordPriority});
370
+ * 3. still tied → higher message hash wins.
371
+ *
372
+ * Promise count is FIRST so this comparison never displaces a transaction that is further along.
373
+ * That restores the pre-priority safety invariant: a member commits purely on promise supermajority
374
+ * (`handleCommitNeeded` signs whenever `approvedPromises >= superMajority`; the commit path has NO
375
+ * conflict re-check), so `resolveRace` is the ONLY arbiter among concurrently-pending conflicts.
376
+ * With promises-first, once transaction X holds a promise supermajority every conflicting rival Y has
377
+ * strictly fewer promises — Y can only match X's count by getting the intersecting quorum member to
378
+ * promise it, but that member already holds X at supermajority and `resolveRace(X, Y)` returns
379
+ * `keep-existing` on X's higher count, so it never does. By quorum intersection any Y-supermajority
380
+ * overlaps X's in ≥1 honest member, and that member rejects Y. One winner (docs/correctness.md
381
+ * Theorem 9). Priority-first would break this: it could displace an already-quorum-reached X for a
382
+ * higher-priority Y with fewer promises, letting BOTH commit (split brain) — the regression fixed by
383
+ * ticket occ-priority-first-breaks-promise-monotonicity.
384
+ *
385
+ * Priority is now a tie-break that runs only at EQUAL promise counts, which is exactly the
386
+ * concurrent-starvation case aging targets (two fresh rivals, 0 promises each, otherwise coin-flipping
387
+ * on the hash). Priority still breaks those ties deterministically, so aging still solves the stated
388
+ * fairness problem in its common case. It only orders two *concurrently-pending* conflicts; it does NOT
389
+ * defer a fresh pend for an absent aged transaction (that residual — sequential sub-window starvation —
390
+ * is the deferred feat-occ-priority-reservation).
391
+ *
392
+ * NOTE: residual-fairness tripwire. Under promises-first an aged transaction can still lose to a fresh
393
+ * rival that has *legitimately* gathered even one more promise — that is not the pure-coin-flip
394
+ * starvation aging targets (equal counts, priority wins), it is the monotonicity behaviour we WANT (a
395
+ * more-progressed rival is never displaced). If deeper fairness against a genuinely-more-progressed
396
+ * rival is ever needed, it belongs to feat-occ-priority-reservation (reserve/defer at pend time), NOT
397
+ * to this race tie-break.
398
+ *
399
+ * NOTE: Byzantine self-assert is a fairness DoS, not a safety hole. A coordinator can stamp
400
+ * priority == MaxPriority on every transaction; recordPriority clamps to the cap so it cannot
401
+ * exceed it, and priority never influences validity/operationsHash/stale-read checks — and now sits
402
+ * below the promise count, so it can only break equal-count ties it might have ~50% won anyway,
403
+ * degrading to at-worst-status-quo fairness (the same graceful-degradation class as spam under
404
+ * honest-majority). Binding priority to provable age is out of scope (feat-occ-priority-reservation).
405
+ *
406
+ * NOTE: keep priority a self-contained additive message field + this one comparison key so it
407
+ * composes with — does not block — a future HLC/crdt-sync redesign of this same path
408
+ * (design-hot-log-tail-sharding-guidance).
254
409
  */
255
410
  private resolveRace;
411
+ /**
412
+ * Aged advisory priority carried by a record's pend operation, clamped to [0, MaxPriority].
413
+ * The multi-collection path carries it on `pend.transaction.priority`; the single-collection
414
+ * (`Collection.sync`) path carries it as top-level `pend.priority`; a record with neither — a
415
+ * legacy/unversioned coordinator's transaction, or a non-pend operation — is priority 0
416
+ * (backward compatible: such transactions simply never age). Both carriers live inside the signed
417
+ * `message`, so priority is integrity-protected in transit; clamping here bounds a self-asserted
418
+ * out-of-range value to the cap.
419
+ *
420
+ * NOTE: `message` is fixed for a transaction's whole lifecycle (promises/commits accrue in the
421
+ * separate `promises`/`commits` maps, never in `message`), so a transaction keeps its rank through
422
+ * the commit phase — there is no "priority drops to 0 at commit" asymmetry. resolveRace is only
423
+ * consulted at the promise decision (hasConflict), i.e. between two still-open conflicting
424
+ * transactions, which is exactly the concurrent-contention case priority is meant to order.
425
+ */
426
+ private recordPriority;
256
427
  private operationsConflict;
257
428
  private getActionId;
258
429
  private getAffectedBlockIds;
@@ -1 +1 @@
1
- {"version":3,"file":"cluster-repo.d.ts","sourceRoot":"","sources":["../../../src/cluster/cluster-repo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAA0B,qBAAqB,EAAE,sBAAsB,EAAgB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAiB,UAAU,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACjO,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAiC,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGxG,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAO5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAqB7E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,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