gate-evm-tools 1.0.28 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (742) hide show
  1. package/README.md +47 -18
  2. package/bin/cli.js +6 -0
  3. package/bin/delivery.cjs +52 -0
  4. package/bin/manifest-bootstrap.js +4 -15
  5. package/dist/commands/check.d.ts.map +1 -1
  6. package/dist/commands/check.js +26 -2
  7. package/dist/commands/check.js.map +1 -1
  8. package/dist/commands/plan/file-store.d.ts.map +1 -0
  9. package/dist/commands/plan/generate-deployment.d.ts +48 -0
  10. package/dist/commands/plan/generate-deployment.d.ts.map +1 -0
  11. package/dist/commands/plan/generate-deployment.js +211 -0
  12. package/dist/commands/plan/generate-deployment.js.map +1 -0
  13. package/dist/commands/plan/helpers.d.ts.map +1 -0
  14. package/dist/commands/plan/index.d.ts +3 -0
  15. package/dist/commands/plan/index.d.ts.map +1 -0
  16. package/dist/commands/plan/index.js +88 -0
  17. package/dist/commands/plan/index.js.map +1 -0
  18. package/dist/commands/sync.js +1 -1
  19. package/dist/commands/sync.js.map +1 -1
  20. package/dist/core/BytecodeChecker.d.ts.map +1 -1
  21. package/dist/core/BytecodeChecker.js +27 -8
  22. package/dist/core/BytecodeChecker.js.map +1 -1
  23. package/dist/core/preparation/artifacts.d.ts +2 -0
  24. package/dist/core/preparation/artifacts.d.ts.map +1 -1
  25. package/dist/core/preparation/artifacts.js +9 -3
  26. package/dist/core/preparation/artifacts.js.map +1 -1
  27. package/dist/core/preparation/batch.d.ts +26 -0
  28. package/dist/core/preparation/batch.d.ts.map +1 -0
  29. package/dist/core/preparation/batch.js +72 -0
  30. package/dist/core/preparation/batch.js.map +1 -0
  31. package/dist/core/preparation/evm.d.ts +61 -6
  32. package/dist/core/preparation/evm.d.ts.map +1 -1
  33. package/dist/core/preparation/evm.js +122 -34
  34. package/dist/core/preparation/evm.js.map +1 -1
  35. package/dist/core/preparation/evmManifestSync.d.ts +68 -0
  36. package/dist/core/preparation/evmManifestSync.d.ts.map +1 -0
  37. package/dist/core/preparation/evmManifestSync.js +154 -0
  38. package/dist/core/preparation/evmManifestSync.js.map +1 -0
  39. package/dist/core/preparation/index.d.ts +40 -2
  40. package/dist/core/preparation/index.d.ts.map +1 -1
  41. package/dist/core/preparation/index.js +3 -3
  42. package/dist/core/preparation/index.js.map +1 -1
  43. package/dist/core/preparation/manifest.d.ts +17 -3
  44. package/dist/core/preparation/manifest.d.ts.map +1 -1
  45. package/dist/core/preparation/manifest.js +23 -28
  46. package/dist/core/preparation/manifest.js.map +1 -1
  47. package/dist/core/preparation/normalize.d.ts.map +1 -1
  48. package/dist/core/preparation/normalize.js +67 -20
  49. package/dist/core/preparation/normalize.js.map +1 -1
  50. package/dist/core/preparation/transparent.d.ts +23 -0
  51. package/dist/core/preparation/transparent.d.ts.map +1 -0
  52. package/dist/core/preparation/transparent.js +103 -0
  53. package/dist/core/preparation/transparent.js.map +1 -0
  54. package/dist/core/preparation/types.d.ts +54 -7
  55. package/dist/core/preparation/types.d.ts.map +1 -1
  56. package/dist/core/preparation/zksync.d.ts.map +1 -1
  57. package/dist/core/preparation/zksync.js +2 -0
  58. package/dist/core/preparation/zksync.js.map +1 -1
  59. package/dist/custody/credential.d.ts.map +1 -1
  60. package/dist/custody/credential.js +1 -6
  61. package/dist/custody/credential.js.map +1 -1
  62. package/dist/custody/hardhat-runtime.d.ts.map +1 -1
  63. package/dist/custody/hardhat-runtime.js +2 -0
  64. package/dist/custody/hardhat-runtime.js.map +1 -1
  65. package/dist/custody/hardhat.d.ts +1 -0
  66. package/dist/custody/hardhat.d.ts.map +1 -1
  67. package/dist/custody/hardhat.js +1 -0
  68. package/dist/custody/hardhat.js.map +1 -1
  69. package/dist/custody/index.d.ts +1 -0
  70. package/dist/custody/index.d.ts.map +1 -1
  71. package/dist/custody/index.js +1 -0
  72. package/dist/custody/index.js.map +1 -1
  73. package/dist/custody/provider-wait.d.ts +13 -0
  74. package/dist/custody/provider-wait.d.ts.map +1 -0
  75. package/dist/custody/provider-wait.js +78 -0
  76. package/dist/custody/provider-wait.js.map +1 -0
  77. package/dist/delivery/policy.d.ts +6 -0
  78. package/dist/delivery/policy.d.ts.map +1 -0
  79. package/dist/delivery/policy.js +24 -0
  80. package/dist/delivery/policy.js.map +1 -0
  81. package/dist/deployment-evm/index.d.ts +4 -0
  82. package/dist/deployment-evm/index.d.ts.map +1 -0
  83. package/dist/deployment-evm/index.js +3 -0
  84. package/dist/deployment-evm/index.js.map +1 -0
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +9 -0
  87. package/dist/index.js.map +1 -1
  88. package/dist/sync/index.d.ts +15 -0
  89. package/dist/sync/index.d.ts.map +1 -1
  90. package/dist/sync/index.js +13 -0
  91. package/dist/sync/index.js.map +1 -1
  92. package/dist/types.d.ts +3 -0
  93. package/dist/types.d.ts.map +1 -1
  94. package/dist/workflow/index.d.ts +10 -2
  95. package/dist/workflow/index.d.ts.map +1 -1
  96. package/dist/workflow/index.js +6 -0
  97. package/dist/workflow/index.js.map +1 -1
  98. package/dist-cjs/core/BytecodeChecker.js +526 -0
  99. package/dist-cjs/core/BytecodeChecker.js.map +1 -0
  100. package/dist-cjs/core/legacyProxyArtifact.js +42 -0
  101. package/dist-cjs/core/legacyProxyArtifact.js.map +1 -0
  102. package/dist-cjs/core/preparation/artifacts.js +11 -4
  103. package/dist-cjs/core/preparation/artifacts.js.map +1 -1
  104. package/dist-cjs/core/preparation/batch.js +76 -0
  105. package/dist-cjs/core/preparation/batch.js.map +1 -0
  106. package/dist-cjs/core/preparation/evm.js +128 -37
  107. package/dist-cjs/core/preparation/evm.js.map +1 -1
  108. package/dist-cjs/core/preparation/evmManifestSync.js +163 -0
  109. package/dist-cjs/core/preparation/evmManifestSync.js.map +1 -0
  110. package/dist-cjs/core/preparation/index.js +3 -3
  111. package/dist-cjs/core/preparation/index.js.map +1 -1
  112. package/dist-cjs/core/preparation/manifest.js +25 -30
  113. package/dist-cjs/core/preparation/manifest.js.map +1 -1
  114. package/dist-cjs/core/preparation/normalize.js +67 -20
  115. package/dist-cjs/core/preparation/normalize.js.map +1 -1
  116. package/dist-cjs/core/preparation/transparent.js +110 -0
  117. package/dist-cjs/core/preparation/transparent.js.map +1 -0
  118. package/dist-cjs/core/preparation/zksync.js +2 -0
  119. package/dist-cjs/core/preparation/zksync.js.map +1 -1
  120. package/dist-cjs/custody/credential.js +1 -6
  121. package/dist-cjs/custody/credential.js.map +1 -1
  122. package/dist-cjs/custody/hardhat-runtime.js +2 -0
  123. package/dist-cjs/custody/hardhat-runtime.js.map +1 -1
  124. package/dist-cjs/custody/hardhat.js +3 -1
  125. package/dist-cjs/custody/hardhat.js.map +1 -1
  126. package/dist-cjs/custody/index.js +3 -1
  127. package/dist-cjs/custody/index.js.map +1 -1
  128. package/dist-cjs/custody/provider-wait.js +81 -0
  129. package/dist-cjs/custody/provider-wait.js.map +1 -0
  130. package/dist-cjs/delivery/policy.js +29 -0
  131. package/dist-cjs/delivery/policy.js.map +1 -0
  132. package/dist-cjs/deployment-evm/index.js +10 -0
  133. package/dist-cjs/deployment-evm/index.js.map +1 -0
  134. package/dist-cjs/sync/index.js +13 -0
  135. package/dist-cjs/sync/index.js.map +1 -1
  136. package/dist-cjs/workflow/index.js +22 -1
  137. package/dist-cjs/workflow/index.js.map +1 -1
  138. package/dist-runtime/config/hardhatAdapters.js +2 -1
  139. package/dist-runtime/config/hardhatAdapters.js.map +1 -1
  140. package/dist-runtime/config/openzeppelin.d.ts +2 -1
  141. package/dist-runtime/config/openzeppelin.js +2 -19
  142. package/dist-runtime/config/openzeppelin.js.map +1 -1
  143. package/dist-runtime/delivery/abi.d.ts +14 -0
  144. package/dist-runtime/delivery/abi.js +161 -0
  145. package/dist-runtime/delivery/abi.js.map +1 -0
  146. package/dist-runtime/delivery/aggregate-bootstrap.d.ts +12 -0
  147. package/dist-runtime/delivery/aggregate-bootstrap.js +42 -0
  148. package/dist-runtime/delivery/aggregate-bootstrap.js.map +1 -0
  149. package/dist-runtime/delivery/aggregate-channel.d.ts +28 -0
  150. package/dist-runtime/delivery/aggregate-channel.js +159 -0
  151. package/dist-runtime/delivery/aggregate-channel.js.map +1 -0
  152. package/dist-runtime/delivery/aggregate-diagnostics.d.ts +14 -0
  153. package/dist-runtime/delivery/aggregate-diagnostics.js +73 -0
  154. package/dist-runtime/delivery/aggregate-diagnostics.js.map +1 -0
  155. package/dist-runtime/delivery/aggregate-inputs.d.ts +172 -0
  156. package/dist-runtime/delivery/aggregate-inputs.js +57 -0
  157. package/dist-runtime/delivery/aggregate-inputs.js.map +1 -0
  158. package/dist-runtime/delivery/aggregate-source.d.ts +25 -0
  159. package/dist-runtime/delivery/aggregate-source.js +87 -0
  160. package/dist-runtime/delivery/aggregate-source.js.map +1 -0
  161. package/dist-runtime/delivery/aggregate-worker.d.ts +1 -0
  162. package/dist-runtime/delivery/aggregate-worker.js +199 -0
  163. package/dist-runtime/delivery/aggregate-worker.js.map +1 -0
  164. package/dist-runtime/delivery/aggregate.d.ts +51 -0
  165. package/dist-runtime/delivery/aggregate.js +190 -0
  166. package/dist-runtime/delivery/aggregate.js.map +1 -0
  167. package/dist-runtime/delivery/bindings.d.ts +21 -0
  168. package/dist-runtime/delivery/bindings.js +53 -0
  169. package/dist-runtime/delivery/bindings.js.map +1 -0
  170. package/dist-runtime/delivery/business-extension.d.ts +10 -0
  171. package/dist-runtime/delivery/business-extension.js +38 -0
  172. package/dist-runtime/delivery/business-extension.js.map +1 -0
  173. package/dist-runtime/delivery/calldata-archive.d.ts +18 -0
  174. package/dist-runtime/delivery/calldata-archive.js +31 -0
  175. package/dist-runtime/delivery/calldata-archive.js.map +1 -0
  176. package/dist-runtime/delivery/calldata-details.d.ts +47 -0
  177. package/dist-runtime/delivery/calldata-details.js +94 -0
  178. package/dist-runtime/delivery/calldata-details.js.map +1 -0
  179. package/dist-runtime/delivery/calldata-format.d.ts +4 -0
  180. package/dist-runtime/delivery/calldata-format.js +17 -0
  181. package/dist-runtime/delivery/calldata-format.js.map +1 -0
  182. package/dist-runtime/delivery/calldata-preparations.d.ts +13 -0
  183. package/dist-runtime/delivery/calldata-preparations.js +85 -0
  184. package/dist-runtime/delivery/calldata-preparations.js.map +1 -0
  185. package/dist-runtime/delivery/calldata-review.d.ts +44 -0
  186. package/dist-runtime/delivery/calldata-review.js +131 -0
  187. package/dist-runtime/delivery/calldata-review.js.map +1 -0
  188. package/dist-runtime/delivery/check-code.d.ts +19 -0
  189. package/dist-runtime/delivery/check-code.js +63 -0
  190. package/dist-runtime/delivery/check-code.js.map +1 -0
  191. package/dist-runtime/delivery/closure-format.d.ts +77 -0
  192. package/dist-runtime/delivery/closure-format.js +225 -0
  193. package/dist-runtime/delivery/closure-format.js.map +1 -0
  194. package/dist-runtime/delivery/codec-pin.d.ts +2 -0
  195. package/dist-runtime/delivery/codec-pin.js +7 -0
  196. package/dist-runtime/delivery/codec-pin.js.map +1 -0
  197. package/dist-runtime/delivery/codec.d.ts +19 -0
  198. package/dist-runtime/delivery/codec.js +73 -0
  199. package/dist-runtime/delivery/codec.js.map +1 -0
  200. package/dist-runtime/delivery/compiler-dependency-pins.d.ts +7 -0
  201. package/dist-runtime/delivery/compiler-dependency-pins.js +1689 -0
  202. package/dist-runtime/delivery/compiler-dependency-pins.js.map +1 -0
  203. package/dist-runtime/delivery/compiler-files.d.ts +40 -0
  204. package/dist-runtime/delivery/compiler-files.js +222 -0
  205. package/dist-runtime/delivery/compiler-files.js.map +1 -0
  206. package/dist-runtime/delivery/compiler-io.d.ts +2 -0
  207. package/dist-runtime/delivery/compiler-io.js +13 -0
  208. package/dist-runtime/delivery/compiler-io.js.map +1 -0
  209. package/dist-runtime/delivery/compiler-pins.d.ts +10 -0
  210. package/dist-runtime/delivery/compiler-pins.js +147 -0
  211. package/dist-runtime/delivery/compiler-pins.js.map +1 -0
  212. package/dist-runtime/delivery/compiler.d.ts +188 -0
  213. package/dist-runtime/delivery/compiler.js +851 -0
  214. package/dist-runtime/delivery/compiler.js.map +1 -0
  215. package/dist-runtime/delivery/config.d.ts +48 -0
  216. package/dist-runtime/delivery/config.js +124 -0
  217. package/dist-runtime/delivery/config.js.map +1 -0
  218. package/dist-runtime/delivery/configuration-definition.d.ts +31 -0
  219. package/dist-runtime/delivery/configuration-definition.js +343 -0
  220. package/dist-runtime/delivery/configuration-definition.js.map +1 -0
  221. package/dist-runtime/delivery/configuration-hre.d.ts +17 -0
  222. package/dist-runtime/delivery/configuration-hre.js +198 -0
  223. package/dist-runtime/delivery/configuration-hre.js.map +1 -0
  224. package/dist-runtime/delivery/configuration-runtime.d.ts +36 -0
  225. package/dist-runtime/delivery/configuration-runtime.js +248 -0
  226. package/dist-runtime/delivery/configuration-runtime.js.map +1 -0
  227. package/dist-runtime/delivery/configuration.d.ts +35 -0
  228. package/dist-runtime/delivery/configuration.js +86 -0
  229. package/dist-runtime/delivery/configuration.js.map +1 -0
  230. package/dist-runtime/delivery/contract-source.d.ts +14 -0
  231. package/dist-runtime/delivery/contract-source.js +138 -0
  232. package/dist-runtime/delivery/contract-source.js.map +1 -0
  233. package/dist-runtime/delivery/create2.d.ts +3 -0
  234. package/dist-runtime/delivery/create2.js +48 -0
  235. package/dist-runtime/delivery/create2.js.map +1 -0
  236. package/dist-runtime/delivery/custom-closure.d.ts +27 -0
  237. package/dist-runtime/delivery/custom-closure.js +818 -0
  238. package/dist-runtime/delivery/custom-closure.js.map +1 -0
  239. package/dist-runtime/delivery/custom-format.d.ts +35 -0
  240. package/dist-runtime/delivery/custom-format.js +410 -0
  241. package/dist-runtime/delivery/custom-format.js.map +1 -0
  242. package/dist-runtime/delivery/custom.d.ts +32 -0
  243. package/dist-runtime/delivery/custom.js +158 -0
  244. package/dist-runtime/delivery/custom.js.map +1 -0
  245. package/dist-runtime/delivery/data.d.ts +7 -0
  246. package/dist-runtime/delivery/data.js +86 -0
  247. package/dist-runtime/delivery/data.js.map +1 -0
  248. package/dist-runtime/delivery/development.d.ts +92 -0
  249. package/dist-runtime/delivery/development.js +406 -0
  250. package/dist-runtime/delivery/development.js.map +1 -0
  251. package/dist-runtime/delivery/engine.d.ts +9 -0
  252. package/dist-runtime/delivery/engine.js +23 -0
  253. package/dist-runtime/delivery/engine.js.map +1 -0
  254. package/dist-runtime/delivery/eoa-observation.d.ts +43 -0
  255. package/dist-runtime/delivery/eoa-observation.js +145 -0
  256. package/dist-runtime/delivery/eoa-observation.js.map +1 -0
  257. package/dist-runtime/delivery/eoa-signed.d.ts +2 -0
  258. package/dist-runtime/delivery/eoa-signed.js +74 -0
  259. package/dist-runtime/delivery/eoa-signed.js.map +1 -0
  260. package/dist-runtime/delivery/eoa.d.ts +82 -0
  261. package/dist-runtime/delivery/eoa.js +274 -0
  262. package/dist-runtime/delivery/eoa.js.map +1 -0
  263. package/dist-runtime/delivery/execution-db.d.ts +20 -0
  264. package/dist-runtime/delivery/execution-db.js +153 -0
  265. package/dist-runtime/delivery/execution-db.js.map +1 -0
  266. package/dist-runtime/delivery/execution-files.d.ts +9 -0
  267. package/dist-runtime/delivery/execution-files.js +138 -0
  268. package/dist-runtime/delivery/execution-files.js.map +1 -0
  269. package/dist-runtime/delivery/execution-identity.d.ts +15 -0
  270. package/dist-runtime/delivery/execution-identity.js +33 -0
  271. package/dist-runtime/delivery/execution-identity.js.map +1 -0
  272. package/dist-runtime/delivery/execution-model.d.ts +56 -0
  273. package/dist-runtime/delivery/execution-model.js +66 -0
  274. package/dist-runtime/delivery/execution-model.js.map +1 -0
  275. package/dist-runtime/delivery/execution-store.d.ts +48 -0
  276. package/dist-runtime/delivery/execution-store.js +361 -0
  277. package/dist-runtime/delivery/execution-store.js.map +1 -0
  278. package/dist-runtime/delivery/existing-code.d.ts +37 -0
  279. package/dist-runtime/delivery/existing-code.js +83 -0
  280. package/dist-runtime/delivery/existing-code.js.map +1 -0
  281. package/dist-runtime/delivery/export.d.ts +51 -0
  282. package/dist-runtime/delivery/export.js +69 -0
  283. package/dist-runtime/delivery/export.js.map +1 -0
  284. package/dist-runtime/delivery/forkAudit.d.ts +119 -0
  285. package/dist-runtime/delivery/forkAudit.js +473 -0
  286. package/dist-runtime/delivery/forkAudit.js.map +1 -0
  287. package/dist-runtime/delivery/hardhat.d.ts +3 -0
  288. package/dist-runtime/delivery/hardhat.js +45 -0
  289. package/dist-runtime/delivery/hardhat.js.map +1 -0
  290. package/dist-runtime/delivery/history-registration.d.ts +2 -0
  291. package/dist-runtime/delivery/history-registration.js +17 -0
  292. package/dist-runtime/delivery/history-registration.js.map +1 -0
  293. package/dist-runtime/delivery/identities.d.ts +22 -0
  294. package/dist-runtime/delivery/identities.js +97 -0
  295. package/dist-runtime/delivery/identities.js.map +1 -0
  296. package/dist-runtime/delivery/input-files.d.ts +5 -0
  297. package/dist-runtime/delivery/input-files.js +70 -0
  298. package/dist-runtime/delivery/input-files.js.map +1 -0
  299. package/dist-runtime/delivery/inputs.d.ts +62 -0
  300. package/dist-runtime/delivery/inputs.js +194 -0
  301. package/dist-runtime/delivery/inputs.js.map +1 -0
  302. package/dist-runtime/delivery/journal.d.ts +35 -0
  303. package/dist-runtime/delivery/journal.js +278 -0
  304. package/dist-runtime/delivery/journal.js.map +1 -0
  305. package/dist-runtime/delivery/manifest.d.ts +14 -0
  306. package/dist-runtime/delivery/manifest.js +68 -0
  307. package/dist-runtime/delivery/manifest.js.map +1 -0
  308. package/dist-runtime/delivery/materialization.d.ts +20 -0
  309. package/dist-runtime/delivery/materialization.js +138 -0
  310. package/dist-runtime/delivery/materialization.js.map +1 -0
  311. package/dist-runtime/delivery/observations.d.ts +31 -0
  312. package/dist-runtime/delivery/observations.js +38 -0
  313. package/dist-runtime/delivery/observations.js.map +1 -0
  314. package/dist-runtime/delivery/parameter-defaults.d.ts +10 -0
  315. package/dist-runtime/delivery/parameter-defaults.js +86 -0
  316. package/dist-runtime/delivery/parameter-defaults.js.map +1 -0
  317. package/dist-runtime/delivery/parameters.d.ts +55 -0
  318. package/dist-runtime/delivery/parameters.js +279 -0
  319. package/dist-runtime/delivery/parameters.js.map +1 -0
  320. package/dist-runtime/delivery/pending.d.ts +70 -0
  321. package/dist-runtime/delivery/pending.js +99 -0
  322. package/dist-runtime/delivery/pending.js.map +1 -0
  323. package/dist-runtime/delivery/plan.d.ts +50 -0
  324. package/dist-runtime/delivery/plan.js +209 -0
  325. package/dist-runtime/delivery/plan.js.map +1 -0
  326. package/dist-runtime/delivery/planning.d.ts +84 -0
  327. package/dist-runtime/delivery/planning.js +318 -0
  328. package/dist-runtime/delivery/planning.js.map +1 -0
  329. package/dist-runtime/delivery/policy.d.ts +4 -0
  330. package/dist-runtime/delivery/policy.js +9 -0
  331. package/dist-runtime/delivery/policy.js.map +1 -0
  332. package/dist-runtime/delivery/preparation.d.ts +6 -0
  333. package/dist-runtime/delivery/preparation.js +178 -0
  334. package/dist-runtime/delivery/preparation.js.map +1 -0
  335. package/dist-runtime/delivery/production-environment.d.ts +2 -0
  336. package/dist-runtime/delivery/production-environment.js +13 -0
  337. package/dist-runtime/delivery/production-environment.js.map +1 -0
  338. package/dist-runtime/delivery/production-finalization.d.ts +86 -0
  339. package/dist-runtime/delivery/production-finalization.js +292 -0
  340. package/dist-runtime/delivery/production-finalization.js.map +1 -0
  341. package/dist-runtime/delivery/production-intent.d.ts +2 -0
  342. package/dist-runtime/delivery/production-intent.js +16 -0
  343. package/dist-runtime/delivery/production-intent.js.map +1 -0
  344. package/dist-runtime/delivery/production.d.ts +582 -0
  345. package/dist-runtime/delivery/production.js +445 -0
  346. package/dist-runtime/delivery/production.js.map +1 -0
  347. package/dist-runtime/delivery/project-files.d.ts +8 -0
  348. package/dist-runtime/delivery/project-files.js +87 -0
  349. package/dist-runtime/delivery/project-files.js.map +1 -0
  350. package/dist-runtime/delivery/project-rpc.d.ts +19 -0
  351. package/dist-runtime/delivery/project-rpc.js +138 -0
  352. package/dist-runtime/delivery/project-rpc.js.map +1 -0
  353. package/dist-runtime/delivery/project.d.ts +17 -0
  354. package/dist-runtime/delivery/project.js +170 -0
  355. package/dist-runtime/delivery/project.js.map +1 -0
  356. package/dist-runtime/delivery/protocol.d.ts +49 -0
  357. package/dist-runtime/delivery/protocol.js +112 -0
  358. package/dist-runtime/delivery/protocol.js.map +1 -0
  359. package/dist-runtime/delivery/public-calldata.d.ts +25 -0
  360. package/dist-runtime/delivery/public-calldata.js +97 -0
  361. package/dist-runtime/delivery/public-calldata.js.map +1 -0
  362. package/dist-runtime/delivery/references.d.ts +19 -0
  363. package/dist-runtime/delivery/references.js +84 -0
  364. package/dist-runtime/delivery/references.js.map +1 -0
  365. package/dist-runtime/delivery/release-graph.d.ts +97 -0
  366. package/dist-runtime/delivery/release-graph.js +139 -0
  367. package/dist-runtime/delivery/release-graph.js.map +1 -0
  368. package/dist-runtime/delivery/release-history-capture.d.ts +7 -0
  369. package/dist-runtime/delivery/release-history-capture.js +76 -0
  370. package/dist-runtime/delivery/release-history-capture.js.map +1 -0
  371. package/dist-runtime/delivery/release-history.d.ts +43 -0
  372. package/dist-runtime/delivery/release-history.js +322 -0
  373. package/dist-runtime/delivery/release-history.js.map +1 -0
  374. package/dist-runtime/delivery/release-inputs.d.ts +33 -0
  375. package/dist-runtime/delivery/release-inputs.js +129 -0
  376. package/dist-runtime/delivery/release-inputs.js.map +1 -0
  377. package/dist-runtime/delivery/release.d.ts +196 -0
  378. package/dist-runtime/delivery/release.js +261 -0
  379. package/dist-runtime/delivery/release.js.map +1 -0
  380. package/dist-runtime/delivery/safe-manifest.d.ts +9 -0
  381. package/dist-runtime/delivery/safe-manifest.js +13 -0
  382. package/dist-runtime/delivery/safe-manifest.js.map +1 -0
  383. package/dist-runtime/delivery/safe-observation.d.ts +30 -0
  384. package/dist-runtime/delivery/safe-observation.js +487 -0
  385. package/dist-runtime/delivery/safe-observation.js.map +1 -0
  386. package/dist-runtime/delivery/safe-prepare.d.ts +13 -0
  387. package/dist-runtime/delivery/safe-prepare.js +81 -0
  388. package/dist-runtime/delivery/safe-prepare.js.map +1 -0
  389. package/dist-runtime/delivery/safe.d.ts +92 -0
  390. package/dist-runtime/delivery/safe.js +254 -0
  391. package/dist-runtime/delivery/safe.js.map +1 -0
  392. package/dist-runtime/delivery/same-fork-baseline.d.ts +8 -0
  393. package/dist-runtime/delivery/same-fork-baseline.js +21 -0
  394. package/dist-runtime/delivery/same-fork-baseline.js.map +1 -0
  395. package/dist-runtime/delivery/setup.d.ts +31 -0
  396. package/dist-runtime/delivery/setup.js +230 -0
  397. package/dist-runtime/delivery/setup.js.map +1 -0
  398. package/dist-runtime/delivery/source.d.ts +42 -0
  399. package/dist-runtime/delivery/source.js +139 -0
  400. package/dist-runtime/delivery/source.js.map +1 -0
  401. package/dist-runtime/delivery/target-fields.d.ts +2 -0
  402. package/dist-runtime/delivery/target-fields.js +11 -0
  403. package/dist-runtime/delivery/target-fields.js.map +1 -0
  404. package/dist-runtime/delivery/task-identity.d.ts +23 -0
  405. package/dist-runtime/delivery/task-identity.js +109 -0
  406. package/dist-runtime/delivery/task-identity.js.map +1 -0
  407. package/dist-runtime/delivery/toolchain.d.ts +3 -0
  408. package/dist-runtime/delivery/toolchain.js +52 -0
  409. package/dist-runtime/delivery/toolchain.js.map +1 -0
  410. package/dist-runtime/delivery/validation.d.ts +9 -0
  411. package/dist-runtime/delivery/validation.js +155 -0
  412. package/dist-runtime/delivery/validation.js.map +1 -0
  413. package/dist-runtime/delivery/verification.d.ts +16 -0
  414. package/dist-runtime/delivery/verification.js +65 -0
  415. package/dist-runtime/delivery/verification.js.map +1 -0
  416. package/dist-runtime/migrate.js +1 -0
  417. package/dist-runtime/migrate.js.map +1 -1
  418. package/dist-runtime/miner/binary.d.ts +2 -0
  419. package/dist-runtime/miner/binary.js +54 -0
  420. package/dist-runtime/miner/binary.js.map +1 -0
  421. package/dist-runtime/miner/cli.d.ts +1 -0
  422. package/dist-runtime/miner/cli.js +131 -0
  423. package/dist-runtime/miner/cli.js.map +1 -0
  424. package/dist-runtime/miner/index.d.ts +5 -0
  425. package/dist-runtime/miner/index.js +13 -0
  426. package/dist-runtime/miner/index.js.map +1 -0
  427. package/dist-runtime/miner/request.d.ts +7 -0
  428. package/dist-runtime/miner/request.js +73 -0
  429. package/dist-runtime/miner/request.js.map +1 -0
  430. package/dist-runtime/miner/runner.d.ts +2 -0
  431. package/dist-runtime/miner/runner.js +131 -0
  432. package/dist-runtime/miner/runner.js.map +1 -0
  433. package/dist-runtime/miner/types.d.ts +89 -0
  434. package/dist-runtime/miner/types.js +3 -0
  435. package/dist-runtime/miner/types.js.map +1 -0
  436. package/dist-runtime/miner/verify.d.ts +2 -0
  437. package/dist-runtime/miner/verify.js +75 -0
  438. package/dist-runtime/miner/verify.js.map +1 -0
  439. package/dist-runtime/runtime-identity.json +2 -2
  440. package/dist-runtime/vendor/plan-codec/index.cjs +897 -0
  441. package/dist-runtime/vendor/plan-codec/index.d.cts +38 -0
  442. package/dist-runtime/vendor/plan-codec/provenance.json +25 -0
  443. package/dist-runtime/workflow/engine.d.ts +14 -0
  444. package/dist-runtime/workflow/engine.js +160 -0
  445. package/dist-runtime/workflow/engine.js.map +1 -0
  446. package/dist-runtime/workflow/lib/authority.d.ts +6 -3
  447. package/dist-runtime/workflow/lib/authority.js.map +1 -1
  448. package/dist-runtime/workflow/lib/calls.d.ts +1 -1
  449. package/dist-runtime/workflow/lib/calls.js +44 -34
  450. package/dist-runtime/workflow/lib/calls.js.map +1 -1
  451. package/dist-runtime/workflow/lib/canonicalData.d.ts +8 -0
  452. package/dist-runtime/workflow/lib/canonicalData.js +68 -0
  453. package/dist-runtime/workflow/lib/canonicalData.js.map +1 -0
  454. package/dist-runtime/workflow/lib/checkCodeRunner.js +7 -4
  455. package/dist-runtime/workflow/lib/checkCodeRunner.js.map +1 -1
  456. package/dist-runtime/workflow/lib/config.d.ts +3 -1
  457. package/dist-runtime/workflow/lib/config.js.map +1 -1
  458. package/dist-runtime/workflow/lib/context.d.ts +77 -0
  459. package/dist-runtime/workflow/lib/context.js +3 -0
  460. package/dist-runtime/workflow/lib/context.js.map +1 -0
  461. package/dist-runtime/workflow/lib/create2.d.ts +5 -27
  462. package/dist-runtime/workflow/lib/create2.js +11 -79
  463. package/dist-runtime/workflow/lib/create2.js.map +1 -1
  464. package/dist-runtime/workflow/lib/deploymentInfo.d.ts +2 -0
  465. package/dist-runtime/workflow/lib/deploymentInfo.js +6 -0
  466. package/dist-runtime/workflow/lib/deploymentInfo.js.map +1 -1
  467. package/dist-runtime/workflow/lib/deploymentRecords.d.ts +2 -0
  468. package/dist-runtime/workflow/lib/deploymentRecords.js +1 -1
  469. package/dist-runtime/workflow/lib/deploymentRecords.js.map +1 -1
  470. package/dist-runtime/workflow/lib/deployments.d.ts +5 -5
  471. package/dist-runtime/workflow/lib/deployments.js +5 -13
  472. package/dist-runtime/workflow/lib/deployments.js.map +1 -1
  473. package/dist-runtime/workflow/lib/evidencePorts.d.ts +55 -0
  474. package/dist-runtime/workflow/lib/evidencePorts.js +3 -0
  475. package/dist-runtime/workflow/lib/evidencePorts.js.map +1 -0
  476. package/dist-runtime/workflow/lib/executionPlan.d.ts +4 -42
  477. package/dist-runtime/workflow/lib/executionPlan.js +15 -210
  478. package/dist-runtime/workflow/lib/executionPlan.js.map +1 -1
  479. package/dist-runtime/workflow/lib/externalExecutionScanner.js +2 -1
  480. package/dist-runtime/workflow/lib/externalExecutionScanner.js.map +1 -1
  481. package/dist-runtime/workflow/lib/gateTool.d.ts +6 -2
  482. package/dist-runtime/workflow/lib/gateTool.js +22 -12
  483. package/dist-runtime/workflow/lib/gateTool.js.map +1 -1
  484. package/dist-runtime/workflow/lib/gateToolSync.d.ts +4 -1
  485. package/dist-runtime/workflow/lib/gateToolSync.js +8 -2
  486. package/dist-runtime/workflow/lib/gateToolSync.js.map +1 -1
  487. package/dist-runtime/workflow/lib/operationNames.d.ts +3 -0
  488. package/dist-runtime/workflow/lib/operationNames.js +34 -0
  489. package/dist-runtime/workflow/lib/operationNames.js.map +1 -0
  490. package/dist-runtime/workflow/lib/parameters.d.ts +1 -1
  491. package/dist-runtime/workflow/lib/parameters.js +11 -22
  492. package/dist-runtime/workflow/lib/parameters.js.map +1 -1
  493. package/dist-runtime/workflow/lib/pendingDeploymentReuse.js +18 -52
  494. package/dist-runtime/workflow/lib/pendingDeploymentReuse.js.map +1 -1
  495. package/dist-runtime/workflow/lib/pendingUupsBinding.d.ts +42 -0
  496. package/dist-runtime/workflow/lib/pendingUupsBinding.js +39 -0
  497. package/dist-runtime/workflow/lib/pendingUupsBinding.js.map +1 -0
  498. package/dist-runtime/workflow/lib/plan.d.ts +55 -0
  499. package/dist-runtime/workflow/lib/plan.js +324 -0
  500. package/dist-runtime/workflow/lib/plan.js.map +1 -0
  501. package/dist-runtime/workflow/lib/planCli.d.ts +14 -0
  502. package/dist-runtime/workflow/lib/planCli.js +279 -0
  503. package/dist-runtime/workflow/lib/planCli.js.map +1 -0
  504. package/dist-runtime/workflow/lib/preparationEvidence.d.ts +4 -0
  505. package/dist-runtime/workflow/lib/preparationEvidence.js +19 -0
  506. package/dist-runtime/workflow/lib/preparationEvidence.js.map +1 -0
  507. package/dist-runtime/workflow/lib/proxy.d.ts +4 -2
  508. package/dist-runtime/workflow/lib/proxy.js +3 -4
  509. package/dist-runtime/workflow/lib/proxy.js.map +1 -1
  510. package/dist-runtime/workflow/lib/runtime.d.ts +6 -0
  511. package/dist-runtime/workflow/lib/runtime.js +48 -0
  512. package/dist-runtime/workflow/lib/runtime.js.map +1 -0
  513. package/dist-runtime/workflow/lib/signer.d.ts +3 -2
  514. package/dist-runtime/workflow/lib/signer.js +18 -18
  515. package/dist-runtime/workflow/lib/signer.js.map +1 -1
  516. package/dist-runtime/workflow/lib/simulation.d.ts +13 -6
  517. package/dist-runtime/workflow/lib/simulation.js +39 -31
  518. package/dist-runtime/workflow/lib/simulation.js.map +1 -1
  519. package/dist-runtime/workflow/lib/state.js +3 -3
  520. package/dist-runtime/workflow/lib/state.js.map +1 -1
  521. package/dist-runtime/workflow/lib/staticValidation.d.ts +28 -0
  522. package/dist-runtime/workflow/lib/staticValidation.js +54 -10
  523. package/dist-runtime/workflow/lib/staticValidation.js.map +1 -1
  524. package/dist-runtime/workflow/lib/transactionPlanner.d.ts +62 -0
  525. package/dist-runtime/workflow/lib/transactionPlanner.js +258 -0
  526. package/dist-runtime/workflow/lib/transactionPlanner.js.map +1 -0
  527. package/dist-runtime/workflow/lib/typedValue.d.ts +3 -0
  528. package/dist-runtime/workflow/lib/typedValue.js +76 -0
  529. package/dist-runtime/workflow/lib/typedValue.js.map +1 -0
  530. package/dist-runtime/workflow/lib/validation.d.ts +23 -0
  531. package/dist-runtime/workflow/lib/validation.js +15 -0
  532. package/dist-runtime/workflow/lib/validation.js.map +1 -0
  533. package/dist-runtime/workflow/planAdd.d.ts +1 -0
  534. package/dist-runtime/workflow/planAdd.js +11 -0
  535. package/dist-runtime/workflow/planAdd.js.map +1 -0
  536. package/dist-runtime/workflow/planRead.d.ts +1 -0
  537. package/dist-runtime/workflow/planRead.js +11 -0
  538. package/dist-runtime/workflow/planRead.js.map +1 -0
  539. package/dist-runtime/workflow/planStatus.d.ts +1 -0
  540. package/dist-runtime/workflow/planStatus.js +11 -0
  541. package/dist-runtime/workflow/planStatus.js.map +1 -0
  542. package/dist-runtime/workflow/planWrite.d.ts +1 -0
  543. package/dist-runtime/workflow/planWrite.js +11 -0
  544. package/dist-runtime/workflow/planWrite.js.map +1 -0
  545. package/dist-runtime/workflow/run.d.ts +1 -40
  546. package/dist-runtime/workflow/run.js +69 -139
  547. package/dist-runtime/workflow/run.js.map +1 -1
  548. package/dist-runtime/workflow/staticValidate.js +8 -3
  549. package/dist-runtime/workflow/staticValidate.js.map +1 -1
  550. package/dist-runtime/workflow/steps/call.d.ts +1 -1
  551. package/dist-runtime/workflow/steps/check.d.ts +1 -1
  552. package/dist-runtime/workflow/steps/custom.d.ts +1 -1
  553. package/dist-runtime/workflow/steps/deploy.d.ts +1 -1
  554. package/dist-runtime/workflow/steps/deploy.js +110 -55
  555. package/dist-runtime/workflow/steps/deploy.js.map +1 -1
  556. package/dist-runtime/workflow/steps/upgrade.d.ts +1 -1
  557. package/dist-runtime/workflow/steps/upgrade.js +84 -49
  558. package/dist-runtime/workflow/steps/upgrade.js.map +1 -1
  559. package/dist-runtime/workflow/steps/view.d.ts +1 -1
  560. package/docs/compiler-qualification.md +38 -0
  561. package/docs/configuration-runtime-observation.md +29 -0
  562. package/docs/create2-miner.md +100 -0
  563. package/docs/delivery-aggregate.md +29 -0
  564. package/docs/delivery-calldata.md +27 -0
  565. package/docs/delivery-custom-input-closure.md +51 -0
  566. package/docs/delivery-development.md +38 -0
  567. package/docs/delivery-eoa.md +46 -0
  568. package/docs/delivery-evm-manifest.md +20 -0
  569. package/docs/delivery-execution-store.md +33 -0
  570. package/docs/delivery-inputs.md +95 -0
  571. package/docs/delivery-parameters.md +65 -0
  572. package/docs/delivery-planning.md +140 -0
  573. package/docs/delivery-release.md +119 -0
  574. package/docs/delivery-safe.md +75 -0
  575. package/docs/delivery-setup.md +198 -0
  576. package/docs/delivery-source.md +67 -0
  577. package/docs/direct-package-acceptance.md +2 -0
  578. package/docs/openzeppelin-acceptance.md +86 -0
  579. package/docs/openzeppelin-baseline.json +27 -0
  580. package/docs/openzeppelin-integration.md +115 -0
  581. package/docs/plans/2026-10-28-openzeppelin-toolkit-consolidation.md +396 -0
  582. package/docs/plans/2026-11-02-transparent-proxy-delivery.md +78 -0
  583. package/docs/superpowers/plans/2026-08-17-custody-hardhat-signers.md +1 -1
  584. package/docs/superpowers/plans/2026-09-24-scheme-aware-static-validation.md +193 -0
  585. package/docs/superpowers/plans/2026-10-28-create2-miner.md +82 -0
  586. package/docs/workflow-reference.md +12 -4
  587. package/docs/workflow-runtime.md +6 -0
  588. package/package.json +148 -10
  589. package/resources/create2/LICENSE +21 -0
  590. package/resources/create2/README.md +9 -0
  591. package/resources/create2/darwin-arm64/smartflow_miner +0 -0
  592. package/resources/create2/darwin-x64/smartflow_miner +0 -0
  593. package/resources/create2/manifest.json +27 -0
  594. package/runtime/config/hardhatAdapters.ts +2 -1
  595. package/runtime/config/openzeppelin.ts +3 -21
  596. package/runtime/delivery/abi.ts +225 -0
  597. package/runtime/delivery/aggregate-bootstrap.ts +31 -0
  598. package/runtime/delivery/aggregate-channel.ts +88 -0
  599. package/runtime/delivery/aggregate-diagnostics.ts +63 -0
  600. package/runtime/delivery/aggregate-inputs.ts +39 -0
  601. package/runtime/delivery/aggregate-source.ts +57 -0
  602. package/runtime/delivery/aggregate-worker.ts +143 -0
  603. package/runtime/delivery/aggregate.ts +139 -0
  604. package/runtime/delivery/bindings.ts +37 -0
  605. package/runtime/delivery/business-extension.ts +33 -0
  606. package/runtime/delivery/calldata-archive.ts +25 -0
  607. package/runtime/delivery/calldata-details.ts +90 -0
  608. package/runtime/delivery/calldata-format.ts +14 -0
  609. package/runtime/delivery/calldata-preparations.ts +76 -0
  610. package/runtime/delivery/calldata-review.ts +126 -0
  611. package/runtime/delivery/check-code.ts +38 -0
  612. package/runtime/delivery/closure-format.ts +350 -0
  613. package/runtime/delivery/codec-pin.ts +3 -0
  614. package/runtime/delivery/codec.ts +50 -0
  615. package/runtime/delivery/compiler-dependency-pins.ts +1685 -0
  616. package/runtime/delivery/compiler-files.ts +181 -0
  617. package/runtime/delivery/compiler-io.ts +10 -0
  618. package/runtime/delivery/compiler-pins.ts +143 -0
  619. package/runtime/delivery/compiler.ts +701 -0
  620. package/runtime/delivery/config.ts +116 -0
  621. package/runtime/delivery/configuration-definition.ts +160 -0
  622. package/runtime/delivery/configuration-hre.ts +130 -0
  623. package/runtime/delivery/configuration-runtime.ts +163 -0
  624. package/runtime/delivery/configuration.ts +67 -0
  625. package/runtime/delivery/contract-source.ts +112 -0
  626. package/runtime/delivery/create2.ts +57 -0
  627. package/runtime/delivery/custom-closure.ts +993 -0
  628. package/runtime/delivery/custom-format.ts +479 -0
  629. package/runtime/delivery/custom.ts +219 -0
  630. package/runtime/delivery/data.ts +94 -0
  631. package/runtime/delivery/development.ts +264 -0
  632. package/runtime/delivery/engine.ts +29 -0
  633. package/runtime/delivery/eoa-observation.ts +106 -0
  634. package/runtime/delivery/eoa-signed.ts +55 -0
  635. package/runtime/delivery/eoa.ts +288 -0
  636. package/runtime/delivery/execution-db.ts +131 -0
  637. package/runtime/delivery/execution-files.ts +135 -0
  638. package/runtime/delivery/execution-identity.ts +32 -0
  639. package/runtime/delivery/execution-model.ts +102 -0
  640. package/runtime/delivery/execution-store.ts +411 -0
  641. package/runtime/delivery/existing-code.ts +45 -0
  642. package/runtime/delivery/export.ts +99 -0
  643. package/runtime/delivery/forkAudit.ts +620 -0
  644. package/runtime/delivery/hardhat.ts +38 -0
  645. package/runtime/delivery/history-registration.ts +10 -0
  646. package/runtime/delivery/identities.ts +132 -0
  647. package/runtime/delivery/input-files.ts +46 -0
  648. package/runtime/delivery/inputs.ts +204 -0
  649. package/runtime/delivery/journal.ts +205 -0
  650. package/runtime/delivery/manifest.ts +54 -0
  651. package/runtime/delivery/materialization.ts +53 -0
  652. package/runtime/delivery/observations.ts +60 -0
  653. package/runtime/delivery/parameter-defaults.ts +75 -0
  654. package/runtime/delivery/parameters.ts +367 -0
  655. package/runtime/delivery/pending.ts +98 -0
  656. package/runtime/delivery/plan.ts +337 -0
  657. package/runtime/delivery/planning.ts +411 -0
  658. package/runtime/delivery/policy.ts +9 -0
  659. package/runtime/delivery/preparation.ts +240 -0
  660. package/runtime/delivery/production-environment.ts +7 -0
  661. package/runtime/delivery/production-finalization.ts +181 -0
  662. package/runtime/delivery/production-intent.ts +14 -0
  663. package/runtime/delivery/production.ts +415 -0
  664. package/runtime/delivery/project-files.ts +63 -0
  665. package/runtime/delivery/project-rpc.ts +116 -0
  666. package/runtime/delivery/project.ts +129 -0
  667. package/runtime/delivery/protocol.ts +94 -0
  668. package/runtime/delivery/public-calldata.ts +74 -0
  669. package/runtime/delivery/references.ts +106 -0
  670. package/runtime/delivery/release-graph.ts +79 -0
  671. package/runtime/delivery/release-history-capture.ts +32 -0
  672. package/runtime/delivery/release-history.ts +178 -0
  673. package/runtime/delivery/release-inputs.ts +107 -0
  674. package/runtime/delivery/release.ts +166 -0
  675. package/runtime/delivery/safe-manifest.ts +11 -0
  676. package/runtime/delivery/safe-observation.ts +626 -0
  677. package/runtime/delivery/safe-prepare.ts +101 -0
  678. package/runtime/delivery/safe.ts +355 -0
  679. package/runtime/delivery/same-fork-baseline.ts +17 -0
  680. package/runtime/delivery/setup.ts +184 -0
  681. package/runtime/delivery/source.ts +130 -0
  682. package/runtime/delivery/target-fields.ts +7 -0
  683. package/runtime/delivery/task-identity.ts +85 -0
  684. package/runtime/delivery/toolchain.ts +48 -0
  685. package/runtime/delivery/validation.ts +252 -0
  686. package/runtime/delivery/verification.ts +47 -0
  687. package/runtime/migrate.ts +1 -0
  688. package/runtime/miner/binary.ts +41 -0
  689. package/runtime/miner/cli.ts +87 -0
  690. package/runtime/miner/index.ts +5 -0
  691. package/runtime/miner/request.ts +54 -0
  692. package/runtime/miner/runner.ts +90 -0
  693. package/runtime/miner/types.ts +71 -0
  694. package/runtime/miner/verify.ts +61 -0
  695. package/runtime/vendor/plan-codec/index.cjs +897 -0
  696. package/runtime/vendor/plan-codec/index.d.cts +38 -0
  697. package/runtime/vendor/plan-codec/provenance.json +25 -0
  698. package/runtime/workflow/engine.ts +174 -0
  699. package/runtime/workflow/lib/authority.ts +3 -3
  700. package/runtime/workflow/lib/calls.ts +47 -37
  701. package/runtime/workflow/lib/canonicalData.ts +45 -0
  702. package/runtime/workflow/lib/checkCodeRunner.ts +7 -3
  703. package/runtime/workflow/lib/config.ts +1 -1
  704. package/runtime/workflow/lib/context.ts +77 -0
  705. package/runtime/workflow/lib/create2.ts +18 -121
  706. package/runtime/workflow/lib/deploymentInfo.ts +8 -0
  707. package/runtime/workflow/lib/deploymentRecords.ts +3 -1
  708. package/runtime/workflow/lib/deployments.ts +6 -14
  709. package/runtime/workflow/lib/evidencePorts.ts +20 -0
  710. package/runtime/workflow/lib/executionPlan.ts +17 -268
  711. package/runtime/workflow/lib/externalExecutionScanner.ts +2 -1
  712. package/runtime/workflow/lib/gateTool.ts +22 -10
  713. package/runtime/workflow/lib/gateToolSync.ts +11 -3
  714. package/runtime/workflow/lib/operationNames.ts +32 -0
  715. package/runtime/workflow/lib/parameters.ts +8 -21
  716. package/runtime/workflow/lib/pendingDeploymentReuse.ts +4 -56
  717. package/runtime/workflow/lib/pendingUupsBinding.ts +43 -0
  718. package/runtime/workflow/lib/plan.ts +334 -0
  719. package/runtime/workflow/lib/planCli.ts +279 -0
  720. package/runtime/workflow/lib/preparationEvidence.ts +14 -0
  721. package/runtime/workflow/lib/proxy.ts +6 -3
  722. package/runtime/workflow/lib/runtime.ts +46 -0
  723. package/runtime/workflow/lib/signer.ts +8 -5
  724. package/runtime/workflow/lib/simulation.ts +41 -17
  725. package/runtime/workflow/lib/state.ts +3 -3
  726. package/runtime/workflow/lib/staticValidation.ts +92 -11
  727. package/runtime/workflow/lib/transactionPlanner.ts +314 -0
  728. package/runtime/workflow/lib/typedValue.ts +46 -0
  729. package/runtime/workflow/lib/validation.ts +50 -0
  730. package/runtime/workflow/planAdd.ts +8 -0
  731. package/runtime/workflow/planRead.ts +8 -0
  732. package/runtime/workflow/planStatus.ts +8 -0
  733. package/runtime/workflow/planWrite.ts +8 -0
  734. package/runtime/workflow/run.ts +42 -176
  735. package/runtime/workflow/staticValidate.ts +8 -3
  736. package/runtime/workflow/steps/call.ts +1 -1
  737. package/runtime/workflow/steps/check.ts +1 -1
  738. package/runtime/workflow/steps/custom.ts +1 -1
  739. package/runtime/workflow/steps/deploy.ts +99 -58
  740. package/runtime/workflow/steps/upgrade.ts +88 -57
  741. package/runtime/workflow/steps/view.ts +1 -1
  742. package/bin/workflow.cjs +0 -19
@@ -0,0 +1,143 @@
1
+ /** Fixed package entry; business modules are loaded only after the private stage command. */
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import {createRequire} from 'node:module';
5
+ import {parseWorkerMessage,type WorkerMessage} from './aggregate-channel';
6
+ import {strictData} from './data';
7
+ import {canonicalJson,deepFreeze,semanticHash,exactObject} from '../workflow/lib/canonicalData';
8
+ import type {StagedDeliveryCollection,DeliveryCollection} from './planning';
9
+ import type {DeliveryConfigurationHandle,DeliveryConfigurationEvidence} from './configuration';
10
+ import type {DeliveryCompilerCollector,CompilerEvidence} from './compiler';
11
+ import type {openOwnedSource} from './aggregate-source';
12
+ import {workerFailureReason,sourceRpcFailures} from './aggregate-diagnostics';
13
+
14
+ if(!process.send||!process.connected||require.main!==module){console.error('Aggregate worker requires an owned channel');process.exit(1);}
15
+ let state:'new'|'staging'|'staged'|'checked'|'bound'|'closed'|'failed'='new',last=0;
16
+ let association:{session:string;epoch:string;target:string}|undefined;
17
+ let role:'source'|'target',config:DeliveryConfigurationHandle|undefined,stage:StagedDeliveryCollection|undefined;
18
+ let source:Awaited<ReturnType<typeof openOwnedSource>>|undefined,compiler:DeliveryCompilerCollector|undefined;
19
+ let stagedCompiler:CompilerEvidence|undefined,finalConfiguration:DeliveryConfigurationEvidence|undefined;
20
+ let busy=false,initial:any,contribution:any;
21
+ let phase='protocol';
22
+ async function cleanup(){stage?.close();config?.close();await source?.close();}
23
+ async function dispatch(message:WorkerMessage):Promise<unknown>{
24
+ if(!['stage','bind'].includes(message.command)&&message.data!==null)throw new Error('Unexpected worker command data');
25
+ if(message.command==='stage'){
26
+ if(state!=='new')throw new Error('Duplicate worker stage');
27
+ state='staging';initial=deepFreeze(strictData(message.data)) as any;
28
+ exactObject(initial,initial.role==='source'?['root','workspaceRoot','projectRoot','request','role','handshakePath']:['root','workspaceRoot','projectRoot','request','role','handshake','target','params','steps','deploymentId','businessRoot','executionId','sourceDefinitionHash',...(Object.hasOwn(initial,'derivationSeed')?['derivationSeed']:[])],'worker stage input');
29
+ const {parseDeliveryRequest}=require('./protocol') as typeof import('./protocol');
30
+ const request=parseDeliveryRequest(initial.request);role=initial.role;
31
+ if(!['source','target'].includes(role)||request.network!==message.target||request.mode!=='simulate')throw new Error('Worker target mismatch');
32
+ const root=fs.realpathSync(process.cwd());
33
+ if(root!==initial.root)throw new Error('Worker root mismatch');
34
+ process.env.GATE_DELIVERY_CONTEXT=JSON.stringify(request);
35
+ process.env.HARDHAT_NETWORK=role==='source'?request.network:'hardhat';
36
+ if(role==='target'){
37
+ const handshake=initial.handshake;
38
+ if(handshake?.version!==1||handshake.session!==message.session||handshake.target!==message.target||handshake.snapshot.chainId!==initial.target.chainId)throw new Error('Source handshake association mismatch');
39
+ require('./aggregate-bootstrap').establishOwnedFork({network:request.network,chainId:initial.target.chainId,url:handshake.proxyUrl,blockNumber:handshake.snapshot.blockNumber});
40
+ }
41
+ // This is the only project loader; same original project/config/module resolution.
42
+ const req=createRequire(path.join(root,'package.json'));
43
+ phase='project-loader';req('ts-node/register');
44
+ const hre=req('hardhat') as typeof import('hardhat');
45
+ if(role==='source'){
46
+ const {openOwnedSource}=require('./aggregate-source') as typeof import('./aggregate-source');
47
+ phase='source-open';source=await openOwnedSource(hre,request,message.session,message.epoch);
48
+ phase='source-configuration';config=require('./configuration').openDeliveryConfiguration({workspaceRoot:initial.workspaceRoot,projectRoot:initial.projectRoot,network:request.network});
49
+ fs.writeFileSync(initial.handshakePath,JSON.stringify(source.handshake),{flag:'wx',mode:0o600});
50
+ state='staged';return {ready:true,handshake:source.handshake};
51
+ }
52
+ const {stageDeliveryPlan}=require('./planning') as typeof import('./planning');
53
+ const {setupSimulationFork,verifySimulationForkSnapshot}=require('../workflow/lib/simulation') as typeof import('../workflow/lib/simulation');
54
+ const {impersonateWorkflowSimulationSigner}=require('../workflow/lib/signer') as typeof import('../workflow/lib/signer');
55
+ const {WorkflowState}=require('../workflow/lib/state') as typeof import('../workflow/lib/state');
56
+ const {qualifyDeliveryCompiler}=require('./compiler') as typeof import('./compiler');
57
+ phase='fork-setup';const simulation=await setupSimulationFork(hre,request.network,{snapshotJson:JSON.stringify(initial.handshake.snapshot),sourceRpcUrl:initial.handshake.proxyUrl});
58
+ phase='fork-verify';
59
+ await verifySimulationForkSnapshot(hre,simulation);
60
+ const operator=(request.devSigner??request.operator)!.toLowerCase();
61
+ phase='fork-signer';
62
+ const signer=await impersonateWorkflowSimulationSigner(hre,operator);
63
+ phase='target-configuration';config=require('./configuration').openDeliveryConfiguration({workspaceRoot:initial.workspaceRoot,projectRoot:initial.projectRoot,network:request.network});
64
+ phase='compile';compiler=await qualifyDeliveryCompiler(hre);
65
+ const header={version:1 as const,schema:'gate-delivery-plan' as const,deploymentId:initial.deploymentId,environment:request.environment,target:request.network,
66
+ chainId:String(initial.target.chainId),executionId:initial.executionId,operator,sourceDefinitionHash:initial.sourceDefinitionHash,runtimeIdentity:config!.snapshot.runtime.declared};
67
+ const context={root,taskDir:path.join(root,initial.businessRoot),taskId:initial.deploymentId,executionId:initial.executionId,targetId:request.network,target:initial.target,targetParams:initial.params,
68
+ existingDeploymentPolicies:{},config:{},mode:'simulate' as const,simulation,signer,signerAddress:operator,
69
+ runtime:{hre,localFork:{provider:hre.network.provider,impersonate:(address:string)=>impersonateWorkflowSimulationSigner(hre,address)}},
70
+ state:new WorkflowState(),externalCalls:[],operatorReceipts:[],reporter:{event(){},result(){}}};
71
+ const identities={read:async()=>header,readSourceBlock:async(blockNumber:number)=>{
72
+ const rpc=async(method:string,params:unknown[])=>{
73
+ const response=await fetch(initial.handshake.proxyUrl,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({jsonrpc:'2.0',id:1,method,params}),signal:AbortSignal.timeout(30000)});
74
+ const data=await response.json() as any;if(data.error)throw new Error(Object.values(sourceRpcFailures).includes(data.error.message)?data.error.message:'Source read failed');return data.result;
75
+ };
76
+ const [chain,block]=await Promise.all([rpc('eth_chainId',[]),rpc('eth_getBlockByNumber',['0x'+blockNumber.toString(16),false])]);
77
+ return {chainId:BigInt(chain).toString(),blockNumber:Number(BigInt(block.number)),blockHash:block.hash};
78
+ }};
79
+ phase='planning';stage=await stageDeliveryPlan({context,header,identities,steps:initial.steps,derivationSeed:initial.derivationSeed??initial.executionId});
80
+ if(!stage.snapshot.preparations.length){
81
+ phase='existing-code-artifacts';
82
+ const {collectExistingCodeArtifacts,requiredExistingAddresses}=require('./existing-code') as typeof import('./existing-code');
83
+ const {fileBytes}=require('./materialization') as typeof import('./materialization');
84
+ await collectExistingCodeArtifacts({target:request.network,addresses:requiredExistingAddresses({plan:stage.payload,verification:stage.snapshot.verification}),registry:JSON.parse(fileBytes(root,'contractInfo.json')??'{}'),metadata:JSON.parse(fileBytes(root,'deploymentInfo.json')??'{"version":1,"networks":{}}'),readArtifact:name=>hre.artifacts.readArtifact(name)});
85
+ }
86
+ phase='staged-reread';stagedCompiler=compiler.evidence();config!.assertUnchanged();
87
+ contribution={compiler:stagedCompiler,custom:stage.payload.customInputClosure,payloadHash:semanticHash(stage.payload),invariantHash:stage.invariantHash,snapshot:stage.snapshot};
88
+ state='staged';return {ready:true,...contribution,observation:{pid:process.pid,manifestDir:process.env.MANIFEST_DEFAULT_DIR,operator,executionId:initial.executionId}};
89
+ }
90
+ if(message.command==='check'){
91
+ phase='barrier';await (require('./compiler-io') as typeof import('./compiler-io')).yieldCompilerIo();
92
+ if(state!=='staged')throw new Error('Worker check order violation');
93
+ if(role==='source'){
94
+ phase='source-recheck';await source!.check();
95
+ phase='source-seal';finalConfiguration=config!.seal() as DeliveryConfigurationEvidence;
96
+ state='checked';return {configuration:finalConfiguration};
97
+ }
98
+ phase='plan-recheck';
99
+ await stage!.assertUnchanged();
100
+ phase='compiler-recheck';
101
+ if(canonicalJson(compiler!.evidence())!==canonicalJson(stagedCompiler))throw new Error('Compiler contribution drift');
102
+ phase='configuration-seal';finalConfiguration=config!.seal() as DeliveryConfigurationEvidence;
103
+ state='checked';return {configuration:finalConfiguration,...contribution};
104
+ }
105
+ if(message.command==='bind'){
106
+ if(state!=='checked'||role!=='target')throw new Error('Worker bind order violation');
107
+ const input=exactObject(message.data,['inputsHash'],'binding');
108
+ phase='binding';const result=stage!.bind(input.inputsHash as string);
109
+ const {inputsHash:_,planHash:__,...payload}=result.plan;
110
+ if(semanticHash(payload)!==contribution.payloadHash)throw new Error('Final binding changed staged payload');
111
+ state='bound';return result;
112
+ }
113
+ if(message.command==='close'){
114
+ if(!((role==='source'&&state==='checked')||(role==='target'&&state==='bound')))throw new Error('Worker close order violation');
115
+ await cleanup();state='closed';return {closed:true};
116
+ }
117
+ throw new Error('Unsupported worker command');
118
+ }
119
+ process.on('message',async raw=>{
120
+ let message:WorkerMessage;
121
+ try{
122
+ message=parseWorkerMessage(raw);
123
+ if(busy||state==='closed'||state==='failed'||message.id!==last+1)throw new Error('Worker protocol order violation');
124
+ if(!association){if(message.command!=='stage')throw new Error('Worker stage required');association={session:message.session,epoch:message.epoch,target:message.target};}
125
+ if(message.session!==association.session||message.epoch!==association.epoch||message.target!==association.target)throw new Error('Worker protocol association mismatch');
126
+ last=message.id;busy=true;
127
+ const value=await dispatch(message);
128
+ process.send!({...message,data:{ok:true,value}},(error:Error|null)=>{
129
+ if(error){state='failed';process.exit(1);}
130
+ if(state==='closed'){process.disconnect();process.exit(0);}
131
+ });
132
+ busy=false;
133
+ }catch(error){
134
+ state='failed';
135
+ const active=association;
136
+
137
+ const reason=workerFailureReason(error);
138
+ if(active&&process.connected)await new Promise<void>(resolve=>process.send!({version:1,...active,id:last,command:(raw as any)?.command,data:{ok:false,value:{phase,...(reason?{reason}:{})}}},()=>resolve()));
139
+ await cleanup().catch(()=>{});process.exit(1);
140
+ }
141
+ });
142
+ process.on('disconnect',()=>{if(state!=='closed')process.exit(1);});
143
+ process.once('SIGTERM',()=>{state='failed';void cleanup().finally(()=>process.exit(1));});
@@ -0,0 +1,139 @@
1
+ /** Owned multi-target input qualification. This grants no release-ready or broadcast authority. */
2
+ import fs from 'node:fs';
3
+ import {aggregateInputHash} from './execution-identity';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import {randomUUID} from 'node:crypto';
7
+ import {openDeliveryInputs,consumeDeliveryInputParameters,type DeliveryInputEvidence} from './inputs';
8
+ import {openAggregateSources} from './aggregate-inputs';
9
+ import {parseDeliveryRequest,safeId,type DeliveryRequest} from './protocol';
10
+ import {strictData} from './data';
11
+ import {inputDigest} from './input-files';
12
+ import {projectRoot} from './project-files';
13
+ import {RuntimeObservation} from './configuration-runtime';
14
+ import {OwnedWorker,OwnedWorkerFailure} from './aggregate-channel';
15
+ import {deepFreeze,canonicalJson,semanticHash,exactObject} from '../workflow/lib/canonicalData';
16
+ import type {DeliveryCollection} from './planning';
17
+ import type {DeliveryConfigurationEvidence} from './configuration';
18
+ import type {CompilerEvidence} from './compiler';
19
+ import type {CustomInputClosure} from './custom-closure';
20
+ export interface DeliveryAggregateOptions {
21
+ workspaceRoot:string;projectRoot:string;selection:'development'|'release'|'all';
22
+ targets:Array<{request:DeliveryRequest;executionId:string}>;
23
+ }
24
+ export interface DeliveryAggregate {
25
+ version:1;inputsHash:string;sourceDefinitionHash:string;
26
+ inputs:{business:DeliveryInputEvidence;sourceDefinitions:unknown;runtime:ReturnType<RuntimeObservation['observe']>;
27
+ targets:Array<{target:string;configuration:DeliveryConfigurationEvidence;sourceConfiguration:DeliveryConfigurationEvidence;compiler:CompilerEvidence;custom:CustomInputClosure|null}>;
28
+ files:Array<{path:string;digest:string}>};
29
+ collections:DeliveryCollection[];
30
+ /** Runtime diagnostics stay outside the immutable-input preimage. */
31
+ observations:Array<{target:string;pid:number;sourcePid:number;manifestDir:string;operator:string;executionId:string;payloadHash:string;invariantHash:string;exited:true}>;
32
+ }
33
+ function same(a:unknown,b:unknown,label:string):void{if(canonicalJson(a)!==canonicalJson(b))throw new Error(`${label} drift or mismatch`);}
34
+ /** Derives business data once; only actual worker channels can contribute staged authority. */
35
+ class DiscoveryReplayError extends Error {}
36
+ export async function collectDeliveryAggregate(raw:DeliveryAggregateOptions):Promise<Readonly<DeliveryAggregate>> {
37
+ try{return await collectOwnedAggregate(raw);}
38
+ catch(error){if(error instanceof OwnedWorkerFailure||error instanceof DiscoveryReplayError)throw error;throw new Error('Delivery aggregate input qualification failed');}
39
+ }
40
+ async function collectOwnedAggregate(raw:DeliveryAggregateOptions):Promise<Readonly<DeliveryAggregate>> {
41
+ const input=strictData(raw);
42
+ exactObject(input,['workspaceRoot','projectRoot','selection','targets'],'aggregate options');
43
+ if(!['development','release','all'].includes(input.selection)||!Array.isArray(input.targets)||!input.targets.length)throw new Error('Aggregate requires selected target requests');
44
+ const root=projectRoot(input.workspaceRoot,input.projectRoot),workspace=projectRoot(input.workspaceRoot,'.');
45
+ if(path.resolve(process.cwd())!==root)throw new Error('Aggregate must run from the original project root');
46
+ const targets=input.targets.map(value=>{
47
+ if(!value||Object.keys(value).some(k=>!['request','executionId','expected'].includes(k)))throw new Error('Invalid aggregate target');
48
+ if(Object.hasOwn(value,'expected'))throw new DiscoveryReplayError('Staged replay requires independently closed current inputs; use known-final collection');
49
+ const request=parseDeliveryRequest(value.request);safeId(value.executionId,'executionId');
50
+ if(request.mode!=='simulate'||request.purpose==='prod-execution')throw new Error('Aggregate input qualification requires simulation');
51
+ return {...value,request};
52
+ });
53
+ if(new Set(targets.map(x=>x.request.network)).size!==targets.length||new Set(targets.map(x=>x.executionId)).size!==targets.length)throw new Error('Aggregate target and execution IDs must be distinct');
54
+ // Every invocation gets its own actual environment/network/step/sourceRef validation.
55
+ const sourceOwner=openAggregateSources({workspaceRoot:workspace,projectRoot:input.projectRoot,requests:targets.map(x=>x.request)});
56
+ const {sources,definitions:sourceDefinitions,sourceDefinitionHash}=sourceOwner;
57
+ for(const source of sources){const scope=source.invocation.task.scope!.deployment as any,first=sources[0].invocation.task.scope!.deployment as any;
58
+ for(const key of ['deploymentId','developmentNetwork','releaseTargetNetworks','projectRoot'])same(scope[key],first[key],'Aggregate business scope');
59
+ }
60
+ let runtime:RuntimeObservation|undefined,business:ReturnType<typeof openDeliveryInputs>|undefined;
61
+ const workers:OwnedWorker[]=[];let failure:Error|undefined;
62
+ const session=randomUUID(),directory=fs.mkdtempSync(path.join(os.tmpdir(),'gate-delivery-aggregate-'));
63
+ const live=()=>{if(failure)throw failure;for(const worker of workers)worker.assertLive();};
64
+ const checkSources=()=>sourceOwner.assertUnchanged();
65
+ try{
66
+ runtime=new RuntimeObservation(root);
67
+ business=openDeliveryInputs({workspaceRoot:workspace,projectRoot:input.projectRoot,request:targets[0].request,selection:input.selection});
68
+ same(targets.map(x=>x.request.network),business.snapshot.targets.map(x=>x.id),'Selected target request order');
69
+ const receipts=targets.map(({request})=>business!.parameters(request.network));
70
+ const rows:any[]=[];
71
+ for(const [index,target] of targets.entries()){
72
+ live();checkSources();
73
+ const publicTarget=business.snapshot.targets[index];
74
+ if(publicTarget.environment!==target.request.environment)throw new Error('Selected request environment mismatch');
75
+ const common={root,workspaceRoot:workspace,projectRoot:input.projectRoot,request:target.request};
76
+ const source=new OwnedWorker(root,session,target.request.network,'source',error=>{failure??=error;});workers.push(source);
77
+ const handshakePath=path.join(directory,`${index}.json`);
78
+ const ready=await source.request('stage',{...common,role:'source',handshakePath});
79
+ if(ready.ready!==true||!fs.existsSync(handshakePath))throw new Error('Source handshake is not READY');
80
+ const bytes=fs.readFileSync(handshakePath,'utf8'),handshake=JSON.parse(bytes);
81
+ same(handshake,ready.handshake,'Source handshake');
82
+ if(handshake.version!==1||handshake.session!==session||handshake.epoch!==source.epoch||handshake.target!==target.request.network)throw new Error('Source handshake association mismatch');
83
+ const worker=new OwnedWorker(root,session,target.request.network,'target',error=>{failure??=error;});workers.push(worker);
84
+ const staged=await worker.request('stage',{...common,role:'target',handshake,target:publicTarget,params:business.values(publicTarget.id),steps:business.snapshot.steps,
85
+ deploymentId:business.snapshot.deploymentId,businessRoot:business.snapshot.businessRoot,executionId:target.executionId,sourceDefinitionHash});
86
+ if(staged.ready!==true)throw new Error('Target stage is not READY');
87
+ rows.push({target:publicTarget.id,source,worker,staged});
88
+ }
89
+ // Producer/evaluation ports terminate before the final union. No producer runs below this point.
90
+ checkSources();const sealed=business.seal() as DeliveryInputEvidence;
91
+ for(const [index,receipt] of receipts.entries())same(consumeDeliveryInputParameters(receipt),sealed.parameters[index].resolved.values,'Owned parameter receipt');
92
+ const contributions:DeliveryAggregate['inputs']['targets']=[];
93
+ for(const row of rows){
94
+ live();
95
+ const checked=await row.worker.request('check');
96
+ same(checked.compiler,row.staged.compiler,'Compiler stage');same(checked.custom,row.staged.custom,'Target custom closure');same(checked.payloadHash,row.staged.payloadHash,'Staged payload');same(checked.invariantHash,row.staged.invariantHash,'Staged invariant');
97
+ const sourceChecked=await row.source.request('check');
98
+ contributions.push({target:row.target,configuration:checked.configuration,sourceConfiguration:sourceChecked.configuration,compiler:checked.compiler,custom:checked.custom});
99
+ }
100
+ checkSources();runtime.assertUnchanged();const parentRuntime=runtime.observe();
101
+ const files=new Map<string,string>();
102
+ const add=(path:string,digest:string)=>{if(files.has(path)&&files.get(path)!==digest)throw new Error('Conflicting aggregate immutable input');files.set(path,digest);};
103
+ for(const file of sealed.files)add(file.path,file.digest);
104
+ for(const parameter of sealed.parameters)for(const file of parameter.closure?.files??[])add(file.path,file.digest);
105
+ for(const row of contributions){
106
+ for(const file of row.custom?.files??[])add(file.path,file.digest);
107
+ for(const artifact of row.compiler.artifacts){add(artifact.path,inputDigest(artifact.contents));add(artifact.debugPath,inputDigest(artifact.debugContents));}
108
+ for(const build of row.compiler.builds)add(build.path,inputDigest(build.contents));
109
+ for(const job of row.compiler.jobs)for(const file of job.sources)add(file.path,file.digest);
110
+ for(const file of row.compiler.toolchain.modules)add(file.path,file.digest);
111
+ for(const config of [row.configuration,row.sourceConfiguration]){
112
+ for(const file of config.files)add(file.path,file.digest);
113
+ for(const file of config.runtime.modules)add(file.path,file.digest);
114
+ for(const pkg of [config.runtime.package,...config.runtime.dependencies])for(const file of pkg.payload)add(`${pkg.lockLocation}/${file.path}`,file.digest);
115
+ }
116
+ }
117
+ const union=[...files].sort(([a],[b])=>a.localeCompare(b,'en')).map(([path,digest])=>({path,digest}));
118
+ // No runtime state, observation, plan hash or randomized compiler exact evidence enters this preimage.
119
+ const inputsHash=aggregateInputHash({inputs:{business:sealed,sourceDefinitions,runtime:parentRuntime,files:union,targets:contributions}});
120
+ live();
121
+ const collections:DeliveryCollection[]=[];
122
+ for(const row of rows){
123
+ const collection=await row.worker.request('bind',{inputsHash}) as DeliveryCollection;
124
+ if(collection.plan.inputsHash!==inputsHash||collection.plan.sourceDefinitionHash!==sourceDefinitionHash)throw new Error('Final target identity mismatch');
125
+ const {inputsHash:_,planHash:__,...payload}=collection.plan;
126
+ same(semanticHash(payload),row.staged.payloadHash,'Final staged payload');collections.push(collection);
127
+ }
128
+ // No externally reachable plan exists until every actual child has exited successfully.
129
+ for(const row of rows){if(failure)throw failure;await row.worker.request('close');await row.source.request('close');}
130
+ if(failure)throw failure;
131
+ return deepFreeze({version:1,inputsHash,sourceDefinitionHash,inputs:{business:sealed,sourceDefinitions,runtime:parentRuntime,targets:contributions,files:union},collections,
132
+ observations:rows.map(row=>({target:row.target,...row.staged.observation,sourcePid:row.source.pid,payloadHash:row.staged.payloadHash,invariantHash:row.staged.invariantHash,exited:true}))}) as DeliveryAggregate;
133
+ }finally{
134
+ business?.close();runtime?.close();
135
+ const results=await Promise.allSettled(workers.map(worker=>worker.reap()));
136
+ fs.rmSync(directory,{recursive:true,force:true});
137
+ if(results.some(x=>x.status==='rejected'))throw new Error('Aggregate worker cleanup failed');
138
+ }
139
+ }
@@ -0,0 +1,37 @@
1
+ import type { ExecutionBindings } from '../workflow/lib/context';
2
+ import { canonicalData, exactObject, nonempty, deepFreeze } from '../workflow/lib/canonicalData';
3
+ export interface DerivedBindings { executionId: string; derivationSeed: string; values: Record<string, string> }
4
+ export function parseDerivedBindings(raw: unknown): DerivedBindings {
5
+ const input = exactObject(raw, ['executionId', 'derivationSeed', 'values'], 'derived bindings');
6
+ const values = canonicalData(input.values) as Record<string, unknown>;
7
+ if (!values || typeof values !== 'object' || Array.isArray(values)) throw new Error('derived values must be an object');
8
+ for (const [key, value] of Object.entries(values)) { nonempty(key, 'derived key'); nonempty(value, 'derived value'); }
9
+ return deepFreeze({ executionId: nonempty(input.executionId, 'executionId'), derivationSeed: nonempty(input.derivationSeed, 'derivationSeed'), values: values as Record<string, string> });
10
+ }
11
+ export class DeliveryExecutionBindings implements ExecutionBindings {
12
+ readonly derivationSeed: string;
13
+ private readonly executionId: string;
14
+ private readonly expected?: DerivedBindings;
15
+ private readonly values: Record<string, string> = Object.create(null);
16
+ private sealed = false;
17
+ constructor(input: { executionId: string; derivationSeed: string; expected?: DerivedBindings }) {
18
+ this.executionId = nonempty(input.executionId, 'executionId'); this.derivationSeed = nonempty(input.derivationSeed, 'derivationSeed');
19
+ this.expected = input.expected && parseDerivedBindings(input.expected);
20
+ if (this.expected && (this.expected.executionId !== this.executionId || this.expected.derivationSeed !== this.derivationSeed)) throw new Error('derived binding identity mismatch');
21
+ }
22
+ recordOrAssertDerivedValue(key: string, value: string): void {
23
+ if (this.sealed) throw new Error('derived bindings are sealed');
24
+ nonempty(key, 'derived key'); nonempty(value, 'derived value');
25
+ if (Object.hasOwn(this.values, key)) throw new Error(`duplicate derived binding ${key}`);
26
+ if (this.expected) {
27
+ if (!Object.hasOwn(this.expected.values, key)) throw new Error(`unexpected derived binding ${key}`);
28
+ if (this.expected.values[key] !== value) throw new Error(`derived binding ${key} differs`);
29
+ }
30
+ this.values[key] = value;
31
+ }
32
+ seal(): DerivedBindings {
33
+ if (this.expected && Object.keys(this.expected.values).some(key => !Object.hasOwn(this.values, key))) throw new Error('missing expected derived bindings');
34
+ this.sealed = true;
35
+ return parseDerivedBindings({ executionId: this.executionId, derivationSeed: this.derivationSeed, values: this.values });
36
+ }
37
+ }
@@ -0,0 +1,33 @@
1
+ /** Shared declarative steps may gain network parameters without changing accepted dev behavior. */
2
+ import {resolveValue, type WorkflowStep} from '../workflow/lib/parameters';
3
+ import {canonicalJson} from '../workflow/lib/canonicalData';
4
+ import {pointerPart} from './data';
5
+ import type {ResolvedDeliveryParameters} from './parameters';
6
+
7
+ export function validateHistoricalBusinessExtension(input: {
8
+ before: readonly WorkflowStep[]; after: readonly WorkflowStep[];
9
+ previous: ResolvedDeliveryParameters; current: ResolvedDeliveryParameters; target: Record<string, unknown>;
10
+ }): void {
11
+ if ([...input.before, ...input.after].some(step => step.kind === 'custom')) throw Error('Historical custom steps require unchanged manifest/schema and parameters');
12
+ const symbolicState = {get: (key: string) => ({$ref: `state.${key}`})};
13
+ const project = (steps: readonly WorkflowStep[], params: unknown) => steps.map(step => {
14
+ const {name: _name, description: _description, ...operation} = step;
15
+ return resolveValue(operation, {targetId: input.previous.target, target: input.target,
16
+ params: params as Record<string, unknown>, state: symbolicState as never});
17
+ });
18
+ if (canonicalJson(project(input.before, input.previous.values)) !== canonicalJson(project(input.after, input.current.values))) throw Error('Historical resolved development operations changed');
19
+ const references = new Set<string>();
20
+ const visit = (value: unknown): void => {
21
+ if (typeof value === 'string' && value.startsWith('$param.')) references.add('/' + value.slice(7).split('.').map(pointerPart).join('/'));
22
+ else if (value && typeof value === 'object') {
23
+ const ref = (value as any).$ref;
24
+ if (typeof ref === 'string' && ref.startsWith('param.')) references.add('/' + ref.slice(6).split('.').map(pointerPart).join('/'));
25
+ else Object.values(value).forEach(visit);
26
+ }
27
+ };
28
+ input.after.forEach(visit);
29
+ for (const leaf of input.current.provenance) {
30
+ if (!input.previous.provenance.some(old => old.path === leaf.path)
31
+ && ![...references].some(ref => leaf.path === ref || leaf.path.startsWith(ref + '/'))) throw Error('Historical added parameter is not used by the shared steps');
32
+ }
33
+ }
@@ -0,0 +1,25 @@
1
+ /** Immutable project-local file publication. This is not execution authority. */
2
+ import { projectRoot } from './project-files';
3
+ import { atomicDevelopmentWrite, withDevelopmentFileLock, fileBytes, byteHash } from './materialization';
4
+ import { canonicalJson, semanticHash } from '../workflow/lib/canonicalData';
5
+ import { safeId } from './protocol';
6
+ import { serializeDeliveryCalls, deliveryCalldataPath } from './calldata-format';
7
+ import type { DeliveryCall } from './public-calldata';
8
+ export async function archiveDeliveryCalls(input:{workspaceRoot:string;projectRoot:string;deploymentId:string;calls:readonly DeliveryCall[];provenance:unknown;assertCurrent():void}){
9
+ const root=projectRoot(input.workspaceRoot,input.projectRoot),deployment=safeId(input.deploymentId,'deploymentId');
10
+ const bytes=serializeDeliveryCalls(input.calls)+'\n',sha256=byteHash(bytes);
11
+ const path=deliveryCalldataPath(deployment,sha256);
12
+ const body={version:1,path,sha256,provenance:input.provenance};
13
+ const record=canonicalJson(body)+'\n',provenancePath=`.gate-delivery/deliveries/${deployment}/${sha256}-${semanticHash(body)}.json`;
14
+ return withDevelopmentFileLock(root,async()=>{
15
+ input.assertCurrent();
16
+ for(const [file,content] of [[path,bytes],[provenancePath,record]]){
17
+ const existing=fileBytes(root,file);
18
+ if(existing!==null&&existing!==content)throw Error('Immutable calldata archive conflict');
19
+ if(existing===null)atomicDevelopmentWrite(root,file,content);
20
+ }
21
+ input.assertCurrent();
22
+ if(fileBytes(root,path)!==bytes)throw Error('Published calldata changed');
23
+ return {status:'READY' as const,path,sha256,size:Buffer.byteLength(bytes),provenance:{path:provenancePath,sha256:byteHash(record)}};
24
+ });
25
+ }
@@ -0,0 +1,90 @@
1
+ /** Explanations of verified wrapper ABI payloads; never additional transactions. */
2
+ import { Interface, getCreate2Address, keccak256, type ParamType } from 'ethers';
3
+ import { parseCalldataInvocation, type CalldataInvocation } from './calldata-review';
4
+ import type { PreparationEntry } from './journal';
5
+ import { canonicalJson } from '../workflow/lib/canonicalData';
6
+ export interface ExpandedCall {
7
+ to: string; name: string; description: string; abi: string[]; calldata: string;
8
+ value?: string; allowFailure?: boolean; details?: ExpandedDetails;
9
+ }
10
+ export type ExpandedDetails =
11
+ | { type: 'multicall'; calls: ExpandedCall[] }
12
+ | { type: 'create2'; contract: string; role: string; factory: string; salt: string; saltDescription: string;
13
+ constructor: { abi: string[]; args: unknown[]; initialization?: ExpandedCall };
14
+ initCodeHash: string; predictedAddress: string; create2ForwardValue?: string; callForwardValue?: string;
15
+ placeholderImplementation?: string; afterDeployment?: ExpandedCall }
16
+ | { type: 'upgrade'; proxy: string; newImplementation: string; initialization: ExpandedCall | null };
17
+ const childAt = (i: CalldataInvocation, path: number[]) => i.payloads.find(p => JSON.stringify(p.argumentPath) === JSON.stringify(path))?.invocation;
18
+ export function readableInvocationAbi(i: CalldataInvocation): string[] {
19
+ const iface=new Interface(i.abi as any);
20
+ const fragment=i.kind==='constructor'?iface.deploy:iface.getFunction(i.method);
21
+ if (!fragment) throw Error('Readable invocation ABI missing');
22
+ return [fragment.format('full')];
23
+ }
24
+ /** Keep authored business intent, append exact verified arguments without copying wrapper bytecode. */
25
+ export function describeDeliveryInvocation(description: string, raw: CalldataInvocation): string {
26
+ const invocation = parseCalldataInvocation(raw);
27
+ function argumentsText(i: CalldataInvocation, depth: number): string {
28
+ if (depth > 24) throw Error('Nested calldata description exceeds supported depth');
29
+ const iface = new Interface(i.abi as any);
30
+ const fragment = i.kind === 'constructor' ? iface.deploy : iface.getFunction(i.method);
31
+ if (!fragment) throw Error('Description invocation ABI missing');
32
+ const named = (type: ParamType, value: unknown, path: number[]): string =>
33
+ `${type.name || `arg${path[path.length - 1]}`}(${type.format('sighash')})=${render(type, value, path)}`;
34
+ const render = (type: ParamType, value: unknown, path: number[]): string => {
35
+ const payload = i.payloads.find(p => canonicalJson(p.argumentPath) === canonicalJson(path));
36
+ if (payload) {
37
+ const nested = payload.invocation;
38
+ const call = `${nested.method}(${argumentsText(nested, depth + 1)})`;
39
+ return nested.kind === 'constructor' ? `{initCodeHash=${keccak256(nested.data)}, ${call}}` : call;
40
+ }
41
+ if (type.baseType === 'array') return '[' + (value as unknown[])
42
+ .map((item, index) => render(type.arrayChildren!, item, [...path, index])).join(', ') + ']';
43
+ if (type.baseType === 'tuple') return '(' + type.components!
44
+ .map((component, index) => named(component, (value as unknown[])[index], [...path, index])).join(', ') + ')';
45
+ return canonicalJson(value);
46
+ };
47
+ return fragment.inputs.map((type, index) => named(type, i.expectedArguments[index], [index])).join(', ');
48
+ }
49
+ const args = argumentsText(invocation, 0);
50
+ return args ? `${description}\n执行参数:${args}` : description;
51
+ }
52
+ /** Caller validates its preparation journal against the frozen plan first. */
53
+ export function expandDeliveryInvocation(raw: CalldataInvocation, to: string, intent: {name:string;description:string}, entry?: PreparationEntry, depth=0): ExpandedDetails | undefined {
54
+ if(depth>24)throw Error('Nested calldata exceeds supported depth');
55
+ const i=parseCalldataInvocation(raw),args=i.expectedArguments;
56
+ const child=(invocation:CalldataInvocation,target:string,name:string,value='0'):ExpandedCall=>({to:target,name,description:describeDeliveryInvocation(`${intent.description};内部动作:${name}`,invocation),abi:readableInvocationAbi(invocation),calldata:invocation.data,
57
+ ...(BigInt(value)===0n?{}:{value}),...((details=>details?{details}:{})(expandDeliveryInvocation(invocation,target,{name,description:intent.description},entry,depth+1)))});
58
+ if(['aggregate3((address,bool,bytes)[])','aggregate3Value((address,bool,uint256,bytes)[])'].includes(i.method)) {
59
+ const withValue=i.method.startsWith('aggregate3Value');
60
+ return {type:'multicall',calls:(args[0] as any[]).map((row,index)=>{
61
+ const invocation=childAt(i,[0,index,withValue?3:2]);
62
+ if(!invocation)throw Error('Multicall child ABI missing');
63
+ const known=entry?.prepared.plan.transactions.find(tx=>tx.to.toLowerCase()===row[0].toLowerCase()&&tx.data.toLowerCase()===invocation.data);
64
+ const names:Record<string,string>={'deploy-implementation':'部署业务实现','deploy-proxy':'部署代理','deploy-contract':'CREATE2 部署合约','upgrade-proxy':'升级代理并按既定参数初始化'};
65
+ return {...child(invocation,row[0],known?names[known.purpose]??known.purpose:`${intent.name} / ${index+1}`,withValue?row[2]:'0'),allowFailure:row[1]};
66
+ })};
67
+ }
68
+ if(i.method==='deploy(bytes32,bytes,bytes,uint256,uint256)') {
69
+ const ctor=childAt(i,[1]);
70
+ if(!entry||!ctor||ctor.kind!=='constructor')throw Error('CREATE2 explanation requires frozen preparation and constructor ABI');
71
+ const initCodeHash=keccak256(ctor.data),predictedAddress=getCreate2Address(to,String(args[0]),initCodeHash).toLowerCase();
72
+ const deployed=entry.prepared.plan.deployments.find(d=>d.salt.toLowerCase()===String(args[0]).toLowerCase()&&d.address.toLowerCase()===predictedAddress);
73
+ if(!deployed||deployed.initCodeHash&&deployed.initCodeHash.toLowerCase()!==initCodeHash)throw Error('CREATE2 salt, initCode or predicted address differs from frozen preparation');
74
+ const request=entry.prepared.request,placeholder=request.kind==='uups-placeholder-deploy'&&deployed.role==='proxy';
75
+ const initialization=deployed.role==='proxy'?childAt(ctor,[request.kind==='transparent-deploy'?2:1]):undefined;
76
+ if(ctor.payloads.length&&!initialization)throw Error('Constructor executable payload has no registered adapter');
77
+ const forward=childAt(i,[2]);
78
+ return {type:'create2',contract:deployed.role==='proxy'?(request.kind==='transparent-deploy'?'TransparentUpgradeableProxy':'ERC1967Proxy'):request.contract,
79
+ role:deployed.role,factory:to,salt:String(args[0]),saltDescription:deployed.role==='proxy'?'proxySalt:确定代理地址的 CREATE2 盐值,与实现盐值分离':deployed.role==='implementation'?'implementationSalt:本轮业务实现的 CREATE2 盐值,与代理盐值分离':'本轮合约的 CREATE2 盐值',
80
+ constructor:{abi:readableInvocationAbi(ctor),args:ctor.expectedArguments,...(initialization?{initialization:child(initialization,predictedAddress,'构造期间初始化')}: {})},
81
+ initCodeHash,predictedAddress,...(BigInt(String(args[3]))===0n?{}:{create2ForwardValue:String(args[3])}),...(BigInt(String(args[4]))===0n?{}:{callForwardValue:String(args[4])}),
82
+ ...(placeholder?{placeholderImplementation:request.placeholderImplementation}:{}),...(forward?{afterDeployment:child(forward,predictedAddress,'部署后调用',String(args[4]))}:{})};
83
+ }
84
+ if(['upgradeToAndCall(address,bytes)','upgradeAndCall(address,address,bytes)'].includes(i.method)) {
85
+ const transparent=i.method.startsWith('upgradeAndCall'),proxy=transparent?String(args[0]):to,newImplementation=String(args[transparent?1:0]),initializer=childAt(i,[transparent?2:1]);
86
+ return {type:'upgrade',proxy,newImplementation,initialization:initializer?child(initializer,proxy,'升级附带初始化'):null};
87
+ }
88
+ if(i.payloads.length)throw Error('Executable nested payload has no registered explanation adapter');
89
+ return undefined;
90
+ }
@@ -0,0 +1,14 @@
1
+ /** One readable, deterministic file format and path for every public delivery. */
2
+ import { canonicalJson } from '../workflow/lib/canonicalData';
3
+ import { safeId } from './protocol';
4
+ import type { DeliveryCall } from './public-calldata';
5
+
6
+ /** No trailing newline: file publishers append exactly one before hashing. */
7
+ export function serializeDeliveryCalls(calls: readonly DeliveryCall[]): string {
8
+ return JSON.stringify(JSON.parse(canonicalJson(calls)), null, 2);
9
+ }
10
+
11
+ export function deliveryCalldataPath(deploymentId: string, sha256: string): string {
12
+ if (!/^[a-f0-9]{64}$/.test(sha256)) throw Error('Invalid calldata content digest');
13
+ return `scripts/tasks/${safeId(deploymentId, 'deploymentId')}/deliveries/${sha256}/calldata.json`;
14
+ }
@@ -0,0 +1,76 @@
1
+ /** Planning-only adapter: reconstruct deployment intent from frozen requests and compiled artifacts. */
2
+ import { Interface, concat, type InterfaceAbi } from 'ethers';
3
+ import type { PreparationEntry } from './journal';
4
+ import type { ReleaseExecutionTransaction } from '../workflow/lib/transactionPlanner';
5
+ import { createCalldataInvocation, reviewTransaction, type CalldataInvocation, type CalldataTransactionReview } from './calldata-review';
6
+
7
+ const factoryAbi = ['function deploy(bytes32 salt,bytes initCode,bytes data,uint256 create2ForwardValue,uint256 callForwardValue) payable returns(address)'];
8
+ const upgradeAbi = ['function upgradeToAndCall(address newImplementation,bytes data) payable'];
9
+ const adminAbi = ['function upgradeAndCall(address proxy,address implementation,bytes data) payable'];
10
+ const multicallAbi = [
11
+ 'function aggregate3(tuple(address target,bool allowFailure,bytes callData)[] calls) payable returns(tuple(bool success,bytes returnData)[])',
12
+ 'function aggregate3Value(tuple(address target,bool allowFailure,uint256 value,bytes callData)[] calls) payable returns(tuple(bool success,bytes returnData)[])',
13
+ ];
14
+ type ArtifactReader = { readArtifact(name: string): Promise<{ abi: InterfaceAbi; bytecode: string }> };
15
+ export async function preparationCalldataReviews(entries: readonly PreparationEntry[], transactions: readonly ReleaseExecutionTransaction[], artifacts: ArtifactReader): Promise<CalldataTransactionReview[]> {
16
+ const result: CalldataTransactionReview[] = [];
17
+ for (const entry of entries) {
18
+ const { request, plan } = entry.prepared;
19
+ const artifact = await artifacts.readArtifact(request.contract);
20
+ const implementation = plan.deployments.find(d => d.role === 'implementation');
21
+ const initializer = request.kind !== 'create2-deploy' && request.call
22
+ ? createCalldataInvocation({ abi: artifact.abi, method: request.call.method, args: request.call.args,
23
+ data: new Interface(artifact.abi).encodeFunctionData(request.call.method, request.call.args) }) : undefined;
24
+ const inner = new Map<string, CalldataInvocation>();
25
+ for (const tx of plan.transactions) {
26
+ let invocation: CalldataInvocation;
27
+ if (tx.purpose === 'upgrade-proxy') {
28
+ if (request.kind === 'create2-deploy' || !implementation) throw Error('Upgrade ABI intent missing');
29
+ const transparent = request.kind === 'transparent-upgrade';
30
+ const args = transparent ? [request.proxy, implementation.address, initializer?.data ?? '0x'] : [implementation.address, initializer?.data ?? '0x'];
31
+ invocation = createCalldataInvocation({ abi: transparent ? adminAbi : upgradeAbi, method: transparent ? 'upgradeAndCall' : 'upgradeToAndCall', args, data: tx.data,
32
+ payloads: initializer ? [{ argumentPath: [transparent ? 2 : 1], invocation: initializer }] : [] });
33
+ } else {
34
+ const role = tx.purpose === 'deploy-proxy' ? 'proxy' : tx.purpose === 'deploy-implementation' ? 'implementation' : 'contract';
35
+ const deployed = plan.deployments.find(d => d.role === role);
36
+ if (!deployed) throw Error('Deployment ABI intent missing');
37
+ const proxy = role === 'proxy';
38
+ const transparent = request.kind === 'transparent-deploy';
39
+ const code = proxy ? await artifacts.readArtifact(transparent
40
+ ? '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy'
41
+ : '@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy') : artifact;
42
+ const args = !proxy ? request.constructorArgs : request.kind === 'uups-placeholder-deploy'
43
+ ? [request.placeholderImplementation, '0x'] : transparent
44
+ ? [implementation!.address, request.proxyAdminOwner, initializer?.data ?? '0x'] : undefined;
45
+ if (!args) throw Error('Proxy constructor ABI intent missing');
46
+ const constructor = createCalldataInvocation({ abi: code.abi, method: null, args, bytecode: code.bytecode,
47
+ data: concat([code.bytecode, new Interface(code.abi).encodeDeploy(args)]),
48
+ payloads: proxy && transparent && initializer ? [{ argumentPath: [2], invocation: initializer }] : [] });
49
+ if (new Interface(code.abi).encodeDeploy(args).toLowerCase() !== deployed.constructorInput.toLowerCase()) throw Error('Constructor calldata differs from preparation');
50
+ const forward = request.kind === 'create2-deploy' ? [request.create2ForwardValue ?? '0', request.callForwardValue ?? '0'] : ['0', '0'];
51
+ invocation = createCalldataInvocation({ abi: factoryAbi, method: 'deploy', args: [deployed.salt, constructor.data, '0x', ...forward], data: tx.data,
52
+ payloads: [{ argumentPath: [1], invocation: constructor }] });
53
+ }
54
+ inner.set(tx.id, invocation);
55
+ }
56
+ for (const mapping of entry.mappings) {
57
+ const tx = transactions.find(t => t.transactionId === mapping.transactionId);
58
+ if (!tx) throw Error('Calldata preparation mapping missing');
59
+ const calls = mapping.gateToolTransactionIds.map(id => {
60
+ const intent = inner.get(id), prepared = plan.transactions.find(t => t.id === id);
61
+ if (!intent || !prepared) throw Error('Inner calldata ABI intent missing');
62
+ return { intent, prepared };
63
+ });
64
+ if (mapping.kind === 'direct') {
65
+ if (calls.length !== 1) throw Error('Direct calldata mapping must contain one invocation');
66
+ result.push(reviewTransaction(tx, calls[0].intent));
67
+ } else {
68
+ const withValue = calls.some(c => BigInt(c.prepared.value) !== 0n), method = withValue ? 'aggregate3Value' : 'aggregate3';
69
+ const args = [calls.map(({ prepared: p }) => withValue ? [p.to, false, p.value, p.data] : [p.to, false, p.data])];
70
+ result.push(reviewTransaction(tx, createCalldataInvocation({ abi: multicallAbi, method, args, data: tx.data,
71
+ payloads: calls.map((c, index) => ({ argumentPath: [0, index, withValue ? 3 : 2], invocation: c.intent })) })));
72
+ }
73
+ }
74
+ }
75
+ return result;
76
+ }