gate-evm-tools 1.0.26 → 1.0.28

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 (338) hide show
  1. package/README.md +14 -0
  2. package/bin/workflow.cjs +19 -0
  3. package/dist/core/BytecodeChecker.d.ts.map +1 -1
  4. package/dist/core/BytecodeChecker.js +16 -1
  5. package/dist/core/BytecodeChecker.js.map +1 -1
  6. package/dist/core/legacyProxyArtifact.d.ts +6 -0
  7. package/dist/core/legacyProxyArtifact.d.ts.map +1 -0
  8. package/dist/core/legacyProxyArtifact.js +36 -0
  9. package/dist/core/legacyProxyArtifact.js.map +1 -0
  10. package/dist-runtime/config/hardhatAdapters.d.ts +7 -0
  11. package/dist-runtime/config/hardhatAdapters.js +61 -0
  12. package/dist-runtime/config/hardhatAdapters.js.map +1 -0
  13. package/dist-runtime/config/networks.d.ts +32 -0
  14. package/dist-runtime/config/networks.js +275 -0
  15. package/dist-runtime/config/networks.js.map +1 -0
  16. package/dist-runtime/config/openzeppelin.d.ts +28 -0
  17. package/dist-runtime/config/openzeppelin.js +144 -0
  18. package/dist-runtime/config/openzeppelin.js.map +1 -0
  19. package/dist-runtime/config/rpc.d.ts +7 -0
  20. package/dist-runtime/config/rpc.js +19 -0
  21. package/dist-runtime/config/rpc.js.map +1 -0
  22. package/dist-runtime/config/zksyncSolcPath.d.ts +1 -0
  23. package/dist-runtime/config/zksyncSolcPath.js +61 -0
  24. package/dist-runtime/config/zksyncSolcPath.js.map +1 -0
  25. package/dist-runtime/migrate.d.ts +13 -0
  26. package/dist-runtime/migrate.js +208 -0
  27. package/dist-runtime/migrate.js.map +1 -0
  28. package/dist-runtime/package.json +1 -0
  29. package/dist-runtime/projectHardhat.d.ts +4 -0
  30. package/dist-runtime/projectHardhat.js +16 -0
  31. package/dist-runtime/projectHardhat.js.map +1 -0
  32. package/dist-runtime/runtime-identity.json +4 -0
  33. package/dist-runtime/template-migration.json +293 -0
  34. package/dist-runtime/workflow/checkCode.d.ts +1 -0
  35. package/dist-runtime/workflow/checkCode.js +16 -0
  36. package/dist-runtime/workflow/checkCode.js.map +1 -0
  37. package/dist-runtime/workflow/checkCodeFinalize.d.ts +1 -0
  38. package/dist-runtime/workflow/checkCodeFinalize.js +11 -0
  39. package/dist-runtime/workflow/checkCodeFinalize.js.map +1 -0
  40. package/dist-runtime/workflow/checkCodePlan.d.ts +1 -0
  41. package/dist-runtime/workflow/checkCodePlan.js +11 -0
  42. package/dist-runtime/workflow/checkCodePlan.js.map +1 -0
  43. package/dist-runtime/workflow/cli.d.ts +1 -0
  44. package/dist-runtime/workflow/cli.js +302 -0
  45. package/dist-runtime/workflow/cli.js.map +1 -0
  46. package/dist-runtime/workflow/commitContractInfo.d.ts +1 -0
  47. package/dist-runtime/workflow/commitContractInfo.js +64 -0
  48. package/dist-runtime/workflow/commitContractInfo.js.map +1 -0
  49. package/dist-runtime/workflow/create2Hashes.d.ts +1 -0
  50. package/dist-runtime/workflow/create2Hashes.js +76 -0
  51. package/dist-runtime/workflow/create2Hashes.js.map +1 -0
  52. package/dist-runtime/workflow/forkSourceProxy.d.ts +1 -0
  53. package/dist-runtime/workflow/forkSourceProxy.js +151 -0
  54. package/dist-runtime/workflow/forkSourceProxy.js.map +1 -0
  55. package/dist-runtime/workflow/importState.d.ts +1 -0
  56. package/dist-runtime/workflow/importState.js +193 -0
  57. package/dist-runtime/workflow/importState.js.map +1 -0
  58. package/dist-runtime/workflow/lib/authority.d.ts +28 -0
  59. package/dist-runtime/workflow/lib/authority.js +122 -0
  60. package/dist-runtime/workflow/lib/authority.js.map +1 -0
  61. package/dist-runtime/workflow/lib/calldata.d.ts +2 -0
  62. package/dist-runtime/workflow/lib/calldata.js +8 -0
  63. package/dist-runtime/workflow/lib/calldata.js.map +1 -0
  64. package/dist-runtime/workflow/lib/calls.d.ts +23 -0
  65. package/dist-runtime/workflow/lib/calls.js +316 -0
  66. package/dist-runtime/workflow/lib/calls.js.map +1 -0
  67. package/dist-runtime/workflow/lib/checkCode/args.d.ts +2 -0
  68. package/dist-runtime/workflow/lib/checkCode/args.js +68 -0
  69. package/dist-runtime/workflow/lib/checkCode/args.js.map +1 -0
  70. package/dist-runtime/workflow/lib/checkCode/command.d.ts +5 -0
  71. package/dist-runtime/workflow/lib/checkCode/command.js +35 -0
  72. package/dist-runtime/workflow/lib/checkCode/command.js.map +1 -0
  73. package/dist-runtime/workflow/lib/checkCode/dependencies.d.ts +6 -0
  74. package/dist-runtime/workflow/lib/checkCode/dependencies.js +125 -0
  75. package/dist-runtime/workflow/lib/checkCode/dependencies.js.map +1 -0
  76. package/dist-runtime/workflow/lib/checkCode/finalize.d.ts +17 -0
  77. package/dist-runtime/workflow/lib/checkCode/finalize.js +174 -0
  78. package/dist-runtime/workflow/lib/checkCode/finalize.js.map +1 -0
  79. package/dist-runtime/workflow/lib/checkCode/index.d.ts +3 -0
  80. package/dist-runtime/workflow/lib/checkCode/index.js +20 -0
  81. package/dist-runtime/workflow/lib/checkCode/index.js.map +1 -0
  82. package/dist-runtime/workflow/lib/checkCode/plan.d.ts +22 -0
  83. package/dist-runtime/workflow/lib/checkCode/plan.js +145 -0
  84. package/dist-runtime/workflow/lib/checkCode/plan.js.map +1 -0
  85. package/dist-runtime/workflow/lib/checkCodeReport.d.ts +25 -0
  86. package/dist-runtime/workflow/lib/checkCodeReport.js +102 -0
  87. package/dist-runtime/workflow/lib/checkCodeReport.js.map +1 -0
  88. package/dist-runtime/workflow/lib/checkCodeRunner.d.ts +87 -0
  89. package/dist-runtime/workflow/lib/checkCodeRunner.js +964 -0
  90. package/dist-runtime/workflow/lib/checkCodeRunner.js.map +1 -0
  91. package/dist-runtime/workflow/lib/cliTool.d.ts +10 -0
  92. package/dist-runtime/workflow/lib/cliTool.js +25 -0
  93. package/dist-runtime/workflow/lib/cliTool.js.map +1 -0
  94. package/dist-runtime/workflow/lib/config.d.ts +33 -0
  95. package/dist-runtime/workflow/lib/config.js +100 -0
  96. package/dist-runtime/workflow/lib/config.js.map +1 -0
  97. package/dist-runtime/workflow/lib/contractInfoCandidates.d.ts +82 -0
  98. package/dist-runtime/workflow/lib/contractInfoCandidates.js +441 -0
  99. package/dist-runtime/workflow/lib/contractInfoCandidates.js.map +1 -0
  100. package/dist-runtime/workflow/lib/controlledMulticallAbi.d.ts +2 -0
  101. package/dist-runtime/workflow/lib/controlledMulticallAbi.js +10 -0
  102. package/dist-runtime/workflow/lib/controlledMulticallAbi.js.map +1 -0
  103. package/dist-runtime/workflow/lib/create2.d.ts +49 -0
  104. package/dist-runtime/workflow/lib/create2.js +194 -0
  105. package/dist-runtime/workflow/lib/create2.js.map +1 -0
  106. package/dist-runtime/workflow/lib/create2Hashes.d.ts +22 -0
  107. package/dist-runtime/workflow/lib/create2Hashes.js +57 -0
  108. package/dist-runtime/workflow/lib/create2Hashes.js.map +1 -0
  109. package/dist-runtime/workflow/lib/deploymentInfo.d.ts +40 -0
  110. package/dist-runtime/workflow/lib/deploymentInfo.js +240 -0
  111. package/dist-runtime/workflow/lib/deploymentInfo.js.map +1 -0
  112. package/dist-runtime/workflow/lib/deploymentRecords.d.ts +137 -0
  113. package/dist-runtime/workflow/lib/deploymentRecords.js +374 -0
  114. package/dist-runtime/workflow/lib/deploymentRecords.js.map +1 -0
  115. package/dist-runtime/workflow/lib/deployments.d.ts +21 -0
  116. package/dist-runtime/workflow/lib/deployments.js +240 -0
  117. package/dist-runtime/workflow/lib/deployments.js.map +1 -0
  118. package/dist-runtime/workflow/lib/erc1967.d.ts +5 -0
  119. package/dist-runtime/workflow/lib/erc1967.js +29 -0
  120. package/dist-runtime/workflow/lib/erc1967.js.map +1 -0
  121. package/dist-runtime/workflow/lib/errors.d.ts +6 -0
  122. package/dist-runtime/workflow/lib/errors.js +77 -0
  123. package/dist-runtime/workflow/lib/errors.js.map +1 -0
  124. package/dist-runtime/workflow/lib/executionId.d.ts +7 -0
  125. package/dist-runtime/workflow/lib/executionId.js +26 -0
  126. package/dist-runtime/workflow/lib/executionId.js.map +1 -0
  127. package/dist-runtime/workflow/lib/executionPlan.d.ts +85 -0
  128. package/dist-runtime/workflow/lib/executionPlan.js +450 -0
  129. package/dist-runtime/workflow/lib/executionPlan.js.map +1 -0
  130. package/dist-runtime/workflow/lib/executionProgress.d.ts +5 -0
  131. package/dist-runtime/workflow/lib/executionProgress.js +100 -0
  132. package/dist-runtime/workflow/lib/executionProgress.js.map +1 -0
  133. package/dist-runtime/workflow/lib/external.d.ts +62 -0
  134. package/dist-runtime/workflow/lib/external.js +282 -0
  135. package/dist-runtime/workflow/lib/external.js.map +1 -0
  136. package/dist-runtime/workflow/lib/externalExecutionScanner.d.ts +64 -0
  137. package/dist-runtime/workflow/lib/externalExecutionScanner.js +638 -0
  138. package/dist-runtime/workflow/lib/externalExecutionScanner.js.map +1 -0
  139. package/dist-runtime/workflow/lib/forkSnapshot.d.ts +34 -0
  140. package/dist-runtime/workflow/lib/forkSnapshot.js +167 -0
  141. package/dist-runtime/workflow/lib/forkSnapshot.js.map +1 -0
  142. package/dist-runtime/workflow/lib/gateTool.d.ts +16 -0
  143. package/dist-runtime/workflow/lib/gateTool.js +177 -0
  144. package/dist-runtime/workflow/lib/gateTool.js.map +1 -0
  145. package/dist-runtime/workflow/lib/gateToolSync.d.ts +22 -0
  146. package/dist-runtime/workflow/lib/gateToolSync.js +253 -0
  147. package/dist-runtime/workflow/lib/gateToolSync.js.map +1 -0
  148. package/dist-runtime/workflow/lib/lock.d.ts +52 -0
  149. package/dist-runtime/workflow/lib/lock.js +269 -0
  150. package/dist-runtime/workflow/lib/lock.js.map +1 -0
  151. package/dist-runtime/workflow/lib/migrationState.d.ts +103 -0
  152. package/dist-runtime/workflow/lib/migrationState.js +920 -0
  153. package/dist-runtime/workflow/lib/migrationState.js.map +1 -0
  154. package/dist-runtime/workflow/lib/operatorExecution.d.ts +28 -0
  155. package/dist-runtime/workflow/lib/operatorExecution.js +134 -0
  156. package/dist-runtime/workflow/lib/operatorExecution.js.map +1 -0
  157. package/dist-runtime/workflow/lib/parameters.d.ts +58 -0
  158. package/dist-runtime/workflow/lib/parameters.js +323 -0
  159. package/dist-runtime/workflow/lib/parameters.js.map +1 -0
  160. package/dist-runtime/workflow/lib/pendingDeploymentReuse.d.ts +29 -0
  161. package/dist-runtime/workflow/lib/pendingDeploymentReuse.js +277 -0
  162. package/dist-runtime/workflow/lib/pendingDeploymentReuse.js.map +1 -0
  163. package/dist-runtime/workflow/lib/proxy.d.ts +18 -0
  164. package/dist-runtime/workflow/lib/proxy.js +19 -0
  165. package/dist-runtime/workflow/lib/proxy.js.map +1 -0
  166. package/dist-runtime/workflow/lib/registryCommit.d.ts +33 -0
  167. package/dist-runtime/workflow/lib/registryCommit.js +319 -0
  168. package/dist-runtime/workflow/lib/registryCommit.js.map +1 -0
  169. package/dist-runtime/workflow/lib/release.d.ts +57 -0
  170. package/dist-runtime/workflow/lib/release.js +256 -0
  171. package/dist-runtime/workflow/lib/release.js.map +1 -0
  172. package/dist-runtime/workflow/lib/releaseFinalize.d.ts +14 -0
  173. package/dist-runtime/workflow/lib/releaseFinalize.js +571 -0
  174. package/dist-runtime/workflow/lib/releaseFinalize.js.map +1 -0
  175. package/dist-runtime/workflow/lib/releaseParameters.d.ts +43 -0
  176. package/dist-runtime/workflow/lib/releaseParameters.js +184 -0
  177. package/dist-runtime/workflow/lib/releaseParameters.js.map +1 -0
  178. package/dist-runtime/workflow/lib/reporter.d.ts +39 -0
  179. package/dist-runtime/workflow/lib/reporter.js +452 -0
  180. package/dist-runtime/workflow/lib/reporter.js.map +1 -0
  181. package/dist-runtime/workflow/lib/resultPaths.d.ts +17 -0
  182. package/dist-runtime/workflow/lib/resultPaths.js +29 -0
  183. package/dist-runtime/workflow/lib/resultPaths.js.map +1 -0
  184. package/dist-runtime/workflow/lib/runtimeVersion.d.ts +10 -0
  185. package/dist-runtime/workflow/lib/runtimeVersion.js +46 -0
  186. package/dist-runtime/workflow/lib/runtimeVersion.js.map +1 -0
  187. package/dist-runtime/workflow/lib/signer.d.ts +10 -0
  188. package/dist-runtime/workflow/lib/signer.js +105 -0
  189. package/dist-runtime/workflow/lib/signer.js.map +1 -0
  190. package/dist-runtime/workflow/lib/signerIdentity.d.ts +1 -0
  191. package/dist-runtime/workflow/lib/signerIdentity.js +23 -0
  192. package/dist-runtime/workflow/lib/signerIdentity.js.map +1 -0
  193. package/dist-runtime/workflow/lib/simulation.d.ts +35 -0
  194. package/dist-runtime/workflow/lib/simulation.js +282 -0
  195. package/dist-runtime/workflow/lib/simulation.js.map +1 -0
  196. package/dist-runtime/workflow/lib/simulationCallers.d.ts +44 -0
  197. package/dist-runtime/workflow/lib/simulationCallers.js +260 -0
  198. package/dist-runtime/workflow/lib/simulationCallers.js.map +1 -0
  199. package/dist-runtime/workflow/lib/sourceRpcPolicy.d.ts +1 -0
  200. package/dist-runtime/workflow/lib/sourceRpcPolicy.js +43 -0
  201. package/dist-runtime/workflow/lib/sourceRpcPolicy.js.map +1 -0
  202. package/dist-runtime/workflow/lib/state.d.ts +6 -0
  203. package/dist-runtime/workflow/lib/state.js +25 -0
  204. package/dist-runtime/workflow/lib/state.js.map +1 -0
  205. package/dist-runtime/workflow/lib/staticValidation.d.ts +22 -0
  206. package/dist-runtime/workflow/lib/staticValidation.js +124 -0
  207. package/dist-runtime/workflow/lib/staticValidation.js.map +1 -0
  208. package/dist-runtime/workflow/lib/zksyncForkCapability.d.ts +27 -0
  209. package/dist-runtime/workflow/lib/zksyncForkCapability.js +52 -0
  210. package/dist-runtime/workflow/lib/zksyncForkCapability.js.map +1 -0
  211. package/dist-runtime/workflow/lib/zksyncForkRunner.d.ts +57 -0
  212. package/dist-runtime/workflow/lib/zksyncForkRunner.js +344 -0
  213. package/dist-runtime/workflow/lib/zksyncForkRunner.js.map +1 -0
  214. package/dist-runtime/workflow/reconcileExternal.d.ts +1 -0
  215. package/dist-runtime/workflow/reconcileExternal.js +87 -0
  216. package/dist-runtime/workflow/reconcileExternal.js.map +1 -0
  217. package/dist-runtime/workflow/reconcileExternalRun.d.ts +1 -0
  218. package/dist-runtime/workflow/reconcileExternalRun.js +77 -0
  219. package/dist-runtime/workflow/reconcileExternalRun.js.map +1 -0
  220. package/dist-runtime/workflow/releaseFinalize.d.ts +1 -0
  221. package/dist-runtime/workflow/releaseFinalize.js +11 -0
  222. package/dist-runtime/workflow/releaseFinalize.js.map +1 -0
  223. package/dist-runtime/workflow/run.d.ts +40 -0
  224. package/dist-runtime/workflow/run.js +858 -0
  225. package/dist-runtime/workflow/run.js.map +1 -0
  226. package/dist-runtime/workflow/staticValidate.d.ts +1 -0
  227. package/dist-runtime/workflow/staticValidate.js +26 -0
  228. package/dist-runtime/workflow/staticValidate.js.map +1 -0
  229. package/dist-runtime/workflow/steps/call.d.ts +3 -0
  230. package/dist-runtime/workflow/steps/call.js +9 -0
  231. package/dist-runtime/workflow/steps/call.js.map +1 -0
  232. package/dist-runtime/workflow/steps/check.d.ts +3 -0
  233. package/dist-runtime/workflow/steps/check.js +9 -0
  234. package/dist-runtime/workflow/steps/check.js.map +1 -0
  235. package/dist-runtime/workflow/steps/custom.d.ts +3 -0
  236. package/dist-runtime/workflow/steps/custom.js +33 -0
  237. package/dist-runtime/workflow/steps/custom.js.map +1 -0
  238. package/dist-runtime/workflow/steps/deploy.d.ts +3 -0
  239. package/dist-runtime/workflow/steps/deploy.js +596 -0
  240. package/dist-runtime/workflow/steps/deploy.js.map +1 -0
  241. package/dist-runtime/workflow/steps/upgrade.d.ts +3 -0
  242. package/dist-runtime/workflow/steps/upgrade.js +466 -0
  243. package/dist-runtime/workflow/steps/upgrade.js.map +1 -0
  244. package/dist-runtime/workflow/steps/view.d.ts +3 -0
  245. package/dist-runtime/workflow/steps/view.js +9 -0
  246. package/dist-runtime/workflow/steps/view.js.map +1 -0
  247. package/docs/direct-package-acceptance.md +20 -0
  248. package/docs/external-infrastructure-acceptance.md +33 -0
  249. package/docs/network-runtime-acceptance.md +18 -0
  250. package/docs/plans/2026-09-09-workflow-extraction.md +16 -0
  251. package/docs/superpowers/plans/2026-07-22-manifest-bootstrap-transaction.md +50 -0
  252. package/docs/superpowers/plans/2026-07-22-manifest-review-remediation.md +49 -0
  253. package/docs/superpowers/plans/2026-08-17-custody-hardhat-signers.md +227 -0
  254. package/docs/superpowers/plans/2026-09-09-remove-template-infrastructure-contracts.md +11 -0
  255. package/docs/workflow-reference.md +1181 -0
  256. package/docs/workflow-runtime-acceptance.md +17 -0
  257. package/docs/workflow-runtime.md +56 -0
  258. package/package.json +26 -5
  259. package/runtime/config/hardhatAdapters.ts +58 -0
  260. package/runtime/config/networks.ts +305 -0
  261. package/runtime/config/openzeppelin.ts +173 -0
  262. package/runtime/config/rpc.ts +27 -0
  263. package/runtime/config/zksyncSolcPath.ts +59 -0
  264. package/runtime/hardhat-types.d.ts +2 -0
  265. package/runtime/migrate.ts +154 -0
  266. package/runtime/projectHardhat.ts +10 -0
  267. package/runtime/template-migration.json +293 -0
  268. package/runtime/workflow/checkCode.ts +13 -0
  269. package/runtime/workflow/checkCodeFinalize.ts +8 -0
  270. package/runtime/workflow/checkCodePlan.ts +8 -0
  271. package/runtime/workflow/cli.ts +356 -0
  272. package/runtime/workflow/commitContractInfo.ts +63 -0
  273. package/runtime/workflow/create2Hashes.ts +79 -0
  274. package/runtime/workflow/forkSourceProxy.ts +193 -0
  275. package/runtime/workflow/importState.ts +190 -0
  276. package/runtime/workflow/lib/authority.ts +170 -0
  277. package/runtime/workflow/lib/calldata.ts +9 -0
  278. package/runtime/workflow/lib/calls.ts +407 -0
  279. package/runtime/workflow/lib/checkCode/args.ts +76 -0
  280. package/runtime/workflow/lib/checkCode/command.ts +36 -0
  281. package/runtime/workflow/lib/checkCode/dependencies.ts +112 -0
  282. package/runtime/workflow/lib/checkCode/finalize.ts +198 -0
  283. package/runtime/workflow/lib/checkCode/index.ts +18 -0
  284. package/runtime/workflow/lib/checkCode/plan.ts +163 -0
  285. package/runtime/workflow/lib/checkCodeReport.ts +133 -0
  286. package/runtime/workflow/lib/checkCodeRunner.ts +1225 -0
  287. package/runtime/workflow/lib/cliTool.ts +31 -0
  288. package/runtime/workflow/lib/config.ts +130 -0
  289. package/runtime/workflow/lib/contractInfoCandidates.ts +690 -0
  290. package/runtime/workflow/lib/controlledMulticallAbi.ts +6 -0
  291. package/runtime/workflow/lib/create2.ts +278 -0
  292. package/runtime/workflow/lib/create2Hashes.ts +83 -0
  293. package/runtime/workflow/lib/deploymentInfo.ts +286 -0
  294. package/runtime/workflow/lib/deploymentRecords.ts +576 -0
  295. package/runtime/workflow/lib/deployments.ts +276 -0
  296. package/runtime/workflow/lib/erc1967.ts +57 -0
  297. package/runtime/workflow/lib/errors.ts +95 -0
  298. package/runtime/workflow/lib/executionId.ts +35 -0
  299. package/runtime/workflow/lib/executionPlan.ts +550 -0
  300. package/runtime/workflow/lib/executionProgress.ts +127 -0
  301. package/runtime/workflow/lib/external.ts +372 -0
  302. package/runtime/workflow/lib/externalExecutionScanner.ts +892 -0
  303. package/runtime/workflow/lib/forkSnapshot.ts +231 -0
  304. package/runtime/workflow/lib/gateTool.ts +261 -0
  305. package/runtime/workflow/lib/gateToolSync.ts +398 -0
  306. package/runtime/workflow/lib/lock.ts +388 -0
  307. package/runtime/workflow/lib/migrationState.ts +1246 -0
  308. package/runtime/workflow/lib/operatorExecution.ts +174 -0
  309. package/runtime/workflow/lib/parameters.ts +438 -0
  310. package/runtime/workflow/lib/pendingDeploymentReuse.ts +428 -0
  311. package/runtime/workflow/lib/proxy.ts +45 -0
  312. package/runtime/workflow/lib/registryCommit.ts +455 -0
  313. package/runtime/workflow/lib/release.ts +329 -0
  314. package/runtime/workflow/lib/releaseFinalize.ts +711 -0
  315. package/runtime/workflow/lib/releaseParameters.ts +248 -0
  316. package/runtime/workflow/lib/reporter.ts +502 -0
  317. package/runtime/workflow/lib/resultPaths.ts +49 -0
  318. package/runtime/workflow/lib/runtimeVersion.ts +28 -0
  319. package/runtime/workflow/lib/signer.ts +124 -0
  320. package/runtime/workflow/lib/signerIdentity.ts +22 -0
  321. package/runtime/workflow/lib/simulation.ts +415 -0
  322. package/runtime/workflow/lib/simulationCallers.ts +335 -0
  323. package/runtime/workflow/lib/sourceRpcPolicy.ts +41 -0
  324. package/runtime/workflow/lib/state.ts +25 -0
  325. package/runtime/workflow/lib/staticValidation.ts +142 -0
  326. package/runtime/workflow/lib/zksyncForkCapability.ts +80 -0
  327. package/runtime/workflow/lib/zksyncForkRunner.ts +505 -0
  328. package/runtime/workflow/reconcileExternal.ts +86 -0
  329. package/runtime/workflow/reconcileExternalRun.ts +88 -0
  330. package/runtime/workflow/releaseFinalize.ts +8 -0
  331. package/runtime/workflow/run.ts +1072 -0
  332. package/runtime/workflow/staticValidate.ts +23 -0
  333. package/runtime/workflow/steps/call.ts +10 -0
  334. package/runtime/workflow/steps/check.ts +10 -0
  335. package/runtime/workflow/steps/custom.ts +43 -0
  336. package/runtime/workflow/steps/deploy.ts +772 -0
  337. package/runtime/workflow/steps/upgrade.ts +599 -0
  338. package/runtime/workflow/steps/view.ts +10 -0
@@ -0,0 +1,450 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.releaseExecutionPlanRelativePath = exports.loadReleaseExecutionPlan = exports.writeReleaseExecutionPlan = exports.ReleaseExecutionPlanner = exports.ExecutionSegmentDeferred = void 0;
7
+ const crypto_1 = __importDefault(require("crypto"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ class ExecutionSegmentDeferred extends Error {
11
+ transactionId;
12
+ constructor(transactionId) {
13
+ super(`Execution is waiting for the preceding external segment before ${transactionId}`);
14
+ this.transactionId = transactionId;
15
+ this.name = "ExecutionSegmentDeferred";
16
+ }
17
+ }
18
+ exports.ExecutionSegmentDeferred = ExecutionSegmentDeferred;
19
+ const SAFE_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,199}$/;
20
+ const ADDRESS = /^0x[0-9a-fA-F]{40}$/;
21
+ const DATA = /^0x(?:[0-9a-fA-F]{2})*$/;
22
+ const HASH = /^[0-9a-f]{64}$/;
23
+ const safeId = (value, label) => {
24
+ if (typeof value !== "string" || !SAFE_ID.test(value)) {
25
+ throw new Error(`${label} must match ${SAFE_ID}`);
26
+ }
27
+ return value;
28
+ };
29
+ const address = (value, label) => {
30
+ if (typeof value !== "string" || !ADDRESS.test(value)) {
31
+ throw new Error(`${label} must be an EVM address`);
32
+ }
33
+ if (value.toLowerCase() === "0x0000000000000000000000000000000000000000") {
34
+ throw new Error(`${label} must be non-zero`);
35
+ }
36
+ return value.toLowerCase();
37
+ };
38
+ const value = (raw, label) => {
39
+ if (typeof raw !== "string" || !/^(?:0[xX][0-9a-fA-F]+|[0-9]+)$/.test(raw)) {
40
+ throw new Error(`${label} must be a nonnegative integer string`);
41
+ }
42
+ return BigInt(raw).toString(10);
43
+ };
44
+ const data = (raw, label) => {
45
+ if (typeof raw !== "string" || !DATA.test(raw)) {
46
+ throw new Error(`${label} must be canonical byte calldata`);
47
+ }
48
+ return raw.toLowerCase();
49
+ };
50
+ const factoryDeps = (raw, label) => {
51
+ if (!Array.isArray(raw))
52
+ throw new Error(`${label} must be an array`);
53
+ const seen = new Set();
54
+ const normalized = [];
55
+ for (const [index, dependency] of raw.entries()) {
56
+ if (typeof dependency !== "string" || !/^0x(?:[0-9a-fA-F]{2})+$/.test(dependency)) {
57
+ throw new Error(`${label}[${index}] must be non-empty byte-aligned bytecode`);
58
+ }
59
+ const value = dependency.toLowerCase();
60
+ const hash = crypto_1.default
61
+ .createHash("sha256")
62
+ .update(Buffer.from(value.slice(2), "hex"))
63
+ .digest("hex");
64
+ if (seen.has(hash))
65
+ continue;
66
+ seen.add(hash);
67
+ normalized.push(value);
68
+ }
69
+ return normalized;
70
+ };
71
+ const exactKeys = (value, expected, label) => {
72
+ const actual = Object.keys(value).sort();
73
+ const wanted = [...expected].sort();
74
+ if (actual.length !== wanted.length || actual.some((key, index) => key !== wanted[index])) {
75
+ throw new Error(`${label} contains unsupported or missing fields`);
76
+ }
77
+ };
78
+ const record = (raw, label) => {
79
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
80
+ throw new Error(`${label} must be an object`);
81
+ }
82
+ return raw;
83
+ };
84
+ const normalizeTransaction = (raw, index, strict) => {
85
+ const input = record(raw, `transactions[${index}]`);
86
+ const isZkSync = input.scheme === "zksync-eravm";
87
+ if (input.scheme !== undefined && !isZkSync) {
88
+ throw new Error(`transactions[${index}].scheme must be zksync-eravm when present`);
89
+ }
90
+ if (isZkSync && input.factoryDeps === undefined) {
91
+ throw new Error(`transactions[${index}].factoryDeps is required for zkSync`);
92
+ }
93
+ if (!isZkSync && input.factoryDeps !== undefined) {
94
+ throw new Error(`transactions[${index}].factoryDeps is only supported for zkSync`);
95
+ }
96
+ if (strict) {
97
+ exactKeys(input, [
98
+ "transactionId",
99
+ "stepId",
100
+ "transactionIndex",
101
+ "route",
102
+ "executor",
103
+ "to",
104
+ "value",
105
+ "data",
106
+ "operation",
107
+ ...(isZkSync ? ["scheme", "factoryDeps"] : []),
108
+ ], `transactions[${index}]`);
109
+ }
110
+ if (input.transactionIndex !== index) {
111
+ throw new Error(`transactions[${index}].transactionIndex must equal ${index}`);
112
+ }
113
+ if (input.route !== "operator" && input.route !== "external") {
114
+ throw new Error(`transactions[${index}].route is invalid`);
115
+ }
116
+ if (input.operation !== 0 && input.operation !== 1) {
117
+ throw new Error(`transactions[${index}].operation must be 0 or 1`);
118
+ }
119
+ return {
120
+ transactionId: safeId(input.transactionId, `transactions[${index}].transactionId`),
121
+ stepId: safeId(input.stepId, `transactions[${index}].stepId`),
122
+ transactionIndex: index,
123
+ route: input.route,
124
+ executor: address(input.executor, `transactions[${index}].executor`),
125
+ to: address(input.to, `transactions[${index}].to`),
126
+ value: value(input.value, `transactions[${index}].value`),
127
+ data: data(input.data, `transactions[${index}].data`),
128
+ operation: input.operation,
129
+ ...(isZkSync ? {
130
+ scheme: "zksync-eravm",
131
+ factoryDeps: factoryDeps(input.factoryDeps, `transactions[${index}].factoryDeps`),
132
+ } : {}),
133
+ };
134
+ };
135
+ const normalizeBody = (raw, strict) => {
136
+ const input = record(raw, "execution plan");
137
+ if (strict) {
138
+ exactKeys(input, [
139
+ "version",
140
+ "taskId",
141
+ "target",
142
+ "executionId",
143
+ "releaseKind",
144
+ "operator",
145
+ "transactions",
146
+ ], "execution plan body");
147
+ }
148
+ if (input.version !== 1)
149
+ throw new Error("execution plan version must be 1");
150
+ if (input.releaseKind !== "development" && input.releaseKind !== "admin_release") {
151
+ throw new Error("execution plan releaseKind is invalid");
152
+ }
153
+ if (!Array.isArray(input.transactions)) {
154
+ throw new Error("execution plan transactions must be an array");
155
+ }
156
+ const operator = address(input.operator, "execution plan operator");
157
+ const transactions = input.transactions.map((transaction, index) => (normalizeTransaction(transaction, index, strict)));
158
+ const transactionIds = new Set();
159
+ for (const transaction of transactions) {
160
+ if (transactionIds.has(transaction.transactionId)) {
161
+ throw new Error(`execution plan contains duplicate transactionId ${transaction.transactionId}`);
162
+ }
163
+ transactionIds.add(transaction.transactionId);
164
+ if (transaction.route === "operator" && transaction.executor !== operator) {
165
+ throw new Error(`operator transaction ${transaction.transactionId} must use the plan operator`);
166
+ }
167
+ if (transaction.route === "external" && transaction.executor === operator) {
168
+ throw new Error(`external transaction ${transaction.transactionId} cannot use the plan operator`);
169
+ }
170
+ }
171
+ if (input.releaseKind === "development"
172
+ && transactions.some((transaction) => transaction.route === "external")) {
173
+ throw new Error("development execution plans cannot contain external transactions");
174
+ }
175
+ return {
176
+ version: 1,
177
+ taskId: safeId(input.taskId, "execution plan taskId"),
178
+ target: safeId(input.target, "execution plan target"),
179
+ executionId: safeId(input.executionId, "execution plan executionId"),
180
+ releaseKind: input.releaseKind,
181
+ operator,
182
+ transactions,
183
+ };
184
+ };
185
+ const hashBody = (body) => {
186
+ return crypto_1.default.createHash("sha256").update(JSON.stringify(body)).digest("hex");
187
+ };
188
+ const confinedPath = (root, taskDir, target, executionId) => {
189
+ const resolvedRoot = path_1.default.resolve(root);
190
+ const resolvedTask = path_1.default.resolve(taskDir);
191
+ const relativeTask = path_1.default.relative(resolvedRoot, resolvedTask);
192
+ if (relativeTask === "" || relativeTask.startsWith("..") || path_1.default.isAbsolute(relativeTask)) {
193
+ throw new Error("execution plan task directory must be inside the project root");
194
+ }
195
+ const filePath = path_1.default.join(resolvedTask, "results", target, executionId, "execution-plan.json");
196
+ const relativeFile = path_1.default.relative(resolvedTask, filePath);
197
+ if (relativeFile.startsWith("..") || path_1.default.isAbsolute(relativeFile)) {
198
+ throw new Error("execution plan path escapes the task directory");
199
+ }
200
+ return filePath;
201
+ };
202
+ const assertNoSymlinks = (root, target) => {
203
+ const resolvedRoot = path_1.default.resolve(root);
204
+ const resolvedTarget = path_1.default.resolve(target);
205
+ const relative = path_1.default.relative(resolvedRoot, resolvedTarget);
206
+ if (relative.startsWith("..") || path_1.default.isAbsolute(relative)) {
207
+ throw new Error("execution plan path escapes its trusted root");
208
+ }
209
+ let current = resolvedRoot;
210
+ if (fs_1.default.existsSync(current) && fs_1.default.lstatSync(current).isSymbolicLink()) {
211
+ throw new Error("execution plan path contains a symlink");
212
+ }
213
+ for (const segment of relative.split(path_1.default.sep).filter(Boolean)) {
214
+ current = path_1.default.join(current, segment);
215
+ if (fs_1.default.existsSync(current) && fs_1.default.lstatSync(current).isSymbolicLink()) {
216
+ throw new Error("execution plan path contains a symlink");
217
+ }
218
+ }
219
+ };
220
+ const writeExclusive = (filePath, value) => {
221
+ fs_1.default.mkdirSync(path_1.default.dirname(filePath), { recursive: true });
222
+ let descriptor;
223
+ try {
224
+ descriptor = fs_1.default.openSync(filePath, "wx", 0o600);
225
+ }
226
+ catch (error) {
227
+ throw error;
228
+ }
229
+ try {
230
+ fs_1.default.writeFileSync(descriptor, JSON.stringify(value, null, 2) + "\n");
231
+ fs_1.default.fsyncSync(descriptor);
232
+ }
233
+ catch (error) {
234
+ fs_1.default.closeSync(descriptor);
235
+ fs_1.default.unlinkSync(filePath);
236
+ throw error;
237
+ }
238
+ fs_1.default.closeSync(descriptor);
239
+ };
240
+ class ReleaseExecutionPlanner {
241
+ body;
242
+ expected;
243
+ transactions = [];
244
+ segmentedExecution;
245
+ completedTransactions;
246
+ segmentEnd;
247
+ constructor(input) {
248
+ const body = normalizeBody({
249
+ version: 1,
250
+ taskId: input.taskId,
251
+ target: input.target,
252
+ executionId: input.executionId,
253
+ releaseKind: input.releaseKind,
254
+ operator: input.operator,
255
+ transactions: [],
256
+ }, false);
257
+ this.body = {
258
+ version: 1,
259
+ taskId: body.taskId,
260
+ target: body.target,
261
+ executionId: body.executionId,
262
+ releaseKind: body.releaseKind,
263
+ operator: body.operator,
264
+ };
265
+ if (input.expectedPlan) {
266
+ const expected = normalizeBody(input.expectedPlan, false);
267
+ for (const key of ["taskId", "target", "executionId", "releaseKind", "operator"]) {
268
+ if (expected[key] !== this.body[key]) {
269
+ throw new Error(`locked execution plan ${key} does not match the runtime`);
270
+ }
271
+ }
272
+ this.expected = expected;
273
+ }
274
+ this.segmentedExecution = input.segmentedExecution === true;
275
+ this.completedTransactions = input.completedTransactions ?? [];
276
+ if (this.segmentedExecution && !this.expected) {
277
+ throw new Error("segmented execution requires a locked execution plan");
278
+ }
279
+ if (!this.segmentedExecution && this.completedTransactions.length > 0) {
280
+ throw new Error("completed transactions require segmented execution");
281
+ }
282
+ if (this.expected) {
283
+ if (this.completedTransactions.length > this.expected.transactions.length) {
284
+ throw new Error("completed transactions exceed the execution plan");
285
+ }
286
+ for (const [index, completed] of this.completedTransactions.entries()) {
287
+ if (completed.transactionId !== this.expected.transactions[index]?.transactionId
288
+ || typeof completed.transactionHash !== "string"
289
+ || !/^0x[0-9a-fA-F]{64}$/.test(completed.transactionHash)) {
290
+ throw new Error("completed transactions must form a contiguous plan prefix");
291
+ }
292
+ }
293
+ }
294
+ const expectedTransactions = this.expected?.transactions ?? [];
295
+ let segmentEnd = this.completedTransactions.length;
296
+ if (this.segmentedExecution && segmentEnd < expectedTransactions.length) {
297
+ if (expectedTransactions[segmentEnd].route === "operator") {
298
+ while (segmentEnd < expectedTransactions.length
299
+ && expectedTransactions[segmentEnd].route === "operator")
300
+ segmentEnd += 1;
301
+ }
302
+ while (segmentEnd < expectedTransactions.length
303
+ && expectedTransactions[segmentEnd].route === "external")
304
+ segmentEnd += 1;
305
+ }
306
+ else if (!this.segmentedExecution) {
307
+ segmentEnd = Number.MAX_SAFE_INTEGER;
308
+ }
309
+ this.segmentEnd = segmentEnd;
310
+ }
311
+ add(input) {
312
+ const index = this.transactions.length;
313
+ const stepId = safeId(input.stepId, "planned transaction stepId");
314
+ const executor = address(input.executor, "planned transaction executor");
315
+ const transaction = normalizeTransaction({
316
+ transactionId: `tx-${String(index + 1).padStart(4, "0")}-${stepId}`,
317
+ stepId,
318
+ transactionIndex: index,
319
+ route: executor === this.body.operator ? "operator" : "external",
320
+ executor,
321
+ to: input.to,
322
+ value: input.value,
323
+ data: input.data,
324
+ operation: input.operation,
325
+ ...(input.scheme === undefined ? {} : { scheme: input.scheme }),
326
+ ...(input.factoryDeps === undefined ? {} : { factoryDeps: input.factoryDeps }),
327
+ }, index, false);
328
+ if (this.body.releaseKind === "development" && transaction.route === "external") {
329
+ throw new Error("development execution plans cannot contain external transactions");
330
+ }
331
+ const expected = this.expected?.transactions[index];
332
+ if (this.expected && (!expected || JSON.stringify(expected) !== JSON.stringify(transaction))) {
333
+ throw new Error(`transaction ${transaction.transactionId} does not match locked execution plan`);
334
+ }
335
+ if (this.segmentedExecution && index >= this.segmentEnd) {
336
+ throw new ExecutionSegmentDeferred(transaction.transactionId);
337
+ }
338
+ this.transactions.push(transaction);
339
+ const completed = this.completedTransactions[index];
340
+ if (completed) {
341
+ return {
342
+ ...transaction,
343
+ executionAction: "replay",
344
+ transactionHash: completed.transactionHash.toLowerCase(),
345
+ };
346
+ }
347
+ return {
348
+ ...transaction,
349
+ executionAction: transaction.route === "external" ? "package" : "execute",
350
+ };
351
+ }
352
+ complete(options = {}) {
353
+ if (this.expected
354
+ && this.transactions.length !== this.expected.transactions.length
355
+ && options.allowPartial !== true) {
356
+ throw new Error("execution did not consume every locked transaction");
357
+ }
358
+ if (options.allowPartial === true && !this.segmentedExecution) {
359
+ throw new Error("partial execution plan completion requires segmented execution");
360
+ }
361
+ return normalizeBody({
362
+ ...this.body,
363
+ transactions: this.transactions,
364
+ }, false);
365
+ }
366
+ }
367
+ exports.ReleaseExecutionPlanner = ReleaseExecutionPlanner;
368
+ const writeReleaseExecutionPlan = (input) => {
369
+ const body = normalizeBody(input.plan, false);
370
+ const filePath = confinedPath(input.root, input.taskDir, body.target, body.executionId);
371
+ assertNoSymlinks(input.root, filePath);
372
+ const plan = {
373
+ ...body,
374
+ planHash: hashBody(body),
375
+ createdAt: new Date().toISOString(),
376
+ };
377
+ if (fs_1.default.existsSync(filePath)) {
378
+ const existing = (0, exports.loadReleaseExecutionPlan)({
379
+ root: input.root,
380
+ taskDir: input.taskDir,
381
+ target: body.target,
382
+ executionId: body.executionId,
383
+ });
384
+ if (existing.planHash === plan.planHash)
385
+ return existing;
386
+ throw new Error("execution plan already exists with different content");
387
+ }
388
+ writeExclusive(filePath, plan);
389
+ return plan;
390
+ };
391
+ exports.writeReleaseExecutionPlan = writeReleaseExecutionPlan;
392
+ const loadReleaseExecutionPlan = (input) => {
393
+ const target = safeId(input.target, "execution plan target");
394
+ const executionId = safeId(input.executionId, "execution plan executionId");
395
+ const filePath = confinedPath(input.root, input.taskDir, target, executionId);
396
+ assertNoSymlinks(input.root, filePath);
397
+ let parsed;
398
+ try {
399
+ parsed = JSON.parse(fs_1.default.readFileSync(filePath, "utf8"));
400
+ }
401
+ catch (error) {
402
+ throw new Error(`Cannot load execution plan: ${error instanceof Error ? error.message : String(error)}`);
403
+ }
404
+ const inputPlan = record(parsed, "execution plan");
405
+ exactKeys(inputPlan, [
406
+ "version",
407
+ "taskId",
408
+ "target",
409
+ "executionId",
410
+ "releaseKind",
411
+ "operator",
412
+ "transactions",
413
+ "planHash",
414
+ "createdAt",
415
+ ], "execution plan");
416
+ const body = normalizeBody({
417
+ version: inputPlan.version,
418
+ taskId: inputPlan.taskId,
419
+ target: inputPlan.target,
420
+ executionId: inputPlan.executionId,
421
+ releaseKind: inputPlan.releaseKind,
422
+ operator: inputPlan.operator,
423
+ transactions: inputPlan.transactions,
424
+ }, true);
425
+ if (body.target !== target || body.executionId !== executionId) {
426
+ throw new Error("execution plan path identity does not match its contents");
427
+ }
428
+ if (typeof inputPlan.createdAt !== "string" || !Number.isFinite(Date.parse(inputPlan.createdAt))) {
429
+ throw new Error("execution plan createdAt must be an ISO timestamp");
430
+ }
431
+ const calculatedHash = hashBody(body);
432
+ if (typeof inputPlan.planHash !== "string" || !HASH.test(inputPlan.planHash)) {
433
+ throw new Error("execution plan planHash is invalid");
434
+ }
435
+ if (inputPlan.planHash !== calculatedHash) {
436
+ throw new Error("execution plan hash does not match its contents");
437
+ }
438
+ if (input.expectedHash !== undefined && input.expectedHash !== calculatedHash) {
439
+ throw new Error("execution plan hash does not match the parameter lock");
440
+ }
441
+ return {
442
+ ...body,
443
+ planHash: calculatedHash,
444
+ createdAt: inputPlan.createdAt,
445
+ };
446
+ };
447
+ exports.loadReleaseExecutionPlan = loadReleaseExecutionPlan;
448
+ const releaseExecutionPlanRelativePath = (taskDir, plan) => path_1.default.relative(taskDir, path_1.default.join(taskDir, "results", plan.target, plan.executionId, "execution-plan.json")).split(path_1.default.sep).join("/");
449
+ exports.releaseExecutionPlanRelativePath = releaseExecutionPlanRelativePath;
450
+ //# sourceMappingURL=executionPlan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executionPlan.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/executionPlan.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AAsDxB,MAAa,wBAAyB,SAAQ,KAAK;IAC5B;IAArB,Y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Y,KAAK,cAAc,EAAE,CAAC;QAC9E,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO;QACL,GAAG,IAAI;QACP,QAAQ,EAAE,cAAc;QACxB,SAAS,EAAE,SAAS,CAAC,SAAS;KAC/B,CAAC;AACJ,CAAC,CAAC;AA7DW,QAAA,wBAAwB,4BA6DnC;AAEK,MAAM,gCAAgC,GAAG,CAC9C,OAAe,EACf,IAA0D,EAClD,EAAE,CAAC,cAAI,CAAC,QAAQ,CACxB,OAAO,EACP,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,qBAAqB,CAAC,CACpF,CAAC,KAAK,CAAC,cAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AANf,QAAA,gCAAgC,oCAMjB"}
@@ -0,0 +1,5 @@
1
+ import type { CompletedExecutionTransaction, ReleaseExecutionPlan } from "./executionPlan";
2
+ export declare const loadCompletedExecutionPrefix: (input: {
3
+ taskDir: string;
4
+ plan: ReleaseExecutionPlan;
5
+ }) => CompletedExecutionTransaction[];
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.loadCompletedExecutionPrefix = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const operatorExecution_1 = require("./operatorExecution");
10
+ const TRANSACTION_HASH = /^0x[0-9a-fA-F]{64}$/;
11
+ const reconciliationPath = (taskDir, plan) => path_1.default.join(taskDir, "results", plan.target, plan.executionId, "external-reconciliation.json");
12
+ const readReconciliationMatches = (taskDir, plan) => {
13
+ const filePath = reconciliationPath(taskDir, plan);
14
+ if (!fs_1.default.existsSync(filePath))
15
+ return [];
16
+ let parsed;
17
+ try {
18
+ parsed = JSON.parse(fs_1.default.readFileSync(filePath, "utf8"));
19
+ }
20
+ catch (error) {
21
+ throw new Error(`external reconciliation report is invalid: ${error instanceof Error ? error.message : String(error)}`);
22
+ }
23
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
24
+ throw new Error("external reconciliation report must be an object");
25
+ }
26
+ const report = parsed;
27
+ if (report.version !== 1
28
+ || report.taskId !== plan.taskId
29
+ || report.target !== plan.target
30
+ || report.executionId !== plan.executionId
31
+ || report.executionPlanHash !== plan.planHash
32
+ || !Array.isArray(report.matches)) {
33
+ throw new Error("external reconciliation report does not match the execution plan");
34
+ }
35
+ if (report.status === "failed") {
36
+ throw new Error("failed external reconciliation cannot be resumed");
37
+ }
38
+ return report.matches;
39
+ };
40
+ const loadCompletedExecutionPrefix = (input) => {
41
+ const operatorPath = path_1.default.join(input.taskDir, "results", input.plan.target, input.plan.executionId, "operator-execution.json");
42
+ const operatorResult = fs_1.default.existsSync(operatorPath)
43
+ ? (0, operatorExecution_1.loadOperatorExecutionResult)({ taskDir: input.taskDir, plan: input.plan })
44
+ : undefined;
45
+ const evidence = new Map();
46
+ for (const receipt of operatorResult?.receipts ?? []) {
47
+ evidence.set(receipt.transactionId, receipt);
48
+ }
49
+ const seenMatches = new Set();
50
+ for (const match of readReconciliationMatches(input.taskDir, input.plan)) {
51
+ const transactionIndex = match.transactionIndex;
52
+ const expected = Number.isSafeInteger(transactionIndex)
53
+ ? input.plan.transactions[transactionIndex]
54
+ : undefined;
55
+ if (!expected
56
+ || match.transactionId !== expected.transactionId
57
+ || match.route !== expected.route
58
+ || String(match.executor).toLowerCase() !== expected.executor
59
+ || typeof match.transactionHash !== "string"
60
+ || !TRANSACTION_HASH.test(match.transactionHash)
61
+ || (match.receiptStatus !== 0 && match.receiptStatus !== 1)
62
+ || typeof match.finalized !== "boolean"
63
+ || seenMatches.has(expected.transactionId)) {
64
+ throw new Error("external reconciliation matches do not bind the execution plan");
65
+ }
66
+ seenMatches.add(expected.transactionId);
67
+ if (match.receiptStatus === 0) {
68
+ throw new Error(`reverted transaction ${expected.transactionId} cannot be resumed`);
69
+ }
70
+ if (expected.route === "operator") {
71
+ const receipt = evidence.get(expected.transactionId);
72
+ if (receipt && receipt.transactionHash !== match.transactionHash.toLowerCase()) {
73
+ throw new Error(`operator reconciliation hash differs for ${expected.transactionId}`);
74
+ }
75
+ continue;
76
+ }
77
+ if (match.finalized) {
78
+ evidence.set(expected.transactionId, {
79
+ transactionId: expected.transactionId,
80
+ transactionHash: match.transactionHash.toLowerCase(),
81
+ });
82
+ }
83
+ }
84
+ const completed = [];
85
+ let prefixEnded = false;
86
+ for (const transaction of input.plan.transactions) {
87
+ const item = evidence.get(transaction.transactionId);
88
+ if (!item) {
89
+ prefixEnded = true;
90
+ continue;
91
+ }
92
+ if (prefixEnded) {
93
+ throw new Error("execution evidence must form a contiguous plan prefix");
94
+ }
95
+ completed.push(item);
96
+ }
97
+ return completed;
98
+ };
99
+ exports.loadCompletedExecutionPrefix = loadCompletedExecutionPrefix;
100
+ //# sourceMappingURL=executionProgress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executionProgress.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/executionProgress.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAKxB,2DAAkE;AAElE,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAE/C,MAAM,kBAAkB,GAAG,CACzB,OAAe,EACf,IAA0B,EAClB,EAAE,CAAC,cAAI,CAAC,IAAI,CACpB,OAAO,EACP,SAAS,EACT,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,WAAW,EAChB,8BAA8B,CAC/B,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAChC,OAAe,EACf,IAA0B,EACM,EAAE;IAClC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACnD,IAAI,CAAC,YAAE,CAAC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QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,WAAW,GAAG,IAAI,CAAC;YACnB,SAAS;QACX,CAAC;QACD,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QAC3E,CAAC;QACD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAvEW,QAAA,4BAA4B,gCAuEvC"}
@@ -0,0 +1,62 @@
1
+ import type { ReleaseExecutionPlan } from "./executionPlan";
2
+ export interface ExternalCall {
3
+ transactionId: string;
4
+ stepId: string;
5
+ to: string;
6
+ value: string;
7
+ data: string;
8
+ operation: 0 | 1;
9
+ scheme?: "zksync-eravm";
10
+ factoryDeps?: string[];
11
+ method: string;
12
+ args: unknown[];
13
+ executor: string;
14
+ reason: string;
15
+ }
16
+ export interface ExternalExecutionGroup {
17
+ groupId: string;
18
+ executor: string;
19
+ transactionIds: string[];
20
+ calls: ExternalCall[];
21
+ }
22
+ export interface ExternalExecutionSegment {
23
+ segmentId: string;
24
+ transactionStartIndex: number;
25
+ transactionIds: string[];
26
+ handoffBlock: number;
27
+ groups: ExternalExecutionGroup[];
28
+ createdAt: string;
29
+ }
30
+ export interface ExternalExecutionPackage {
31
+ version: 1;
32
+ taskId: string;
33
+ target: string;
34
+ executionId: string;
35
+ operator: string;
36
+ executionPlanHash: string;
37
+ segments: ExternalExecutionSegment[];
38
+ createdAt: string;
39
+ updatedAt: string;
40
+ }
41
+ export declare class ExternalExecutionRequired extends Error {
42
+ readonly stepId: string;
43
+ readonly calls: ExternalCall[];
44
+ constructor(stepId: string, calls: ExternalCall[]);
45
+ }
46
+ export declare const loadExternalExecutionPackage: (input: {
47
+ taskDir: string;
48
+ plan: ReleaseExecutionPlan;
49
+ }) => {
50
+ filePath: string;
51
+ package: ExternalExecutionPackage;
52
+ } | undefined;
53
+ export declare const writeExternalExecutionPackage: (input: {
54
+ taskDir: string;
55
+ plan: ReleaseExecutionPlan;
56
+ handoffBlock: number;
57
+ calls: ExternalCall[];
58
+ now?: () => string;
59
+ }) => {
60
+ filePath: string;
61
+ package: ExternalExecutionPackage;
62
+ };