gate-evm-tools 1.0.26 → 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 (323) 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 +5 -0
  11. package/dist-runtime/config/hardhatAdapters.js +53 -0
  12. package/dist-runtime/config/hardhatAdapters.js.map +1 -0
  13. package/dist-runtime/config/networks.d.ts +8 -0
  14. package/dist-runtime/config/networks.js +269 -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/create2.d.ts +49 -0
  101. package/dist-runtime/workflow/lib/create2.js +194 -0
  102. package/dist-runtime/workflow/lib/create2.js.map +1 -0
  103. package/dist-runtime/workflow/lib/create2Hashes.d.ts +22 -0
  104. package/dist-runtime/workflow/lib/create2Hashes.js +57 -0
  105. package/dist-runtime/workflow/lib/create2Hashes.js.map +1 -0
  106. package/dist-runtime/workflow/lib/deploymentInfo.d.ts +40 -0
  107. package/dist-runtime/workflow/lib/deploymentInfo.js +240 -0
  108. package/dist-runtime/workflow/lib/deploymentInfo.js.map +1 -0
  109. package/dist-runtime/workflow/lib/deploymentRecords.d.ts +137 -0
  110. package/dist-runtime/workflow/lib/deploymentRecords.js +374 -0
  111. package/dist-runtime/workflow/lib/deploymentRecords.js.map +1 -0
  112. package/dist-runtime/workflow/lib/deployments.d.ts +21 -0
  113. package/dist-runtime/workflow/lib/deployments.js +240 -0
  114. package/dist-runtime/workflow/lib/deployments.js.map +1 -0
  115. package/dist-runtime/workflow/lib/erc1967.d.ts +5 -0
  116. package/dist-runtime/workflow/lib/erc1967.js +29 -0
  117. package/dist-runtime/workflow/lib/erc1967.js.map +1 -0
  118. package/dist-runtime/workflow/lib/errors.d.ts +6 -0
  119. package/dist-runtime/workflow/lib/errors.js +77 -0
  120. package/dist-runtime/workflow/lib/errors.js.map +1 -0
  121. package/dist-runtime/workflow/lib/executionId.d.ts +7 -0
  122. package/dist-runtime/workflow/lib/executionId.js +26 -0
  123. package/dist-runtime/workflow/lib/executionId.js.map +1 -0
  124. package/dist-runtime/workflow/lib/executionPlan.d.ts +85 -0
  125. package/dist-runtime/workflow/lib/executionPlan.js +450 -0
  126. package/dist-runtime/workflow/lib/executionPlan.js.map +1 -0
  127. package/dist-runtime/workflow/lib/executionProgress.d.ts +5 -0
  128. package/dist-runtime/workflow/lib/executionProgress.js +100 -0
  129. package/dist-runtime/workflow/lib/executionProgress.js.map +1 -0
  130. package/dist-runtime/workflow/lib/external.d.ts +62 -0
  131. package/dist-runtime/workflow/lib/external.js +282 -0
  132. package/dist-runtime/workflow/lib/external.js.map +1 -0
  133. package/dist-runtime/workflow/lib/externalExecutionScanner.d.ts +64 -0
  134. package/dist-runtime/workflow/lib/externalExecutionScanner.js +638 -0
  135. package/dist-runtime/workflow/lib/externalExecutionScanner.js.map +1 -0
  136. package/dist-runtime/workflow/lib/forkSnapshot.d.ts +34 -0
  137. package/dist-runtime/workflow/lib/forkSnapshot.js +167 -0
  138. package/dist-runtime/workflow/lib/forkSnapshot.js.map +1 -0
  139. package/dist-runtime/workflow/lib/gateTool.d.ts +16 -0
  140. package/dist-runtime/workflow/lib/gateTool.js +177 -0
  141. package/dist-runtime/workflow/lib/gateTool.js.map +1 -0
  142. package/dist-runtime/workflow/lib/gateToolSync.d.ts +22 -0
  143. package/dist-runtime/workflow/lib/gateToolSync.js +253 -0
  144. package/dist-runtime/workflow/lib/gateToolSync.js.map +1 -0
  145. package/dist-runtime/workflow/lib/lock.d.ts +52 -0
  146. package/dist-runtime/workflow/lib/lock.js +269 -0
  147. package/dist-runtime/workflow/lib/lock.js.map +1 -0
  148. package/dist-runtime/workflow/lib/migrationState.d.ts +103 -0
  149. package/dist-runtime/workflow/lib/migrationState.js +920 -0
  150. package/dist-runtime/workflow/lib/migrationState.js.map +1 -0
  151. package/dist-runtime/workflow/lib/operatorExecution.d.ts +28 -0
  152. package/dist-runtime/workflow/lib/operatorExecution.js +134 -0
  153. package/dist-runtime/workflow/lib/operatorExecution.js.map +1 -0
  154. package/dist-runtime/workflow/lib/parameters.d.ts +58 -0
  155. package/dist-runtime/workflow/lib/parameters.js +322 -0
  156. package/dist-runtime/workflow/lib/parameters.js.map +1 -0
  157. package/dist-runtime/workflow/lib/pendingDeploymentReuse.d.ts +29 -0
  158. package/dist-runtime/workflow/lib/pendingDeploymentReuse.js +277 -0
  159. package/dist-runtime/workflow/lib/pendingDeploymentReuse.js.map +1 -0
  160. package/dist-runtime/workflow/lib/proxy.d.ts +18 -0
  161. package/dist-runtime/workflow/lib/proxy.js +19 -0
  162. package/dist-runtime/workflow/lib/proxy.js.map +1 -0
  163. package/dist-runtime/workflow/lib/registryCommit.d.ts +33 -0
  164. package/dist-runtime/workflow/lib/registryCommit.js +319 -0
  165. package/dist-runtime/workflow/lib/registryCommit.js.map +1 -0
  166. package/dist-runtime/workflow/lib/release.d.ts +57 -0
  167. package/dist-runtime/workflow/lib/release.js +256 -0
  168. package/dist-runtime/workflow/lib/release.js.map +1 -0
  169. package/dist-runtime/workflow/lib/releaseFinalize.d.ts +14 -0
  170. package/dist-runtime/workflow/lib/releaseFinalize.js +571 -0
  171. package/dist-runtime/workflow/lib/releaseFinalize.js.map +1 -0
  172. package/dist-runtime/workflow/lib/releaseParameters.d.ts +43 -0
  173. package/dist-runtime/workflow/lib/releaseParameters.js +184 -0
  174. package/dist-runtime/workflow/lib/releaseParameters.js.map +1 -0
  175. package/dist-runtime/workflow/lib/reporter.d.ts +39 -0
  176. package/dist-runtime/workflow/lib/reporter.js +452 -0
  177. package/dist-runtime/workflow/lib/reporter.js.map +1 -0
  178. package/dist-runtime/workflow/lib/resultPaths.d.ts +17 -0
  179. package/dist-runtime/workflow/lib/resultPaths.js +29 -0
  180. package/dist-runtime/workflow/lib/resultPaths.js.map +1 -0
  181. package/dist-runtime/workflow/lib/runtimeVersion.d.ts +10 -0
  182. package/dist-runtime/workflow/lib/runtimeVersion.js +46 -0
  183. package/dist-runtime/workflow/lib/runtimeVersion.js.map +1 -0
  184. package/dist-runtime/workflow/lib/signer.d.ts +10 -0
  185. package/dist-runtime/workflow/lib/signer.js +105 -0
  186. package/dist-runtime/workflow/lib/signer.js.map +1 -0
  187. package/dist-runtime/workflow/lib/signerIdentity.d.ts +1 -0
  188. package/dist-runtime/workflow/lib/signerIdentity.js +23 -0
  189. package/dist-runtime/workflow/lib/signerIdentity.js.map +1 -0
  190. package/dist-runtime/workflow/lib/simulation.d.ts +35 -0
  191. package/dist-runtime/workflow/lib/simulation.js +282 -0
  192. package/dist-runtime/workflow/lib/simulation.js.map +1 -0
  193. package/dist-runtime/workflow/lib/simulationCallers.d.ts +44 -0
  194. package/dist-runtime/workflow/lib/simulationCallers.js +260 -0
  195. package/dist-runtime/workflow/lib/simulationCallers.js.map +1 -0
  196. package/dist-runtime/workflow/lib/sourceRpcPolicy.d.ts +1 -0
  197. package/dist-runtime/workflow/lib/sourceRpcPolicy.js +43 -0
  198. package/dist-runtime/workflow/lib/sourceRpcPolicy.js.map +1 -0
  199. package/dist-runtime/workflow/lib/state.d.ts +6 -0
  200. package/dist-runtime/workflow/lib/state.js +25 -0
  201. package/dist-runtime/workflow/lib/state.js.map +1 -0
  202. package/dist-runtime/workflow/lib/staticValidation.d.ts +22 -0
  203. package/dist-runtime/workflow/lib/staticValidation.js +124 -0
  204. package/dist-runtime/workflow/lib/staticValidation.js.map +1 -0
  205. package/dist-runtime/workflow/lib/zksyncForkCapability.d.ts +27 -0
  206. package/dist-runtime/workflow/lib/zksyncForkCapability.js +52 -0
  207. package/dist-runtime/workflow/lib/zksyncForkCapability.js.map +1 -0
  208. package/dist-runtime/workflow/lib/zksyncForkRunner.d.ts +57 -0
  209. package/dist-runtime/workflow/lib/zksyncForkRunner.js +344 -0
  210. package/dist-runtime/workflow/lib/zksyncForkRunner.js.map +1 -0
  211. package/dist-runtime/workflow/reconcileExternal.d.ts +1 -0
  212. package/dist-runtime/workflow/reconcileExternal.js +87 -0
  213. package/dist-runtime/workflow/reconcileExternal.js.map +1 -0
  214. package/dist-runtime/workflow/reconcileExternalRun.d.ts +1 -0
  215. package/dist-runtime/workflow/reconcileExternalRun.js +77 -0
  216. package/dist-runtime/workflow/reconcileExternalRun.js.map +1 -0
  217. package/dist-runtime/workflow/releaseFinalize.d.ts +1 -0
  218. package/dist-runtime/workflow/releaseFinalize.js +11 -0
  219. package/dist-runtime/workflow/releaseFinalize.js.map +1 -0
  220. package/dist-runtime/workflow/run.d.ts +40 -0
  221. package/dist-runtime/workflow/run.js +858 -0
  222. package/dist-runtime/workflow/run.js.map +1 -0
  223. package/dist-runtime/workflow/staticValidate.d.ts +1 -0
  224. package/dist-runtime/workflow/staticValidate.js +26 -0
  225. package/dist-runtime/workflow/staticValidate.js.map +1 -0
  226. package/dist-runtime/workflow/steps/call.d.ts +3 -0
  227. package/dist-runtime/workflow/steps/call.js +9 -0
  228. package/dist-runtime/workflow/steps/call.js.map +1 -0
  229. package/dist-runtime/workflow/steps/check.d.ts +3 -0
  230. package/dist-runtime/workflow/steps/check.js +9 -0
  231. package/dist-runtime/workflow/steps/check.js.map +1 -0
  232. package/dist-runtime/workflow/steps/custom.d.ts +3 -0
  233. package/dist-runtime/workflow/steps/custom.js +33 -0
  234. package/dist-runtime/workflow/steps/custom.js.map +1 -0
  235. package/dist-runtime/workflow/steps/deploy.d.ts +3 -0
  236. package/dist-runtime/workflow/steps/deploy.js +595 -0
  237. package/dist-runtime/workflow/steps/deploy.js.map +1 -0
  238. package/dist-runtime/workflow/steps/upgrade.d.ts +3 -0
  239. package/dist-runtime/workflow/steps/upgrade.js +465 -0
  240. package/dist-runtime/workflow/steps/upgrade.js.map +1 -0
  241. package/dist-runtime/workflow/steps/view.d.ts +3 -0
  242. package/dist-runtime/workflow/steps/view.js +9 -0
  243. package/dist-runtime/workflow/steps/view.js.map +1 -0
  244. package/package.json +25 -5
  245. package/runtime/config/hardhatAdapters.ts +50 -0
  246. package/runtime/config/networks.ts +296 -0
  247. package/runtime/config/openzeppelin.ts +173 -0
  248. package/runtime/config/rpc.ts +27 -0
  249. package/runtime/config/zksyncSolcPath.ts +59 -0
  250. package/runtime/hardhat-types.d.ts +2 -0
  251. package/runtime/migrate.ts +154 -0
  252. package/runtime/projectHardhat.ts +10 -0
  253. package/runtime/template-migration.json +293 -0
  254. package/runtime/workflow/checkCode.ts +13 -0
  255. package/runtime/workflow/checkCodeFinalize.ts +8 -0
  256. package/runtime/workflow/checkCodePlan.ts +8 -0
  257. package/runtime/workflow/cli.ts +356 -0
  258. package/runtime/workflow/commitContractInfo.ts +63 -0
  259. package/runtime/workflow/create2Hashes.ts +79 -0
  260. package/runtime/workflow/forkSourceProxy.ts +193 -0
  261. package/runtime/workflow/importState.ts +190 -0
  262. package/runtime/workflow/lib/authority.ts +170 -0
  263. package/runtime/workflow/lib/calldata.ts +9 -0
  264. package/runtime/workflow/lib/calls.ts +407 -0
  265. package/runtime/workflow/lib/checkCode/args.ts +76 -0
  266. package/runtime/workflow/lib/checkCode/command.ts +36 -0
  267. package/runtime/workflow/lib/checkCode/dependencies.ts +112 -0
  268. package/runtime/workflow/lib/checkCode/finalize.ts +198 -0
  269. package/runtime/workflow/lib/checkCode/index.ts +18 -0
  270. package/runtime/workflow/lib/checkCode/plan.ts +163 -0
  271. package/runtime/workflow/lib/checkCodeReport.ts +133 -0
  272. package/runtime/workflow/lib/checkCodeRunner.ts +1225 -0
  273. package/runtime/workflow/lib/cliTool.ts +31 -0
  274. package/runtime/workflow/lib/config.ts +130 -0
  275. package/runtime/workflow/lib/contractInfoCandidates.ts +690 -0
  276. package/runtime/workflow/lib/create2.ts +278 -0
  277. package/runtime/workflow/lib/create2Hashes.ts +83 -0
  278. package/runtime/workflow/lib/deploymentInfo.ts +286 -0
  279. package/runtime/workflow/lib/deploymentRecords.ts +576 -0
  280. package/runtime/workflow/lib/deployments.ts +276 -0
  281. package/runtime/workflow/lib/erc1967.ts +57 -0
  282. package/runtime/workflow/lib/errors.ts +95 -0
  283. package/runtime/workflow/lib/executionId.ts +35 -0
  284. package/runtime/workflow/lib/executionPlan.ts +550 -0
  285. package/runtime/workflow/lib/executionProgress.ts +127 -0
  286. package/runtime/workflow/lib/external.ts +372 -0
  287. package/runtime/workflow/lib/externalExecutionScanner.ts +892 -0
  288. package/runtime/workflow/lib/forkSnapshot.ts +231 -0
  289. package/runtime/workflow/lib/gateTool.ts +261 -0
  290. package/runtime/workflow/lib/gateToolSync.ts +398 -0
  291. package/runtime/workflow/lib/lock.ts +388 -0
  292. package/runtime/workflow/lib/migrationState.ts +1246 -0
  293. package/runtime/workflow/lib/operatorExecution.ts +174 -0
  294. package/runtime/workflow/lib/parameters.ts +437 -0
  295. package/runtime/workflow/lib/pendingDeploymentReuse.ts +428 -0
  296. package/runtime/workflow/lib/proxy.ts +45 -0
  297. package/runtime/workflow/lib/registryCommit.ts +455 -0
  298. package/runtime/workflow/lib/release.ts +329 -0
  299. package/runtime/workflow/lib/releaseFinalize.ts +711 -0
  300. package/runtime/workflow/lib/releaseParameters.ts +248 -0
  301. package/runtime/workflow/lib/reporter.ts +502 -0
  302. package/runtime/workflow/lib/resultPaths.ts +49 -0
  303. package/runtime/workflow/lib/runtimeVersion.ts +28 -0
  304. package/runtime/workflow/lib/signer.ts +124 -0
  305. package/runtime/workflow/lib/signerIdentity.ts +22 -0
  306. package/runtime/workflow/lib/simulation.ts +415 -0
  307. package/runtime/workflow/lib/simulationCallers.ts +335 -0
  308. package/runtime/workflow/lib/sourceRpcPolicy.ts +41 -0
  309. package/runtime/workflow/lib/state.ts +25 -0
  310. package/runtime/workflow/lib/staticValidation.ts +142 -0
  311. package/runtime/workflow/lib/zksyncForkCapability.ts +80 -0
  312. package/runtime/workflow/lib/zksyncForkRunner.ts +505 -0
  313. package/runtime/workflow/reconcileExternal.ts +86 -0
  314. package/runtime/workflow/reconcileExternalRun.ts +88 -0
  315. package/runtime/workflow/releaseFinalize.ts +8 -0
  316. package/runtime/workflow/run.ts +1072 -0
  317. package/runtime/workflow/staticValidate.ts +23 -0
  318. package/runtime/workflow/steps/call.ts +10 -0
  319. package/runtime/workflow/steps/check.ts +10 -0
  320. package/runtime/workflow/steps/custom.ts +43 -0
  321. package/runtime/workflow/steps/deploy.ts +771 -0
  322. package/runtime/workflow/steps/upgrade.ts +598 -0
  323. package/runtime/workflow/steps/view.ts +10 -0
@@ -0,0 +1,282 @@
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.writeExternalExecutionPackage = exports.loadExternalExecutionPackage = exports.ExternalExecutionRequired = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ class ExternalExecutionRequired extends Error {
10
+ stepId;
11
+ calls;
12
+ constructor(stepId, calls) {
13
+ super(`External execution required for step ${stepId}`);
14
+ this.stepId = stepId;
15
+ this.calls = calls;
16
+ this.name = "ExternalExecutionRequired";
17
+ }
18
+ }
19
+ exports.ExternalExecutionRequired = ExternalExecutionRequired;
20
+ const safeId = (value, label) => {
21
+ if (!/^[A-Za-z0-9][A-Za-z0-9_-]{0,199}$/.test(value)) {
22
+ throw new Error(`${label} is invalid`);
23
+ }
24
+ return value;
25
+ };
26
+ const normalizeAddress = (value, label) => {
27
+ if (!/^0x[0-9a-fA-F]{40}$/.test(value))
28
+ throw new Error(`${label} is invalid`);
29
+ return value.toLowerCase();
30
+ };
31
+ const normalizeValue = (value, label) => {
32
+ if (!/^(?:0[xX][0-9a-fA-F]+|[0-9]+)$/.test(value)) {
33
+ throw new Error(`${label} is invalid`);
34
+ }
35
+ return BigInt(value).toString(10);
36
+ };
37
+ const normalizeData = (value, label) => {
38
+ if (!/^0x(?:[0-9a-fA-F]{2})*$/.test(value))
39
+ throw new Error(`${label} is invalid`);
40
+ return value.toLowerCase();
41
+ };
42
+ const normalizeFactoryDeps = (value, label) => {
43
+ if (!Array.isArray(value))
44
+ throw new Error(`${label} must be an array`);
45
+ const output = [];
46
+ const seen = new Set();
47
+ for (const [index, dependency] of value.entries()) {
48
+ if (typeof dependency !== "string" || !/^0x(?:[0-9a-fA-F]{2})+$/.test(dependency)) {
49
+ throw new Error(`${label}[${index}] is invalid`);
50
+ }
51
+ const normalized = dependency.toLowerCase();
52
+ if (seen.has(normalized))
53
+ continue;
54
+ seen.add(normalized);
55
+ output.push(normalized);
56
+ }
57
+ return output;
58
+ };
59
+ const canonicalCall = (call, index) => {
60
+ if (call.operation !== 0 && call.operation !== 1) {
61
+ throw new Error(`external call ${index} operation is invalid`);
62
+ }
63
+ if (call.scheme !== undefined && call.scheme !== "zksync-eravm") {
64
+ throw new Error(`external call ${index} scheme is invalid`);
65
+ }
66
+ if (call.scheme === "zksync-eravm" && call.factoryDeps === undefined) {
67
+ throw new Error(`external call ${index} factoryDeps is required for zkSync`);
68
+ }
69
+ if (call.scheme === undefined && call.factoryDeps !== undefined) {
70
+ throw new Error(`external call ${index} factoryDeps is only supported for zkSync`);
71
+ }
72
+ return {
73
+ transactionId: safeId(call.transactionId, `external call ${index} transactionId`),
74
+ stepId: safeId(call.stepId, `external call ${index} stepId`),
75
+ to: normalizeAddress(call.to, `external call ${index} to`),
76
+ value: normalizeValue(call.value, `external call ${index} value`),
77
+ data: normalizeData(call.data, `external call ${index} data`),
78
+ operation: call.operation,
79
+ ...(call.scheme === "zksync-eravm"
80
+ ? {
81
+ scheme: "zksync-eravm",
82
+ factoryDeps: normalizeFactoryDeps(call.factoryDeps, `external call ${index} factoryDeps`),
83
+ }
84
+ : {}),
85
+ method: String(call.method),
86
+ args: call.args,
87
+ executor: normalizeAddress(call.executor, `external call ${index} executor`),
88
+ reason: String(call.reason),
89
+ };
90
+ };
91
+ const groupAdjacentCalls = (calls) => {
92
+ const groups = [];
93
+ for (const call of calls) {
94
+ const previous = groups.at(-1);
95
+ if (previous && previous.executor === call.executor) {
96
+ previous.transactionIds.push(call.transactionId);
97
+ previous.calls.push(call);
98
+ continue;
99
+ }
100
+ groups.push({
101
+ groupId: `group-${String(groups.length + 1).padStart(4, "0")}`,
102
+ executor: call.executor,
103
+ transactionIds: [call.transactionId],
104
+ calls: [call],
105
+ });
106
+ }
107
+ return groups;
108
+ };
109
+ const packagePath = (taskDir, target, executionId) => {
110
+ safeId(target, "external package target");
111
+ safeId(executionId, "external package executionId");
112
+ const resolvedTask = path_1.default.resolve(taskDir);
113
+ const filePath = path_1.default.join(resolvedTask, "calldata", target, executionId, "external-execution.json");
114
+ const relative = path_1.default.relative(resolvedTask, filePath);
115
+ if (relative.startsWith("..") || path_1.default.isAbsolute(relative)) {
116
+ throw new Error("external package path escapes the task directory");
117
+ }
118
+ return filePath;
119
+ };
120
+ const writeAtomic = (filePath, value) => {
121
+ fs_1.default.mkdirSync(path_1.default.dirname(filePath), { recursive: true });
122
+ const serialized = JSON.stringify(value, null, 2) + "\n";
123
+ const temporary = `${filePath}.${process.pid}.${Date.now()}.tmp`;
124
+ try {
125
+ fs_1.default.writeFileSync(temporary, serialized, { flag: "wx", mode: 0o600 });
126
+ fs_1.default.renameSync(temporary, filePath);
127
+ }
128
+ catch (error) {
129
+ if (fs_1.default.existsSync(temporary))
130
+ fs_1.default.unlinkSync(temporary);
131
+ throw error;
132
+ }
133
+ };
134
+ const externalSegments = (plan) => {
135
+ const segments = [];
136
+ for (const transaction of plan.transactions) {
137
+ if (transaction.route !== "external")
138
+ continue;
139
+ const previous = segments.at(-1);
140
+ if (previous
141
+ && previous.transactions.at(-1).transactionIndex + 1 === transaction.transactionIndex) {
142
+ previous.transactions.push(transaction);
143
+ continue;
144
+ }
145
+ segments.push({ index: segments.length, transactions: [transaction] });
146
+ }
147
+ return segments;
148
+ };
149
+ const canonicalSegmentCalls = (plan, rawCalls) => {
150
+ if (rawCalls.length === 0) {
151
+ throw new Error("external package calls must cover one consecutive external segment");
152
+ }
153
+ const calls = rawCalls.map(canonicalCall);
154
+ const segments = externalSegments(plan);
155
+ const segmentIndex = segments.findIndex((segment) => (segment.transactions.length === calls.length
156
+ && segment.transactions.every((transaction, index) => (transaction.transactionId === calls[index].transactionId))));
157
+ if (segmentIndex < 0) {
158
+ throw new Error("external package calls must cover one consecutive external segment");
159
+ }
160
+ const transactions = segments[segmentIndex].transactions;
161
+ for (const [index, transaction] of transactions.entries()) {
162
+ const call = calls[index];
163
+ if (call.stepId !== transaction.stepId
164
+ || call.executor !== transaction.executor.toLowerCase()
165
+ || call.to !== transaction.to.toLowerCase()
166
+ || call.value !== BigInt(transaction.value).toString(10)
167
+ || call.data !== transaction.data.toLowerCase()
168
+ || call.operation !== transaction.operation
169
+ || call.scheme !== transaction.scheme
170
+ || JSON.stringify(call.factoryDeps) !== JSON.stringify(transaction.factoryDeps)) {
171
+ throw new Error(`external plan transaction ${transaction.transactionId} must match its segment call`);
172
+ }
173
+ }
174
+ return { segmentIndex, transactions, calls };
175
+ };
176
+ const assertExternalTransportSupported = (plan) => {
177
+ if (plan.transactions.some((transaction) => transaction.route === "external" && transaction.scheme === "zksync-eravm")) {
178
+ throw new Error("zkSync external Admin execution is not supported until an exact EIP-712 factoryDeps transport is implemented");
179
+ }
180
+ };
181
+ const parseExistingPackage = (filePath, plan) => {
182
+ if (!fs_1.default.existsSync(filePath))
183
+ return undefined;
184
+ let parsed;
185
+ try {
186
+ parsed = JSON.parse(fs_1.default.readFileSync(filePath, "utf8"));
187
+ }
188
+ catch (error) {
189
+ throw new Error(`external execution package is invalid: ${error instanceof Error ? error.message : String(error)}`);
190
+ }
191
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
192
+ throw new Error("external execution package must be an object");
193
+ }
194
+ const value = parsed;
195
+ if (value.version !== 1
196
+ || value.taskId !== plan.taskId
197
+ || value.target !== plan.target
198
+ || value.executionId !== plan.executionId
199
+ || value.operator !== plan.operator
200
+ || value.executionPlanHash !== plan.planHash
201
+ || !Array.isArray(value.segments)
202
+ || typeof value.createdAt !== "string"
203
+ || typeof value.updatedAt !== "string") {
204
+ throw new Error("external execution package does not match the execution plan");
205
+ }
206
+ const segments = externalSegments(plan);
207
+ for (const [index, rawSegment] of value.segments.entries()) {
208
+ if (!rawSegment || typeof rawSegment !== "object" || Array.isArray(rawSegment)) {
209
+ throw new Error(`external execution segment ${index} is invalid`);
210
+ }
211
+ const segment = rawSegment;
212
+ const expected = segments[index]?.transactions;
213
+ const calls = Array.isArray(segment.groups)
214
+ ? segment.groups.flatMap((group) => group.calls)
215
+ : [];
216
+ if (!expected
217
+ || segment.segmentId !== `segment-${String(index + 1).padStart(4, "0")}`
218
+ || segment.transactionStartIndex !== expected[0].transactionIndex
219
+ || !Array.isArray(segment.transactionIds)
220
+ || JSON.stringify(segment.transactionIds) !== JSON.stringify(expected.map((transaction) => transaction.transactionId))
221
+ || !Number.isSafeInteger(segment.handoffBlock)
222
+ || segment.handoffBlock < 0
223
+ || calls.length !== expected.length) {
224
+ throw new Error(`external execution segment ${index} does not match the execution plan`);
225
+ }
226
+ canonicalSegmentCalls(plan, calls);
227
+ }
228
+ return value;
229
+ };
230
+ const loadExternalExecutionPackage = (input) => {
231
+ assertExternalTransportSupported(input.plan);
232
+ const filePath = packagePath(input.taskDir, input.plan.target, input.plan.executionId);
233
+ const existing = parseExistingPackage(filePath, input.plan);
234
+ return existing ? { filePath, package: existing } : undefined;
235
+ };
236
+ exports.loadExternalExecutionPackage = loadExternalExecutionPackage;
237
+ const writeExternalExecutionPackage = (input) => {
238
+ assertExternalTransportSupported(input.plan);
239
+ if (!Number.isSafeInteger(input.handoffBlock) || input.handoffBlock < 0) {
240
+ throw new Error("external package handoffBlock must be a nonnegative safe integer");
241
+ }
242
+ if (!input.plan.transactions.some((transaction) => transaction.route === "external")) {
243
+ throw new Error("external execution package requires external plan transactions");
244
+ }
245
+ const { segmentIndex, transactions, calls } = canonicalSegmentCalls(input.plan, input.calls);
246
+ const target = safeId(input.plan.target, "external package target");
247
+ const executionId = safeId(input.plan.executionId, "external package executionId");
248
+ const filePath = packagePath(input.taskDir, target, executionId);
249
+ const existing = parseExistingPackage(filePath, input.plan);
250
+ if (existing?.segments[segmentIndex]) {
251
+ return { filePath, package: existing };
252
+ }
253
+ if ((existing?.segments.length ?? 0) !== segmentIndex) {
254
+ throw new Error("external execution segments must be appended in plan order");
255
+ }
256
+ const now = (input.now || (() => new Date().toISOString()))();
257
+ const segment = {
258
+ segmentId: `segment-${String(segmentIndex + 1).padStart(4, "0")}`,
259
+ transactionStartIndex: transactions[0].transactionIndex,
260
+ transactionIds: transactions.map((transaction) => transaction.transactionId),
261
+ handoffBlock: input.handoffBlock,
262
+ groups: groupAdjacentCalls(calls),
263
+ createdAt: now,
264
+ };
265
+ const output = existing
266
+ ? { ...existing, segments: [...existing.segments, segment], updatedAt: now }
267
+ : {
268
+ version: 1,
269
+ taskId: safeId(input.plan.taskId, "external package taskId"),
270
+ target,
271
+ executionId,
272
+ operator: normalizeAddress(input.plan.operator, "external package operator"),
273
+ executionPlanHash: input.plan.planHash,
274
+ segments: [segment],
275
+ createdAt: now,
276
+ updatedAt: now,
277
+ };
278
+ writeAtomic(filePath, output);
279
+ return { filePath, package: output };
280
+ };
281
+ exports.writeExternalExecutionPackage = writeExternalExecutionPackage;
282
+ //# sourceMappingURL=external.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/external.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AA8CxB,MAAa,yBAA0B,SAAQ,KAAK;IAEvC;IACA;IAFX,YACW,MAAc,EACd,KAAqB;QAE9B,KAAK,CAAC,wCAAwC,MAAM,EAAE,CAAC,CAAC;QAH/C,WAAM,GAAN,MAAM,CAAQ;QACd,UAAK,GAAL,KAAK,CAAgB;QAG9B,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AARD,8DAQC;AAED,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,KAAa,EAAU,EAAE;IACtD,IAAI,CAAC,mCAAmC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,aAAa,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,gBAAgB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AC,OAAO,CAAC;YACnB,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,GAAG;SACf,CAAC;IACN,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC9B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACvC,CAAC,CAAC;AAjDW,QAAA,6BAA6B,iCAiDxC"}
@@ -0,0 +1,64 @@
1
+ import { JsonRpcProvider } from "ethers";
2
+ import { syncGateToolUups, type GateToolSyncHre } from "./gateToolSync";
3
+ export type ExternalFinalityPolicy = {
4
+ mode: "rpc_finalized";
5
+ } | {
6
+ mode: "confirmation_depth";
7
+ confirmations: number;
8
+ };
9
+ export interface ExternalReconciliationMatch {
10
+ transactionId: string;
11
+ transactionIndex: number;
12
+ route: "operator" | "external";
13
+ executor: string;
14
+ submittedBy: string;
15
+ executionKind: "eoa" | "safe_call" | "safe_multisend";
16
+ transactionHash: string;
17
+ blockNumber: number;
18
+ blockHash: string;
19
+ blockTransactionIndex: number;
20
+ innerCallIndex?: number;
21
+ receiptStatus: 0 | 1;
22
+ finalized: boolean;
23
+ }
24
+ export interface ExternalReconciliationReport {
25
+ version: 1;
26
+ status: "not_required" | "waiting_operator" | "waiting_finality" | "waiting_external" | "reconciled" | "failed";
27
+ taskId: string;
28
+ target: string;
29
+ executionId: string;
30
+ executionPlanHash: string;
31
+ packagePath?: string;
32
+ packageHash?: string;
33
+ segments?: Array<{
34
+ segmentId: string;
35
+ transactionIds: string[];
36
+ handoffBlock: number;
37
+ nextBlock: number;
38
+ }>;
39
+ finalizedBlock: number;
40
+ finalityPolicy: ExternalFinalityPolicy;
41
+ matchedTransactionIds: string[];
42
+ matches: ExternalReconciliationMatch[];
43
+ failure?: {
44
+ code: string;
45
+ message: string;
46
+ transactionId?: string;
47
+ };
48
+ reportPath: string;
49
+ createdAt: string;
50
+ updatedAt: string;
51
+ completedAt?: string;
52
+ }
53
+ export declare const reconcileExternalExecution: (input: {
54
+ root: string;
55
+ taskId: string;
56
+ network: string;
57
+ executionId: string;
58
+ provider: JsonRpcProvider;
59
+ batchSize?: number;
60
+ gateToolSyncHre?: GateToolSyncHre;
61
+ dependencies?: {
62
+ syncGateToolUups?: typeof syncGateToolUups;
63
+ };
64
+ }) => Promise<ExternalReconciliationReport>;