gate-evm-tools 1.0.25 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/README.md +33 -11
  2. package/bin/workflow.cjs +19 -0
  3. package/dist/commands/check.d.ts.map +1 -1
  4. package/dist/commands/check.js +21 -57
  5. package/dist/commands/check.js.map +1 -1
  6. package/dist/commands/checkBatch.d.ts +4 -0
  7. package/dist/commands/checkBatch.d.ts.map +1 -0
  8. package/dist/commands/checkBatch.js +57 -0
  9. package/dist/commands/checkBatch.js.map +1 -0
  10. package/dist/commands/checkOptions.d.ts +3 -0
  11. package/dist/commands/checkOptions.d.ts.map +1 -1
  12. package/dist/commands/checkOptions.js +10 -1
  13. package/dist/commands/checkOptions.js.map +1 -1
  14. package/dist/commands/prepare.d.ts +1 -2
  15. package/dist/commands/prepare.d.ts.map +1 -1
  16. package/dist/commands/prepare.js +2 -17
  17. package/dist/commands/prepare.js.map +1 -1
  18. package/dist/commands/sync.d.ts.map +1 -1
  19. package/dist/commands/sync.js +2 -17
  20. package/dist/commands/sync.js.map +1 -1
  21. package/dist/commands/validate.d.ts.map +1 -1
  22. package/dist/commands/validate.js +2 -17
  23. package/dist/commands/validate.js.map +1 -1
  24. package/dist/core/BytecodeChecker.d.ts.map +1 -1
  25. package/dist/core/BytecodeChecker.js +16 -1
  26. package/dist/core/BytecodeChecker.js.map +1 -1
  27. package/dist/core/legacyProxyArtifact.d.ts +6 -0
  28. package/dist/core/legacyProxyArtifact.d.ts.map +1 -0
  29. package/dist/core/legacyProxyArtifact.js +36 -0
  30. package/dist/core/legacyProxyArtifact.js.map +1 -0
  31. package/dist/index.js +3 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/types.d.ts +2 -2
  34. package/dist/types.d.ts.map +1 -1
  35. package/dist/utils/hardhat.d.ts +4 -0
  36. package/dist/utils/hardhat.d.ts.map +1 -0
  37. package/dist/utils/hardhat.js +9 -0
  38. package/dist/utils/hardhat.js.map +1 -0
  39. package/dist-runtime/config/hardhatAdapters.d.ts +5 -0
  40. package/dist-runtime/config/hardhatAdapters.js +53 -0
  41. package/dist-runtime/config/hardhatAdapters.js.map +1 -0
  42. package/dist-runtime/config/networks.d.ts +8 -0
  43. package/dist-runtime/config/networks.js +269 -0
  44. package/dist-runtime/config/networks.js.map +1 -0
  45. package/dist-runtime/config/openzeppelin.d.ts +28 -0
  46. package/dist-runtime/config/openzeppelin.js +144 -0
  47. package/dist-runtime/config/openzeppelin.js.map +1 -0
  48. package/dist-runtime/config/rpc.d.ts +7 -0
  49. package/dist-runtime/config/rpc.js +19 -0
  50. package/dist-runtime/config/rpc.js.map +1 -0
  51. package/dist-runtime/config/zksyncSolcPath.d.ts +1 -0
  52. package/dist-runtime/config/zksyncSolcPath.js +61 -0
  53. package/dist-runtime/config/zksyncSolcPath.js.map +1 -0
  54. package/dist-runtime/migrate.d.ts +13 -0
  55. package/dist-runtime/migrate.js +208 -0
  56. package/dist-runtime/migrate.js.map +1 -0
  57. package/dist-runtime/package.json +1 -0
  58. package/dist-runtime/projectHardhat.d.ts +4 -0
  59. package/dist-runtime/projectHardhat.js +16 -0
  60. package/dist-runtime/projectHardhat.js.map +1 -0
  61. package/dist-runtime/runtime-identity.json +4 -0
  62. package/dist-runtime/template-migration.json +293 -0
  63. package/dist-runtime/workflow/checkCode.d.ts +1 -0
  64. package/dist-runtime/workflow/checkCode.js +16 -0
  65. package/dist-runtime/workflow/checkCode.js.map +1 -0
  66. package/dist-runtime/workflow/checkCodeFinalize.d.ts +1 -0
  67. package/dist-runtime/workflow/checkCodeFinalize.js +11 -0
  68. package/dist-runtime/workflow/checkCodeFinalize.js.map +1 -0
  69. package/dist-runtime/workflow/checkCodePlan.d.ts +1 -0
  70. package/dist-runtime/workflow/checkCodePlan.js +11 -0
  71. package/dist-runtime/workflow/checkCodePlan.js.map +1 -0
  72. package/dist-runtime/workflow/cli.d.ts +1 -0
  73. package/dist-runtime/workflow/cli.js +302 -0
  74. package/dist-runtime/workflow/cli.js.map +1 -0
  75. package/dist-runtime/workflow/commitContractInfo.d.ts +1 -0
  76. package/dist-runtime/workflow/commitContractInfo.js +64 -0
  77. package/dist-runtime/workflow/commitContractInfo.js.map +1 -0
  78. package/dist-runtime/workflow/create2Hashes.d.ts +1 -0
  79. package/dist-runtime/workflow/create2Hashes.js +76 -0
  80. package/dist-runtime/workflow/create2Hashes.js.map +1 -0
  81. package/dist-runtime/workflow/forkSourceProxy.d.ts +1 -0
  82. package/dist-runtime/workflow/forkSourceProxy.js +151 -0
  83. package/dist-runtime/workflow/forkSourceProxy.js.map +1 -0
  84. package/dist-runtime/workflow/importState.d.ts +1 -0
  85. package/dist-runtime/workflow/importState.js +193 -0
  86. package/dist-runtime/workflow/importState.js.map +1 -0
  87. package/dist-runtime/workflow/lib/authority.d.ts +28 -0
  88. package/dist-runtime/workflow/lib/authority.js +122 -0
  89. package/dist-runtime/workflow/lib/authority.js.map +1 -0
  90. package/dist-runtime/workflow/lib/calldata.d.ts +2 -0
  91. package/dist-runtime/workflow/lib/calldata.js +8 -0
  92. package/dist-runtime/workflow/lib/calldata.js.map +1 -0
  93. package/dist-runtime/workflow/lib/calls.d.ts +23 -0
  94. package/dist-runtime/workflow/lib/calls.js +316 -0
  95. package/dist-runtime/workflow/lib/calls.js.map +1 -0
  96. package/dist-runtime/workflow/lib/checkCode/args.d.ts +2 -0
  97. package/dist-runtime/workflow/lib/checkCode/args.js +68 -0
  98. package/dist-runtime/workflow/lib/checkCode/args.js.map +1 -0
  99. package/dist-runtime/workflow/lib/checkCode/command.d.ts +5 -0
  100. package/dist-runtime/workflow/lib/checkCode/command.js +35 -0
  101. package/dist-runtime/workflow/lib/checkCode/command.js.map +1 -0
  102. package/dist-runtime/workflow/lib/checkCode/dependencies.d.ts +6 -0
  103. package/dist-runtime/workflow/lib/checkCode/dependencies.js +125 -0
  104. package/dist-runtime/workflow/lib/checkCode/dependencies.js.map +1 -0
  105. package/dist-runtime/workflow/lib/checkCode/finalize.d.ts +17 -0
  106. package/dist-runtime/workflow/lib/checkCode/finalize.js +174 -0
  107. package/dist-runtime/workflow/lib/checkCode/finalize.js.map +1 -0
  108. package/dist-runtime/workflow/lib/checkCode/index.d.ts +3 -0
  109. package/dist-runtime/workflow/lib/checkCode/index.js +20 -0
  110. package/dist-runtime/workflow/lib/checkCode/index.js.map +1 -0
  111. package/dist-runtime/workflow/lib/checkCode/plan.d.ts +22 -0
  112. package/dist-runtime/workflow/lib/checkCode/plan.js +145 -0
  113. package/dist-runtime/workflow/lib/checkCode/plan.js.map +1 -0
  114. package/dist-runtime/workflow/lib/checkCodeReport.d.ts +25 -0
  115. package/dist-runtime/workflow/lib/checkCodeReport.js +102 -0
  116. package/dist-runtime/workflow/lib/checkCodeReport.js.map +1 -0
  117. package/dist-runtime/workflow/lib/checkCodeRunner.d.ts +87 -0
  118. package/dist-runtime/workflow/lib/checkCodeRunner.js +964 -0
  119. package/dist-runtime/workflow/lib/checkCodeRunner.js.map +1 -0
  120. package/dist-runtime/workflow/lib/cliTool.d.ts +10 -0
  121. package/dist-runtime/workflow/lib/cliTool.js +25 -0
  122. package/dist-runtime/workflow/lib/cliTool.js.map +1 -0
  123. package/dist-runtime/workflow/lib/config.d.ts +33 -0
  124. package/dist-runtime/workflow/lib/config.js +100 -0
  125. package/dist-runtime/workflow/lib/config.js.map +1 -0
  126. package/dist-runtime/workflow/lib/contractInfoCandidates.d.ts +82 -0
  127. package/dist-runtime/workflow/lib/contractInfoCandidates.js +441 -0
  128. package/dist-runtime/workflow/lib/contractInfoCandidates.js.map +1 -0
  129. package/dist-runtime/workflow/lib/create2.d.ts +49 -0
  130. package/dist-runtime/workflow/lib/create2.js +194 -0
  131. package/dist-runtime/workflow/lib/create2.js.map +1 -0
  132. package/dist-runtime/workflow/lib/create2Hashes.d.ts +22 -0
  133. package/dist-runtime/workflow/lib/create2Hashes.js +57 -0
  134. package/dist-runtime/workflow/lib/create2Hashes.js.map +1 -0
  135. package/dist-runtime/workflow/lib/deploymentInfo.d.ts +40 -0
  136. package/dist-runtime/workflow/lib/deploymentInfo.js +240 -0
  137. package/dist-runtime/workflow/lib/deploymentInfo.js.map +1 -0
  138. package/dist-runtime/workflow/lib/deploymentRecords.d.ts +137 -0
  139. package/dist-runtime/workflow/lib/deploymentRecords.js +374 -0
  140. package/dist-runtime/workflow/lib/deploymentRecords.js.map +1 -0
  141. package/dist-runtime/workflow/lib/deployments.d.ts +21 -0
  142. package/dist-runtime/workflow/lib/deployments.js +240 -0
  143. package/dist-runtime/workflow/lib/deployments.js.map +1 -0
  144. package/dist-runtime/workflow/lib/erc1967.d.ts +5 -0
  145. package/dist-runtime/workflow/lib/erc1967.js +29 -0
  146. package/dist-runtime/workflow/lib/erc1967.js.map +1 -0
  147. package/dist-runtime/workflow/lib/errors.d.ts +6 -0
  148. package/dist-runtime/workflow/lib/errors.js +77 -0
  149. package/dist-runtime/workflow/lib/errors.js.map +1 -0
  150. package/dist-runtime/workflow/lib/executionId.d.ts +7 -0
  151. package/dist-runtime/workflow/lib/executionId.js +26 -0
  152. package/dist-runtime/workflow/lib/executionId.js.map +1 -0
  153. package/dist-runtime/workflow/lib/executionPlan.d.ts +85 -0
  154. package/dist-runtime/workflow/lib/executionPlan.js +450 -0
  155. package/dist-runtime/workflow/lib/executionPlan.js.map +1 -0
  156. package/dist-runtime/workflow/lib/executionProgress.d.ts +5 -0
  157. package/dist-runtime/workflow/lib/executionProgress.js +100 -0
  158. package/dist-runtime/workflow/lib/executionProgress.js.map +1 -0
  159. package/dist-runtime/workflow/lib/external.d.ts +62 -0
  160. package/dist-runtime/workflow/lib/external.js +282 -0
  161. package/dist-runtime/workflow/lib/external.js.map +1 -0
  162. package/dist-runtime/workflow/lib/externalExecutionScanner.d.ts +64 -0
  163. package/dist-runtime/workflow/lib/externalExecutionScanner.js +638 -0
  164. package/dist-runtime/workflow/lib/externalExecutionScanner.js.map +1 -0
  165. package/dist-runtime/workflow/lib/forkSnapshot.d.ts +34 -0
  166. package/dist-runtime/workflow/lib/forkSnapshot.js +167 -0
  167. package/dist-runtime/workflow/lib/forkSnapshot.js.map +1 -0
  168. package/dist-runtime/workflow/lib/gateTool.d.ts +16 -0
  169. package/dist-runtime/workflow/lib/gateTool.js +177 -0
  170. package/dist-runtime/workflow/lib/gateTool.js.map +1 -0
  171. package/dist-runtime/workflow/lib/gateToolSync.d.ts +22 -0
  172. package/dist-runtime/workflow/lib/gateToolSync.js +253 -0
  173. package/dist-runtime/workflow/lib/gateToolSync.js.map +1 -0
  174. package/dist-runtime/workflow/lib/lock.d.ts +52 -0
  175. package/dist-runtime/workflow/lib/lock.js +269 -0
  176. package/dist-runtime/workflow/lib/lock.js.map +1 -0
  177. package/dist-runtime/workflow/lib/migrationState.d.ts +103 -0
  178. package/dist-runtime/workflow/lib/migrationState.js +920 -0
  179. package/dist-runtime/workflow/lib/migrationState.js.map +1 -0
  180. package/dist-runtime/workflow/lib/operatorExecution.d.ts +28 -0
  181. package/dist-runtime/workflow/lib/operatorExecution.js +134 -0
  182. package/dist-runtime/workflow/lib/operatorExecution.js.map +1 -0
  183. package/dist-runtime/workflow/lib/parameters.d.ts +58 -0
  184. package/dist-runtime/workflow/lib/parameters.js +322 -0
  185. package/dist-runtime/workflow/lib/parameters.js.map +1 -0
  186. package/dist-runtime/workflow/lib/pendingDeploymentReuse.d.ts +29 -0
  187. package/dist-runtime/workflow/lib/pendingDeploymentReuse.js +277 -0
  188. package/dist-runtime/workflow/lib/pendingDeploymentReuse.js.map +1 -0
  189. package/dist-runtime/workflow/lib/proxy.d.ts +18 -0
  190. package/dist-runtime/workflow/lib/proxy.js +19 -0
  191. package/dist-runtime/workflow/lib/proxy.js.map +1 -0
  192. package/dist-runtime/workflow/lib/registryCommit.d.ts +33 -0
  193. package/dist-runtime/workflow/lib/registryCommit.js +319 -0
  194. package/dist-runtime/workflow/lib/registryCommit.js.map +1 -0
  195. package/dist-runtime/workflow/lib/release.d.ts +57 -0
  196. package/dist-runtime/workflow/lib/release.js +256 -0
  197. package/dist-runtime/workflow/lib/release.js.map +1 -0
  198. package/dist-runtime/workflow/lib/releaseFinalize.d.ts +14 -0
  199. package/dist-runtime/workflow/lib/releaseFinalize.js +571 -0
  200. package/dist-runtime/workflow/lib/releaseFinalize.js.map +1 -0
  201. package/dist-runtime/workflow/lib/releaseParameters.d.ts +43 -0
  202. package/dist-runtime/workflow/lib/releaseParameters.js +184 -0
  203. package/dist-runtime/workflow/lib/releaseParameters.js.map +1 -0
  204. package/dist-runtime/workflow/lib/reporter.d.ts +39 -0
  205. package/dist-runtime/workflow/lib/reporter.js +452 -0
  206. package/dist-runtime/workflow/lib/reporter.js.map +1 -0
  207. package/dist-runtime/workflow/lib/resultPaths.d.ts +17 -0
  208. package/dist-runtime/workflow/lib/resultPaths.js +29 -0
  209. package/dist-runtime/workflow/lib/resultPaths.js.map +1 -0
  210. package/dist-runtime/workflow/lib/runtimeVersion.d.ts +10 -0
  211. package/dist-runtime/workflow/lib/runtimeVersion.js +46 -0
  212. package/dist-runtime/workflow/lib/runtimeVersion.js.map +1 -0
  213. package/dist-runtime/workflow/lib/signer.d.ts +10 -0
  214. package/dist-runtime/workflow/lib/signer.js +105 -0
  215. package/dist-runtime/workflow/lib/signer.js.map +1 -0
  216. package/dist-runtime/workflow/lib/signerIdentity.d.ts +1 -0
  217. package/dist-runtime/workflow/lib/signerIdentity.js +23 -0
  218. package/dist-runtime/workflow/lib/signerIdentity.js.map +1 -0
  219. package/dist-runtime/workflow/lib/simulation.d.ts +35 -0
  220. package/dist-runtime/workflow/lib/simulation.js +282 -0
  221. package/dist-runtime/workflow/lib/simulation.js.map +1 -0
  222. package/dist-runtime/workflow/lib/simulationCallers.d.ts +44 -0
  223. package/dist-runtime/workflow/lib/simulationCallers.js +260 -0
  224. package/dist-runtime/workflow/lib/simulationCallers.js.map +1 -0
  225. package/dist-runtime/workflow/lib/sourceRpcPolicy.d.ts +1 -0
  226. package/dist-runtime/workflow/lib/sourceRpcPolicy.js +43 -0
  227. package/dist-runtime/workflow/lib/sourceRpcPolicy.js.map +1 -0
  228. package/dist-runtime/workflow/lib/state.d.ts +6 -0
  229. package/dist-runtime/workflow/lib/state.js +25 -0
  230. package/dist-runtime/workflow/lib/state.js.map +1 -0
  231. package/dist-runtime/workflow/lib/staticValidation.d.ts +22 -0
  232. package/dist-runtime/workflow/lib/staticValidation.js +124 -0
  233. package/dist-runtime/workflow/lib/staticValidation.js.map +1 -0
  234. package/dist-runtime/workflow/lib/zksyncForkCapability.d.ts +27 -0
  235. package/dist-runtime/workflow/lib/zksyncForkCapability.js +52 -0
  236. package/dist-runtime/workflow/lib/zksyncForkCapability.js.map +1 -0
  237. package/dist-runtime/workflow/lib/zksyncForkRunner.d.ts +57 -0
  238. package/dist-runtime/workflow/lib/zksyncForkRunner.js +344 -0
  239. package/dist-runtime/workflow/lib/zksyncForkRunner.js.map +1 -0
  240. package/dist-runtime/workflow/reconcileExternal.d.ts +1 -0
  241. package/dist-runtime/workflow/reconcileExternal.js +87 -0
  242. package/dist-runtime/workflow/reconcileExternal.js.map +1 -0
  243. package/dist-runtime/workflow/reconcileExternalRun.d.ts +1 -0
  244. package/dist-runtime/workflow/reconcileExternalRun.js +77 -0
  245. package/dist-runtime/workflow/reconcileExternalRun.js.map +1 -0
  246. package/dist-runtime/workflow/releaseFinalize.d.ts +1 -0
  247. package/dist-runtime/workflow/releaseFinalize.js +11 -0
  248. package/dist-runtime/workflow/releaseFinalize.js.map +1 -0
  249. package/dist-runtime/workflow/run.d.ts +40 -0
  250. package/dist-runtime/workflow/run.js +858 -0
  251. package/dist-runtime/workflow/run.js.map +1 -0
  252. package/dist-runtime/workflow/staticValidate.d.ts +1 -0
  253. package/dist-runtime/workflow/staticValidate.js +26 -0
  254. package/dist-runtime/workflow/staticValidate.js.map +1 -0
  255. package/dist-runtime/workflow/steps/call.d.ts +3 -0
  256. package/dist-runtime/workflow/steps/call.js +9 -0
  257. package/dist-runtime/workflow/steps/call.js.map +1 -0
  258. package/dist-runtime/workflow/steps/check.d.ts +3 -0
  259. package/dist-runtime/workflow/steps/check.js +9 -0
  260. package/dist-runtime/workflow/steps/check.js.map +1 -0
  261. package/dist-runtime/workflow/steps/custom.d.ts +3 -0
  262. package/dist-runtime/workflow/steps/custom.js +33 -0
  263. package/dist-runtime/workflow/steps/custom.js.map +1 -0
  264. package/dist-runtime/workflow/steps/deploy.d.ts +3 -0
  265. package/dist-runtime/workflow/steps/deploy.js +595 -0
  266. package/dist-runtime/workflow/steps/deploy.js.map +1 -0
  267. package/dist-runtime/workflow/steps/upgrade.d.ts +3 -0
  268. package/dist-runtime/workflow/steps/upgrade.js +465 -0
  269. package/dist-runtime/workflow/steps/upgrade.js.map +1 -0
  270. package/dist-runtime/workflow/steps/view.d.ts +3 -0
  271. package/dist-runtime/workflow/steps/view.js +9 -0
  272. package/dist-runtime/workflow/steps/view.js.map +1 -0
  273. package/package.json +26 -5
  274. package/runtime/config/hardhatAdapters.ts +50 -0
  275. package/runtime/config/networks.ts +296 -0
  276. package/runtime/config/openzeppelin.ts +173 -0
  277. package/runtime/config/rpc.ts +27 -0
  278. package/runtime/config/zksyncSolcPath.ts +59 -0
  279. package/runtime/hardhat-types.d.ts +2 -0
  280. package/runtime/migrate.ts +154 -0
  281. package/runtime/projectHardhat.ts +10 -0
  282. package/runtime/template-migration.json +293 -0
  283. package/runtime/workflow/checkCode.ts +13 -0
  284. package/runtime/workflow/checkCodeFinalize.ts +8 -0
  285. package/runtime/workflow/checkCodePlan.ts +8 -0
  286. package/runtime/workflow/cli.ts +356 -0
  287. package/runtime/workflow/commitContractInfo.ts +63 -0
  288. package/runtime/workflow/create2Hashes.ts +79 -0
  289. package/runtime/workflow/forkSourceProxy.ts +193 -0
  290. package/runtime/workflow/importState.ts +190 -0
  291. package/runtime/workflow/lib/authority.ts +170 -0
  292. package/runtime/workflow/lib/calldata.ts +9 -0
  293. package/runtime/workflow/lib/calls.ts +407 -0
  294. package/runtime/workflow/lib/checkCode/args.ts +76 -0
  295. package/runtime/workflow/lib/checkCode/command.ts +36 -0
  296. package/runtime/workflow/lib/checkCode/dependencies.ts +112 -0
  297. package/runtime/workflow/lib/checkCode/finalize.ts +198 -0
  298. package/runtime/workflow/lib/checkCode/index.ts +18 -0
  299. package/runtime/workflow/lib/checkCode/plan.ts +163 -0
  300. package/runtime/workflow/lib/checkCodeReport.ts +133 -0
  301. package/runtime/workflow/lib/checkCodeRunner.ts +1225 -0
  302. package/runtime/workflow/lib/cliTool.ts +31 -0
  303. package/runtime/workflow/lib/config.ts +130 -0
  304. package/runtime/workflow/lib/contractInfoCandidates.ts +690 -0
  305. package/runtime/workflow/lib/create2.ts +278 -0
  306. package/runtime/workflow/lib/create2Hashes.ts +83 -0
  307. package/runtime/workflow/lib/deploymentInfo.ts +286 -0
  308. package/runtime/workflow/lib/deploymentRecords.ts +576 -0
  309. package/runtime/workflow/lib/deployments.ts +276 -0
  310. package/runtime/workflow/lib/erc1967.ts +57 -0
  311. package/runtime/workflow/lib/errors.ts +95 -0
  312. package/runtime/workflow/lib/executionId.ts +35 -0
  313. package/runtime/workflow/lib/executionPlan.ts +550 -0
  314. package/runtime/workflow/lib/executionProgress.ts +127 -0
  315. package/runtime/workflow/lib/external.ts +372 -0
  316. package/runtime/workflow/lib/externalExecutionScanner.ts +892 -0
  317. package/runtime/workflow/lib/forkSnapshot.ts +231 -0
  318. package/runtime/workflow/lib/gateTool.ts +261 -0
  319. package/runtime/workflow/lib/gateToolSync.ts +398 -0
  320. package/runtime/workflow/lib/lock.ts +388 -0
  321. package/runtime/workflow/lib/migrationState.ts +1246 -0
  322. package/runtime/workflow/lib/operatorExecution.ts +174 -0
  323. package/runtime/workflow/lib/parameters.ts +437 -0
  324. package/runtime/workflow/lib/pendingDeploymentReuse.ts +428 -0
  325. package/runtime/workflow/lib/proxy.ts +45 -0
  326. package/runtime/workflow/lib/registryCommit.ts +455 -0
  327. package/runtime/workflow/lib/release.ts +329 -0
  328. package/runtime/workflow/lib/releaseFinalize.ts +711 -0
  329. package/runtime/workflow/lib/releaseParameters.ts +248 -0
  330. package/runtime/workflow/lib/reporter.ts +502 -0
  331. package/runtime/workflow/lib/resultPaths.ts +49 -0
  332. package/runtime/workflow/lib/runtimeVersion.ts +28 -0
  333. package/runtime/workflow/lib/signer.ts +124 -0
  334. package/runtime/workflow/lib/signerIdentity.ts +22 -0
  335. package/runtime/workflow/lib/simulation.ts +415 -0
  336. package/runtime/workflow/lib/simulationCallers.ts +335 -0
  337. package/runtime/workflow/lib/sourceRpcPolicy.ts +41 -0
  338. package/runtime/workflow/lib/state.ts +25 -0
  339. package/runtime/workflow/lib/staticValidation.ts +142 -0
  340. package/runtime/workflow/lib/zksyncForkCapability.ts +80 -0
  341. package/runtime/workflow/lib/zksyncForkRunner.ts +505 -0
  342. package/runtime/workflow/reconcileExternal.ts +86 -0
  343. package/runtime/workflow/reconcileExternalRun.ts +88 -0
  344. package/runtime/workflow/releaseFinalize.ts +8 -0
  345. package/runtime/workflow/run.ts +1072 -0
  346. package/runtime/workflow/staticValidate.ts +23 -0
  347. package/runtime/workflow/steps/call.ts +10 -0
  348. package/runtime/workflow/steps/check.ts +10 -0
  349. package/runtime/workflow/steps/custom.ts +43 -0
  350. package/runtime/workflow/steps/deploy.ts +771 -0
  351. package/runtime/workflow/steps/upgrade.ts +598 -0
  352. package/runtime/workflow/steps/view.ts +10 -0
@@ -0,0 +1,452 @@
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.WorkflowReporter = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const config_1 = require("./config");
10
+ const resultPaths_1 = require("./resultPaths");
11
+ const RUNTIME_STATUS_FIELDS = [
12
+ "blockedReasons",
13
+ "errorType",
14
+ "retryable",
15
+ "message",
16
+ "stepId",
17
+ "simulationResult",
18
+ "planResult",
19
+ ];
20
+ const STATUS_LOCK_STALE_MS = 30_000;
21
+ const STATUS_LOCK_WAIT_MS = 35_000;
22
+ const STATUS_LOCK_POLL_MS = 10;
23
+ const STATUS_LOCK_SLEEP = new Int32Array(new SharedArrayBuffer(4));
24
+ const isNonZeroEvmAddress = (value) => {
25
+ return typeof value === "string"
26
+ && /^0x[0-9a-fA-F]{40}$/.test(value)
27
+ && value.toLowerCase() !== "0x0000000000000000000000000000000000000000";
28
+ };
29
+ class WorkflowReporter {
30
+ taskDir;
31
+ taskId;
32
+ executionId;
33
+ targetId;
34
+ mode;
35
+ initializedResults = new Set();
36
+ simulationCallerAddress;
37
+ constructor(taskDir, taskId, executionId, targetId, mode = "execute") {
38
+ this.taskDir = taskDir;
39
+ this.taskId = taskId;
40
+ this.executionId = executionId;
41
+ this.targetId = targetId;
42
+ this.mode = mode;
43
+ }
44
+ initializeResults(names = resultPaths_1.WORKFLOW_RESULT_NAMES) {
45
+ const directory = this.resultDirectoryPath();
46
+ fs_1.default.mkdirSync(path_1.default.dirname(directory), { recursive: true });
47
+ try {
48
+ fs_1.default.mkdirSync(directory);
49
+ }
50
+ catch (error) {
51
+ if (error.code !== "EEXIST")
52
+ throw error;
53
+ this.retryFailedVerification(directory, names);
54
+ return;
55
+ }
56
+ this.writeInitialResults(names);
57
+ }
58
+ writeInitialResults(names) {
59
+ for (const name of names) {
60
+ (0, config_1.writeJsonFile)(this.resultPath(name), this.resultEnvelope([]));
61
+ this.initializedResults.add(name);
62
+ }
63
+ }
64
+ retryFailedVerification(directory, names) {
65
+ const claimedError = () => new Error(`Workflow result namespace already claimed for target "${this.targetId}", executionId "${this.executionId}", mode "${this.mode}"; use a new executionId`);
66
+ if (this.mode === "execute" && this.resumeSegmentedAdminExecution(names))
67
+ return;
68
+ if (this.mode !== "verify")
69
+ throw claimedError();
70
+ const parent = path_1.default.dirname(directory);
71
+ const lockPath = path_1.default.join(parent, ".verify-retry.lock");
72
+ let lock;
73
+ try {
74
+ lock = fs_1.default.openSync(lockPath, "wx");
75
+ }
76
+ catch {
77
+ throw claimedError();
78
+ }
79
+ let archivePath;
80
+ try {
81
+ const status = this.readStatusFile(path_1.default.join(this.taskDir, "status.json"));
82
+ const networkStatus = status.networks?.[this.targetId];
83
+ if (networkStatus?.lastExecutionId !== this.executionId
84
+ || networkStatus.lastExecutionMode !== "verify"
85
+ || networkStatus.verifyStatus !== "failed") {
86
+ throw claimedError();
87
+ }
88
+ const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
89
+ const archiveBase = path_1.default.join(parent, `verify.failed.${timestamp}`);
90
+ archivePath = archiveBase;
91
+ for (let suffix = 1; fs_1.default.existsSync(archivePath); suffix += 1) {
92
+ archivePath = `${archiveBase}.${suffix}`;
93
+ }
94
+ fs_1.default.renameSync(directory, archivePath);
95
+ fs_1.default.mkdirSync(directory);
96
+ this.writeInitialResults(names);
97
+ this.status("running", { mode: this.mode });
98
+ }
99
+ catch (error) {
100
+ if (archivePath && fs_1.default.existsSync(archivePath)) {
101
+ fs_1.default.rmSync(directory, { recursive: true, force: true });
102
+ fs_1.default.renameSync(archivePath, directory);
103
+ }
104
+ throw error;
105
+ }
106
+ finally {
107
+ fs_1.default.closeSync(lock);
108
+ fs_1.default.unlinkSync(lockPath);
109
+ }
110
+ }
111
+ resumeSegmentedAdminExecution(names) {
112
+ const executionRoot = path_1.default.join(this.taskDir, "results", this.targetId, this.executionId);
113
+ const planPath = path_1.default.join(executionRoot, "execution-plan.json");
114
+ const reconciliationPath = path_1.default.join(executionRoot, "external-reconciliation.json");
115
+ if (!fs_1.default.existsSync(planPath) || !fs_1.default.existsSync(reconciliationPath))
116
+ return false;
117
+ let plan;
118
+ let reconciliation;
119
+ try {
120
+ plan = (0, config_1.readJsonFile)(planPath);
121
+ reconciliation = (0, config_1.readJsonFile)(reconciliationPath);
122
+ }
123
+ catch {
124
+ return false;
125
+ }
126
+ const status = this.readStatusFile(path_1.default.join(this.taskDir, "status.json"));
127
+ const networkStatus = status.networks?.[this.targetId];
128
+ if (plan.version !== 1
129
+ || plan.taskId !== this.taskId
130
+ || plan.target !== this.targetId
131
+ || plan.executionId !== this.executionId
132
+ || plan.releaseKind !== "admin_release"
133
+ || typeof plan.planHash !== "string"
134
+ || reconciliation.version !== 1
135
+ || reconciliation.status !== "waiting_operator"
136
+ || reconciliation.taskId !== this.taskId
137
+ || reconciliation.target !== this.targetId
138
+ || reconciliation.executionId !== this.executionId
139
+ || reconciliation.executionPlanHash !== plan.planHash
140
+ || networkStatus?.lastExecutionId !== this.executionId
141
+ || networkStatus.lastExecutionMode !== "execute") {
142
+ return false;
143
+ }
144
+ for (const name of names) {
145
+ if (!fs_1.default.existsSync(this.resultPath(name)))
146
+ return false;
147
+ const result = (0, config_1.readJsonFile)(this.resultPath(name));
148
+ if (result.taskId !== this.taskId
149
+ || result.executionId !== this.executionId
150
+ || result.target !== this.targetId
151
+ || result.mode !== "execute"
152
+ || !Array.isArray(result.steps)) {
153
+ return false;
154
+ }
155
+ this.initializedResults.add(name);
156
+ }
157
+ return true;
158
+ }
159
+ event(type, payload = {}) {
160
+ const filePath = path_1.default.join(this.taskDir, "events.jsonl");
161
+ fs_1.default.appendFileSync(filePath, `${JSON.stringify({
162
+ taskId: this.taskId,
163
+ executionId: this.executionId,
164
+ target: this.targetId,
165
+ mode: this.mode,
166
+ type,
167
+ timestamp: new Date().toISOString(),
168
+ ...payload,
169
+ })}\n`);
170
+ }
171
+ status(status, payload = {}) {
172
+ const filePath = path_1.default.join(this.taskDir, "status.json");
173
+ this.withStatusFileLock(filePath, () => {
174
+ const existing = this.readStatusFile(filePath);
175
+ const baseStatus = this.clearRuntimeStatusFields(existing);
176
+ const targetNetworks = this.targetNetworks(existing);
177
+ const networks = {
178
+ ...(existing.networks || {}),
179
+ [this.targetId]: this.updateNetworkStatus(existing.networks?.[this.targetId] || {}, status),
180
+ };
181
+ (0, config_1.writeJsonFile)(filePath, {
182
+ ...baseStatus,
183
+ targetNetworks,
184
+ networks,
185
+ status: this.globalStatus(status, targetNetworks, networks),
186
+ target: this.targetId,
187
+ executionId: this.executionId,
188
+ mode: this.mode,
189
+ updatedAt: new Date().toISOString(),
190
+ ...payload,
191
+ });
192
+ });
193
+ }
194
+ result(name, payload) {
195
+ if (!this.initializedResults.has(name)) {
196
+ throw new Error(`Workflow result ${name} was not initialized for this execution`);
197
+ }
198
+ const filePath = this.resultPath(name);
199
+ const existing = (0, config_1.readJsonFile)(filePath);
200
+ if (!Array.isArray(existing.steps)) {
201
+ throw new Error(`Workflow result ${name} has an invalid steps array`);
202
+ }
203
+ (0, config_1.writeJsonFile)(filePath, this.resultEnvelope([
204
+ ...existing.steps,
205
+ {
206
+ timestamp: new Date().toISOString(),
207
+ ...payload,
208
+ ...(this.simulationCallerAddress
209
+ ? { simulationCallerAddress: this.simulationCallerAddress }
210
+ : {}),
211
+ },
212
+ ]));
213
+ this.initializedResults.add(name);
214
+ }
215
+ setSimulationCallerAddress(callerAddress) {
216
+ if (this.mode !== "simulate" || !isNonZeroEvmAddress(callerAddress)) {
217
+ throw new Error("Simulation caller scope requires a valid simulate-mode address");
218
+ }
219
+ this.simulationCallerAddress = callerAddress;
220
+ }
221
+ clearSimulationCallerAddress() {
222
+ this.simulationCallerAddress = undefined;
223
+ }
224
+ simulationExecutionResultPath(expected) {
225
+ if (this.mode !== "simulate") {
226
+ throw new Error("Simulation execution results require simulate mode");
227
+ }
228
+ const result = (0, config_1.readJsonFile)(this.resultPath("execution"));
229
+ if (result.executionId !== this.executionId
230
+ || result.target !== this.targetId
231
+ || result.mode !== "simulate"
232
+ || !Array.isArray(result.steps)) {
233
+ throw new Error("Simulation execution result does not match this workflow run");
234
+ }
235
+ const terminal = result.steps.at(-1);
236
+ if (terminal?.kind !== "workflow-simulation-completed"
237
+ || terminal.status !== "succeeded"
238
+ || !Array.isArray(terminal.selectedStepIds)
239
+ || terminal.selectedStepIds.length === 0) {
240
+ throw new Error("Simulation execution result is missing canonical completion evidence");
241
+ }
242
+ if (typeof expected === "string") {
243
+ if (!isNonZeroEvmAddress(terminal.signerAddress)
244
+ || !isNonZeroEvmAddress(expected)
245
+ || terminal.signerAddress.toLowerCase() !== expected.toLowerCase()) {
246
+ throw new Error("Simulation execution result is missing canonical completion evidence");
247
+ }
248
+ }
249
+ else {
250
+ const actualCallers = terminal.simulationCallers;
251
+ if (!/^[0-9a-f]{64}$/.test(expected.simulationCallerNetworkHash)
252
+ || terminal.simulationCallerNetworkHash !== expected.simulationCallerNetworkHash
253
+ || terminal.signerAddress !== undefined
254
+ || !Array.isArray(actualCallers)
255
+ || actualCallers.length !== expected.simulationCallers.length
256
+ || expected.simulationCallers.some((caller, index) => {
257
+ const actual = actualCallers[index];
258
+ return !actual
259
+ || actual.stepId !== caller.stepId
260
+ || !isNonZeroEvmAddress(actual.callerAddress)
261
+ || actual.callerAddress.toLowerCase() !== caller.callerAddress.toLowerCase();
262
+ })) {
263
+ throw new Error("Simulation execution result is missing canonical caller completion evidence");
264
+ }
265
+ }
266
+ return (0, resultPaths_1.workflowResultRelativePath)({
267
+ target: this.targetId,
268
+ executionId: this.executionId,
269
+ mode: this.mode,
270
+ name: "execution",
271
+ });
272
+ }
273
+ clearSimulationCompletionEvidence() {
274
+ if (this.mode !== "simulate")
275
+ return;
276
+ const filePath = this.resultPath("execution");
277
+ if (!fs_1.default.existsSync(filePath))
278
+ return;
279
+ const result = (0, config_1.readJsonFile)(filePath);
280
+ if (!Array.isArray(result.steps))
281
+ return;
282
+ const terminal = result.steps.at(-1);
283
+ if (terminal?.kind !== "workflow-simulation-completed")
284
+ return;
285
+ (0, config_1.writeJsonFile)(filePath, this.resultEnvelope(result.steps.slice(0, -1)));
286
+ }
287
+ report(name, lines) {
288
+ const filePath = path_1.default.join(this.taskDir, "docs", name);
289
+ fs_1.default.mkdirSync(path_1.default.dirname(filePath), { recursive: true });
290
+ fs_1.default.writeFileSync(filePath, `${lines.join("\n")}\n`);
291
+ }
292
+ readStatusFile(filePath) {
293
+ if (!fs_1.default.existsSync(filePath))
294
+ return {};
295
+ try {
296
+ const parsed = JSON.parse(fs_1.default.readFileSync(filePath, "utf8"));
297
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
298
+ return {};
299
+ return parsed;
300
+ }
301
+ catch {
302
+ return {};
303
+ }
304
+ }
305
+ withStatusFileLock(filePath, operation) {
306
+ const lockPath = `${filePath}.lock`;
307
+ const token = `${process.pid}:${Date.now()}:${Math.random().toString(16).slice(2)}`;
308
+ const deadline = Date.now() + STATUS_LOCK_WAIT_MS;
309
+ while (true) {
310
+ let descriptor;
311
+ try {
312
+ descriptor = fs_1.default.openSync(lockPath, "wx");
313
+ fs_1.default.writeFileSync(descriptor, `${token}\n`);
314
+ fs_1.default.fsyncSync(descriptor);
315
+ fs_1.default.closeSync(descriptor);
316
+ descriptor = undefined;
317
+ break;
318
+ }
319
+ catch (error) {
320
+ if (descriptor !== undefined)
321
+ fs_1.default.closeSync(descriptor);
322
+ if (error.code !== "EEXIST")
323
+ throw error;
324
+ try {
325
+ if (Date.now() - fs_1.default.statSync(lockPath).mtimeMs > STATUS_LOCK_STALE_MS) {
326
+ fs_1.default.unlinkSync(lockPath);
327
+ continue;
328
+ }
329
+ }
330
+ catch (lockError) {
331
+ if (lockError.code === "ENOENT")
332
+ continue;
333
+ throw lockError;
334
+ }
335
+ if (Date.now() >= deadline) {
336
+ throw new Error(`Timed out waiting for task status lock: ${lockPath}`);
337
+ }
338
+ Atomics.wait(STATUS_LOCK_SLEEP, 0, 0, STATUS_LOCK_POLL_MS);
339
+ }
340
+ }
341
+ try {
342
+ return operation();
343
+ }
344
+ finally {
345
+ try {
346
+ if (fs_1.default.readFileSync(lockPath, "utf8").trim() === token)
347
+ fs_1.default.unlinkSync(lockPath);
348
+ }
349
+ catch (error) {
350
+ if (error.code !== "ENOENT")
351
+ throw error;
352
+ }
353
+ }
354
+ }
355
+ resultEnvelope(steps) {
356
+ return {
357
+ taskId: this.taskId,
358
+ executionId: this.executionId,
359
+ target: this.targetId,
360
+ mode: this.mode,
361
+ updatedAt: new Date().toISOString(),
362
+ steps,
363
+ };
364
+ }
365
+ resultPath(name) {
366
+ return path_1.default.join(this.taskDir, (0, resultPaths_1.workflowResultRelativePath)({
367
+ target: this.targetId,
368
+ executionId: this.executionId,
369
+ mode: this.mode,
370
+ name,
371
+ }));
372
+ }
373
+ resultDirectoryPath() {
374
+ return path_1.default.join(this.taskDir, (0, resultPaths_1.workflowResultRelativeDirectory)({
375
+ target: this.targetId,
376
+ executionId: this.executionId,
377
+ mode: this.mode,
378
+ }));
379
+ }
380
+ clearRuntimeStatusFields(status) {
381
+ const next = { ...status };
382
+ for (const field of RUNTIME_STATUS_FIELDS) {
383
+ delete next[field];
384
+ }
385
+ return next;
386
+ }
387
+ targetNetworks(existing) {
388
+ if (Array.isArray(existing.targetNetworks) && existing.targetNetworks.length > 0) {
389
+ return existing.targetNetworks.map((item) => String(item));
390
+ }
391
+ const networkKeys = existing.networks ? Object.keys(existing.networks) : [];
392
+ return Array.from(new Set([...networkKeys, this.targetId]));
393
+ }
394
+ updateNetworkStatus(current, status) {
395
+ const next = {
396
+ ...current,
397
+ lastExecutionId: this.executionId,
398
+ lastExecutionMode: this.mode,
399
+ updatedAt: new Date().toISOString(),
400
+ };
401
+ if (this.mode === "simulate") {
402
+ return {
403
+ ...next,
404
+ simulationStatus: status === "completed" ? "succeeded" : status,
405
+ };
406
+ }
407
+ if (this.mode === "verify") {
408
+ if (status === "completed")
409
+ return { ...next, verifyStatus: "verified" };
410
+ if (status === "failed")
411
+ return { ...next, verifyStatus: "failed" };
412
+ if (status === "running")
413
+ return { ...next, verifyStatus: "running" };
414
+ return next;
415
+ }
416
+ if (status === "completed") {
417
+ return { ...next, deployStatus: "deployed" };
418
+ }
419
+ if (status === "waiting_external") {
420
+ return { ...next, deployStatus: "waiting_external" };
421
+ }
422
+ if (status === "waiting_code_check") {
423
+ return { ...next, deployStatus: "waiting_code_check" };
424
+ }
425
+ if (status === "failed") {
426
+ return { ...next, deployStatus: "failed" };
427
+ }
428
+ return next;
429
+ }
430
+ globalStatus(fallback, targetNetworks, networks) {
431
+ if (fallback === "waiting_external")
432
+ return "externalPending";
433
+ if (fallback !== "completed")
434
+ return fallback;
435
+ if (this.mode === "simulate")
436
+ return "simulated";
437
+ const targetStates = targetNetworks.map((network) => networks[network] || {});
438
+ const verifiedCount = targetStates.filter((state) => state.verifyStatus === "verified").length;
439
+ if (verifiedCount === targetNetworks.length && targetNetworks.length > 0)
440
+ return "verified";
441
+ if (verifiedCount > 0)
442
+ return "partiallyVerified";
443
+ const deployedCount = targetStates.filter((state) => state.deployStatus === "deployed").length;
444
+ if (deployedCount === targetNetworks.length && targetNetworks.length > 0)
445
+ return "deployed";
446
+ if (deployedCount > 0)
447
+ return "partiallyDeployed";
448
+ return fallback;
449
+ }
450
+ }
451
+ exports.WorkflowReporter = WorkflowReporter;
452
+ //# sourceMappingURL=reporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reporter.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/reporter.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,qCAAuD;AAEvD,+CAKuB;AAEvB,MAAM,qBAAqB,GAAG;IAC5B,gBAAgB;IAChB,WAAW;IACX,WAAW;IACX,SAAS;IACT,QAAQ;IACR,kBAAkB;IAClB,YAAY;CACJ,CAAC;AACX,MAAM,oBAAoB,GAAG,MAAM,CAAC;AACpC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACnC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,iBAAiB,GAAG,IAAI,UAAU,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,MAAM,mBAAmB,GAAG,CAAC,KAAc,EAAmB,EAAE;IAC9D,OAAO,OAAO,KAAK,KAAK,QAAQ;WAC3B,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC;WACjC,KAAK,CA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,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9E,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC,MAAM,CAAC;QAC/F,IAAI,aAAa,KAAK,cAAc,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,UAAU,CAAC;QAC5F,IAAI,aAAa,GAAG,CAAC;YAAE,OAAO,mBAAmB,CAAC;QAElD,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC,MAAM,CAAC;QAC/F,IAAI,aAAa,KAAK,cAAc,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,UAAU,CAAC;QAC5F,IAAI,aAAa,GAAG,CAAC;YAAE,OAAO,mBAAmB,CAAC;QAClD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAtdD,4CAsdC"}
@@ -0,0 +1,17 @@
1
+ import type { WorkflowMode } from "./simulation";
2
+ export declare const WORKFLOW_RESULT_NAMES: readonly ["execution", "view", "verification"];
3
+ export type WorkflowResultName = typeof WORKFLOW_RESULT_NAMES[number];
4
+ interface WorkflowResultPathInput {
5
+ target: string;
6
+ executionId: string;
7
+ mode: WorkflowMode;
8
+ name: WorkflowResultName;
9
+ }
10
+ interface WorkflowResultDirectoryInput {
11
+ target: string;
12
+ executionId: string;
13
+ mode: WorkflowMode;
14
+ }
15
+ export declare const workflowResultRelativeDirectory: (input: WorkflowResultDirectoryInput) => string;
16
+ export declare const workflowResultRelativePath: (input: WorkflowResultPathInput) => string;
17
+ export {};
@@ -0,0 +1,29 @@
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.workflowResultRelativePath = exports.workflowResultRelativeDirectory = exports.WORKFLOW_RESULT_NAMES = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const executionId_1 = require("./executionId");
9
+ exports.WORKFLOW_RESULT_NAMES = ["execution", "view", "verification"];
10
+ const SAFE_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9_-])?$/;
11
+ const confinedSegment = (value, label) => {
12
+ if (!SAFE_SEGMENT.test(value)) {
13
+ throw new Error(`${label} is not safe for a workflow result path`);
14
+ }
15
+ return value;
16
+ };
17
+ const modeSegment = (mode) => {
18
+ return mode === "simulate" ? "simulation" : mode;
19
+ };
20
+ const workflowResultRelativeDirectory = (input) => {
21
+ return path_1.default.posix.join("results", confinedSegment(input.target, "target"), (0, executionId_1.validateExecutionId)(input.executionId), modeSegment(input.mode));
22
+ };
23
+ exports.workflowResultRelativeDirectory = workflowResultRelativeDirectory;
24
+ const workflowResultRelativePath = (input) => {
25
+ const name = confinedSegment(input.name, "result name");
26
+ return path_1.default.posix.join((0, exports.workflowResultRelativeDirectory)(input), `${name}.json`);
27
+ };
28
+ exports.workflowResultRelativePath = workflowResultRelativePath;
29
+ //# sourceMappingURL=resultPaths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resultPaths.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/resultPaths.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,+CAAoD;AAEvC,QAAA,qBAAqB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,CAAU,CAAC;AAiBpF,MAAM,YAAY,GAAG,gDAAgD,CAAC;AAEtE,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,KAAa,EAAU,EAAE;IAC/D,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,yCAAyC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAAkB,EAAU,EAAE;IACjD,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC,CAAC;AAEK,MAAM,+BAA+B,GAAG,CAC7C,KAAmC,EAC3B,EAAE;IACV,OAAO,cAAI,CAAC,KAAK,CAAC,IAAI,CACpB,SAAS,EACT,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,EACvC,IAAA,iCAAmB,EAAC,KAAK,CAAC,WAAW,CAAC,EACtC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CACxB,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,+BAA+B,mCAS1C;AAEK,MAAM,0BAA0B,GAAG,CAAC,KAA8B,EAAU,EAAE;IACnF,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACxD,OAAO,cAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAA,uCAA+B,EAAC,KAAK,CAAC,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC;AACjF,CAAC,CAAC;AAHW,QAAA,0BAA0B,8BAGrC"}
@@ -0,0 +1,10 @@
1
+ export interface RuntimeIdentity {
2
+ version: string;
3
+ digest: string;
4
+ }
5
+ export declare function bindExecutionRuntime(input: {
6
+ taskDir: string;
7
+ target: string;
8
+ executionId: string;
9
+ identity?: RuntimeIdentity;
10
+ }): void;
@@ -0,0 +1,46 @@
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.bindExecutionRuntime = bindExecutionRuntime;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ function bindExecutionRuntime(input) {
10
+ if (!/^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(input.target) || !/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(input.executionId))
11
+ throw new Error('Invalid runtime binding identity');
12
+ const identity = input.identity ?? JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.join(__dirname, '../../runtime-identity.json'), 'utf8'));
13
+ const dir = node_path_1.default.join(input.taskDir, 'runtime-bindings');
14
+ const file = node_path_1.default.join(dir, `${input.target}.${input.executionId}.json`);
15
+ const verify = () => {
16
+ const saved = JSON.parse(node_fs_1.default.readFileSync(file, 'utf8'));
17
+ if (saved.version !== identity.version || saved.digest !== identity.digest)
18
+ throw new Error('Workflow runtime version mismatch: restore the pinned package or prepare a new execution; signed state cannot be silently migrated');
19
+ };
20
+ if (node_fs_1.default.existsSync(file)) {
21
+ verify();
22
+ return;
23
+ }
24
+ const results = node_path_1.default.join(input.taskDir, 'results');
25
+ const prefix = `${input.target}.${input.executionId}.`;
26
+ const legacyResults = node_fs_1.default.existsSync(node_path_1.default.join(results, input.target, input.executionId))
27
+ || (node_fs_1.default.existsSync(results) && node_fs_1.default.readdirSync(results).some(name => name.startsWith(prefix)));
28
+ const lockPath = node_path_1.default.join(input.taskDir, 'parameters.lock.json');
29
+ let legacyLock = false;
30
+ if (node_fs_1.default.existsSync(lockPath)) {
31
+ const contains = (value) => !!value && typeof value === 'object' && (Object.hasOwn(value, input.executionId) || Object.entries(value).some(([key, item]) => (key === 'executionId' && item === input.executionId) || contains(item)));
32
+ legacyLock = contains(JSON.parse(node_fs_1.default.readFileSync(lockPath, 'utf8')));
33
+ }
34
+ if (legacyResults || legacyLock)
35
+ throw new Error('Legacy execution has no runtime binding: continue with its original scripts or prepare a new execution after reconciling completed transactions');
36
+ node_fs_1.default.mkdirSync(dir, { recursive: true });
37
+ try {
38
+ node_fs_1.default.writeFileSync(file, JSON.stringify(identity, null, 2) + '\n', { flag: 'wx' });
39
+ }
40
+ catch (error) {
41
+ if (error.code !== 'EEXIST')
42
+ throw error;
43
+ verify();
44
+ }
45
+ }
46
+ //# sourceMappingURL=runtimeVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeVersion.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/runtimeVersion.ts"],"names":[],"mappings":";;;;;AAGA,oDAwBC;AA3BD,sDAAyB;AACzB,0DAA6B;AAE7B,SAAgB,oBAAoB,CAAC,KAAyF;IAC5H,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtK,MAAM,QAAQ,GAAoB,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAE,CAAC,YAAY,CAAC,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7I,MAAM,GAAG,GAAG,mBAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,WAAW,OAAO,CAAC,CAAC;IACzE,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QACxD,IAAI,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,oIAAoI,CAAC,CAAC;IACpO,CAAC,CAAC;IACF,IAAI,iBAAE,CAAC,UAAU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KAAK,CAAC,iBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;IACD,IAAI,aAAa,IAAI,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,iJAAiJ,CAAC,CAAC;IACpM,iBAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAC,SAAS,EAAC,IAAI,EAAC,CAAC,CAAC;IACpC,IAAI,CAAC;QAAC,iBAAE,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAC,IAAI,EAAE,EAAC,IAAI,EAAC,IAAI,EAAC,CAAC,CAAC;IAAC,CAAC;IACpF,OAAO,KAAK,EAAE,CAAC;QAAC,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,MAAM,KAAK,CAAC;QAAC,MAAM,EAAE,CAAC;IAAC,CAAC;AAClG,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Signer } from "ethers";
2
+ import type { WorkflowMode } from "./simulation";
3
+ export interface WorkflowSignerOptions {
4
+ explicitAddress?: string;
5
+ taskAddress?: string;
6
+ useLock?: boolean;
7
+ }
8
+ export declare const resolveSimulationSignerAddress: (options: WorkflowSignerOptions) => string;
9
+ export declare const impersonateWorkflowSimulationSigner: (signerAddress: string) => Promise<Signer>;
10
+ export declare const resolveWorkflowSigner: (mode: WorkflowMode, options?: WorkflowSignerOptions) => Promise<Signer>;