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,129 @@
1
+ import path from 'node:path';
2
+ import ts from 'typescript';
3
+ import { positiveInteger, type ProjectNetworkSnapshot } from './protocol';
4
+ import { validateNetworkAlias } from './policy';
5
+
6
+ export { stat, confinedFile, projectRoot, readFile, deliveryProjectMarker } from './project-files';
7
+ import { confinedFile, readFile } from './project-files';
8
+ import { projectRpcSyntax, projectRpcOptions, resolveProjectRpc, projectRpcEnvironment, projectPublicRpcEnvironment } from './project-rpc';
9
+
10
+ function unwrap(node: ts.Expression): ts.Expression {
11
+ while (ts.isParenthesizedExpression(node) || ts.isAsExpression(node) || ts.isSatisfiesExpression(node)) node = node.expression;
12
+ return node;
13
+ }
14
+ function properties(node: ts.Expression, label: string): Map<string, ts.Expression> {
15
+ node = unwrap(node);
16
+ if (!ts.isObjectLiteralExpression(node)) throw new Error(`${label} must be a static object literal`);
17
+ const map = new Map<string, ts.Expression>();
18
+ for (const item of node.properties) {
19
+ if (!ts.isPropertyAssignment(item) || (!ts.isIdentifier(item.name) && !ts.isStringLiteral(item.name))) throw new Error(`${label} has unsupported computed or spread fields`);
20
+ const key = item.name.text;
21
+ if (['__proto__', 'constructor', 'prototype'].includes(key)) throw new Error(`Reserved prototype property in ${label}`);
22
+ if (map.has(key)) throw new Error(`Duplicate ${label} field: ${key}`);
23
+ map.set(key, unwrap(item.initializer));
24
+ }
25
+ return map;
26
+ }
27
+ export function parseProjectConfig(source: string): { file: ts.SourceFile; networks: Map<string, ts.Expression>; fields: Map<string, ts.Expression> } {
28
+ const file = ts.createSourceFile('hardhat.config.ts', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
29
+ const diagnostics = (file as ts.SourceFile & { parseDiagnostics: ts.Diagnostic[] }).parseDiagnostics;
30
+ if (diagnostics.length) throw new Error('Invalid hardhat.config.ts syntax');
31
+ const exports = file.statements.filter(ts.isExportAssignment);
32
+ if (exports.length !== 1 || exports[0].isExportEquals) throw new Error('Config requires one default export');
33
+ let config = unwrap(exports[0].expression);
34
+ if (ts.isIdentifier(config)) {
35
+ const name = config.text;
36
+ const declarations = file.statements.filter(ts.isVariableStatement).flatMap(statement => [...statement.declarationList.declarations]
37
+ .map(declaration => ({ declaration, statement }))).filter(({ declaration }) => ts.isIdentifier(declaration.name) && declaration.name.text === name);
38
+ if (declarations.length !== 1 || !(declarations[0].statement.declarationList.flags & ts.NodeFlags.Const) || !declarations[0].declaration.initializer) throw new Error('Config requires a static const object');
39
+ const declaration = declarations[0].declaration;
40
+ const references: ts.Identifier[] = [];
41
+ const visit = (node: ts.Node): void => { if (ts.isIdentifier(node) && node.text === name) references.push(node); ts.forEachChild(node, visit); };
42
+ visit(file);
43
+ if (references.some(node => node !== declaration.name && node !== config)) throw new Error('Ambiguous mutable config references');
44
+ config = unwrap(declaration.initializer!);
45
+ }
46
+ const fields = properties(config, 'config');
47
+ const networkNode = fields.get('networks');
48
+ if (!networkNode) throw new Error('Project config must declare networks');
49
+ return { file, networks: properties(networkNode, 'networks'), fields };
50
+ }
51
+ export function projectSourcesDirectory(root: string): string {
52
+ const { fields } = parseProjectConfig(readFile(root, 'hardhat.config.ts') ?? '');
53
+ const paths = fields.get('paths');
54
+ const sources = paths && properties(paths, 'paths').get('sources');
55
+ if (sources && !ts.isStringLiteral(sources)) throw new Error('Project paths.sources must be a static string for dependency inspection');
56
+ const sourcePath = sources && ts.isStringLiteral(sources) ? sources.text : 'contracts';
57
+ const relative = path.relative(root, path.resolve(root, sourcePath)).split(path.sep).join('/');
58
+ return confinedFile(root, relative, 'directory');
59
+ }
60
+ export function projectDefaultNetwork(root: string): string {
61
+ const { fields } = parseProjectConfig(readFile(root, 'hardhat.config.ts') ?? '');
62
+ const network = fields.get('defaultNetwork');
63
+ if (!network) return 'hardhat';
64
+ if (!ts.isStringLiteral(network)) throw new Error('Project defaultNetwork must be a static string for delivery routing');
65
+ return validateNetworkAlias(network.text, 'defaultNetwork');
66
+ }
67
+ function rpcValue(node: ts.Expression, env: NodeJS.ProcessEnv, helper: boolean): string | undefined {
68
+ node = unwrap(node);
69
+ if (ts.isStringLiteral(node)) return node.text;
70
+ if (ts.isPropertyAccessExpression(node) && ts.isPropertyAccessExpression(node.expression)
71
+ && ts.isIdentifier(node.expression.expression) && node.expression.expression.text === 'process'
72
+ && node.expression.name.text === 'env') return env[node.name.text];
73
+ if (ts.isElementAccessExpression(node) && ts.isPropertyAccessExpression(node.expression)
74
+ && ts.isIdentifier(node.expression.expression) && node.expression.expression.text === 'process'
75
+ && node.expression.name.text === 'env' && ts.isStringLiteral(node.argumentExpression)) return env[node.argumentExpression.text];
76
+ if (ts.isBinaryExpression(node) && [ts.SyntaxKind.BarBarToken, ts.SyntaxKind.QuestionQuestionToken].includes(node.operatorToken.kind)) {
77
+ const left = rpcValue(node.left, env, helper);
78
+ return node.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken
79
+ ? left ?? rpcValue(node.right, env, helper) : left || rpcValue(node.right, env, helper);
80
+ }
81
+ if (helper && ts.isCallExpression(node)) {
82
+ const options = projectRpcOptions(node);
83
+ return resolveProjectRpc(options.route, rpcValue(options.publicFallback, env, false), options.useBaseRpc, env);
84
+ }
85
+ throw new Error('Selected network URL must be a literal or process.env reference');
86
+ }
87
+ /** Read the project-owned definitions without evaluating the config, plugins or HRE. */
88
+ export function readProjectNetworkSnapshots(root: string, aliases: string[], env: NodeJS.ProcessEnv = process.env): ProjectNetworkSnapshot[] {
89
+ const source = readFile(root, 'hardhat.config.ts') ?? '';
90
+ return parseProjectNetworkSnapshots(source, aliases, projectRpcEnvironment(root, source, env));
91
+ }
92
+ /** Public preflight only: RPCs must be in rpc.env or the supplied environment, never .env. */
93
+ export function readPublicProjectNetworkSnapshots(root: string, aliases: string[], env: NodeJS.ProcessEnv = process.env): ProjectNetworkSnapshot[] {
94
+ const source = readFile(root, 'hardhat.config.ts') ?? '';
95
+ return parseProjectNetworkSnapshots(source, aliases, projectPublicRpcEnvironment(root, source, env));
96
+ }
97
+ /** Parse one captured project definition without rereading files or evaluating plugins/HRE. */
98
+ export function parseProjectNetworkSnapshots(source: string, aliases: string[], env: NodeJS.ProcessEnv = process.env): ProjectNetworkSnapshot[] {
99
+ const { file, networks } = parseProjectConfig(source);
100
+ const { helper } = projectRpcSyntax(file);
101
+ return aliases.map(network => {
102
+ validateNetworkAlias(network, 'network', false);
103
+ const selected = networks.get(network);
104
+ if (!selected || network === 'hardhat') throw new Error(`Selected project network is missing or not an RPC target: ${network}`);
105
+ const fields = properties(selected, `network ${network}`);
106
+ const chainId = fields.get('chainId');
107
+ if (!chainId || !ts.isNumericLiteral(chainId)) throw new Error(`Selected network ${network} requires a static chainId`);
108
+ if (fields.has('zksync') && fields.get('zksync')!.kind !== ts.SyntaxKind.FalseKeyword) throw new Error('Delivery requires an EVM network');
109
+ const url = fields.get('url');
110
+ if (!url) throw new Error(`Selected network ${network} requires an RPC URL definition`);
111
+ return { network, chainId: positiveInteger(Number(chainId.text), 'network chainId'), url: rpcValue(url, env, helper) ?? '' };
112
+ });
113
+ }
114
+ export function integratedConfig(source: string): string {
115
+ const { file } = parseProjectConfig(source);
116
+ const imports = file.statements.filter(ts.isImportDeclaration);
117
+ const delivery = imports.filter(node => ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === 'gate-evm-tools/delivery-hardhat');
118
+ if (delivery.length > 1 || delivery.some(node => node.importClause)) throw new Error('Conflicting manual delivery plugin import');
119
+ // Place bootstrap before all imports, after leading comments/shebang/directives.
120
+ const first = file.statements.find(node => !(ts.isExpressionStatement(node) && ts.isStringLiteral(node.expression)));
121
+ if (!first) throw new Error('Missing project config statements');
122
+ if (delivery.length) {
123
+ if (delivery[0] !== first) throw new Error('Delivery plugin must be the first import; move it before other imports');
124
+ return source;
125
+ }
126
+ const at = first.getStart(file);
127
+ const newline = source.includes('\r\n') ? '\r\n' : '\n';
128
+ return source.slice(0, at) + `import "gate-evm-tools/delivery-hardhat";${newline}` + source.slice(at);
129
+ }
@@ -0,0 +1,94 @@
1
+ /** Syntax and routing constraints only. Source verification and host authorization are separate gates. */
2
+ import { validateNetworkAlias } from './policy';
3
+ export type DeliveryEnvironment = 'dev' | 'prod';
4
+ export type DeliveryMode = 'simulate' | 'execute' | 'export-calldata' | 'reconcile' | 'verify';
5
+ export interface DeliveryRequest {
6
+ version: 1;
7
+ environment: DeliveryEnvironment;
8
+ purpose: 'dev-execution' | 'prod-qualification' | 'prod-execution';
9
+ mode: DeliveryMode;
10
+ network: string;
11
+ sourceRef: { path: string; taskId: string; planKey: string; rev: number };
12
+ releaseRef?: { path: string; releaseId: string; inputsHash: string };
13
+ fork?: { blockNumber: number; blockHash: string; readOnly: true };
14
+ devSigner?: string;
15
+ operator?: string;
16
+ }
17
+ export interface ProjectNetworkSnapshot { network: string; chainId: number; url: string }
18
+ export function object(value: unknown, label: string, keys?: string[]): Record<string, unknown> {
19
+ if (!value || typeof value !== 'object' || Array.isArray(value)
20
+ || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) throw new Error(`${label} must be an object`);
21
+ const result = value as Record<string, unknown>;
22
+ if (keys && Object.keys(result).some(key => !keys.includes(key))) throw new Error(`${label} has unknown fields`);
23
+ return result;
24
+ }
25
+ export function safeId(value: unknown, label: string): string {
26
+ if (typeof value !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_-]{0,199}$/.test(value)
27
+ || ['__proto__', 'prototype', 'constructor'].includes(value)) throw new Error(`Invalid ${label}`);
28
+ return value;
29
+ }
30
+ export function portablePath(value: unknown, label: string): string {
31
+ if (typeof value !== 'string' || !value || /[\\\0:]/.test(value)
32
+ || value.split('/').some(part => !part || part === '.' || part === '..'
33
+ || ['__proto__', 'prototype', 'constructor'].includes(part))) throw new Error(`Invalid relative ${label}`);
34
+ return value;
35
+ }
36
+ export function address(value: unknown, label: string): string {
37
+ if (typeof value !== 'string' || !/^0x[\da-fA-F]{40}$/.test(value) || /^0x0{40}$/.test(value)) throw new Error(`Invalid ${label} address`);
38
+ return value;
39
+ }
40
+ export function positiveInteger(value: unknown, label: string): number {
41
+ if (typeof value !== 'number' || !Number.isSafeInteger(value) || value <= 0) throw new Error(`Invalid ${label}`);
42
+ return value;
43
+ }
44
+ export function parseDeliveryRequest(input: unknown): DeliveryRequest {
45
+ const value = object(input, 'delivery request', ['version', 'environment', 'purpose', 'mode', 'network', 'sourceRef', 'releaseRef', 'fork', 'devSigner', 'operator']);
46
+ if (value.version !== 1) throw new Error('Unsupported delivery request version');
47
+ if (typeof value.environment !== 'string' || !['dev', 'prod'].includes(value.environment)) throw new Error('environment must be dev or prod');
48
+ if (typeof value.purpose !== 'string' || !['dev-execution', 'prod-qualification', 'prod-execution'].includes(value.purpose)) throw new Error('Invalid purpose');
49
+ const dev = value.purpose === 'dev-execution';
50
+ if (value.environment !== (dev ? 'dev' : 'prod')) throw new Error('purpose conflicts with environment');
51
+ const modes = dev ? ['simulate', 'execute', 'reconcile', 'verify'] : value.purpose === 'prod-qualification' ? ['simulate', 'verify'] : ['simulate', 'execute', 'export-calldata', 'reconcile', 'verify'];
52
+ if (typeof value.mode !== 'string' || !modes.includes(value.mode)) throw new Error('Explicit valid mode is required for purpose');
53
+ validateNetworkAlias(value.network, 'network', false);
54
+ const source = object(value.sourceRef, 'sourceRef', ['path', 'taskId', 'planKey', 'rev']);
55
+ portablePath(source.path, 'sourceRef.path'); safeId(source.taskId, 'taskId'); safeId(source.planKey, 'planKey'); positiveInteger(source.rev, 'rev');
56
+ if (dev) {
57
+ address(value.devSigner, 'devSigner');
58
+ if ('operator' in value) throw new Error('devSigner and prod operator are separate roles');
59
+ } else {
60
+ address(value.operator, 'operator');
61
+ if ('devSigner' in value) throw new Error('prod operator cannot inherit devSigner');
62
+ }
63
+ if (value.purpose === 'prod-execution') {
64
+ const release = object(value.releaseRef, 'releaseRef', ['path', 'releaseId', 'inputsHash']);
65
+ portablePath(release.path, 'releaseRef.path'); safeId(release.releaseId, 'releaseId');
66
+ if (typeof release.inputsHash !== 'string' || !/^[a-f0-9]{64}$/.test(release.inputsHash)) throw new Error('Invalid releaseRef.inputsHash');
67
+ } else if ('releaseRef' in value) throw new Error('releaseRef requires prod-execution');
68
+ if (value.purpose === 'prod-qualification' && value.mode === 'simulate' && !value.fork) throw new Error('prod-qualification simulate requires a pinned read-only fork');
69
+ if ('fork' in value) {
70
+ const fork = object(value.fork, 'fork', ['blockNumber', 'blockHash', 'readOnly']);
71
+ if (typeof fork.blockNumber !== 'number' || !Number.isSafeInteger(fork.blockNumber) || fork.blockNumber < 0) throw new Error('Invalid fork.blockNumber');
72
+ if (fork.readOnly !== true || typeof fork.blockHash !== 'string' || !/^0x[\da-fA-F]{64}$/.test(fork.blockHash)) throw new Error('fork must pin a block hash and be readOnly');
73
+ if (value.mode !== 'simulate') throw new Error('fork is only valid for simulate mode');
74
+ }
75
+ // Return detached data so callers cannot change routing during an asynchronous provider load.
76
+ return JSON.parse(JSON.stringify(value)) as DeliveryRequest;
77
+ }
78
+ export interface ChainIdProvider { request(args: { method: 'eth_chainId'; params: [] }): Promise<unknown> }
79
+ /** Does not load HRE, signers, verify source contents, or grant execution authority. */
80
+ export async function validateDeliveryRpc(
81
+ input: unknown,
82
+ snapshot: ProjectNetworkSnapshot,
83
+ loadProvider: (snapshot: ProjectNetworkSnapshot) => Promise<ChainIdProvider>,
84
+ ): Promise<{ request: DeliveryRequest; chainId: number }> {
85
+ const request = parseDeliveryRequest(input);
86
+ if (snapshot.network !== request.network) throw new Error('Selected project network snapshot mismatch');
87
+ const expected = positiveInteger(snapshot.chainId, 'snapshot.chainId');
88
+ const provider = await loadProvider({ ...snapshot });
89
+ const raw = await provider.request({ method: 'eth_chainId', params: [] });
90
+ if (typeof raw !== 'string' || !/^0x[\da-fA-F]+$/.test(raw)) throw new Error('Invalid RPC eth_chainId response');
91
+ const actual = BigInt(raw);
92
+ if (actual !== BigInt(expected)) throw new Error(`RPC chainId mismatch: expected ${expected}, actual ${actual}`);
93
+ return { request, chainId: expected };
94
+ }
@@ -0,0 +1,74 @@
1
+ /** Public business projection. Internal provenance and runtime progress stay separate. */
2
+ import { immutableDeliveryPlan } from './export';
3
+ import { parseCalldataReviews } from './calldata-review';
4
+ import type { PreparationEntry } from './journal';
5
+ import { expandDeliveryInvocation, readableInvocationAbi, describeDeliveryInvocation, type ExpandedDetails } from './calldata-details';
6
+ import { nonempty, deepFreeze, canonicalJson, semanticHash } from '../workflow/lib/canonicalData';
7
+ import type { WorkflowStep } from '../workflow/lib/parameters';
8
+
9
+ export { archiveDeliveryCalls } from './calldata-archive';
10
+ export { serializeDeliveryCalls, deliveryCalldataPath } from './calldata-format';
11
+
12
+ export interface DeliveryCall {
13
+ chains: string[]; executor: string; to: string; name: string; description: string;
14
+ abi: string[]; calldata: string; value?: string;
15
+ details?: ExpandedDetails;
16
+ }
17
+ export interface PublicCalldataInput { plan: unknown; calldata: unknown; operations: readonly WorkflowStep[]; preparations?: unknown }
18
+ /** Frozen parameters independently re-encode and compare before any public projection. */
19
+ export function projectDeliveryCalls(input: PublicCalldataInput): readonly DeliveryCall[] {
20
+ const plan = immutableDeliveryPlan(input.plan);
21
+ const reviews = parseCalldataReviews(input.calldata, plan.transactions);
22
+ const journal=input.preparations??[];
23
+ const preparations: PreparationEntry[] = Array.isArray(journal)&&!journal.length&&!plan.deploymentBindings.length?[]
24
+ : (require('./journal') as typeof import('./journal')).parsePreparationJournal(journal, plan.transactions, plan.derivedBindings, {target:plan.target,chainId:plan.chainId,expectedStepIds:plan.deploymentBindings.map(d=>d.stepId)});
25
+ return deepFreeze(plan.transactions.map((tx, index) => {
26
+ if (tx.operation !== 0) throw Error('Public calldata supports ordinary CALL only');
27
+ const binding = plan.transactionBindings[index], operation = plan.operationBindings.find(o => o.stepId === binding.stepId);
28
+ if (!operation) throw Error('Public calldata operation binding missing');
29
+ const source = operation.operationId === null ? input.operations.find(s => s.id === operation.sourceStepId)
30
+ : plan.customBindings.find(s => s.sourceStepId === operation.sourceStepId)?.operations.find(s => s.id === operation.operationId);
31
+ if (!source) throw Error('Frozen operation intent missing');
32
+ const call = binding.callIndex === null ? undefined : (source.calls as any[] | undefined)?.[binding.callIndex];
33
+ const name = nonempty(call?.name ?? source.name, 'operation name');
34
+ const description = nonempty(call?.description ?? source.description, 'operation description');
35
+ const invocation = reviews[index].invocation;
36
+ if (invocation.kind !== 'function') throw Error('Outer public transaction requires function ABI');
37
+ const entry=preparations.find(p=>p.mappings.some(m=>m.transactionId===tx.transactionId));
38
+ const details=expandDeliveryInvocation(invocation,tx.to,{name,description},entry);
39
+ return { chains: [plan.chainId], executor: tx.executor, to: tx.to, name, description:describeDeliveryInvocation(description,invocation),
40
+ abi: readableInvocationAbi(invocation), calldata: tx.data, ...(BigInt(tx.value) === 0n ? {} : { value: tx.value }),...(details?{details}:{}) };
41
+ }));
42
+ }
43
+
44
+ /** Merge matching logical occurrences, never globally deduplicate calldata. */
45
+ export function mergeDeliveryCalls(inputs: readonly PublicCalldataInput[]): readonly DeliveryCall[] {
46
+ if(!inputs.length)throw Error('At least one independently frozen network is required');
47
+ const chains=new Set<string>(), sequences:Array<{chain:string;calls:readonly DeliveryCall[];keys:string[]}>=[];
48
+ const nodes=new Map<string,{call:DeliveryCall;next:Set<string>;incoming:number}>();
49
+ for(const input of inputs){
50
+ const plan=immutableDeliveryPlan(input.plan),chain=plan.chainId,calls=projectDeliveryCalls(input);
51
+ if(chains.has(chain))throw Error('Duplicate chain projection');chains.add(chain);
52
+ const keys=calls.map((call,index)=>{
53
+ const binding=plan.transactionBindings[index],operation=plan.operationBindings.find(o=>o.stepId===binding.stepId)!;
54
+ const {chains:_,...content}=call;
55
+ const key=semanticHash({logical:[operation.sourceStepId,operation.operationId,binding.role,binding.callIndex],content});
56
+ const existing=nodes.get(key);
57
+ if(existing){if(existing.call.chains.includes(chain))throw Error('Duplicate logical occurrence on one chain');existing.call.chains.push(chain);}
58
+ else nodes.set(key,{call:{...call,chains:[chain]},next:new Set(),incoming:0});
59
+ return key;
60
+ });
61
+ sequences.push({chain,calls,keys});
62
+ for(let i=1;i<keys.length;i++){const a=nodes.get(keys[i-1])!,b=nodes.get(keys[i])!;if(!a.next.has(keys[i])){a.next.add(keys[i]);b.incoming++;}}
63
+ }
64
+ const queue=[...nodes].filter(([,n])=>n.incoming===0).map(([key])=>key),ordered:DeliveryCall[]=[];
65
+ for(let at=0;at<queue.length;at++){
66
+ const node=nodes.get(queue[at])!;ordered.push(node.call);
67
+ for(const key of node.next){const next=nodes.get(key)!;if(--next.incoming===0)queue.push(key);}
68
+ }
69
+ // Conflicting cross-chain ordering cannot share occurrences; keep exact per-chain sequences.
70
+ const result=ordered.length===nodes.size?ordered:sequences.flatMap(s=>s.calls.map(call=>({...call,chains:[s.chain]})));
71
+ const content=(call:DeliveryCall)=>{const {chains:_,...rest}=call;return rest;};
72
+ for(const sequence of sequences)if(canonicalJson(result.filter(c=>c.chains.includes(sequence.chain)).map(content))!==canonicalJson(sequence.calls.map(content)))throw Error('Merged calldata changed per-chain order or coverage');
73
+ return deepFreeze(result);
74
+ }
@@ -0,0 +1,106 @@
1
+ import { deepFreeze, semanticHash } from "../workflow/lib/canonicalData";
2
+ import { strictData, ownPath } from "./data";
3
+ import { PUBLIC_TARGET_FIELDS } from './target-fields';
4
+ export const DEFERRED = Symbol("delivery.future-state");
5
+ export interface ReferenceObservation {
6
+ reference: string;
7
+ contentIdentity: string;
8
+ resolvedIdentity: string;
9
+ }
10
+ export interface BusinessReferenceContext {
11
+ params: unknown;
12
+ target: unknown;
13
+ state(): unknown;
14
+ }
15
+ const PUBLIC_TARGET = PUBLIC_TARGET_FIELDS;
16
+ export function parseBusinessReference(raw: unknown): string | null {
17
+ const value = strictData(raw);
18
+ let ref: unknown;
19
+ if (typeof value === "string" && value.startsWith("$")) ref = value.slice(1);
20
+ else if (
21
+ value &&
22
+ typeof value === "object" &&
23
+ !Array.isArray(value) &&
24
+ Object.hasOwn(value, "$ref")
25
+ ) {
26
+ if (Object.keys(value).length !== 1)
27
+ throw new Error("Business $ref requires exact shape");
28
+ ref = (value as Record<string, unknown>).$ref;
29
+ } else return null;
30
+ if (
31
+ typeof ref !== "string" ||
32
+ !/^(param|target|state)\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*$/.test(ref)
33
+ )
34
+ throw new Error("Invalid business reference namespace or path");
35
+ if (ref.startsWith("target.") && !PUBLIC_TARGET.has(ref.slice(7)))
36
+ throw new Error("Reference is outside public target boundary");
37
+ return ref;
38
+ }
39
+ export function resolveBusinessValue(
40
+ raw: unknown,
41
+ context: BusinessReferenceContext,
42
+ options: { deferState?: boolean } = {},
43
+ ): { value: unknown; observations: ReferenceObservation[] } {
44
+ const params = strictData(context.params),
45
+ input = strictData(raw),
46
+ active = new Set<string>();
47
+ const observations: ReferenceObservation[] = [];
48
+ let state: unknown,
49
+ stateRead = false;
50
+ const visit = (value: unknown): unknown => {
51
+ const ref = parseBusinessReference(value);
52
+ if (ref) {
53
+ if (active.has(ref)) throw new Error(`Business reference cycle: ${ref}`);
54
+ const [ns, ...parts] = ref.split(".");
55
+ if (ns === "state" && options.deferState) return DEFERRED;
56
+ if (ns === "state" && !stateRead) {
57
+ // Runtime producers may retain unrelated optional undefined metadata.
58
+ // Validate the selected subtree below, never invoke descriptors on the path.
59
+ state = context.state();
60
+ stateRead = true;
61
+ }
62
+ // Read only the allowlisted target leaf; secret fields are never traversed or observed.
63
+ const source = strictData(
64
+ ownPath(
65
+ ns === "param" ? params : ns === "state" ? state : context.target,
66
+ parts,
67
+ ref,
68
+ ),
69
+ );
70
+ if (ns === "target" && (source === null || typeof source === "object"))
71
+ throw new Error("Public target references require scalar leaves");
72
+ active.add(ref);
73
+ const resolved = visit(source);
74
+ active.delete(ref);
75
+ if (!containsDeferred(resolved))
76
+ observations.push({
77
+ reference: ref,
78
+ contentIdentity: semanticHash(source),
79
+ resolvedIdentity: semanticHash(resolved),
80
+ });
81
+ return resolved;
82
+ }
83
+ if (Array.isArray(value)) return value.map(visit);
84
+ if (value && typeof value === "object")
85
+ return Object.fromEntries(
86
+ Object.entries(value).map(([k, v]) => [k, visit(v)]),
87
+ );
88
+ return value;
89
+ };
90
+ return deepFreeze({
91
+ value: visit(input),
92
+ observations: observations.sort((a, b) =>
93
+ a.reference < b.reference ? -1 : a.reference > b.reference ? 1 : 0,
94
+ ),
95
+ });
96
+ }
97
+ export function containsDeferred(value: unknown): boolean {
98
+ return (
99
+ value === DEFERRED ||
100
+ !!(
101
+ value &&
102
+ typeof value === "object" &&
103
+ Object.values(value).some(containsDeferred)
104
+ )
105
+ );
106
+ }
@@ -0,0 +1,79 @@
1
+ /** Actual-file release graph classification. No caller-selected roots or target subsets. */
2
+ import {parseCanonicalPlan,projectCanonicalDefinitions,deploymentPurpose} from './source';
3
+ import {projectRoot} from './project-files';
4
+ import {readInputBytes,parseInputDocument,assertUnambiguousHandoff} from './input-files';
5
+ import {canonicalJson,deepFreeze,semanticHash,exactObject} from '../workflow/lib/canonicalData';
6
+ import {safeId,portablePath,object} from './protocol';
7
+ export interface ReleaseGraphOptions {workspaceRoot:string;projectRoot:string;handoff:string;taskId:string;deploymentId:string;releaseRef:{path:string;releaseId:string;inputsHash:string}}
8
+ export const sameReleaseData=(a:unknown,b:unknown,label:string):void=>{if(canonicalJson(a)!==canonicalJson(b))throw Error(`${label} mismatch`);};
9
+ /** A completed simulation-only script task supplies reports, never on-chain acceptance. */
10
+ export function isDevelopmentAcceptancePrerequisite(task:Parameters<typeof deploymentPurpose>[0]){
11
+ const d=task.scope?.deployment as any;
12
+ return deploymentPurpose(task)==='dev-execution'&&Array.isArray(d?.allowedActions)&&d.allowedActions.some((action:string)=>action!=='simulate');
13
+ }
14
+ export function readReleaseUniverse(input:Omit<ReleaseGraphOptions,'releaseRef'>){
15
+ const workspace=projectRoot(input.workspaceRoot,'.'),root=projectRoot(workspace,input.projectRoot);
16
+ safeId(input.deploymentId,'deploymentId');portablePath(input.handoff,'handoff');
17
+ const text=readInputBytes(workspace,input.handoff).toString();assertUnambiguousHandoff(text);
18
+ const plan=parseCanonicalPlan(text);if(plan.taskId!==input.taskId)throw Error('Current task identity mismatch');
19
+ const task=object(parseInputDocument(readInputBytes(root,`scripts/tasks/${input.deploymentId}/task.yaml`),'yaml'),'task.yaml',['version','id','developmentNetwork','releaseTargetNetworks','requirementRef','productionRequirementRef','referenceDeploymentId']);
20
+ if(task.version!==1||task.id!==input.deploymentId||!Array.isArray(task.releaseTargetNetworks)||!task.releaseTargetNetworks.length)throw Error('Invalid release target scope');
21
+ const targets=task.releaseTargetNetworks as string[];if(new Set(targets).size!==targets.length)throw Error('Duplicate release target');
22
+ const entries=Object.entries(plan.tasks).flatMap(([lane,tasks])=>tasks.map(task=>({lane,task}))),relevant=entries.filter(({task:t})=>{const d=t.scope?.deployment as any;return d?.projectRoot===input.projectRoot&&d?.deploymentId===input.deploymentId;});
23
+ for(const {task:t} of relevant){const d=t.scope!.deployment as any;sameReleaseData(d.developmentNetwork,task.developmentNetwork,'Current development target');
24
+ if(['prod-qualification','prod-execution'].includes(deploymentPurpose(t)!)){
25
+ sameReleaseData(d.releaseTargetNetworks,targets,'Current selected targets');
26
+ sameReleaseData(d.productionRequirementRef??null,task.productionRequirementRef??null,'Current production confirmation');
27
+ }else if((d.releaseTargetNetworks??[]).some((network:string)=>!targets.includes(network)))throw Error('Current selected targets removed a development-declared target');
28
+ }
29
+ const qualifications=targets.map(target=>{const rows=relevant.filter(({task:t})=>deploymentPurpose(t)==='prod-qualification'&&(t.scope!.deployment as any).targetNetwork===target);if(rows.length!==1)throw Error('Missing or ambiguous qualification target');const row=rows[0],d=row.task.scope!.deployment as any;if(plan.lanes[row.lane].state!=='enabled'||row.task.status==='cancelled'||d.environment!=='prod'||d.releaseRef!==undefined)throw Error('Ineligible qualification task');sameReleaseData([...d.allowedActions].sort(),['simulate','verify'],'Qualification allowedActions');return row.task;});
30
+ if(relevant.some(({task:t})=>deploymentPurpose(t)==='prod-qualification'&&!targets.includes((t.scope!.deployment as any).targetNetwork)))throw Error('Unknown qualification target');
31
+ const upstream=projectCanonicalDefinitions(text,{roots:qualifications.map(t=>t.planKey),mode:'upstream'});
32
+ return {workspace,root,text,plan,entries,relevant,targets,qualifications,upstream,developmentNetwork:task.developmentNetwork as string};
33
+ }
34
+ export function readReleaseGraph(input:ReleaseGraphOptions){
35
+ const u=readReleaseUniverse(input);safeId(input.releaseRef.releaseId,'releaseId');portablePath(input.releaseRef.path,'releaseRef.path');if(!/^[a-f0-9]{64}$/.test(input.releaseRef.inputsHash))throw Error('Invalid release input hash');
36
+ // Classify ALL relevant production tasks first. Filtering a good ref first conceals split/wrong bindings.
37
+ const groups=new Map<string,typeof u.relevant>();
38
+ for(const row of u.relevant.filter(({task})=>deploymentPurpose(task)==='prod-execution')){const d=row.task.scope!.deployment as any,ref=d.releaseRef;if(!ref)throw Error('Missing release binding');const key=canonicalJson(ref),rows=groups.get(key)??[];rows.push(row);groups.set(key,rows);}
39
+ const selectedKey=canonicalJson(input.releaseRef);
40
+ for(const [key,rows] of groups){const ref=(rows[0].task.scope!.deployment as any).releaseRef;if(ref.releaseId===input.releaseRef.releaseId&&key!==selectedKey)throw Error('Split release binding');
41
+ if(rows.some(({task})=>!u.targets.includes((task.scope!.deployment as any).targetNetwork)))throw Error('Unknown production target');
42
+ const byKey=new Map(u.entries.map(row=>[row.task.planKey,row.task]));
43
+ const ancestors=(task:typeof rows[number]['task'],seen=new Set<string>()):Set<string>=>{for(const id of task.dependsOn){if(seen.has(id))continue;seen.add(id);const prior=byKey.get(id);if(prior)ancestors(prior,seen);}return seen;};
44
+ for(const target of u.targets){
45
+ const tasks=rows.filter(({task})=>(task.scope!.deployment as any).targetNetwork===target).sort((a,b)=>a.task.no-b.task.no);
46
+ if(!tasks.length)throw Error('Missing complete release stage graph');
47
+ const qualification=u.qualifications.find(t=>(t.scope!.deployment as any).targetNetwork===target)!;
48
+ const actions=(task:typeof rows[number]['task'])=>(task.scope!.deployment as any).allowedActions as string[];
49
+ const prepares=tasks.filter(({task})=>actions(task).includes('simulate'));
50
+ const effects=tasks.filter(({task})=>actions(task).some(a=>['execute','export-calldata'].includes(a)));
51
+ const verifies=tasks.filter(({task})=>actions(task).includes('verify'));
52
+ if(!prepares.length||!effects.length||!verifies.length)throw Error('Incomplete production stage graph: simulate, execute/export and verify required');
53
+ for(let index=1;index<tasks.length;index++)if(!ancestors(tasks[index].task).has(tasks[index-1].task.planKey))throw Error('Split or duplicate release dependency graph');
54
+ if(!actions(tasks.at(-1)!.task).includes('verify'))throw Error('Production graph must finish with verification');
55
+ for(const {lane,task} of tasks){
56
+ const d=task.scope!.deployment as any,upstream=ancestors(task);
57
+ if(u.plan.lanes[lane].state!=='enabled'||task.status==='cancelled'||d.environment!=='prod')throw Error('Ineligible production task');
58
+ if(actions(task).some(a=>['execute','export-calldata'].includes(a))&&!actions(task).some(a=>['reconcile','verify'].includes(a)))throw Error('Production effect task requires reconcile or verify to observe completion');
59
+ if(!upstream.has(qualification.planKey))throw Error('Split release dependency graph');
60
+ if(actions(task).some(a=>['execute','export-calldata'].includes(a))&&!prepares.some(p=>p.task.planKey===task.planKey||upstream.has(p.task.planKey)))throw Error('Missing production preparation dependency');
61
+ if(actions(task).includes('verify')&&effects.some(e=>e.task.planKey!==task.planKey&&!upstream.has(e.task.planKey)))throw Error('Missing production verification dependency');
62
+ }
63
+ }
64
+ }
65
+ const selected=groups.get(selectedKey);if(!selected)throw Error('Missing complete release graph');
66
+ const graph=projectCanonicalDefinitions(u.text,{roots:selected.map(r=>r.task.planKey),mode:'full'});
67
+ return deepFreeze({targets:u.targets,graph:graph.snapshot,prodTaskGraphHash:semanticHash(graph.snapshot)});
68
+ }
69
+ /** Progress is deliberately outside sourceDefinitionHash: eligibility is checked anew. */
70
+ export function currentReleasePrerequisites(input:Omit<ReleaseGraphOptions,'releaseRef'>){
71
+ const u=readReleaseUniverse(input),keys=new Set(u.upstream.snapshot.tasks.map(t=>t.planKey)),qual=new Set(u.qualifications.map(t=>t.planKey));
72
+ const requirementKeys=new Set(u.relevant.map(({task})=>(task.scope?.deployment as any)?.requirementRef?.planKey).filter(Boolean));
73
+ const required=u.entries.filter(({lane,task})=>keys.has(task.planKey)&&!qual.has(task.planKey)&&!requirementKeys.has(task.planKey)&&u.plan.lanes[lane].state==='enabled');
74
+ // Explicit dependencies (including the requirement's prerequisites) define this
75
+ // round. Unrelated development/audit work appended later is not a prerequisite.
76
+ if(!required.some(({task})=>{const d=task.scope?.deployment as any;return isDevelopmentAcceptancePrerequisite(task)&&d.deploymentId===input.deploymentId&&d.projectRoot===input.projectRoot&&d.environment==='dev'&&d.targetNetwork===u.developmentNetwork&&d.allowedActions.includes('verify');}))throw Error('Missing development acceptance prerequisite: verify');
77
+ for(const {task} of required)if(task.status!=='completed'||task.result?.kind!=='success'||task.adoptedRev!==task.rev)throw Error(`Current prerequisite is incomplete or stale: ${task.planKey}`);
78
+ return {...u,required};
79
+ }
@@ -0,0 +1,32 @@
1
+ /** Narrow R1→R2 handoff: capture the currently installed producer and changing containers BEFORE prod edits. */
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import {gzipSync} from 'node:zlib';
5
+ import {readInputBytes} from './input-files';
6
+ import {confinedFile,projectRoot} from './project-files';
7
+ import {atomicDevelopmentWrite,byteHash,developmentPath} from './materialization';
8
+ import {canonicalJson,semanticHash} from '../workflow/lib/canonicalData';
9
+ import {parseDeliveryPlan} from './plan';
10
+ import {safeId} from './protocol';
11
+ import type {DeliveryAggregate,DeliveryAggregateOptions} from './aggregate';
12
+ import type {HistoricalDevelopmentFiles} from './release-history';
13
+ export function captureDevelopmentReleaseHistory(input:{root:string;source:DeliveryAggregateOptions;aggregate:DeliveryAggregate}):HistoricalDevelopmentFiles {
14
+ const root=fs.realpathSync(input.root),a=input.aggregate,plan=parseDeliveryPlan(a.collections[0]?.plan);
15
+ if(input.source.selection!=='development'||a.collections.length!==1||plan.environment!=='dev'||projectRoot(input.source.workspaceRoot,input.source.projectRoot)!==root)throw Error('Historical capture requires original development source');
16
+ safeId(plan.executionId,'executionId');
17
+ const base=`.gate-delivery/history/${plan.executionId}`,readyPath=`${base}/READY.json`;
18
+ const acceptanceFile=`.gate-delivery/development/${plan.executionId}.acceptance.json`,acceptance=JSON.parse(readInputBytes(root,acceptanceFile).toString());
19
+ if(acceptance.status!=='accepted'||acceptance.planHash!==plan.planHash||acceptance.inputsHash!==a.inputsHash||semanticHash(acceptance.runtimeIdentity)!==semanticHash(plan.runtimeIdentity))throw Error('Historical capture requires actual accepted development');
20
+ const original=a.inputs.runtime.package;if(original.name!=='gate-evm-tools'||original.lockLocation!=='node_modules/gate-evm-tools')throw Error('Unsupported historical producer location');
21
+ const files:Array<{path:string;digest:string;base64:string}>=[];
22
+ const visit=(relative:string)=>{const dir=confinedFile(root,`${original.lockLocation}/${relative}`.replace(/\/$/,''),'directory');for(const name of fs.readdirSync(dir).sort()){const rel=relative?`${relative}/${name}`:name;const stat=fs.lstatSync(path.join(dir,name));if(stat.isDirectory()){if(name==='node_modules')continue;visit(rel);}else{const bytes=readInputBytes(root,`${original.lockLocation}/${rel}`);files.push({path:rel,digest:byteHash(bytes),base64:bytes.toString('base64')});}}};visit('');files.sort((a,b)=>a.path<b.path?-1:a.path>b.path?1:0);
23
+ if(semanticHash(files.map(({path,digest})=>({path,digest})))!==semanticHash(original.payload))throw Error('Historical capture must precede producer/runtime replacement');
24
+ const descriptor:HistoricalDevelopmentFiles={aggregateFile:`${base}/aggregate.json`,sourceFile:`${base}/source.json`,acceptanceFile,packageRoot:`${base}/package`,inputsRoot:`${base}/inputs`,archiveFile:`${base}/package.snapshot.json.gz`};
25
+ if(fs.existsSync(developmentPath(root,readyPath))){const ready=JSON.parse(readInputBytes(root,readyPath).toString());if(ready.schema!=='gate-delivery-history-ready'||ready.generation!=='complete'||ready.planHash!==plan.planHash||ready.aggregateHash!==semanticHash(a))throw Error('Conflicting historical capture');for(const f of ready.files)if(byteHash(readInputBytes(root,f.path))!==f.sha256)throw Error('Captured historical file drift');return descriptor;}
26
+ const saved:Array<{path:string;sha256:string}>=[];
27
+ const write=(relative:string,bytes:Buffer)=>{const file=developmentPath(root,relative);fs.mkdirSync(path.dirname(file),{recursive:true,mode:0o700});if(fs.existsSync(file)&&!readInputBytes(root,relative).equals(bytes))throw Error('Partial historical capture conflict');const fd=fs.openSync(file,'w',0o600);try{fs.writeFileSync(fd,bytes);fs.fsyncSync(fd);}finally{fs.closeSync(fd);}saved.push({path:relative,sha256:byteHash(bytes)});};
28
+ for(const file of files)write(`${base}/package/${file.path}`,Buffer.from(file.base64,'base64'));
29
+ for(const name of [`${a.inputs.business.businessRoot}/task.yaml`,`${a.inputs.business.businessRoot}/parameters.yaml`,`${a.inputs.business.businessRoot}/parameters.provenance.json`,'config.yaml','hardhat.config.ts','package-lock.json','contractInfo.json','deploymentInfo.json'])write(`${base}/inputs/${name}`,readInputBytes(root,name));
30
+ write(descriptor.aggregateFile,Buffer.from(canonicalJson(a)+'\n'));write(descriptor.sourceFile,Buffer.from(canonicalJson(input.source)+'\n'));write(descriptor.archiveFile,gzipSync(Buffer.from(canonicalJson({schema:'gate-delivery-package-snapshot',version:1,runtimeIdentity:plan.runtimeIdentity,observedPackage:original,files}))));
31
+ atomicDevelopmentWrite(root,readyPath,canonicalJson({schema:'gate-delivery-history-ready',version:1,generation:'complete',planHash:plan.planHash,aggregateHash:semanticHash(a),descriptor,files:saved})+'\n');return descriptor;
32
+ }