@xyo-network/chain-sdk 5.0.4 → 5.1.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 (305) hide show
  1. package/dist/browser/index.d.ts +1 -0
  2. package/dist/browser/index.d.ts.map +1 -1
  3. package/dist/browser/index.mjs +1 -0
  4. package/dist/browser/index.mjs.map +2 -2
  5. package/dist/browser/modules/analyze/ChainHeadSelector.d.ts +40 -0
  6. package/dist/browser/modules/analyze/ChainHeadSelector.d.ts.map +1 -1
  7. package/dist/browser/modules/analyze/admission.d.ts +65 -0
  8. package/dist/browser/modules/analyze/admission.d.ts.map +1 -0
  9. package/dist/browser/modules/analyze/index.d.ts +1 -0
  10. package/dist/browser/modules/analyze/index.d.ts.map +1 -1
  11. package/dist/browser/modules/protocol/block/BuildBlockOptions.d.ts +8 -0
  12. package/dist/browser/modules/protocol/block/BuildBlockOptions.d.ts.map +1 -1
  13. package/dist/browser/modules/protocol/block/buildBlock.d.ts.map +1 -1
  14. package/dist/browser/modules/protocol/block/buildNextBlock.d.ts +2 -1
  15. package/dist/browser/modules/protocol/block/buildNextBlock.d.ts.map +1 -1
  16. package/dist/browser/modules/services/implementation/processPendingBlocks.d.ts +9 -1
  17. package/dist/browser/modules/services/implementation/processPendingBlocks.d.ts.map +1 -1
  18. package/dist/browser/modules/services/simple/block/runner/SimpleBlockRunner.d.ts +34 -1
  19. package/dist/browser/modules/services/simple/block/runner/SimpleBlockRunner.d.ts.map +1 -1
  20. package/dist/browser/modules/services/simple/block/runner/index.d.ts +1 -0
  21. package/dist/browser/modules/services/simple/block/runner/index.d.ts.map +1 -1
  22. package/dist/browser/modules/services/simple/block/runner/selectSupersededCandidate.d.ts +22 -0
  23. package/dist/browser/modules/services/simple/block/runner/selectSupersededCandidate.d.ts.map +1 -0
  24. package/dist/browser/modules/slashing/detect/DetectedOffense.d.ts +27 -0
  25. package/dist/browser/modules/slashing/detect/DetectedOffense.d.ts.map +1 -0
  26. package/dist/browser/modules/slashing/detect/candidatePairs.d.ts +44 -0
  27. package/dist/browser/modules/slashing/detect/candidatePairs.d.ts.map +1 -0
  28. package/dist/browser/modules/slashing/detect/index.d.ts +5 -0
  29. package/dist/browser/modules/slashing/detect/index.d.ts.map +1 -0
  30. package/dist/browser/modules/slashing/detect/offenseGate.d.ts +18 -0
  31. package/dist/browser/modules/slashing/detect/offenseGate.d.ts.map +1 -0
  32. package/dist/browser/modules/slashing/detect/suppression.d.ts +23 -0
  33. package/dist/browser/modules/slashing/detect/suppression.d.ts.map +1 -0
  34. package/dist/browser/modules/slashing/eligibility/evaluateProducerEligibility.d.ts +71 -0
  35. package/dist/browser/modules/slashing/eligibility/evaluateProducerEligibility.d.ts.map +1 -0
  36. package/dist/browser/modules/slashing/eligibility/index.d.ts +2 -0
  37. package/dist/browser/modules/slashing/eligibility/index.d.ts.map +1 -0
  38. package/dist/browser/modules/slashing/index/SlashIndexStore.d.ts +22 -0
  39. package/dist/browser/modules/slashing/index/SlashIndexStore.d.ts.map +1 -0
  40. package/dist/browser/modules/slashing/index/foldSlashIndex.d.ts +56 -0
  41. package/dist/browser/modules/slashing/index/foldSlashIndex.d.ts.map +1 -0
  42. package/dist/browser/modules/slashing/index/index.d.ts +3 -0
  43. package/dist/browser/modules/slashing/index/index.d.ts.map +1 -0
  44. package/dist/browser/modules/slashing/index.d.ts +6 -0
  45. package/dist/browser/modules/slashing/index.d.ts.map +1 -0
  46. package/dist/browser/modules/slashing/model/OffenseProcedure.d.ts +28 -0
  47. package/dist/browser/modules/slashing/model/OffenseProcedure.d.ts.map +1 -0
  48. package/dist/browser/modules/slashing/model/OffenseVerificationContext.d.ts +88 -0
  49. package/dist/browser/modules/slashing/model/OffenseVerificationContext.d.ts.map +1 -0
  50. package/dist/browser/modules/slashing/model/SlashHistoryReader.d.ts +34 -0
  51. package/dist/browser/modules/slashing/model/SlashHistoryReader.d.ts.map +1 -0
  52. package/dist/browser/modules/slashing/model/VerificationOutcome.d.ts +39 -0
  53. package/dist/browser/modules/slashing/model/VerificationOutcome.d.ts.map +1 -0
  54. package/dist/browser/modules/slashing/model/index.d.ts +6 -0
  55. package/dist/browser/modules/slashing/model/index.d.ts.map +1 -0
  56. package/dist/browser/modules/slashing/model/offenseKey.d.ts +42 -0
  57. package/dist/browser/modules/slashing/model/offenseKey.d.ts.map +1 -0
  58. package/dist/browser/modules/slashing/verify/index.d.ts +10 -0
  59. package/dist/browser/modules/slashing/verify/index.d.ts.map +1 -0
  60. package/dist/browser/modules/slashing/verify/preamble.d.ts +63 -0
  61. package/dist/browser/modules/slashing/verify/preamble.d.ts.map +1 -0
  62. package/dist/browser/modules/slashing/verify/verifyEquivocation.d.ts +19 -0
  63. package/dist/browser/modules/slashing/verify/verifyEquivocation.d.ts.map +1 -0
  64. package/dist/browser/modules/slashing/verify/verifyFalseAnchor.d.ts +15 -0
  65. package/dist/browser/modules/slashing/verify/verifyFalseAnchor.d.ts.map +1 -0
  66. package/dist/browser/modules/slashing/verify/verifyFalseAttestation.d.ts +22 -0
  67. package/dist/browser/modules/slashing/verify/verifyFalseAttestation.d.ts.map +1 -0
  68. package/dist/browser/modules/slashing/verify/verifyIneligibleProduction.d.ts +18 -0
  69. package/dist/browser/modules/slashing/verify/verifyIneligibleProduction.d.ts.map +1 -0
  70. package/dist/browser/modules/slashing/verify/verifyInvalidBlock.d.ts +18 -0
  71. package/dist/browser/modules/slashing/verify/verifyInvalidBlock.d.ts.map +1 -0
  72. package/dist/browser/modules/slashing/verify/verifyInvalidSlashRequest.d.ts +11 -0
  73. package/dist/browser/modules/slashing/verify/verifyInvalidSlashRequest.d.ts.map +1 -0
  74. package/dist/browser/modules/slashing/verify/verifyOffense.d.ts +29 -0
  75. package/dist/browser/modules/slashing/verify/verifyOffense.d.ts.map +1 -0
  76. package/dist/browser/modules/slashing/verify/verifyRewardOvermint.d.ts +23 -0
  77. package/dist/browser/modules/slashing/verify/verifyRewardOvermint.d.ts.map +1 -0
  78. package/dist/browser/modules/validation/elevatedPayload/lib/findElevatingTransaction.d.ts +14 -0
  79. package/dist/browser/modules/validation/elevatedPayload/lib/findElevatingTransaction.d.ts.map +1 -0
  80. package/dist/browser/modules/validation/elevatedPayload/lib/index.d.ts +2 -0
  81. package/dist/browser/modules/validation/elevatedPayload/lib/index.d.ts.map +1 -1
  82. package/dist/browser/modules/validation/elevatedPayload/lib/validateSlashPayloadInBlock.d.ts +33 -0
  83. package/dist/browser/modules/validation/elevatedPayload/lib/validateSlashPayloadInBlock.d.ts.map +1 -0
  84. package/dist/browser/modules/validation/elevatedPayload/payloads/index.d.ts +5 -0
  85. package/dist/browser/modules/validation/elevatedPayload/payloads/index.d.ts.map +1 -1
  86. package/dist/browser/modules/validation/elevatedPayload/payloads/validateSlashAdjudicationInBlock.d.ts +14 -0
  87. package/dist/browser/modules/validation/elevatedPayload/payloads/validateSlashAdjudicationInBlock.d.ts.map +1 -0
  88. package/dist/browser/modules/validation/elevatedPayload/payloads/validateSlashChallengeInBlock.d.ts +10 -0
  89. package/dist/browser/modules/validation/elevatedPayload/payloads/validateSlashChallengeInBlock.d.ts.map +1 -0
  90. package/dist/browser/modules/validation/elevatedPayload/payloads/validateSlashCommitInBlock.d.ts +10 -0
  91. package/dist/browser/modules/validation/elevatedPayload/payloads/validateSlashCommitInBlock.d.ts.map +1 -0
  92. package/dist/browser/modules/validation/elevatedPayload/payloads/validateSlashEvidenceInBlock.d.ts +10 -0
  93. package/dist/browser/modules/validation/elevatedPayload/payloads/validateSlashEvidenceInBlock.d.ts.map +1 -0
  94. package/dist/browser/modules/validation/elevatedPayload/payloads/validateSlashRequestInBlock.d.ts +14 -0
  95. package/dist/browser/modules/validation/elevatedPayload/payloads/validateSlashRequestInBlock.d.ts.map +1 -0
  96. package/dist/browser/modules/validation/elevatedPayload/validatePayloadInBlock.d.ts.map +1 -1
  97. package/dist/browser/slashing.d.ts +2 -0
  98. package/dist/browser/slashing.d.ts.map +1 -0
  99. package/dist/neutral/analyze.mjs +85 -3
  100. package/dist/neutral/analyze.mjs.map +3 -3
  101. package/dist/neutral/index.d.ts +1 -0
  102. package/dist/neutral/index.d.ts.map +1 -1
  103. package/dist/neutral/index.mjs +1 -0
  104. package/dist/neutral/index.mjs.map +2 -2
  105. package/dist/neutral/modules/analyze/ChainHeadSelector.d.ts +40 -0
  106. package/dist/neutral/modules/analyze/ChainHeadSelector.d.ts.map +1 -1
  107. package/dist/neutral/modules/analyze/admission.d.ts +65 -0
  108. package/dist/neutral/modules/analyze/admission.d.ts.map +1 -0
  109. package/dist/neutral/modules/analyze/index.d.ts +1 -0
  110. package/dist/neutral/modules/analyze/index.d.ts.map +1 -1
  111. package/dist/neutral/modules/protocol/block/BuildBlockOptions.d.ts +8 -0
  112. package/dist/neutral/modules/protocol/block/BuildBlockOptions.d.ts.map +1 -1
  113. package/dist/neutral/modules/protocol/block/buildBlock.d.ts.map +1 -1
  114. package/dist/neutral/modules/protocol/block/buildNextBlock.d.ts +2 -1
  115. package/dist/neutral/modules/protocol/block/buildNextBlock.d.ts.map +1 -1
  116. package/dist/neutral/modules/services/implementation/processPendingBlocks.d.ts +9 -1
  117. package/dist/neutral/modules/services/implementation/processPendingBlocks.d.ts.map +1 -1
  118. package/dist/neutral/modules/services/simple/block/runner/SimpleBlockRunner.d.ts +34 -1
  119. package/dist/neutral/modules/services/simple/block/runner/SimpleBlockRunner.d.ts.map +1 -1
  120. package/dist/neutral/modules/services/simple/block/runner/index.d.ts +1 -0
  121. package/dist/neutral/modules/services/simple/block/runner/index.d.ts.map +1 -1
  122. package/dist/neutral/modules/services/simple/block/runner/selectSupersededCandidate.d.ts +22 -0
  123. package/dist/neutral/modules/services/simple/block/runner/selectSupersededCandidate.d.ts.map +1 -0
  124. package/dist/neutral/modules/slashing/detect/DetectedOffense.d.ts +27 -0
  125. package/dist/neutral/modules/slashing/detect/DetectedOffense.d.ts.map +1 -0
  126. package/dist/neutral/modules/slashing/detect/candidatePairs.d.ts +44 -0
  127. package/dist/neutral/modules/slashing/detect/candidatePairs.d.ts.map +1 -0
  128. package/dist/neutral/modules/slashing/detect/index.d.ts +5 -0
  129. package/dist/neutral/modules/slashing/detect/index.d.ts.map +1 -0
  130. package/dist/neutral/modules/slashing/detect/offenseGate.d.ts +18 -0
  131. package/dist/neutral/modules/slashing/detect/offenseGate.d.ts.map +1 -0
  132. package/dist/neutral/modules/slashing/detect/suppression.d.ts +23 -0
  133. package/dist/neutral/modules/slashing/detect/suppression.d.ts.map +1 -0
  134. package/dist/neutral/modules/slashing/eligibility/evaluateProducerEligibility.d.ts +71 -0
  135. package/dist/neutral/modules/slashing/eligibility/evaluateProducerEligibility.d.ts.map +1 -0
  136. package/dist/neutral/modules/slashing/eligibility/index.d.ts +2 -0
  137. package/dist/neutral/modules/slashing/eligibility/index.d.ts.map +1 -0
  138. package/dist/neutral/modules/slashing/index/SlashIndexStore.d.ts +22 -0
  139. package/dist/neutral/modules/slashing/index/SlashIndexStore.d.ts.map +1 -0
  140. package/dist/neutral/modules/slashing/index/foldSlashIndex.d.ts +56 -0
  141. package/dist/neutral/modules/slashing/index/foldSlashIndex.d.ts.map +1 -0
  142. package/dist/neutral/modules/slashing/index/index.d.ts +3 -0
  143. package/dist/neutral/modules/slashing/index/index.d.ts.map +1 -0
  144. package/dist/neutral/modules/slashing/index.d.ts +6 -0
  145. package/dist/neutral/modules/slashing/index.d.ts.map +1 -0
  146. package/dist/neutral/modules/slashing/model/OffenseProcedure.d.ts +28 -0
  147. package/dist/neutral/modules/slashing/model/OffenseProcedure.d.ts.map +1 -0
  148. package/dist/neutral/modules/slashing/model/OffenseVerificationContext.d.ts +88 -0
  149. package/dist/neutral/modules/slashing/model/OffenseVerificationContext.d.ts.map +1 -0
  150. package/dist/neutral/modules/slashing/model/SlashHistoryReader.d.ts +34 -0
  151. package/dist/neutral/modules/slashing/model/SlashHistoryReader.d.ts.map +1 -0
  152. package/dist/neutral/modules/slashing/model/VerificationOutcome.d.ts +39 -0
  153. package/dist/neutral/modules/slashing/model/VerificationOutcome.d.ts.map +1 -0
  154. package/dist/neutral/modules/slashing/model/index.d.ts +6 -0
  155. package/dist/neutral/modules/slashing/model/index.d.ts.map +1 -0
  156. package/dist/neutral/modules/slashing/model/offenseKey.d.ts +42 -0
  157. package/dist/neutral/modules/slashing/model/offenseKey.d.ts.map +1 -0
  158. package/dist/neutral/modules/slashing/verify/index.d.ts +10 -0
  159. package/dist/neutral/modules/slashing/verify/index.d.ts.map +1 -0
  160. package/dist/neutral/modules/slashing/verify/preamble.d.ts +63 -0
  161. package/dist/neutral/modules/slashing/verify/preamble.d.ts.map +1 -0
  162. package/dist/neutral/modules/slashing/verify/verifyEquivocation.d.ts +19 -0
  163. package/dist/neutral/modules/slashing/verify/verifyEquivocation.d.ts.map +1 -0
  164. package/dist/neutral/modules/slashing/verify/verifyFalseAnchor.d.ts +15 -0
  165. package/dist/neutral/modules/slashing/verify/verifyFalseAnchor.d.ts.map +1 -0
  166. package/dist/neutral/modules/slashing/verify/verifyFalseAttestation.d.ts +22 -0
  167. package/dist/neutral/modules/slashing/verify/verifyFalseAttestation.d.ts.map +1 -0
  168. package/dist/neutral/modules/slashing/verify/verifyIneligibleProduction.d.ts +18 -0
  169. package/dist/neutral/modules/slashing/verify/verifyIneligibleProduction.d.ts.map +1 -0
  170. package/dist/neutral/modules/slashing/verify/verifyInvalidBlock.d.ts +18 -0
  171. package/dist/neutral/modules/slashing/verify/verifyInvalidBlock.d.ts.map +1 -0
  172. package/dist/neutral/modules/slashing/verify/verifyInvalidSlashRequest.d.ts +11 -0
  173. package/dist/neutral/modules/slashing/verify/verifyInvalidSlashRequest.d.ts.map +1 -0
  174. package/dist/neutral/modules/slashing/verify/verifyOffense.d.ts +29 -0
  175. package/dist/neutral/modules/slashing/verify/verifyOffense.d.ts.map +1 -0
  176. package/dist/neutral/modules/slashing/verify/verifyRewardOvermint.d.ts +23 -0
  177. package/dist/neutral/modules/slashing/verify/verifyRewardOvermint.d.ts.map +1 -0
  178. package/dist/neutral/modules/validation/elevatedPayload/lib/findElevatingTransaction.d.ts +14 -0
  179. package/dist/neutral/modules/validation/elevatedPayload/lib/findElevatingTransaction.d.ts.map +1 -0
  180. package/dist/neutral/modules/validation/elevatedPayload/lib/index.d.ts +2 -0
  181. package/dist/neutral/modules/validation/elevatedPayload/lib/index.d.ts.map +1 -1
  182. package/dist/neutral/modules/validation/elevatedPayload/lib/validateSlashPayloadInBlock.d.ts +33 -0
  183. package/dist/neutral/modules/validation/elevatedPayload/lib/validateSlashPayloadInBlock.d.ts.map +1 -0
  184. package/dist/neutral/modules/validation/elevatedPayload/payloads/index.d.ts +5 -0
  185. package/dist/neutral/modules/validation/elevatedPayload/payloads/index.d.ts.map +1 -1
  186. package/dist/neutral/modules/validation/elevatedPayload/payloads/validateSlashAdjudicationInBlock.d.ts +14 -0
  187. package/dist/neutral/modules/validation/elevatedPayload/payloads/validateSlashAdjudicationInBlock.d.ts.map +1 -0
  188. package/dist/neutral/modules/validation/elevatedPayload/payloads/validateSlashChallengeInBlock.d.ts +10 -0
  189. package/dist/neutral/modules/validation/elevatedPayload/payloads/validateSlashChallengeInBlock.d.ts.map +1 -0
  190. package/dist/neutral/modules/validation/elevatedPayload/payloads/validateSlashCommitInBlock.d.ts +10 -0
  191. package/dist/neutral/modules/validation/elevatedPayload/payloads/validateSlashCommitInBlock.d.ts.map +1 -0
  192. package/dist/neutral/modules/validation/elevatedPayload/payloads/validateSlashEvidenceInBlock.d.ts +10 -0
  193. package/dist/neutral/modules/validation/elevatedPayload/payloads/validateSlashEvidenceInBlock.d.ts.map +1 -0
  194. package/dist/neutral/modules/validation/elevatedPayload/payloads/validateSlashRequestInBlock.d.ts +14 -0
  195. package/dist/neutral/modules/validation/elevatedPayload/payloads/validateSlashRequestInBlock.d.ts.map +1 -0
  196. package/dist/neutral/modules/validation/elevatedPayload/validatePayloadInBlock.d.ts.map +1 -1
  197. package/dist/neutral/protocol.mjs +8 -3
  198. package/dist/neutral/protocol.mjs.map +2 -2
  199. package/dist/neutral/services.mjs +77 -7
  200. package/dist/neutral/services.mjs.map +4 -4
  201. package/dist/neutral/slashing.d.ts +2 -0
  202. package/dist/neutral/slashing.d.ts.map +1 -0
  203. package/dist/neutral/slashing.mjs +824 -0
  204. package/dist/neutral/slashing.mjs.map +7 -0
  205. package/dist/neutral/validation.mjs +274 -43
  206. package/dist/neutral/validation.mjs.map +4 -4
  207. package/dist/node/index.d.ts +1 -0
  208. package/dist/node/index.d.ts.map +1 -1
  209. package/dist/node/index.mjs +1 -0
  210. package/dist/node/index.mjs.map +2 -2
  211. package/dist/node/modules/analyze/ChainHeadSelector.d.ts +40 -0
  212. package/dist/node/modules/analyze/ChainHeadSelector.d.ts.map +1 -1
  213. package/dist/node/modules/analyze/admission.d.ts +65 -0
  214. package/dist/node/modules/analyze/admission.d.ts.map +1 -0
  215. package/dist/node/modules/analyze/index.d.ts +1 -0
  216. package/dist/node/modules/analyze/index.d.ts.map +1 -1
  217. package/dist/node/modules/protocol/block/BuildBlockOptions.d.ts +8 -0
  218. package/dist/node/modules/protocol/block/BuildBlockOptions.d.ts.map +1 -1
  219. package/dist/node/modules/protocol/block/buildBlock.d.ts.map +1 -1
  220. package/dist/node/modules/protocol/block/buildNextBlock.d.ts +2 -1
  221. package/dist/node/modules/protocol/block/buildNextBlock.d.ts.map +1 -1
  222. package/dist/node/modules/services/implementation/processPendingBlocks.d.ts +9 -1
  223. package/dist/node/modules/services/implementation/processPendingBlocks.d.ts.map +1 -1
  224. package/dist/node/modules/services/simple/block/runner/SimpleBlockRunner.d.ts +34 -1
  225. package/dist/node/modules/services/simple/block/runner/SimpleBlockRunner.d.ts.map +1 -1
  226. package/dist/node/modules/services/simple/block/runner/index.d.ts +1 -0
  227. package/dist/node/modules/services/simple/block/runner/index.d.ts.map +1 -1
  228. package/dist/node/modules/services/simple/block/runner/selectSupersededCandidate.d.ts +22 -0
  229. package/dist/node/modules/services/simple/block/runner/selectSupersededCandidate.d.ts.map +1 -0
  230. package/dist/node/modules/slashing/detect/DetectedOffense.d.ts +27 -0
  231. package/dist/node/modules/slashing/detect/DetectedOffense.d.ts.map +1 -0
  232. package/dist/node/modules/slashing/detect/candidatePairs.d.ts +44 -0
  233. package/dist/node/modules/slashing/detect/candidatePairs.d.ts.map +1 -0
  234. package/dist/node/modules/slashing/detect/index.d.ts +5 -0
  235. package/dist/node/modules/slashing/detect/index.d.ts.map +1 -0
  236. package/dist/node/modules/slashing/detect/offenseGate.d.ts +18 -0
  237. package/dist/node/modules/slashing/detect/offenseGate.d.ts.map +1 -0
  238. package/dist/node/modules/slashing/detect/suppression.d.ts +23 -0
  239. package/dist/node/modules/slashing/detect/suppression.d.ts.map +1 -0
  240. package/dist/node/modules/slashing/eligibility/evaluateProducerEligibility.d.ts +71 -0
  241. package/dist/node/modules/slashing/eligibility/evaluateProducerEligibility.d.ts.map +1 -0
  242. package/dist/node/modules/slashing/eligibility/index.d.ts +2 -0
  243. package/dist/node/modules/slashing/eligibility/index.d.ts.map +1 -0
  244. package/dist/node/modules/slashing/index/SlashIndexStore.d.ts +22 -0
  245. package/dist/node/modules/slashing/index/SlashIndexStore.d.ts.map +1 -0
  246. package/dist/node/modules/slashing/index/foldSlashIndex.d.ts +56 -0
  247. package/dist/node/modules/slashing/index/foldSlashIndex.d.ts.map +1 -0
  248. package/dist/node/modules/slashing/index/index.d.ts +3 -0
  249. package/dist/node/modules/slashing/index/index.d.ts.map +1 -0
  250. package/dist/node/modules/slashing/index.d.ts +6 -0
  251. package/dist/node/modules/slashing/index.d.ts.map +1 -0
  252. package/dist/node/modules/slashing/model/OffenseProcedure.d.ts +28 -0
  253. package/dist/node/modules/slashing/model/OffenseProcedure.d.ts.map +1 -0
  254. package/dist/node/modules/slashing/model/OffenseVerificationContext.d.ts +88 -0
  255. package/dist/node/modules/slashing/model/OffenseVerificationContext.d.ts.map +1 -0
  256. package/dist/node/modules/slashing/model/SlashHistoryReader.d.ts +34 -0
  257. package/dist/node/modules/slashing/model/SlashHistoryReader.d.ts.map +1 -0
  258. package/dist/node/modules/slashing/model/VerificationOutcome.d.ts +39 -0
  259. package/dist/node/modules/slashing/model/VerificationOutcome.d.ts.map +1 -0
  260. package/dist/node/modules/slashing/model/index.d.ts +6 -0
  261. package/dist/node/modules/slashing/model/index.d.ts.map +1 -0
  262. package/dist/node/modules/slashing/model/offenseKey.d.ts +42 -0
  263. package/dist/node/modules/slashing/model/offenseKey.d.ts.map +1 -0
  264. package/dist/node/modules/slashing/verify/index.d.ts +10 -0
  265. package/dist/node/modules/slashing/verify/index.d.ts.map +1 -0
  266. package/dist/node/modules/slashing/verify/preamble.d.ts +63 -0
  267. package/dist/node/modules/slashing/verify/preamble.d.ts.map +1 -0
  268. package/dist/node/modules/slashing/verify/verifyEquivocation.d.ts +19 -0
  269. package/dist/node/modules/slashing/verify/verifyEquivocation.d.ts.map +1 -0
  270. package/dist/node/modules/slashing/verify/verifyFalseAnchor.d.ts +15 -0
  271. package/dist/node/modules/slashing/verify/verifyFalseAnchor.d.ts.map +1 -0
  272. package/dist/node/modules/slashing/verify/verifyFalseAttestation.d.ts +22 -0
  273. package/dist/node/modules/slashing/verify/verifyFalseAttestation.d.ts.map +1 -0
  274. package/dist/node/modules/slashing/verify/verifyIneligibleProduction.d.ts +18 -0
  275. package/dist/node/modules/slashing/verify/verifyIneligibleProduction.d.ts.map +1 -0
  276. package/dist/node/modules/slashing/verify/verifyInvalidBlock.d.ts +18 -0
  277. package/dist/node/modules/slashing/verify/verifyInvalidBlock.d.ts.map +1 -0
  278. package/dist/node/modules/slashing/verify/verifyInvalidSlashRequest.d.ts +11 -0
  279. package/dist/node/modules/slashing/verify/verifyInvalidSlashRequest.d.ts.map +1 -0
  280. package/dist/node/modules/slashing/verify/verifyOffense.d.ts +29 -0
  281. package/dist/node/modules/slashing/verify/verifyOffense.d.ts.map +1 -0
  282. package/dist/node/modules/slashing/verify/verifyRewardOvermint.d.ts +23 -0
  283. package/dist/node/modules/slashing/verify/verifyRewardOvermint.d.ts.map +1 -0
  284. package/dist/node/modules/validation/elevatedPayload/lib/findElevatingTransaction.d.ts +14 -0
  285. package/dist/node/modules/validation/elevatedPayload/lib/findElevatingTransaction.d.ts.map +1 -0
  286. package/dist/node/modules/validation/elevatedPayload/lib/index.d.ts +2 -0
  287. package/dist/node/modules/validation/elevatedPayload/lib/index.d.ts.map +1 -1
  288. package/dist/node/modules/validation/elevatedPayload/lib/validateSlashPayloadInBlock.d.ts +33 -0
  289. package/dist/node/modules/validation/elevatedPayload/lib/validateSlashPayloadInBlock.d.ts.map +1 -0
  290. package/dist/node/modules/validation/elevatedPayload/payloads/index.d.ts +5 -0
  291. package/dist/node/modules/validation/elevatedPayload/payloads/index.d.ts.map +1 -1
  292. package/dist/node/modules/validation/elevatedPayload/payloads/validateSlashAdjudicationInBlock.d.ts +14 -0
  293. package/dist/node/modules/validation/elevatedPayload/payloads/validateSlashAdjudicationInBlock.d.ts.map +1 -0
  294. package/dist/node/modules/validation/elevatedPayload/payloads/validateSlashChallengeInBlock.d.ts +10 -0
  295. package/dist/node/modules/validation/elevatedPayload/payloads/validateSlashChallengeInBlock.d.ts.map +1 -0
  296. package/dist/node/modules/validation/elevatedPayload/payloads/validateSlashCommitInBlock.d.ts +10 -0
  297. package/dist/node/modules/validation/elevatedPayload/payloads/validateSlashCommitInBlock.d.ts.map +1 -0
  298. package/dist/node/modules/validation/elevatedPayload/payloads/validateSlashEvidenceInBlock.d.ts +10 -0
  299. package/dist/node/modules/validation/elevatedPayload/payloads/validateSlashEvidenceInBlock.d.ts.map +1 -0
  300. package/dist/node/modules/validation/elevatedPayload/payloads/validateSlashRequestInBlock.d.ts +14 -0
  301. package/dist/node/modules/validation/elevatedPayload/payloads/validateSlashRequestInBlock.d.ts.map +1 -0
  302. package/dist/node/modules/validation/elevatedPayload/validatePayloadInBlock.d.ts.map +1 -1
  303. package/dist/node/slashing.d.ts +2 -0
  304. package/dist/node/slashing.d.ts.map +1 -0
  305. package/package.json +11 -5
@@ -0,0 +1,824 @@
1
+ // src/modules/slashing/detect/candidatePairs.ts
2
+ function competes(first, second) {
3
+ if (first.dataHash === second.dataHash) return false;
4
+ return first.block === second.block || first.previous === second.previous;
5
+ }
6
+ function linked(first, second) {
7
+ return first.supersedes === second.dataHash || second.supersedes === first.dataHash;
8
+ }
9
+ function findCandidatePairs(sightings) {
10
+ const byProducer = /* @__PURE__ */ new Map();
11
+ for (const sighting of sightings) {
12
+ const seen = byProducer.get(sighting.producer) ?? [];
13
+ if (!seen.some((candidate) => candidate.dataHash === sighting.dataHash)) seen.push(sighting);
14
+ byProducer.set(sighting.producer, seen);
15
+ }
16
+ const pairs = [];
17
+ for (const [producer, candidates] of byProducer) {
18
+ for (const [index, first] of candidates.entries()) {
19
+ for (const second of candidates.slice(index + 1)) {
20
+ if (!competes(first, second) || linked(first, second)) continue;
21
+ pairs.push({
22
+ block: Math.max(first.block, second.block),
23
+ first,
24
+ producer,
25
+ second
26
+ });
27
+ }
28
+ }
29
+ }
30
+ return pairs;
31
+ }
32
+
33
+ // src/modules/slashing/detect/offenseGate.ts
34
+ import { isOffenseReportableAt, isRuleObservedAt } from "@xyo-network/xl1-sdk";
35
+ function isOffenseWatchable(params, offense, height) {
36
+ if (!isOffenseReportableAt(params, offense, height)) return false;
37
+ return offense === "equivocation" ? isRuleObservedAt(params, "supersedes-field", height) : true;
38
+ }
39
+
40
+ // src/modules/slashing/detect/suppression.ts
41
+ async function suppressionFor(history, key) {
42
+ if (await history.adjudicationByKey(key) !== void 0) return "adjudicated";
43
+ return (await history.requestsByKey(key)).length > 0 ? "already-reported" : void 0;
44
+ }
45
+
46
+ // src/modules/slashing/eligibility/evaluateProducerEligibility.ts
47
+ import { evaluationPoint, producerIneligibility } from "@xyo-network/xl1-sdk";
48
+ async function evaluateProducerEligibility(input) {
49
+ const {
50
+ accused,
51
+ blockAnchor,
52
+ height,
53
+ intent,
54
+ params,
55
+ parentAnchor,
56
+ snapshot
57
+ } = input;
58
+ if (blockAnchor === void 0 || parentAnchor === void 0) {
59
+ return { resolvable: false };
60
+ }
61
+ if (snapshot === void 0) {
62
+ return { eStar: evaluationPoint(parentAnchor, blockAnchor, params.freshnessBandEvmBlocks), resolvable: false };
63
+ }
64
+ const eStar = evaluationPoint(parentAnchor, blockAnchor, params.freshnessBandEvmBlocks);
65
+ const minAge = params.minStakeAgeEvmBlocks;
66
+ const [seasonedActive, seasonedSelfBond, active, intentValid] = await Promise.all([
67
+ snapshot.seasonedActiveByStakedAt(accused, eStar, minAge),
68
+ snapshot.seasonedSelfBondAt(accused, eStar, minAge),
69
+ snapshot.activeByStakedAt(accused, eStar),
70
+ intent(accused, height)
71
+ ]);
72
+ if (intentValid === void 0) {
73
+ return {
74
+ activeStake: seasonedActive,
75
+ eStar,
76
+ resolvable: false,
77
+ selfBond: seasonedSelfBond
78
+ };
79
+ }
80
+ const standing = {
81
+ active,
82
+ seasonedActive,
83
+ seasonedSelfBond
84
+ };
85
+ const reason = producerIneligibility(
86
+ standing,
87
+ {
88
+ minSelfBond: hexAtto(params.minProducerSelfBondAtto),
89
+ minStake: hexAtto(params.minProducerStakeAtto)
90
+ },
91
+ intentValid
92
+ );
93
+ return {
94
+ activeStake: seasonedActive,
95
+ eStar,
96
+ eligible: reason === null,
97
+ intentValid,
98
+ reason: reason ?? void 0,
99
+ resolvable: true,
100
+ selfBond: seasonedSelfBond
101
+ };
102
+ }
103
+ function hexAtto(value) {
104
+ if (value === "") return 0n;
105
+ return BigInt(value.startsWith("0x") ? value : `0x${value}`);
106
+ }
107
+
108
+ // src/modules/slashing/index/foldSlashIndex.ts
109
+ import {
110
+ isSlashAdjudication,
111
+ isSlashChallenge,
112
+ isSlashCommit,
113
+ isSlashRequest,
114
+ slashIndexAccusedPath,
115
+ slashIndexAdjudicationPath,
116
+ slashIndexChallengePath,
117
+ slashIndexCommitPath,
118
+ slashIndexKeyPath,
119
+ SlashIndexKeyRecordSchema,
120
+ slashIndexRequestPath
121
+ } from "@xyo-network/xl1-sdk";
122
+
123
+ // src/modules/slashing/model/offenseKey.ts
124
+ function offenseKeyOf(request) {
125
+ return {
126
+ accused: request.accused,
127
+ block: request.block,
128
+ chain: request.chain,
129
+ offense: request.offense
130
+ };
131
+ }
132
+ function offenseKeyString(key) {
133
+ return `${key.chain}|${key.accused}|${key.offense}|${key.block}`;
134
+ }
135
+ function canonicalOffenseHeight(request) {
136
+ return request.block;
137
+ }
138
+
139
+ // src/modules/slashing/index/foldSlashIndex.ts
140
+ var emptyDelta = () => ({
141
+ accused: /* @__PURE__ */ new Map(),
142
+ keys: /* @__PURE__ */ new Map(),
143
+ pending: [],
144
+ records: []
145
+ });
146
+ var recordAt = (path, payload) => ({
147
+ immutable: true,
148
+ path,
149
+ value: payload
150
+ });
151
+ function foldSlashIndex(blocks) {
152
+ const delta = emptyDelta();
153
+ const keyPathByRequest = /* @__PURE__ */ new Map();
154
+ for (const [, payloads] of blocks) {
155
+ for (const payload of payloads) foldPayload(delta, keyPathByRequest, payload);
156
+ }
157
+ return delta;
158
+ }
159
+ function keyPathFor(delta, request) {
160
+ const key = offenseKeyOf(request);
161
+ const path = slashIndexKeyPath(key.accused, key.offense, key.block);
162
+ if (!delta.keys.has(path)) {
163
+ delta.keys.set(path, {
164
+ accused: key.accused,
165
+ block: key.block,
166
+ challenges: [],
167
+ chain: key.chain,
168
+ offense: key.offense,
169
+ requests: [],
170
+ schema: SlashIndexKeyRecordSchema
171
+ });
172
+ const accusedPath = slashIndexAccusedPath(key.accused);
173
+ delta.accused.set(accusedPath, [...delta.accused.get(accusedPath) ?? [], offenseKeyString(key)]);
174
+ }
175
+ return path;
176
+ }
177
+ function foldPayload(delta, keyPathByRequest, payload) {
178
+ if (isSlashRequest(payload)) {
179
+ delta.records.push(recordAt(slashIndexRequestPath(payload._dataHash), payload));
180
+ const path = keyPathFor(delta, payload);
181
+ keyPathByRequest.set(payload._dataHash, path);
182
+ const record = delta.keys.get(path);
183
+ if (record !== void 0 && !record.requests.includes(payload._dataHash)) {
184
+ record.requests.push(payload._dataHash);
185
+ }
186
+ return;
187
+ }
188
+ if (isSlashCommit(payload)) {
189
+ delta.records.push(recordAt(slashIndexCommitPath(payload._dataHash), payload));
190
+ return;
191
+ }
192
+ if (isSlashChallenge(payload)) {
193
+ delta.records.push(recordAt(slashIndexChallengePath(payload._dataHash), payload));
194
+ linkToRequest(delta, keyPathByRequest, payload._dataHash, payload.request, "challenge");
195
+ return;
196
+ }
197
+ if (isSlashAdjudication(payload)) {
198
+ delta.records.push(recordAt(slashIndexAdjudicationPath(payload._dataHash), payload));
199
+ const path = linkToRequest(delta, keyPathByRequest, payload._dataHash, payload.request, "adjudication");
200
+ const record = path === void 0 ? void 0 : delta.keys.get(path);
201
+ if (record !== void 0) {
202
+ record.adjudication = payload._dataHash;
203
+ record.outcome = payload.outcome;
204
+ }
205
+ }
206
+ }
207
+ function linkToRequest(delta, keyPathByRequest, hash, request, kind) {
208
+ const path = keyPathByRequest.get(request);
209
+ if (path === void 0) {
210
+ delta.pending.push({
211
+ hash,
212
+ kind,
213
+ request
214
+ });
215
+ return void 0;
216
+ }
217
+ if (kind === "challenge") {
218
+ const record = delta.keys.get(path);
219
+ if (record !== void 0 && !record.challenges.includes(hash)) record.challenges.push(hash);
220
+ }
221
+ return path;
222
+ }
223
+ function mergeKeyRecord(existing, next) {
224
+ if (existing === void 0) return next;
225
+ const union = (left, right) => [.../* @__PURE__ */ new Set([...left, ...right])];
226
+ return {
227
+ ...existing,
228
+ ...next,
229
+ // set-once: a verdict already recorded is never replaced by a later pass
230
+ adjudication: existing.adjudication ?? next.adjudication,
231
+ challenges: union(existing.challenges, next.challenges),
232
+ outcome: existing.outcome ?? next.outcome,
233
+ requests: union(existing.requests, next.requests)
234
+ };
235
+ }
236
+
237
+ // src/modules/slashing/index/SlashIndexStore.ts
238
+ var SlashIndexStoreMoniker = "SlashIndexStore";
239
+ function isSlashIndexStore(value) {
240
+ const candidate = value;
241
+ return typeof candidate?.readObject === "function" && typeof candidate.hasObject === "function" && typeof candidate.writeObject === "function";
242
+ }
243
+
244
+ // src/modules/slashing/model/VerificationOutcome.ts
245
+ var VerificationOutcomes = ["verified", "indeterminate", "provably-invalid"];
246
+ function verdict(outcome, reason, transcript = {}, provisional) {
247
+ return provisional === void 0 ? {
248
+ outcome,
249
+ reason,
250
+ transcript
251
+ } : {
252
+ outcome,
253
+ provisional,
254
+ reason,
255
+ transcript
256
+ };
257
+ }
258
+
259
+ // src/modules/slashing/verify/preamble.ts
260
+ import { isBoundWitness, PayloadBuilder } from "@xyo-network/sdk";
261
+ import { BoundWitnessSignaturesValidator } from "@xyo-network/xl1-sdk";
262
+ async function verifyArtifacts(artifacts, referenced) {
263
+ const byHash = /* @__PURE__ */ new Map();
264
+ for (const claimed of referenced) {
265
+ const candidate = artifacts.get(claimed);
266
+ if (candidate === void 0) {
267
+ return {
268
+ missing: true,
269
+ ok: false,
270
+ reason: `cited artifact ${claimed} is not available to this verifier`
271
+ };
272
+ }
273
+ const payload = candidate;
274
+ const dataHash = await PayloadBuilder.dataHash(payload);
275
+ if (dataHash !== claimed) {
276
+ return { ok: false, reason: `artifact cited as ${claimed} hashes to ${dataHash}` };
277
+ }
278
+ if (isBoundWitness(payload)) {
279
+ const signatureErrors = await BoundWitnessSignaturesValidator(payload);
280
+ if (signatureErrors.length > 0) {
281
+ return { ok: false, reason: `artifact ${dataHash} carries an invalid signature` };
282
+ }
283
+ }
284
+ byHash.set(dataHash, {
285
+ dataHash,
286
+ payload,
287
+ storageHash: await PayloadBuilder.hash(payload)
288
+ });
289
+ }
290
+ return { byHash, ok: true };
291
+ }
292
+ async function referencesArtifact(reference, artifact) {
293
+ if (reference === null || reference === void 0) return false;
294
+ if (reference === artifact.dataHash) return true;
295
+ const storageHash = artifact.storageHash ?? await PayloadBuilder.hash(artifact.payload);
296
+ return reference === storageHash;
297
+ }
298
+ async function freshnessGate(ctx, request) {
299
+ const eOff = await ctx.chain.validatedAnchorAt(request.block);
300
+ if (eOff === void 0) {
301
+ return {
302
+ reason: "no anchor resolvable at the offense height",
303
+ verdict: verdict("indeterminate", "no anchor resolvable at the offense height")
304
+ };
305
+ }
306
+ const submissionHeight = ctx.submission.commitCarryingHeight ?? ctx.submission.requestCarryingHeight;
307
+ const eSub = await ctx.chain.validatedAnchorAt(submissionHeight);
308
+ if (eSub === void 0) {
309
+ return {
310
+ eOff,
311
+ reason: "no anchor resolvable at the submission height",
312
+ verdict: verdict("indeterminate", "no anchor resolvable at the submission height")
313
+ };
314
+ }
315
+ const age = eSub - eOff;
316
+ if (age > ctx.params.evidenceFreshnessEvmBlocks) {
317
+ const reason = `offense is ${age} EVM blocks old, past the ${ctx.params.evidenceFreshnessEvmBlocks} limit`;
318
+ return {
319
+ eOff,
320
+ eSub,
321
+ reason,
322
+ verdict: verdict("provably-invalid", reason, {
323
+ age,
324
+ eOff,
325
+ eSub
326
+ })
327
+ };
328
+ }
329
+ return {
330
+ eOff,
331
+ eSub,
332
+ reason: `offense is ${age} EVM blocks old`
333
+ };
334
+ }
335
+
336
+ // src/modules/slashing/verify/verifyEquivocation.ts
337
+ import { asBlockBoundWitness } from "@xyo-network/xl1-sdk";
338
+ var asCitedBlock = (artifact) => {
339
+ const block = asBlockBoundWitness(artifact.payload);
340
+ return block === void 0 ? void 0 : { block, dataHash: artifact.dataHash };
341
+ };
342
+ var verifyEquivocation = async (_ctx, request, artifacts) => {
343
+ const cited = [...artifacts.values()];
344
+ if (cited.length !== 2) {
345
+ return verdict("provably-invalid", `equivocation needs two distinct blocks, got ${cited.length}`);
346
+ }
347
+ const blocks = cited.map((artifact) => asCitedBlock(artifact));
348
+ const [first, second] = blocks;
349
+ if (first === void 0 || second === void 0) {
350
+ return verdict("provably-invalid", "cited artifacts are not both blocks");
351
+ }
352
+ const transcript = {
353
+ accused: request.accused,
354
+ first: {
355
+ block: first.block.block,
356
+ dataHash: first.dataHash,
357
+ previous: first.block.previous,
358
+ supersedes: first.block.supersedes ?? null
359
+ },
360
+ second: {
361
+ block: second.block.block,
362
+ dataHash: second.dataHash,
363
+ previous: second.block.previous,
364
+ supersedes: second.block.supersedes ?? null
365
+ }
366
+ };
367
+ if (!blocks.every((cite) => cite?.block.addresses.includes(request.accused))) {
368
+ return verdict("provably-invalid", "the accused did not sign both blocks", transcript);
369
+ }
370
+ if (first.block.chain !== second.block.chain) {
371
+ return verdict("provably-invalid", "the blocks are on different chains", transcript);
372
+ }
373
+ if (first.block.chain !== request.chain) {
374
+ return verdict("provably-invalid", "the blocks are not on the chain the report names", transcript);
375
+ }
376
+ if (first.block.block !== request.block && second.block.block !== request.block) {
377
+ return verdict("provably-invalid", "the report does not locate the offense at either cited block", transcript);
378
+ }
379
+ if (first.block.block !== second.block.block && first.block.previous !== second.block.previous) {
380
+ return verdict("provably-invalid", "the blocks neither share a height nor a parent", transcript);
381
+ }
382
+ const superseded = /* @__PURE__ */ new Set([first.block.supersedes, second.block.supersedes]);
383
+ if (superseded.has(first.dataHash) || superseded.has(second.dataHash)) {
384
+ return verdict("provably-invalid", "one block supersedes the other, so this is a re-proposal", transcript);
385
+ }
386
+ return verdict("verified", "two competing candidates with no supersedes link between them", transcript);
387
+ };
388
+
389
+ // src/modules/slashing/verify/verifyFalseAnchor.ts
390
+ import { isDefined } from "@ariestools/sdk";
391
+ import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/sdk";
392
+ import { asBlockBoundWitness as asBlockBoundWitness2, isTimePayload } from "@xyo-network/xl1-sdk";
393
+ async function anchoredBlocks(artifacts) {
394
+ const cited = [...artifacts.values()];
395
+ const times = await Promise.all(cited.filter((artifact) => isTimePayload(artifact.payload)).map(async (artifact) => ({
396
+ hashes: [artifact.dataHash, artifact.storageHash ?? await PayloadBuilder2.hash(artifact.payload)].filter((hash) => isDefined(hash)),
397
+ time: artifact.payload
398
+ })));
399
+ return cited.flatMap((artifact) => {
400
+ const block = asBlockBoundWitness2(artifact.payload);
401
+ return block === void 0 ? [] : [{ artifact, block }];
402
+ }).map(({ artifact, block }) => {
403
+ const carried = new Set(block.payload_hashes);
404
+ const time = times.find((candidate) => candidate.hashes.some((hash) => carried.has(hash)));
405
+ return {
406
+ artifact,
407
+ block,
408
+ evm: time?.time?.ethereum,
409
+ evmHash: time?.time?.ethereumHash
410
+ };
411
+ });
412
+ }
413
+ async function parentOf(accused, blocks) {
414
+ for (const candidate of blocks) {
415
+ if (candidate === accused) continue;
416
+ if (await referencesArtifact(accused.block.previous, candidate.artifact)) return candidate;
417
+ }
418
+ return void 0;
419
+ }
420
+ var verifyFalseAnchor = async (ctx, request, artifacts) => {
421
+ const blocks = await anchoredBlocks(artifacts);
422
+ const accused = blocks.find((candidate) => candidate.block.block === request.block);
423
+ if (accused === void 0) return verdict("provably-invalid", "the accused block was not among the cited artifacts");
424
+ const parent = await parentOf(accused, blocks);
425
+ if (accused.evm === void 0 || accused.evmHash === void 0) {
426
+ return verdict("provably-invalid", "the accused block carries no EVM anchor to be false about");
427
+ }
428
+ if (!accused.block.addresses.includes(request.accused)) {
429
+ return verdict("provably-invalid", "the accused did not sign the cited block");
430
+ }
431
+ const transcript = {
432
+ accused: request.accused,
433
+ block: accused.block.block,
434
+ claimedEvm: accused.evm,
435
+ claimedEvmHash: accused.evmHash,
436
+ parentEvm: parent?.evm ?? null
437
+ };
438
+ if (parent?.evm !== void 0 && accused.evm < parent.evm) {
439
+ return verdict("verified", `the anchor went backwards, from ${parent.evm} to ${accused.evm}`, transcript);
440
+ }
441
+ if (request.evm !== accused.evm) {
442
+ return verdict("provably-invalid", "the report does not name the anchor the block claims", transcript);
443
+ }
444
+ if (ctx.evm === void 0) {
445
+ return verdict("indeterminate", "no EVM view, so the claimed anchor cannot be checked", transcript);
446
+ }
447
+ const head = await ctx.evm.head();
448
+ if (head === void 0) {
449
+ return verdict("indeterminate", "the EVM head is not resolvable", transcript);
450
+ }
451
+ if (head - accused.evm < ctx.params.maturityEvmBlocks) {
452
+ return verdict("indeterminate", `the anchor is only ${head - accused.evm} EVM blocks deep and has not matured`, { ...transcript, head });
453
+ }
454
+ const canonical = await ctx.evm.canonicalHashAt(accused.evm);
455
+ if (canonical === void 0) {
456
+ return verdict("indeterminate", "the canonical hash at that EVM height is not resolvable", transcript);
457
+ }
458
+ return canonical === accused.evmHash ? verdict("provably-invalid", "the block anchored to the canonical hash at that height", { ...transcript, canonical }) : verdict("verified", "the block anchored to a hash the EVM never had at that height", { ...transcript, canonical });
459
+ };
460
+
461
+ // src/modules/slashing/verify/verifyFalseAttestation.ts
462
+ import { isBoundWitness as isBoundWitness2 } from "@xyo-network/sdk";
463
+ import {
464
+ asBlockBoundWitness as asBlockBoundWitness3,
465
+ isStepWitness,
466
+ StepSizes
467
+ } from "@xyo-network/xl1-sdk";
468
+ var citedAttestation = (cited) => {
469
+ const entry = cited.find((artifact) => isStepWitness(artifact.payload));
470
+ return entry === void 0 ? void 0 : { artifact: entry, attestation: entry.payload };
471
+ };
472
+ async function boundToAccused(cited, attestation, accused) {
473
+ for (const artifact of cited) {
474
+ const payload = artifact.payload;
475
+ if (!isBoundWitness2(artifact.payload)) continue;
476
+ if (!(payload.addresses?.includes(accused) ?? false)) continue;
477
+ for (const carried of payload.payload_hashes ?? []) {
478
+ if (await referencesArtifact(carried, attestation.artifact)) return true;
479
+ }
480
+ }
481
+ return false;
482
+ }
483
+ var verifyFalseAttestation = async (ctx, request, artifacts) => {
484
+ const cited = [...artifacts.values()];
485
+ const found = citedAttestation(cited);
486
+ if (found === void 0) {
487
+ return verdict("provably-invalid", "no attestation among the cited artifacts");
488
+ }
489
+ const { attestation } = found;
490
+ const transcript = {
491
+ accused: request.accused,
492
+ attestedBlock: attestation.blockNumber,
493
+ attestedBlockHash: attestation.blockHash,
494
+ attestedStepHash: attestation.stepHash,
495
+ stepSize: attestation.stepSize
496
+ };
497
+ if (attestation.witness !== request.accused || !await boundToAccused(cited, found, request.accused)) {
498
+ return verdict("provably-invalid", "the attestation is not bound to the accused by any cited signed carrier", transcript);
499
+ }
500
+ const level = StepSizes.indexOf(attestation.stepSize);
501
+ if (level === -1) {
502
+ return verdict("provably-invalid", `the attestation names an unknown step size ${attestation.stepSize}`, transcript);
503
+ }
504
+ const attested = cited.map((artifact) => ({ block: asBlockBoundWitness3(artifact.payload), dataHash: artifact.dataHash })).find((candidate) => candidate.block !== void 0 && candidate.dataHash === attestation.blockHash);
505
+ if (attested?.block !== void 0) {
506
+ const carried = attested.block.step_hashes?.[level];
507
+ return carried === attestation.stepHash ? verdict("provably-invalid", "the block carries the step hash the attestation names at that level", transcript) : verdict("verified", "the attested block says something else at that level", {
508
+ ...transcript,
509
+ blockStepHashes: attested.block.step_hashes ?? [],
510
+ carried: carried ?? null
511
+ });
512
+ }
513
+ const age = ctx.submission.requestCarryingHeight - attestation.blockNumber;
514
+ if (age > ctx.params.evidenceRetentionXl1Blocks) {
515
+ return verdict("indeterminate", `the attested block is ${age} blocks back, past the retention window`, transcript);
516
+ }
517
+ const finalized = await ctx.chain.blockAtHeight(attestation.blockNumber);
518
+ if (finalized === void 0) {
519
+ return verdict("indeterminate", "the attested height is not resolvable on this canonical chain", transcript);
520
+ }
521
+ const finalizedHash = finalized[0]._dataHash;
522
+ return finalizedHash === attestation.blockHash ? verdict("provably-invalid", "the attested block is the one finalized at that height", transcript) : verdict(
523
+ "verified",
524
+ "no block with the attested hash was finalized at that height",
525
+ { ...transcript, finalizedHash: finalizedHash ?? null },
526
+ true
527
+ );
528
+ };
529
+
530
+ // src/modules/slashing/verify/verifyIneligibleProduction.ts
531
+ import { asBlockBoundWitness as asBlockBoundWitness4, isTimePayload as isTimePayload2 } from "@xyo-network/xl1-sdk";
532
+ async function anchorOf(block, artifacts) {
533
+ for (const artifact of artifacts.values()) {
534
+ if (!isTimePayload2(artifact.payload)) continue;
535
+ for (const carried of block.payload_hashes) {
536
+ if (await referencesArtifact(carried, artifact)) return artifact.payload.ethereum;
537
+ }
538
+ }
539
+ return void 0;
540
+ }
541
+ var blockAt = (height, artifacts) => [...artifacts.values()].map((artifact) => asBlockBoundWitness4(artifact.payload)).find((block) => block?.block === height);
542
+ async function blockByReference(reference, artifacts) {
543
+ if (reference === null) return void 0;
544
+ for (const artifact of artifacts.values()) {
545
+ const block = asBlockBoundWitness4(artifact.payload);
546
+ if (block === void 0) continue;
547
+ if (await referencesArtifact(reference, artifact)) return block;
548
+ }
549
+ return void 0;
550
+ }
551
+ var verifyIneligibleProduction = async (ctx, request, artifacts) => {
552
+ const accused = blockAt(request.block, artifacts);
553
+ const parent = accused === void 0 ? void 0 : await blockByReference(accused.previous, artifacts);
554
+ if (accused === void 0 || parent === void 0) {
555
+ return verdict("provably-invalid", "the accused block and its signed parent were not both cited");
556
+ }
557
+ if (!accused.addresses.includes(request.accused)) {
558
+ return verdict("provably-invalid", "the accused did not sign the cited block");
559
+ }
560
+ const blockAnchor = await anchorOf(accused, artifacts);
561
+ const parentAnchor = await anchorOf(parent, artifacts);
562
+ if (blockAnchor === void 0 || parentAnchor === void 0) {
563
+ return verdict("indeterminate", "the blocks do not both carry an anchor to measure against");
564
+ }
565
+ const evaluation = await evaluateProducerEligibility({
566
+ accused: request.accused,
567
+ blockAnchor,
568
+ height: request.block,
569
+ intent: () => accused.addresses.includes(request.accused),
570
+ params: ctx.params,
571
+ parentAnchor,
572
+ snapshot: ctx.snapshot
573
+ });
574
+ const transcript = {
575
+ accused: request.accused,
576
+ blockAnchor,
577
+ eStar: evaluation.eStar ?? null,
578
+ parentAnchor
579
+ };
580
+ if (request.evm !== evaluation.eStar) {
581
+ return verdict("provably-invalid", `the report measures at ${request.evm}, but the rule measures at ${evaluation.eStar}`, transcript);
582
+ }
583
+ if (!evaluation.resolvable) {
584
+ return verdict("indeterminate", "no stake snapshot, so standing cannot be measured", transcript);
585
+ }
586
+ const measured = {
587
+ ...transcript,
588
+ seasonedActive: evaluation.activeStake?.toString() ?? null,
589
+ seasonedSelfBond: evaluation.selfBond?.toString() ?? null
590
+ };
591
+ return evaluation.eligible === true ? verdict("provably-invalid", "the accused met every participation requirement at that point", measured) : verdict("verified", `the accused was ineligible at that point: ${evaluation.reason}`, { ...measured, reason: evaluation.reason ?? null });
592
+ };
593
+
594
+ // src/modules/slashing/verify/verifyInvalidBlock.ts
595
+ import { asBlockBoundWitness as asBlockBoundWitness5, BlockCumulativeBalanceValidatorFactory } from "@xyo-network/xl1-sdk";
596
+ import { validateBlock } from "#validation";
597
+ function citedHydratedBlock(artifacts) {
598
+ const cited = [...artifacts.values()];
599
+ const entry = cited.find((artifact) => asBlockBoundWitness5(artifact.payload) !== void 0);
600
+ const block = entry === void 0 ? void 0 : asBlockBoundWitness5(entry.payload);
601
+ return block === void 0 ? void 0 : { block, payloads: cited.filter((artifact) => artifact !== entry).map((artifact) => artifact.payload) };
602
+ }
603
+ async function replayStateRules(ctx, cited, transcript) {
604
+ if (ctx.balances === void 0) {
605
+ return verdict("indeterminate", "no balance view, so state rules cannot be replayed", transcript);
606
+ }
607
+ const errors = await BlockCumulativeBalanceValidatorFactory()(
608
+ {
609
+ accountBalance: ctx.balances,
610
+ chainIdAtBlockNumber: () => cited.block.chain,
611
+ singletons: {}
612
+ },
613
+ [cited.block, cited.payloads]
614
+ );
615
+ return errors.length > 0 ? verdict("verified", `the cited block breaks a state rule: ${errors[0]?.message}`, {
616
+ ...transcript,
617
+ errors: errors.map((error) => error.message),
618
+ rule: "state"
619
+ }) : verdict("provably-invalid", "the cited block satisfies every rule this procedure can replay", transcript);
620
+ }
621
+ var verifyInvalidBlock = async (ctx, request, artifacts) => {
622
+ const cited = citedHydratedBlock(artifacts);
623
+ if (cited === void 0) return verdict("provably-invalid", "no block among the cited artifacts");
624
+ const transcript = {
625
+ accused: request.accused,
626
+ block: cited.block.block,
627
+ catalogVersion: ctx.catalogVersion,
628
+ payloadCount: cited.payloads.length
629
+ };
630
+ if (cited.block.block !== request.block) {
631
+ return verdict("provably-invalid", "the cited block is not at the height the report names", transcript);
632
+ }
633
+ if (!cited.block.addresses.includes(request.accused)) {
634
+ return verdict("provably-invalid", "the accused did not sign the cited block", transcript);
635
+ }
636
+ const protocolErrors = await validateBlock({ singletons: {} }, cited.block, cited.block.chain);
637
+ if (protocolErrors.length > 0) {
638
+ return verdict("verified", `the cited block breaks a protocol rule: ${protocolErrors[0]?.message}`, {
639
+ ...transcript,
640
+ errors: protocolErrors.map((error) => error.message),
641
+ rule: "protocol"
642
+ });
643
+ }
644
+ if (cited.block.previous === null) {
645
+ return verdict("provably-invalid", "the cited block is a genesis block, which has no parent to judge it against", transcript);
646
+ }
647
+ const parent = await ctx.chain.blockByHash(cited.block.previous);
648
+ if (parent === void 0) {
649
+ return verdict("indeterminate", "the parent is not resolvable on this canonical chain", transcript);
650
+ }
651
+ if (cited.block.block !== parent[0].block + 1) {
652
+ return verdict("verified", "the cited block does not follow its own parent in height", {
653
+ ...transcript,
654
+ parentBlock: parent[0].block,
655
+ rule: "height"
656
+ });
657
+ }
658
+ return await replayStateRules(ctx, cited, transcript);
659
+ };
660
+
661
+ // src/modules/slashing/verify/verifyInvalidSlashRequest.ts
662
+ import { isSlashRequest as isSlashRequest2 } from "@xyo-network/xl1-sdk";
663
+ var inverted = {
664
+ "indeterminate": "indeterminate",
665
+ "provably-invalid": "verified",
666
+ "verified": "provably-invalid"
667
+ };
668
+ function createVerifyInvalidSlashRequest(resolve) {
669
+ return async (ctx, request, artifacts) => {
670
+ const accused = artifacts.values().find((artifact) => isSlashRequest2(artifact.payload));
671
+ if (accused === void 0) {
672
+ return verdict("provably-invalid", "no slash request among the cited artifacts");
673
+ }
674
+ const original = accused.payload;
675
+ const key = offenseKeyOf(original);
676
+ const finalized = (await ctx.history.requestsByKey(key)).find((candidate) => candidate.hash === accused.dataHash);
677
+ if (finalized === void 0) {
678
+ return verdict("indeterminate", "the accused request is not visible in finalized history");
679
+ }
680
+ const transcript = {
681
+ accusedRequest: accused.dataHash,
682
+ innerOffense: original.offense,
683
+ originalCarryingHeight: finalized.carryingHeight,
684
+ reporter: request.accused
685
+ };
686
+ const adjudication = await ctx.history.adjudicationByKey(key);
687
+ if (adjudication !== void 0) {
688
+ if (adjudication.carryingHeight >= finalized.carryingHeight) {
689
+ return verdict("provably-invalid", "timing-excused: the offense was not yet adjudicated when the report was filed", { ...transcript, adjudicationHeight: adjudication.carryingHeight });
690
+ }
691
+ return verdict("verified", "re-litigation: the offense was already adjudicated on-chain when the report was filed", { ...transcript, adjudicationHeight: adjudication.carryingHeight });
692
+ }
693
+ const procedure = resolve()[original.offense];
694
+ if (procedure === void 0) {
695
+ return verdict("indeterminate", `no verification procedure for the inner offense '${original.offense}'`, transcript);
696
+ }
697
+ const innerCtx = {
698
+ ...ctx,
699
+ catalogVersion: original.catalog,
700
+ submission: { requestCarryingHeight: finalized.carryingHeight }
701
+ };
702
+ const innerArtifacts = await verifyArtifacts(ctx.artifacts, original.evidence);
703
+ if (!innerArtifacts.ok) {
704
+ return innerArtifacts.missing === true ? verdict("indeterminate", `the original's evidence is not available to re-run: ${innerArtifacts.reason}`, transcript) : verdict("verified", `the original's evidence fails the preamble: ${innerArtifacts.reason}`, transcript);
705
+ }
706
+ const innerFreshness = await freshnessGate(innerCtx, original);
707
+ const innerVerdict = innerFreshness.verdict ?? await procedure(innerCtx, original, innerArtifacts.byHash);
708
+ return verdict(
709
+ inverted[innerVerdict.outcome],
710
+ `the original report verified as '${innerVerdict.outcome}': ${innerVerdict.reason}`,
711
+ {
712
+ ...transcript,
713
+ inner: innerVerdict.transcript,
714
+ innerOutcome: innerVerdict.outcome
715
+ }
716
+ );
717
+ };
718
+ }
719
+
720
+ // src/modules/slashing/verify/verifyRewardOvermint.ts
721
+ import { hexToBigInt } from "@ariestools/sdk";
722
+ import {
723
+ asBlockBoundWitness as asBlockBoundWitness6,
724
+ isTransferPayload,
725
+ rewardFromBlockNumber,
726
+ XYO_ZERO_ADDRESS
727
+ } from "@xyo-network/xl1-sdk";
728
+ function mintedBy(payloads) {
729
+ return payloads.filter((payload) => isTransferPayload(payload)).filter((transfer) => transfer.from === XYO_ZERO_ADDRESS).reduce((total, transfer) => total + Object.values(transfer.transfers).reduce((sum, amount) => sum + hexToBigInt(amount), 0n), 0n);
730
+ }
731
+ async function allowedEmission(ctx, blockNumber, parentAnchor) {
732
+ if (ctx.params.rewardSource === "schedule") return rewardFromBlockNumber(blockNumber);
733
+ if (parentAnchor === void 0 || ctx.blockRewardAt === void 0) return void 0;
734
+ return await ctx.blockRewardAt(parentAnchor);
735
+ }
736
+ var verifyRewardOvermint = async (ctx, request, artifacts) => {
737
+ const cited = [...artifacts.values()];
738
+ const entry = cited.find((artifact) => asBlockBoundWitness6(artifact.payload) !== void 0);
739
+ const block = entry === void 0 ? void 0 : asBlockBoundWitness6(entry.payload);
740
+ if (block === void 0) return verdict("provably-invalid", "no block among the cited artifacts");
741
+ if (block.block !== request.block) {
742
+ return verdict("provably-invalid", "the cited block is not at the height the report names");
743
+ }
744
+ if (!block.addresses.includes(request.accused)) {
745
+ return verdict("provably-invalid", "the accused did not sign the cited block");
746
+ }
747
+ const payloads = cited.filter((artifact) => artifact !== entry).map((artifact) => artifact.payload);
748
+ const minted = mintedBy(payloads);
749
+ const parentAnchor = block.previous === null ? void 0 : await ctx.chain.validatedAnchorAt(block.block - 1);
750
+ const allowed = await allowedEmission(ctx, block.block, parentAnchor);
751
+ const transcript = {
752
+ accused: request.accused,
753
+ allowed: allowed === void 0 ? null : allowed.toString(),
754
+ block: block.block,
755
+ minted: minted.toString(),
756
+ parentAnchor: parentAnchor ?? null,
757
+ rewardSource: ctx.params.rewardSource
758
+ };
759
+ if (allowed === void 0) {
760
+ return verdict("indeterminate", "the allowed emission for this block cannot be established", transcript);
761
+ }
762
+ return minted > allowed ? verdict("verified", `the block minted ${minted} against an allowance of ${allowed}`, transcript) : verdict("provably-invalid", `the block minted ${minted}, within its allowance of ${allowed}`, transcript);
763
+ };
764
+
765
+ // src/modules/slashing/verify/verifyOffense.ts
766
+ var offenseProcedures = {
767
+ "equivocation": verifyEquivocation,
768
+ "false-anchor": verifyFalseAnchor,
769
+ "false-attestation": verifyFalseAttestation,
770
+ "ineligible-production": verifyIneligibleProduction,
771
+ "invalid-block": verifyInvalidBlock,
772
+ "invalid-slash-request": createVerifyInvalidSlashRequest(() => offenseProcedures),
773
+ "reward-overmint": verifyRewardOvermint
774
+ };
775
+ async function verifyOffense(ctx, request) {
776
+ const artifacts = await verifyArtifacts(ctx.artifacts, request.evidence);
777
+ if (!artifacts.ok) {
778
+ return verdict(artifacts.missing === true ? "indeterminate" : "provably-invalid", artifacts.reason, { stage: "artifacts" });
779
+ }
780
+ const freshness = await freshnessGate(ctx, request);
781
+ if (freshness.verdict !== void 0) return freshness.verdict;
782
+ const procedure = offenseProcedures[request.offense];
783
+ if (procedure === void 0) {
784
+ return verdict("indeterminate", `no verification procedure for '${request.offense}'`, { catalogVersion: ctx.catalogVersion, offense: request.offense });
785
+ }
786
+ const result = await procedure(ctx, request, artifacts.byHash);
787
+ return {
788
+ ...result,
789
+ transcript: {
790
+ ...result.transcript,
791
+ eOff: freshness.eOff ?? null,
792
+ eSub: freshness.eSub ?? null,
793
+ offense: request.offense
794
+ }
795
+ };
796
+ }
797
+ export {
798
+ SlashIndexStoreMoniker,
799
+ VerificationOutcomes,
800
+ canonicalOffenseHeight,
801
+ createVerifyInvalidSlashRequest,
802
+ evaluateProducerEligibility,
803
+ findCandidatePairs,
804
+ foldSlashIndex,
805
+ freshnessGate,
806
+ isOffenseWatchable,
807
+ isSlashIndexStore,
808
+ mergeKeyRecord,
809
+ offenseKeyOf,
810
+ offenseKeyString,
811
+ offenseProcedures,
812
+ referencesArtifact,
813
+ suppressionFor,
814
+ verdict,
815
+ verifyArtifacts,
816
+ verifyEquivocation,
817
+ verifyFalseAnchor,
818
+ verifyFalseAttestation,
819
+ verifyIneligibleProduction,
820
+ verifyInvalidBlock,
821
+ verifyOffense,
822
+ verifyRewardOvermint
823
+ };
824
+ //# sourceMappingURL=slashing.mjs.map