gate-evm-tools 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/bin/workflow.cjs +19 -0
- package/dist/core/BytecodeChecker.d.ts.map +1 -1
- package/dist/core/BytecodeChecker.js +16 -1
- package/dist/core/BytecodeChecker.js.map +1 -1
- package/dist/core/legacyProxyArtifact.d.ts +6 -0
- package/dist/core/legacyProxyArtifact.d.ts.map +1 -0
- package/dist/core/legacyProxyArtifact.js +36 -0
- package/dist/core/legacyProxyArtifact.js.map +1 -0
- package/dist-runtime/config/hardhatAdapters.d.ts +7 -0
- package/dist-runtime/config/hardhatAdapters.js +61 -0
- package/dist-runtime/config/hardhatAdapters.js.map +1 -0
- package/dist-runtime/config/networks.d.ts +32 -0
- package/dist-runtime/config/networks.js +275 -0
- package/dist-runtime/config/networks.js.map +1 -0
- package/dist-runtime/config/openzeppelin.d.ts +28 -0
- package/dist-runtime/config/openzeppelin.js +144 -0
- package/dist-runtime/config/openzeppelin.js.map +1 -0
- package/dist-runtime/config/rpc.d.ts +7 -0
- package/dist-runtime/config/rpc.js +19 -0
- package/dist-runtime/config/rpc.js.map +1 -0
- package/dist-runtime/config/zksyncSolcPath.d.ts +1 -0
- package/dist-runtime/config/zksyncSolcPath.js +61 -0
- package/dist-runtime/config/zksyncSolcPath.js.map +1 -0
- package/dist-runtime/migrate.d.ts +13 -0
- package/dist-runtime/migrate.js +208 -0
- package/dist-runtime/migrate.js.map +1 -0
- package/dist-runtime/package.json +1 -0
- package/dist-runtime/projectHardhat.d.ts +4 -0
- package/dist-runtime/projectHardhat.js +16 -0
- package/dist-runtime/projectHardhat.js.map +1 -0
- package/dist-runtime/runtime-identity.json +4 -0
- package/dist-runtime/template-migration.json +293 -0
- package/dist-runtime/workflow/checkCode.d.ts +1 -0
- package/dist-runtime/workflow/checkCode.js +16 -0
- package/dist-runtime/workflow/checkCode.js.map +1 -0
- package/dist-runtime/workflow/checkCodeFinalize.d.ts +1 -0
- package/dist-runtime/workflow/checkCodeFinalize.js +11 -0
- package/dist-runtime/workflow/checkCodeFinalize.js.map +1 -0
- package/dist-runtime/workflow/checkCodePlan.d.ts +1 -0
- package/dist-runtime/workflow/checkCodePlan.js +11 -0
- package/dist-runtime/workflow/checkCodePlan.js.map +1 -0
- package/dist-runtime/workflow/cli.d.ts +1 -0
- package/dist-runtime/workflow/cli.js +302 -0
- package/dist-runtime/workflow/cli.js.map +1 -0
- package/dist-runtime/workflow/commitContractInfo.d.ts +1 -0
- package/dist-runtime/workflow/commitContractInfo.js +64 -0
- package/dist-runtime/workflow/commitContractInfo.js.map +1 -0
- package/dist-runtime/workflow/create2Hashes.d.ts +1 -0
- package/dist-runtime/workflow/create2Hashes.js +76 -0
- package/dist-runtime/workflow/create2Hashes.js.map +1 -0
- package/dist-runtime/workflow/forkSourceProxy.d.ts +1 -0
- package/dist-runtime/workflow/forkSourceProxy.js +151 -0
- package/dist-runtime/workflow/forkSourceProxy.js.map +1 -0
- package/dist-runtime/workflow/importState.d.ts +1 -0
- package/dist-runtime/workflow/importState.js +193 -0
- package/dist-runtime/workflow/importState.js.map +1 -0
- package/dist-runtime/workflow/lib/authority.d.ts +28 -0
- package/dist-runtime/workflow/lib/authority.js +122 -0
- package/dist-runtime/workflow/lib/authority.js.map +1 -0
- package/dist-runtime/workflow/lib/calldata.d.ts +2 -0
- package/dist-runtime/workflow/lib/calldata.js +8 -0
- package/dist-runtime/workflow/lib/calldata.js.map +1 -0
- package/dist-runtime/workflow/lib/calls.d.ts +23 -0
- package/dist-runtime/workflow/lib/calls.js +316 -0
- package/dist-runtime/workflow/lib/calls.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/args.d.ts +2 -0
- package/dist-runtime/workflow/lib/checkCode/args.js +68 -0
- package/dist-runtime/workflow/lib/checkCode/args.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/command.d.ts +5 -0
- package/dist-runtime/workflow/lib/checkCode/command.js +35 -0
- package/dist-runtime/workflow/lib/checkCode/command.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/dependencies.d.ts +6 -0
- package/dist-runtime/workflow/lib/checkCode/dependencies.js +125 -0
- package/dist-runtime/workflow/lib/checkCode/dependencies.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/finalize.d.ts +17 -0
- package/dist-runtime/workflow/lib/checkCode/finalize.js +174 -0
- package/dist-runtime/workflow/lib/checkCode/finalize.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/index.d.ts +3 -0
- package/dist-runtime/workflow/lib/checkCode/index.js +20 -0
- package/dist-runtime/workflow/lib/checkCode/index.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/plan.d.ts +22 -0
- package/dist-runtime/workflow/lib/checkCode/plan.js +145 -0
- package/dist-runtime/workflow/lib/checkCode/plan.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCodeReport.d.ts +25 -0
- package/dist-runtime/workflow/lib/checkCodeReport.js +102 -0
- package/dist-runtime/workflow/lib/checkCodeReport.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCodeRunner.d.ts +87 -0
- package/dist-runtime/workflow/lib/checkCodeRunner.js +964 -0
- package/dist-runtime/workflow/lib/checkCodeRunner.js.map +1 -0
- package/dist-runtime/workflow/lib/cliTool.d.ts +10 -0
- package/dist-runtime/workflow/lib/cliTool.js +25 -0
- package/dist-runtime/workflow/lib/cliTool.js.map +1 -0
- package/dist-runtime/workflow/lib/config.d.ts +33 -0
- package/dist-runtime/workflow/lib/config.js +100 -0
- package/dist-runtime/workflow/lib/config.js.map +1 -0
- package/dist-runtime/workflow/lib/contractInfoCandidates.d.ts +82 -0
- package/dist-runtime/workflow/lib/contractInfoCandidates.js +441 -0
- package/dist-runtime/workflow/lib/contractInfoCandidates.js.map +1 -0
- package/dist-runtime/workflow/lib/controlledMulticallAbi.d.ts +2 -0
- package/dist-runtime/workflow/lib/controlledMulticallAbi.js +10 -0
- package/dist-runtime/workflow/lib/controlledMulticallAbi.js.map +1 -0
- package/dist-runtime/workflow/lib/create2.d.ts +49 -0
- package/dist-runtime/workflow/lib/create2.js +194 -0
- package/dist-runtime/workflow/lib/create2.js.map +1 -0
- package/dist-runtime/workflow/lib/create2Hashes.d.ts +22 -0
- package/dist-runtime/workflow/lib/create2Hashes.js +57 -0
- package/dist-runtime/workflow/lib/create2Hashes.js.map +1 -0
- package/dist-runtime/workflow/lib/deploymentInfo.d.ts +40 -0
- package/dist-runtime/workflow/lib/deploymentInfo.js +240 -0
- package/dist-runtime/workflow/lib/deploymentInfo.js.map +1 -0
- package/dist-runtime/workflow/lib/deploymentRecords.d.ts +137 -0
- package/dist-runtime/workflow/lib/deploymentRecords.js +374 -0
- package/dist-runtime/workflow/lib/deploymentRecords.js.map +1 -0
- package/dist-runtime/workflow/lib/deployments.d.ts +21 -0
- package/dist-runtime/workflow/lib/deployments.js +240 -0
- package/dist-runtime/workflow/lib/deployments.js.map +1 -0
- package/dist-runtime/workflow/lib/erc1967.d.ts +5 -0
- package/dist-runtime/workflow/lib/erc1967.js +29 -0
- package/dist-runtime/workflow/lib/erc1967.js.map +1 -0
- package/dist-runtime/workflow/lib/errors.d.ts +6 -0
- package/dist-runtime/workflow/lib/errors.js +77 -0
- package/dist-runtime/workflow/lib/errors.js.map +1 -0
- package/dist-runtime/workflow/lib/executionId.d.ts +7 -0
- package/dist-runtime/workflow/lib/executionId.js +26 -0
- package/dist-runtime/workflow/lib/executionId.js.map +1 -0
- package/dist-runtime/workflow/lib/executionPlan.d.ts +85 -0
- package/dist-runtime/workflow/lib/executionPlan.js +450 -0
- package/dist-runtime/workflow/lib/executionPlan.js.map +1 -0
- package/dist-runtime/workflow/lib/executionProgress.d.ts +5 -0
- package/dist-runtime/workflow/lib/executionProgress.js +100 -0
- package/dist-runtime/workflow/lib/executionProgress.js.map +1 -0
- package/dist-runtime/workflow/lib/external.d.ts +62 -0
- package/dist-runtime/workflow/lib/external.js +282 -0
- package/dist-runtime/workflow/lib/external.js.map +1 -0
- package/dist-runtime/workflow/lib/externalExecutionScanner.d.ts +64 -0
- package/dist-runtime/workflow/lib/externalExecutionScanner.js +638 -0
- package/dist-runtime/workflow/lib/externalExecutionScanner.js.map +1 -0
- package/dist-runtime/workflow/lib/forkSnapshot.d.ts +34 -0
- package/dist-runtime/workflow/lib/forkSnapshot.js +167 -0
- package/dist-runtime/workflow/lib/forkSnapshot.js.map +1 -0
- package/dist-runtime/workflow/lib/gateTool.d.ts +16 -0
- package/dist-runtime/workflow/lib/gateTool.js +177 -0
- package/dist-runtime/workflow/lib/gateTool.js.map +1 -0
- package/dist-runtime/workflow/lib/gateToolSync.d.ts +22 -0
- package/dist-runtime/workflow/lib/gateToolSync.js +253 -0
- package/dist-runtime/workflow/lib/gateToolSync.js.map +1 -0
- package/dist-runtime/workflow/lib/lock.d.ts +52 -0
- package/dist-runtime/workflow/lib/lock.js +269 -0
- package/dist-runtime/workflow/lib/lock.js.map +1 -0
- package/dist-runtime/workflow/lib/migrationState.d.ts +103 -0
- package/dist-runtime/workflow/lib/migrationState.js +920 -0
- package/dist-runtime/workflow/lib/migrationState.js.map +1 -0
- package/dist-runtime/workflow/lib/operatorExecution.d.ts +28 -0
- package/dist-runtime/workflow/lib/operatorExecution.js +134 -0
- package/dist-runtime/workflow/lib/operatorExecution.js.map +1 -0
- package/dist-runtime/workflow/lib/parameters.d.ts +58 -0
- package/dist-runtime/workflow/lib/parameters.js +323 -0
- package/dist-runtime/workflow/lib/parameters.js.map +1 -0
- package/dist-runtime/workflow/lib/pendingDeploymentReuse.d.ts +29 -0
- package/dist-runtime/workflow/lib/pendingDeploymentReuse.js +277 -0
- package/dist-runtime/workflow/lib/pendingDeploymentReuse.js.map +1 -0
- package/dist-runtime/workflow/lib/proxy.d.ts +18 -0
- package/dist-runtime/workflow/lib/proxy.js +19 -0
- package/dist-runtime/workflow/lib/proxy.js.map +1 -0
- package/dist-runtime/workflow/lib/registryCommit.d.ts +33 -0
- package/dist-runtime/workflow/lib/registryCommit.js +319 -0
- package/dist-runtime/workflow/lib/registryCommit.js.map +1 -0
- package/dist-runtime/workflow/lib/release.d.ts +57 -0
- package/dist-runtime/workflow/lib/release.js +256 -0
- package/dist-runtime/workflow/lib/release.js.map +1 -0
- package/dist-runtime/workflow/lib/releaseFinalize.d.ts +14 -0
- package/dist-runtime/workflow/lib/releaseFinalize.js +571 -0
- package/dist-runtime/workflow/lib/releaseFinalize.js.map +1 -0
- package/dist-runtime/workflow/lib/releaseParameters.d.ts +43 -0
- package/dist-runtime/workflow/lib/releaseParameters.js +184 -0
- package/dist-runtime/workflow/lib/releaseParameters.js.map +1 -0
- package/dist-runtime/workflow/lib/reporter.d.ts +39 -0
- package/dist-runtime/workflow/lib/reporter.js +452 -0
- package/dist-runtime/workflow/lib/reporter.js.map +1 -0
- package/dist-runtime/workflow/lib/resultPaths.d.ts +17 -0
- package/dist-runtime/workflow/lib/resultPaths.js +29 -0
- package/dist-runtime/workflow/lib/resultPaths.js.map +1 -0
- package/dist-runtime/workflow/lib/runtimeVersion.d.ts +10 -0
- package/dist-runtime/workflow/lib/runtimeVersion.js +46 -0
- package/dist-runtime/workflow/lib/runtimeVersion.js.map +1 -0
- package/dist-runtime/workflow/lib/signer.d.ts +10 -0
- package/dist-runtime/workflow/lib/signer.js +105 -0
- package/dist-runtime/workflow/lib/signer.js.map +1 -0
- package/dist-runtime/workflow/lib/signerIdentity.d.ts +1 -0
- package/dist-runtime/workflow/lib/signerIdentity.js +23 -0
- package/dist-runtime/workflow/lib/signerIdentity.js.map +1 -0
- package/dist-runtime/workflow/lib/simulation.d.ts +35 -0
- package/dist-runtime/workflow/lib/simulation.js +282 -0
- package/dist-runtime/workflow/lib/simulation.js.map +1 -0
- package/dist-runtime/workflow/lib/simulationCallers.d.ts +44 -0
- package/dist-runtime/workflow/lib/simulationCallers.js +260 -0
- package/dist-runtime/workflow/lib/simulationCallers.js.map +1 -0
- package/dist-runtime/workflow/lib/sourceRpcPolicy.d.ts +1 -0
- package/dist-runtime/workflow/lib/sourceRpcPolicy.js +43 -0
- package/dist-runtime/workflow/lib/sourceRpcPolicy.js.map +1 -0
- package/dist-runtime/workflow/lib/state.d.ts +6 -0
- package/dist-runtime/workflow/lib/state.js +25 -0
- package/dist-runtime/workflow/lib/state.js.map +1 -0
- package/dist-runtime/workflow/lib/staticValidation.d.ts +22 -0
- package/dist-runtime/workflow/lib/staticValidation.js +124 -0
- package/dist-runtime/workflow/lib/staticValidation.js.map +1 -0
- package/dist-runtime/workflow/lib/zksyncForkCapability.d.ts +27 -0
- package/dist-runtime/workflow/lib/zksyncForkCapability.js +52 -0
- package/dist-runtime/workflow/lib/zksyncForkCapability.js.map +1 -0
- package/dist-runtime/workflow/lib/zksyncForkRunner.d.ts +57 -0
- package/dist-runtime/workflow/lib/zksyncForkRunner.js +344 -0
- package/dist-runtime/workflow/lib/zksyncForkRunner.js.map +1 -0
- package/dist-runtime/workflow/reconcileExternal.d.ts +1 -0
- package/dist-runtime/workflow/reconcileExternal.js +87 -0
- package/dist-runtime/workflow/reconcileExternal.js.map +1 -0
- package/dist-runtime/workflow/reconcileExternalRun.d.ts +1 -0
- package/dist-runtime/workflow/reconcileExternalRun.js +77 -0
- package/dist-runtime/workflow/reconcileExternalRun.js.map +1 -0
- package/dist-runtime/workflow/releaseFinalize.d.ts +1 -0
- package/dist-runtime/workflow/releaseFinalize.js +11 -0
- package/dist-runtime/workflow/releaseFinalize.js.map +1 -0
- package/dist-runtime/workflow/run.d.ts +40 -0
- package/dist-runtime/workflow/run.js +858 -0
- package/dist-runtime/workflow/run.js.map +1 -0
- package/dist-runtime/workflow/staticValidate.d.ts +1 -0
- package/dist-runtime/workflow/staticValidate.js +26 -0
- package/dist-runtime/workflow/staticValidate.js.map +1 -0
- package/dist-runtime/workflow/steps/call.d.ts +3 -0
- package/dist-runtime/workflow/steps/call.js +9 -0
- package/dist-runtime/workflow/steps/call.js.map +1 -0
- package/dist-runtime/workflow/steps/check.d.ts +3 -0
- package/dist-runtime/workflow/steps/check.js +9 -0
- package/dist-runtime/workflow/steps/check.js.map +1 -0
- package/dist-runtime/workflow/steps/custom.d.ts +3 -0
- package/dist-runtime/workflow/steps/custom.js +33 -0
- package/dist-runtime/workflow/steps/custom.js.map +1 -0
- package/dist-runtime/workflow/steps/deploy.d.ts +3 -0
- package/dist-runtime/workflow/steps/deploy.js +596 -0
- package/dist-runtime/workflow/steps/deploy.js.map +1 -0
- package/dist-runtime/workflow/steps/upgrade.d.ts +3 -0
- package/dist-runtime/workflow/steps/upgrade.js +466 -0
- package/dist-runtime/workflow/steps/upgrade.js.map +1 -0
- package/dist-runtime/workflow/steps/view.d.ts +3 -0
- package/dist-runtime/workflow/steps/view.js +9 -0
- package/dist-runtime/workflow/steps/view.js.map +1 -0
- package/docs/direct-package-acceptance.md +20 -0
- package/docs/external-infrastructure-acceptance.md +33 -0
- package/docs/network-runtime-acceptance.md +18 -0
- package/docs/plans/2026-09-09-workflow-extraction.md +16 -0
- package/docs/superpowers/plans/2026-07-22-manifest-bootstrap-transaction.md +50 -0
- package/docs/superpowers/plans/2026-07-22-manifest-review-remediation.md +49 -0
- package/docs/superpowers/plans/2026-08-17-custody-hardhat-signers.md +227 -0
- package/docs/superpowers/plans/2026-09-09-remove-template-infrastructure-contracts.md +11 -0
- package/docs/workflow-reference.md +1181 -0
- package/docs/workflow-runtime-acceptance.md +17 -0
- package/docs/workflow-runtime.md +56 -0
- package/package.json +26 -5
- package/runtime/config/hardhatAdapters.ts +58 -0
- package/runtime/config/networks.ts +305 -0
- package/runtime/config/openzeppelin.ts +173 -0
- package/runtime/config/rpc.ts +27 -0
- package/runtime/config/zksyncSolcPath.ts +59 -0
- package/runtime/hardhat-types.d.ts +2 -0
- package/runtime/migrate.ts +154 -0
- package/runtime/projectHardhat.ts +10 -0
- package/runtime/template-migration.json +293 -0
- package/runtime/workflow/checkCode.ts +13 -0
- package/runtime/workflow/checkCodeFinalize.ts +8 -0
- package/runtime/workflow/checkCodePlan.ts +8 -0
- package/runtime/workflow/cli.ts +356 -0
- package/runtime/workflow/commitContractInfo.ts +63 -0
- package/runtime/workflow/create2Hashes.ts +79 -0
- package/runtime/workflow/forkSourceProxy.ts +193 -0
- package/runtime/workflow/importState.ts +190 -0
- package/runtime/workflow/lib/authority.ts +170 -0
- package/runtime/workflow/lib/calldata.ts +9 -0
- package/runtime/workflow/lib/calls.ts +407 -0
- package/runtime/workflow/lib/checkCode/args.ts +76 -0
- package/runtime/workflow/lib/checkCode/command.ts +36 -0
- package/runtime/workflow/lib/checkCode/dependencies.ts +112 -0
- package/runtime/workflow/lib/checkCode/finalize.ts +198 -0
- package/runtime/workflow/lib/checkCode/index.ts +18 -0
- package/runtime/workflow/lib/checkCode/plan.ts +163 -0
- package/runtime/workflow/lib/checkCodeReport.ts +133 -0
- package/runtime/workflow/lib/checkCodeRunner.ts +1225 -0
- package/runtime/workflow/lib/cliTool.ts +31 -0
- package/runtime/workflow/lib/config.ts +130 -0
- package/runtime/workflow/lib/contractInfoCandidates.ts +690 -0
- package/runtime/workflow/lib/controlledMulticallAbi.ts +6 -0
- package/runtime/workflow/lib/create2.ts +278 -0
- package/runtime/workflow/lib/create2Hashes.ts +83 -0
- package/runtime/workflow/lib/deploymentInfo.ts +286 -0
- package/runtime/workflow/lib/deploymentRecords.ts +576 -0
- package/runtime/workflow/lib/deployments.ts +276 -0
- package/runtime/workflow/lib/erc1967.ts +57 -0
- package/runtime/workflow/lib/errors.ts +95 -0
- package/runtime/workflow/lib/executionId.ts +35 -0
- package/runtime/workflow/lib/executionPlan.ts +550 -0
- package/runtime/workflow/lib/executionProgress.ts +127 -0
- package/runtime/workflow/lib/external.ts +372 -0
- package/runtime/workflow/lib/externalExecutionScanner.ts +892 -0
- package/runtime/workflow/lib/forkSnapshot.ts +231 -0
- package/runtime/workflow/lib/gateTool.ts +261 -0
- package/runtime/workflow/lib/gateToolSync.ts +398 -0
- package/runtime/workflow/lib/lock.ts +388 -0
- package/runtime/workflow/lib/migrationState.ts +1246 -0
- package/runtime/workflow/lib/operatorExecution.ts +174 -0
- package/runtime/workflow/lib/parameters.ts +438 -0
- package/runtime/workflow/lib/pendingDeploymentReuse.ts +428 -0
- package/runtime/workflow/lib/proxy.ts +45 -0
- package/runtime/workflow/lib/registryCommit.ts +455 -0
- package/runtime/workflow/lib/release.ts +329 -0
- package/runtime/workflow/lib/releaseFinalize.ts +711 -0
- package/runtime/workflow/lib/releaseParameters.ts +248 -0
- package/runtime/workflow/lib/reporter.ts +502 -0
- package/runtime/workflow/lib/resultPaths.ts +49 -0
- package/runtime/workflow/lib/runtimeVersion.ts +28 -0
- package/runtime/workflow/lib/signer.ts +124 -0
- package/runtime/workflow/lib/signerIdentity.ts +22 -0
- package/runtime/workflow/lib/simulation.ts +415 -0
- package/runtime/workflow/lib/simulationCallers.ts +335 -0
- package/runtime/workflow/lib/sourceRpcPolicy.ts +41 -0
- package/runtime/workflow/lib/state.ts +25 -0
- package/runtime/workflow/lib/staticValidation.ts +142 -0
- package/runtime/workflow/lib/zksyncForkCapability.ts +80 -0
- package/runtime/workflow/lib/zksyncForkRunner.ts +505 -0
- package/runtime/workflow/reconcileExternal.ts +86 -0
- package/runtime/workflow/reconcileExternalRun.ts +88 -0
- package/runtime/workflow/releaseFinalize.ts +8 -0
- package/runtime/workflow/run.ts +1072 -0
- package/runtime/workflow/staticValidate.ts +23 -0
- package/runtime/workflow/steps/call.ts +10 -0
- package/runtime/workflow/steps/check.ts +10 -0
- package/runtime/workflow/steps/custom.ts +43 -0
- package/runtime/workflow/steps/deploy.ts +772 -0
- package/runtime/workflow/steps/upgrade.ts +599 -0
- package/runtime/workflow/steps/view.ts +10 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.commitVerifiedContractInfo = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const config_1 = require("./config");
|
|
10
|
+
const contractInfoCandidates_1 = require("./contractInfoCandidates");
|
|
11
|
+
const deployments_1 = require("./deployments");
|
|
12
|
+
const deploymentInfo_1 = require("./deploymentInfo");
|
|
13
|
+
const deploymentRecords_1 = require("./deploymentRecords");
|
|
14
|
+
const executionPlan_1 = require("./executionPlan");
|
|
15
|
+
const operatorExecution_1 = require("./operatorExecution");
|
|
16
|
+
const lock_1 = require("./lock");
|
|
17
|
+
const release_1 = require("./release");
|
|
18
|
+
const SAFE_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,199}$/;
|
|
19
|
+
const safeId = (value, label) => {
|
|
20
|
+
if (!SAFE_ID.test(value))
|
|
21
|
+
throw new Error(`${label} is invalid`);
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
const projectRelative = (root, filePath) => {
|
|
25
|
+
const relative = path_1.default.relative(path_1.default.resolve(root), path_1.default.resolve(filePath));
|
|
26
|
+
if (!relative || relative.startsWith("..") || path_1.default.isAbsolute(relative)) {
|
|
27
|
+
throw new Error("Registry evidence path escapes the project root");
|
|
28
|
+
}
|
|
29
|
+
return relative.split(path_1.default.sep).join("/");
|
|
30
|
+
};
|
|
31
|
+
const writeExclusiveJson = (filePath, value) => {
|
|
32
|
+
fs_1.default.mkdirSync(path_1.default.dirname(filePath), { recursive: true });
|
|
33
|
+
try {
|
|
34
|
+
fs_1.default.writeFileSync(filePath, JSON.stringify(value, null, 2) + "\n", {
|
|
35
|
+
flag: "wx",
|
|
36
|
+
mode: 0o600,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error
|
|
41
|
+
&& typeof error === "object"
|
|
42
|
+
&& "code" in error
|
|
43
|
+
&& String(error.code) === "EEXIST") {
|
|
44
|
+
throw new Error(`Registry evidence already exists: ${filePath}`);
|
|
45
|
+
}
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const loadContractInfoBackup = (filePath) => ((0, deployments_1.validateContractInfo)((0, config_1.readJsonFile)(filePath)));
|
|
50
|
+
const candidatePath = (root, executionId) => path_1.default.join(root, `contractInfo.pending.${safeId(executionId, "selection executionId")}.json`);
|
|
51
|
+
const verificationPath = (taskDir, selection) => path_1.default.join(taskDir, "results", selection.network, selection.executionId, "verify", "verification.json");
|
|
52
|
+
const assertBusinessVerification = (taskDir, taskId, selection) => {
|
|
53
|
+
let verification;
|
|
54
|
+
try {
|
|
55
|
+
verification = (0, config_1.readJsonFile)(verificationPath(taskDir, selection));
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
throw new Error(`Business verification is missing for ${selection.network}`);
|
|
59
|
+
}
|
|
60
|
+
if (verification.taskId !== taskId
|
|
61
|
+
|| verification.target !== selection.network
|
|
62
|
+
|| verification.executionId !== selection.executionId
|
|
63
|
+
|| verification.mode !== "verify"
|
|
64
|
+
|| !Array.isArray(verification.steps)
|
|
65
|
+
|| verification.steps.length === 0) {
|
|
66
|
+
throw new Error(`Business verification is missing for ${selection.network}`);
|
|
67
|
+
}
|
|
68
|
+
for (const [index, rawStep] of verification.steps.entries()) {
|
|
69
|
+
if (!rawStep || typeof rawStep !== "object" || Array.isArray(rawStep)) {
|
|
70
|
+
throw new Error(`Business verification step ${index} is invalid`);
|
|
71
|
+
}
|
|
72
|
+
const step = rawStep;
|
|
73
|
+
if (!step.results || typeof step.results !== "object" || Array.isArray(step.results)) {
|
|
74
|
+
throw new Error(`Business verification step ${index} has no results`);
|
|
75
|
+
}
|
|
76
|
+
for (const result of Object.values(step.results)) {
|
|
77
|
+
if (!result || typeof result !== "object" || Array.isArray(result)) {
|
|
78
|
+
throw new Error(`Business verification step ${index} result is invalid`);
|
|
79
|
+
}
|
|
80
|
+
const comparison = result;
|
|
81
|
+
if (String(comparison.actual) !== String(comparison.expected)) {
|
|
82
|
+
throw new Error(`Business verification step ${index} did not match expected state`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const status = (0, config_1.readJsonFile)(path_1.default.join(taskDir, "status.json"));
|
|
87
|
+
const networkStatus = status.networks && typeof status.networks === "object"
|
|
88
|
+
? status.networks[selection.network]
|
|
89
|
+
: undefined;
|
|
90
|
+
if (networkStatus?.lastExecutionId !== selection.executionId
|
|
91
|
+
|| networkStatus.lastExecutionMode !== "verify"
|
|
92
|
+
|| networkStatus.verifyStatus !== "verified") {
|
|
93
|
+
throw new Error(`Verify status is stale for ${selection.network}`);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const readRecord = (taskDir, taskId, selection) => {
|
|
97
|
+
const filePath = (0, deploymentRecords_1.deploymentRecordPath)(taskDir, selection.network, selection.executionId);
|
|
98
|
+
const record = (0, config_1.readJsonFile)(filePath);
|
|
99
|
+
if (record.taskId !== taskId
|
|
100
|
+
|| record.network !== selection.network
|
|
101
|
+
|| record.executionId !== selection.executionId) {
|
|
102
|
+
throw new Error(`Deployment record identity mismatch for ${selection.network}`);
|
|
103
|
+
}
|
|
104
|
+
if (record.status !== "waiting_code_check" && record.status !== "applied") {
|
|
105
|
+
throw new Error(`Deployment record ${selection.network} is ${record.status}, expected waiting_code_check`);
|
|
106
|
+
}
|
|
107
|
+
return { record, filePath };
|
|
108
|
+
};
|
|
109
|
+
const readCandidate = (root, taskId, selection, allowPromoted) => {
|
|
110
|
+
const filePath = candidatePath(root, selection.executionId);
|
|
111
|
+
if (!fs_1.default.existsSync(filePath))
|
|
112
|
+
return undefined;
|
|
113
|
+
const candidate = (0, contractInfoCandidates_1.validateContractInfoCandidate)((0, config_1.readJsonFile)(filePath));
|
|
114
|
+
if (candidate.deploymentId !== taskId
|
|
115
|
+
|| candidate.executionId !== selection.executionId
|
|
116
|
+
|| candidate.network !== selection.network) {
|
|
117
|
+
throw new Error(`ContractInfo candidate identity mismatch for ${selection.network}`);
|
|
118
|
+
}
|
|
119
|
+
if (candidate.status === "promoted" && !allowPromoted) {
|
|
120
|
+
throw new Error(`ContractInfo candidate was already committed for ${selection.network}`);
|
|
121
|
+
}
|
|
122
|
+
return { candidate, filePath };
|
|
123
|
+
};
|
|
124
|
+
const reconciliationPath = (taskDir, selection) => path_1.default.join(taskDir, "results", selection.network, selection.executionId, "external-reconciliation.json");
|
|
125
|
+
const assertExecutionEvidence = (input) => {
|
|
126
|
+
const plan = (0, executionPlan_1.loadReleaseExecutionPlan)({
|
|
127
|
+
root: input.root,
|
|
128
|
+
taskDir: input.taskDir,
|
|
129
|
+
target: input.selection.network,
|
|
130
|
+
executionId: input.selection.executionId,
|
|
131
|
+
});
|
|
132
|
+
if (plan.taskId !== input.taskId)
|
|
133
|
+
throw new Error("Execution plan taskId mismatch");
|
|
134
|
+
const operatorExecutionPath = path_1.default.join(input.taskDir, "results", plan.target, plan.executionId, "operator-execution.json");
|
|
135
|
+
if (plan.transactions.some((transaction) => transaction.route === "operator")
|
|
136
|
+
|| fs_1.default.existsSync(operatorExecutionPath)) {
|
|
137
|
+
(0, operatorExecution_1.loadOperatorExecutionResult)({ taskDir: input.taskDir, plan });
|
|
138
|
+
}
|
|
139
|
+
if (plan.releaseKind === "development") {
|
|
140
|
+
if (plan.transactions.some((transaction) => transaction.route !== "operator")) {
|
|
141
|
+
throw new Error("Development registry commit cannot contain external transactions");
|
|
142
|
+
}
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const lock = (0, lock_1.readParameterLockExecution)(input.taskDir, input.selection.executionId);
|
|
146
|
+
if (lock.finalSimulation.status !== "succeeded") {
|
|
147
|
+
throw new Error(`Final simulation is incomplete for ${input.selection.network}`);
|
|
148
|
+
}
|
|
149
|
+
if (lock.finalSimulation.executionPlanHash !== plan.planHash) {
|
|
150
|
+
throw new Error(`Final simulation execution plan is stale for ${input.selection.network}`);
|
|
151
|
+
}
|
|
152
|
+
const report = (0, config_1.readJsonFile)(reconciliationPath(input.taskDir, input.selection));
|
|
153
|
+
if (report.version !== 1
|
|
154
|
+
|| report.taskId !== input.taskId
|
|
155
|
+
|| report.target !== input.selection.network
|
|
156
|
+
|| report.executionId !== input.selection.executionId
|
|
157
|
+
|| report.executionPlanHash !== plan.planHash
|
|
158
|
+
|| (report.status !== "not_required" && report.status !== "reconciled")
|
|
159
|
+
|| !Array.isArray(report.matches)
|
|
160
|
+
|| report.matches.length !== plan.transactions.length
|
|
161
|
+
|| report.matches.some((match) => (!match
|
|
162
|
+
|| typeof match !== "object"
|
|
163
|
+
|| match.finalized !== true
|
|
164
|
+
|| match.receiptStatus !== 1))) {
|
|
165
|
+
throw new Error(`Admin external reconciliation is incomplete for ${input.selection.network}`);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const updateCommittedStatus = (taskDir, selections) => {
|
|
169
|
+
const filePath = path_1.default.join(taskDir, "status.json");
|
|
170
|
+
const current = (0, config_1.readJsonFile)(filePath);
|
|
171
|
+
const currentNetworks = current.networks && typeof current.networks === "object"
|
|
172
|
+
? current.networks
|
|
173
|
+
: {};
|
|
174
|
+
const networks = { ...currentNetworks };
|
|
175
|
+
const now = new Date().toISOString();
|
|
176
|
+
for (const selection of selections) {
|
|
177
|
+
networks[selection.network] = {
|
|
178
|
+
...(networks[selection.network] || {}),
|
|
179
|
+
deployStatus: "deployed_pending_code_audit",
|
|
180
|
+
registryExecutionId: selection.executionId,
|
|
181
|
+
updatedAt: now,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
(0, config_1.writeJsonFile)(filePath, {
|
|
185
|
+
...current,
|
|
186
|
+
status: "deployed_pending_code_audit",
|
|
187
|
+
networks,
|
|
188
|
+
updatedAt: now,
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
const markDeploymentRecordsCommitted = (root, recordPaths) => {
|
|
192
|
+
const now = new Date().toISOString();
|
|
193
|
+
for (const recordPath of recordPaths) {
|
|
194
|
+
const filePath = path_1.default.join(root, ...recordPath.split("/"));
|
|
195
|
+
const record = (0, config_1.readJsonFile)(filePath);
|
|
196
|
+
const changes = record.changes.map((change) => (change.status === "waiting_code_check"
|
|
197
|
+
? { ...change, status: "applied" }
|
|
198
|
+
: change));
|
|
199
|
+
if (changes.some((change) => change.status !== "applied")) {
|
|
200
|
+
throw new Error(`Deployment record is not ready to commit: ${recordPath}`);
|
|
201
|
+
}
|
|
202
|
+
(0, config_1.writeJsonFile)(filePath, {
|
|
203
|
+
...record,
|
|
204
|
+
status: "applied",
|
|
205
|
+
changes,
|
|
206
|
+
updatedAt: now,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const validateSelections = (selections) => {
|
|
211
|
+
if (selections.length === 0)
|
|
212
|
+
throw new Error("Registry commit requires at least one selection");
|
|
213
|
+
const normalized = selections.map((selection) => ({
|
|
214
|
+
network: safeId(selection.network, "selection network"),
|
|
215
|
+
executionId: safeId(selection.executionId, "selection executionId"),
|
|
216
|
+
})).sort((left, right) => left.network.localeCompare(right.network));
|
|
217
|
+
if (new Set(normalized.map((selection) => selection.network)).size !== normalized.length) {
|
|
218
|
+
throw new Error("Registry commit selections contain a duplicate network");
|
|
219
|
+
}
|
|
220
|
+
return normalized;
|
|
221
|
+
};
|
|
222
|
+
const loadExistingReport = (filePath, taskId, commitId, selections) => {
|
|
223
|
+
if (!fs_1.default.existsSync(filePath))
|
|
224
|
+
return undefined;
|
|
225
|
+
const report = (0, config_1.readJsonFile)(filePath);
|
|
226
|
+
if (report.version !== 1
|
|
227
|
+
|| report.status !== "committed"
|
|
228
|
+
|| report.taskId !== taskId
|
|
229
|
+
|| report.commitId !== commitId
|
|
230
|
+
|| JSON.stringify(report.selections) !== JSON.stringify(selections)) {
|
|
231
|
+
throw new Error("Registry commitId already exists with different content");
|
|
232
|
+
}
|
|
233
|
+
return report;
|
|
234
|
+
};
|
|
235
|
+
const commitVerifiedContractInfo = (input) => {
|
|
236
|
+
const taskId = safeId(input.taskId, "registry taskId");
|
|
237
|
+
const commitId = safeId(input.commitId, "registry commitId");
|
|
238
|
+
const selections = validateSelections(input.selections);
|
|
239
|
+
const taskDir = path_1.default.join(input.root, "scripts", "tasks", taskId);
|
|
240
|
+
const registryDir = path_1.default.join(taskDir, "results", "registry");
|
|
241
|
+
const reportFile = path_1.default.join(registryDir, `${commitId}.json`);
|
|
242
|
+
const backupFile = path_1.default.join(registryDir, `${commitId}.contractInfo.before.json`);
|
|
243
|
+
const recoveringCommit = fs_1.default.existsSync(backupFile);
|
|
244
|
+
const existingReport = loadExistingReport(reportFile, taskId, commitId, selections);
|
|
245
|
+
if (existingReport) {
|
|
246
|
+
const config = (0, config_1.loadConfig)(input.root);
|
|
247
|
+
if ((0, release_1.hashValue)((0, deployments_1.loadContractInfo)(input.root, config)) !== existingReport.afterHash) {
|
|
248
|
+
throw new Error("Committed contractInfo hash no longer matches the registry report");
|
|
249
|
+
}
|
|
250
|
+
if ((0, release_1.hashValue)((0, deploymentInfo_1.loadDeploymentInfo)(input.root)) !== existingReport.deploymentInfoHash) {
|
|
251
|
+
throw new Error("Committed deploymentInfo hash no longer matches the registry report");
|
|
252
|
+
}
|
|
253
|
+
return existingReport;
|
|
254
|
+
}
|
|
255
|
+
const records = [];
|
|
256
|
+
const candidates = [];
|
|
257
|
+
for (const selection of selections) {
|
|
258
|
+
assertExecutionEvidence({ root: input.root, taskDir, taskId, selection });
|
|
259
|
+
assertBusinessVerification(taskDir, taskId, selection);
|
|
260
|
+
const record = readRecord(taskDir, taskId, selection);
|
|
261
|
+
records.push(projectRelative(input.root, record.filePath));
|
|
262
|
+
const candidate = readCandidate(input.root, taskId, selection, recoveringCommit);
|
|
263
|
+
if (candidate)
|
|
264
|
+
candidates.push(candidate);
|
|
265
|
+
}
|
|
266
|
+
const config = (0, config_1.loadConfig)(input.root);
|
|
267
|
+
const current = (0, deployments_1.loadContractInfo)(input.root, config);
|
|
268
|
+
const before = recoveringCommit
|
|
269
|
+
? loadContractInfoBackup(backupFile)
|
|
270
|
+
: current;
|
|
271
|
+
const beforeHash = (0, release_1.hashValue)(before);
|
|
272
|
+
let afterHash = beforeHash;
|
|
273
|
+
let changedEntries = [];
|
|
274
|
+
let deploymentInfoHash = (0, release_1.hashValue)((0, deploymentInfo_1.loadDeploymentInfo)(input.root));
|
|
275
|
+
let backupPath;
|
|
276
|
+
if (candidates.length > 0) {
|
|
277
|
+
if (!recoveringCommit) {
|
|
278
|
+
writeExclusiveJson(backupFile, before);
|
|
279
|
+
}
|
|
280
|
+
backupPath = projectRelative(input.root, backupFile);
|
|
281
|
+
const promoted = (0, contractInfoCandidates_1.promoteContractInfoCandidates)({
|
|
282
|
+
root: input.root,
|
|
283
|
+
config,
|
|
284
|
+
candidatePaths: candidates.map((candidate) => projectRelative(input.root, candidate.filePath)),
|
|
285
|
+
});
|
|
286
|
+
afterHash = promoted.afterHash;
|
|
287
|
+
changedEntries = promoted.changedEntries;
|
|
288
|
+
}
|
|
289
|
+
const deploymentInfo = (0, deploymentInfo_1.updateDeploymentInfoFromRecords)({
|
|
290
|
+
root: input.root,
|
|
291
|
+
records: records.map((recordPath) => ({ recordPath })),
|
|
292
|
+
expectedContractInfo: (0, deployments_1.loadContractInfo)(input.root, config),
|
|
293
|
+
});
|
|
294
|
+
deploymentInfoHash = (0, release_1.hashValue)(deploymentInfo);
|
|
295
|
+
markDeploymentRecordsCommitted(input.root, records);
|
|
296
|
+
updateCommittedStatus(taskDir, selections);
|
|
297
|
+
const report = {
|
|
298
|
+
version: 1,
|
|
299
|
+
status: "committed",
|
|
300
|
+
taskId,
|
|
301
|
+
commitId,
|
|
302
|
+
selections,
|
|
303
|
+
beforeHash,
|
|
304
|
+
afterHash,
|
|
305
|
+
changedEntries: [...changedEntries].sort((left, right) => (`${left.network}.${left.instanceId}`.localeCompare(`${right.network}.${right.instanceId}`))),
|
|
306
|
+
candidatePaths: candidates
|
|
307
|
+
.map((candidate) => projectRelative(input.root, candidate.filePath))
|
|
308
|
+
.sort(),
|
|
309
|
+
sourceRecordPaths: [...records].sort(),
|
|
310
|
+
backupPath,
|
|
311
|
+
deploymentInfoPath: "deploymentInfo.json",
|
|
312
|
+
deploymentInfoHash,
|
|
313
|
+
completedAt: new Date().toISOString(),
|
|
314
|
+
};
|
|
315
|
+
writeExclusiveJson(reportFile, report);
|
|
316
|
+
return report;
|
|
317
|
+
};
|
|
318
|
+
exports.commitVerifiedContractInfo = commitVerifiedContractInfo;
|
|
319
|
+
//# sourceMappingURL=registryCommit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registryCommit.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/registryCommit.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,qCAAmE;AACnE,qEAKkC;AAClC,+CAAuE;AACvE,qDAAuF;AACvF,2DAA2F;AAC3F,mDAA2D;AAC3D,2DAAkE;AAClE,iCAAoD;AACpD,uCAAsC;AA+BtC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAEpD,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,KAAa,EAAU,EAAE;IACtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,aAAa,CAAC,CAAC;IACjE,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAU,EAAE;IACjE,MAAM,QAAQ,GAAG,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3E,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,cAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CAAC,iDAAiD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U;QACV,SAAS;QACT,cAAc,EAAE,CAAC,GAAG,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CACxD,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAC3F,CAAC;QACF,cAAc,EAAE,UAAU;aACvB,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;aACnE,IAAI,EAAE;QACT,iBAAiB,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE;QACtC,UAAU;QACV,kBAAkB,EAAE,qBAAqB;QACzC,kBAAkB;QAClB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACtC,CAAC;IACF,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA/FW,QAAA,0BAA0B,8BA+FrC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare const normalizeCreate2Scheme: (value: unknown) => "evm" | "zksync-eravm";
|
|
2
|
+
export interface ReleaseFingerprint {
|
|
3
|
+
manifestHash: string;
|
|
4
|
+
artifactHash: string;
|
|
5
|
+
parametersHash: string;
|
|
6
|
+
configHash: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ArtifactFingerprintInput {
|
|
9
|
+
contract: string;
|
|
10
|
+
bytecode: string;
|
|
11
|
+
deployedBytecode: string;
|
|
12
|
+
linkReferences: unknown;
|
|
13
|
+
deployedLinkReferences: unknown;
|
|
14
|
+
solcVersion: string;
|
|
15
|
+
optimizer: unknown;
|
|
16
|
+
evmVersion?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ReleaseFingerprintInput {
|
|
19
|
+
manifest: string;
|
|
20
|
+
artifacts: ArtifactFingerprintInput[];
|
|
21
|
+
parameters: Record<string, unknown>;
|
|
22
|
+
network: string;
|
|
23
|
+
chainId?: number;
|
|
24
|
+
target: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
export interface ReleaseNetwork extends Partial<ReleaseFingerprint> {
|
|
27
|
+
status: string;
|
|
28
|
+
simulationResult: string;
|
|
29
|
+
simulatedAt: string;
|
|
30
|
+
simulationCallerNetworkHash?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface DeploymentRelease {
|
|
33
|
+
version: 1;
|
|
34
|
+
sourceSuperTaskId: string;
|
|
35
|
+
developmentNetwork: string;
|
|
36
|
+
manifestHash: string;
|
|
37
|
+
artifactHash: string;
|
|
38
|
+
networks: Record<string, ReleaseNetwork>;
|
|
39
|
+
}
|
|
40
|
+
export interface ReleaseTargetSimulationRecordInput {
|
|
41
|
+
taskDir: string;
|
|
42
|
+
network: string;
|
|
43
|
+
executionId: string;
|
|
44
|
+
simulationResult: string;
|
|
45
|
+
simulatedAt: string;
|
|
46
|
+
simulationCallerNetworkHash: string;
|
|
47
|
+
fingerprint: ReleaseFingerprint;
|
|
48
|
+
}
|
|
49
|
+
export declare const stableJson: (value: unknown) => string;
|
|
50
|
+
export declare const hashValue: (value: unknown) => string;
|
|
51
|
+
export declare const hashArtifactInputs: (artifacts: ArtifactFingerprintInput[]) => string;
|
|
52
|
+
export declare const hashTargetConfig: (network: string, chainId: number | undefined, target: Record<string, unknown>) => string;
|
|
53
|
+
export declare const buildReleaseFingerprint: (input: ReleaseFingerprintInput) => ReleaseFingerprint;
|
|
54
|
+
export declare const validateRelease: (value: unknown) => DeploymentRelease;
|
|
55
|
+
export declare const loadRelease: (taskDir: string) => DeploymentRelease;
|
|
56
|
+
export declare const recordReleaseTargetSimulationSucceeded: (input: ReleaseTargetSimulationRecordInput) => DeploymentRelease;
|
|
57
|
+
export declare const assertReleaseNetworkReady: (release: DeploymentRelease, network: string, currentFingerprint: ReleaseFingerprint) => ReleaseNetwork;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.assertReleaseNetworkReady = exports.recordReleaseTargetSimulationSucceeded = exports.loadRelease = exports.validateRelease = exports.buildReleaseFingerprint = exports.hashTargetConfig = exports.hashArtifactInputs = exports.hashValue = exports.stableJson = exports.normalizeCreate2Scheme = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const normalizeCreate2Scheme = (value) => {
|
|
11
|
+
if (value === undefined || value === null || value === "" || value === "evm") {
|
|
12
|
+
return "evm";
|
|
13
|
+
}
|
|
14
|
+
if (value === "zksync-eravm")
|
|
15
|
+
return value;
|
|
16
|
+
throw new Error("CREATE2 scheme must be evm or zksync-eravm");
|
|
17
|
+
};
|
|
18
|
+
exports.normalizeCreate2Scheme = normalizeCreate2Scheme;
|
|
19
|
+
const asObject = (value, label) => {
|
|
20
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
21
|
+
throw new Error(label + " must be an object");
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
25
|
+
const requiredString = (source, key, label) => {
|
|
26
|
+
const value = source[key];
|
|
27
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
28
|
+
throw new Error(label + "." + key + " must be a non-empty string");
|
|
29
|
+
}
|
|
30
|
+
return value.trim();
|
|
31
|
+
};
|
|
32
|
+
const normalizeForJson = (value) => {
|
|
33
|
+
if (Array.isArray(value)) {
|
|
34
|
+
return value.map((item) => normalizeForJson(item));
|
|
35
|
+
}
|
|
36
|
+
if (value && typeof value === "object") {
|
|
37
|
+
return Object.fromEntries(Object.keys(value)
|
|
38
|
+
.sort()
|
|
39
|
+
.filter((key) => value[key] !== undefined)
|
|
40
|
+
.map((key) => [key, normalizeForJson(value[key])]));
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
};
|
|
44
|
+
const stableJson = (value) => {
|
|
45
|
+
return JSON.stringify(normalizeForJson(value));
|
|
46
|
+
};
|
|
47
|
+
exports.stableJson = stableJson;
|
|
48
|
+
const hashValue = (value) => {
|
|
49
|
+
return crypto_1.default.createHash("sha256").update((0, exports.stableJson)(value)).digest("hex");
|
|
50
|
+
};
|
|
51
|
+
exports.hashValue = hashValue;
|
|
52
|
+
const hashText = (value) => {
|
|
53
|
+
return crypto_1.default.createHash("sha256").update(value).digest("hex");
|
|
54
|
+
};
|
|
55
|
+
const optionalObject = (value) => {
|
|
56
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
57
|
+
? value
|
|
58
|
+
: {};
|
|
59
|
+
};
|
|
60
|
+
const normalizedAddress = (value) => {
|
|
61
|
+
return typeof value === "string" ? value.toLowerCase() : value;
|
|
62
|
+
};
|
|
63
|
+
const hashArtifactInputs = (artifacts) => {
|
|
64
|
+
const normalized = artifacts
|
|
65
|
+
.map((artifact) => ({
|
|
66
|
+
contract: artifact.contract,
|
|
67
|
+
bytecode: artifact.bytecode,
|
|
68
|
+
deployedBytecode: artifact.deployedBytecode,
|
|
69
|
+
linkReferences: artifact.linkReferences,
|
|
70
|
+
deployedLinkReferences: artifact.deployedLinkReferences,
|
|
71
|
+
solcVersion: artifact.solcVersion,
|
|
72
|
+
optimizer: artifact.optimizer,
|
|
73
|
+
evmVersion: artifact.evmVersion || null,
|
|
74
|
+
}))
|
|
75
|
+
.sort((left, right) => left.contract.localeCompare(right.contract));
|
|
76
|
+
return (0, exports.hashValue)(normalized);
|
|
77
|
+
};
|
|
78
|
+
exports.hashArtifactInputs = hashArtifactInputs;
|
|
79
|
+
const hashTargetConfig = (network, chainId, target) => {
|
|
80
|
+
const create2 = optionalObject(target.create2);
|
|
81
|
+
const multicall = optionalObject(target.multicall);
|
|
82
|
+
const uups = optionalObject(target.uups);
|
|
83
|
+
return (0, exports.hashValue)({
|
|
84
|
+
network,
|
|
85
|
+
chainId: chainId ?? null,
|
|
86
|
+
create2: {
|
|
87
|
+
scheme: (0, exports.normalizeCreate2Scheme)(create2.scheme),
|
|
88
|
+
factory: normalizedAddress(create2.factory),
|
|
89
|
+
caller: normalizedAddress(create2.caller),
|
|
90
|
+
leadingZeroBytes: create2.leadingZeroBytes,
|
|
91
|
+
},
|
|
92
|
+
controlledMulticall: normalizedAddress(multicall.controlledMulticall),
|
|
93
|
+
uupsPlaceholderImplementation: normalizedAddress(uups.placeholderImplementation),
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
exports.hashTargetConfig = hashTargetConfig;
|
|
97
|
+
const buildReleaseFingerprint = (input) => {
|
|
98
|
+
return {
|
|
99
|
+
manifestHash: hashText(input.manifest),
|
|
100
|
+
artifactHash: (0, exports.hashArtifactInputs)(input.artifacts),
|
|
101
|
+
parametersHash: (0, exports.hashValue)(input.parameters),
|
|
102
|
+
configHash: (0, exports.hashTargetConfig)(input.network, input.chainId, input.target),
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
exports.buildReleaseFingerprint = buildReleaseFingerprint;
|
|
106
|
+
const validateRelease = (value) => {
|
|
107
|
+
const release = asObject(value, "release.json");
|
|
108
|
+
if (release.version !== 1) {
|
|
109
|
+
throw new Error("release.json.version must be 1");
|
|
110
|
+
}
|
|
111
|
+
const networksValue = asObject(release.networks, "release.json.networks");
|
|
112
|
+
const networks = {};
|
|
113
|
+
for (const [network, networkValue] of Object.entries(networksValue)) {
|
|
114
|
+
const entry = asObject(networkValue, "release.json.networks." + network);
|
|
115
|
+
const parsed = {
|
|
116
|
+
status: requiredString(entry, "status", "release.json.networks." + network),
|
|
117
|
+
simulationResult: requiredString(entry, "simulationResult", "release.json.networks." + network),
|
|
118
|
+
simulatedAt: requiredString(entry, "simulatedAt", "release.json.networks." + network),
|
|
119
|
+
};
|
|
120
|
+
for (const key of ["manifestHash", "artifactHash", "parametersHash", "configHash"]) {
|
|
121
|
+
if (entry[key] !== undefined) {
|
|
122
|
+
parsed[key] = requiredString(entry, key, "release.json.networks." + network);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (entry.simulationCallerNetworkHash !== undefined) {
|
|
126
|
+
parsed.simulationCallerNetworkHash = requiredString(entry, "simulationCallerNetworkHash", "release.json.networks." + network);
|
|
127
|
+
}
|
|
128
|
+
networks[network] = parsed;
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
version: 1,
|
|
132
|
+
sourceSuperTaskId: requiredString(release, "sourceSuperTaskId", "release.json"),
|
|
133
|
+
developmentNetwork: requiredString(release, "developmentNetwork", "release.json"),
|
|
134
|
+
manifestHash: requiredString(release, "manifestHash", "release.json"),
|
|
135
|
+
artifactHash: requiredString(release, "artifactHash", "release.json"),
|
|
136
|
+
networks,
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
exports.validateRelease = validateRelease;
|
|
140
|
+
const loadRelease = (taskDir) => {
|
|
141
|
+
const filePath = path_1.default.join(taskDir, "release.json");
|
|
142
|
+
if (!fs_1.default.existsSync(filePath)) {
|
|
143
|
+
throw new Error("Missing release.json in deployment task");
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
return (0, exports.validateRelease)(JSON.parse(fs_1.default.readFileSync(filePath, "utf8")));
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
if (error instanceof SyntaxError) {
|
|
150
|
+
throw new Error("release.json must contain valid JSON: " + error.message);
|
|
151
|
+
}
|
|
152
|
+
throw error;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
exports.loadRelease = loadRelease;
|
|
156
|
+
const safeResultPathSegment = (value, label) => {
|
|
157
|
+
if (!value
|
|
158
|
+
|| value === "."
|
|
159
|
+
|| value === ".."
|
|
160
|
+
|| !/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(value)) {
|
|
161
|
+
throw new Error(label + " must be a safe path segment");
|
|
162
|
+
}
|
|
163
|
+
return value;
|
|
164
|
+
};
|
|
165
|
+
const writeReleaseAtomically = (filePath, value) => {
|
|
166
|
+
const contents = `${JSON.stringify(value, null, 2)}\n`;
|
|
167
|
+
const tempPath = `${filePath}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`;
|
|
168
|
+
let descriptor;
|
|
169
|
+
try {
|
|
170
|
+
descriptor = fs_1.default.openSync(tempPath, "wx");
|
|
171
|
+
fs_1.default.writeFileSync(descriptor, contents);
|
|
172
|
+
fs_1.default.fsyncSync(descriptor);
|
|
173
|
+
fs_1.default.closeSync(descriptor);
|
|
174
|
+
descriptor = undefined;
|
|
175
|
+
fs_1.default.renameSync(tempPath, filePath);
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
if (descriptor !== undefined)
|
|
179
|
+
fs_1.default.closeSync(descriptor);
|
|
180
|
+
if (fs_1.default.existsSync(tempPath))
|
|
181
|
+
fs_1.default.unlinkSync(tempPath);
|
|
182
|
+
throw error;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const recordReleaseTargetSimulationSucceeded = (input) => {
|
|
186
|
+
const network = safeResultPathSegment(input.network, "release network");
|
|
187
|
+
const executionId = safeResultPathSegment(input.executionId, "simulation executionId");
|
|
188
|
+
const expectedResult = `results/${network}/${executionId}/simulation/execution.json`;
|
|
189
|
+
if (input.simulationResult !== expectedResult) {
|
|
190
|
+
throw new Error("Release target requires a canonical simulation result path");
|
|
191
|
+
}
|
|
192
|
+
if (!Number.isFinite(Date.parse(input.simulatedAt))) {
|
|
193
|
+
throw new Error("Release target simulatedAt is invalid");
|
|
194
|
+
}
|
|
195
|
+
if (!/^[0-9a-f]{64}$/.test(input.simulationCallerNetworkHash)) {
|
|
196
|
+
throw new Error("Release target simulation caller network hash is invalid");
|
|
197
|
+
}
|
|
198
|
+
const release = (0, exports.loadRelease)(input.taskDir);
|
|
199
|
+
const current = release.networks[network];
|
|
200
|
+
if (!current)
|
|
201
|
+
throw new Error("Release target is not present in release.json");
|
|
202
|
+
const recordedFingerprint = {
|
|
203
|
+
manifestHash: current.manifestHash || release.manifestHash,
|
|
204
|
+
artifactHash: current.artifactHash || release.artifactHash,
|
|
205
|
+
parametersHash: current.parametersHash || "",
|
|
206
|
+
configHash: current.configHash || "",
|
|
207
|
+
};
|
|
208
|
+
for (const key of ["manifestHash", "artifactHash", "parametersHash", "configHash"]) {
|
|
209
|
+
if (!input.fingerprint[key] || recordedFingerprint[key] !== input.fingerprint[key]) {
|
|
210
|
+
throw new Error("Release target fingerprint changed: " + key);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const next = (0, exports.validateRelease)({
|
|
214
|
+
...release,
|
|
215
|
+
networks: {
|
|
216
|
+
...release.networks,
|
|
217
|
+
[network]: {
|
|
218
|
+
...current,
|
|
219
|
+
status: "simulated",
|
|
220
|
+
...input.fingerprint,
|
|
221
|
+
simulationCallerNetworkHash: input.simulationCallerNetworkHash,
|
|
222
|
+
simulationResult: expectedResult,
|
|
223
|
+
simulatedAt: input.simulatedAt,
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
writeReleaseAtomically(path_1.default.join(input.taskDir, "release.json"), next);
|
|
228
|
+
return next;
|
|
229
|
+
};
|
|
230
|
+
exports.recordReleaseTargetSimulationSucceeded = recordReleaseTargetSimulationSucceeded;
|
|
231
|
+
const assertReleaseNetworkReady = (release, network, currentFingerprint) => {
|
|
232
|
+
const entry = release.networks[network];
|
|
233
|
+
if (!entry) {
|
|
234
|
+
throw new Error("Network " + network + " is not present in release.json");
|
|
235
|
+
}
|
|
236
|
+
if (entry.status !== "ready") {
|
|
237
|
+
throw new Error("Network " + network + " is not release-ready");
|
|
238
|
+
}
|
|
239
|
+
if (!entry.simulationCallerNetworkHash || !/^[0-9a-f]{64}$/.test(entry.simulationCallerNetworkHash)) {
|
|
240
|
+
throw new Error("Network " + network + " release caller network hash is missing or invalid");
|
|
241
|
+
}
|
|
242
|
+
const expected = {
|
|
243
|
+
manifestHash: entry.manifestHash || release.manifestHash,
|
|
244
|
+
artifactHash: entry.artifactHash || release.artifactHash,
|
|
245
|
+
parametersHash: entry.parametersHash || "",
|
|
246
|
+
configHash: entry.configHash || "",
|
|
247
|
+
};
|
|
248
|
+
for (const key of ["manifestHash", "artifactHash", "parametersHash", "configHash"]) {
|
|
249
|
+
if (!expected[key] || expected[key] !== currentFingerprint[key]) {
|
|
250
|
+
throw new Error("Network " + network + " release fingerprint changed: " + key);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return entry;
|
|
254
|
+
};
|
|
255
|
+
exports.assertReleaseNetworkReady = assertReleaseNetworkReady;
|
|
256
|
+
//# sourceMappingURL=release.js.map
|