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,253 @@
|
|
|
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.syncGateToolUups = 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 projectHardhat_1 = __importDefault(require("../../projectHardhat"));
|
|
11
|
+
const sync_1 = require("gate-evm-tools/sync");
|
|
12
|
+
const config_1 = require("./config");
|
|
13
|
+
const SAFE_FILE_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,199}$/;
|
|
14
|
+
const HASH = /^[a-f0-9]{64}$/;
|
|
15
|
+
const TRANSACTION_HASH = /^0x[a-fA-F0-9]{64}$/;
|
|
16
|
+
const confinedPath = (root, requested, label) => {
|
|
17
|
+
const resolvedRoot = path_1.default.resolve(root);
|
|
18
|
+
const resolved = path_1.default.resolve(requested);
|
|
19
|
+
const relative = path_1.default.relative(resolvedRoot, resolved);
|
|
20
|
+
if (!relative || relative.startsWith("..") || path_1.default.isAbsolute(relative)) {
|
|
21
|
+
throw new Error(`${label} must be inside the project root`);
|
|
22
|
+
}
|
|
23
|
+
let current = resolvedRoot;
|
|
24
|
+
for (const segment of relative.split(path_1.default.sep).filter(Boolean)) {
|
|
25
|
+
current = path_1.default.join(current, segment);
|
|
26
|
+
if (fs_1.default.existsSync(current) && fs_1.default.lstatSync(current).isSymbolicLink()) {
|
|
27
|
+
throw new Error(`${label} path cannot contain a symlink`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return resolved;
|
|
31
|
+
};
|
|
32
|
+
const record = (value, label) => {
|
|
33
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
34
|
+
throw new Error(`${label} must be an object`);
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
};
|
|
38
|
+
const stringField = (value, key) => {
|
|
39
|
+
const field = value[key];
|
|
40
|
+
if (typeof field !== "string" || !field) {
|
|
41
|
+
throw new Error(`GateTool sync result is missing ${key}`);
|
|
42
|
+
}
|
|
43
|
+
return field;
|
|
44
|
+
};
|
|
45
|
+
const sameAddress = (left, right) => (left.toLowerCase() === right.toLowerCase());
|
|
46
|
+
const readRegularBytes = (filePath, label) => {
|
|
47
|
+
const stat = fs_1.default.lstatSync(filePath);
|
|
48
|
+
if (!stat.isFile())
|
|
49
|
+
throw new Error(`${label} must be a regular file`);
|
|
50
|
+
return fs_1.default.readFileSync(filePath);
|
|
51
|
+
};
|
|
52
|
+
const jsonFromBytes = (contents, label) => {
|
|
53
|
+
return record(JSON.parse(contents.toString("utf8")), label);
|
|
54
|
+
};
|
|
55
|
+
const canonicalJsonBytes = (value) => (Buffer.from(`${JSON.stringify(value, null, 2)}\n`));
|
|
56
|
+
const writeImmutableFile = (filePath, contents, root, label) => {
|
|
57
|
+
const confined = confinedPath(root, filePath, label);
|
|
58
|
+
fs_1.default.mkdirSync(path_1.default.dirname(confined), { recursive: true });
|
|
59
|
+
confinedPath(root, path_1.default.dirname(confined), `${label} directory`);
|
|
60
|
+
if (fs_1.default.existsSync(confined)) {
|
|
61
|
+
const existing = readRegularBytes(confined, label);
|
|
62
|
+
if (!existing.equals(contents)) {
|
|
63
|
+
throw new Error(`${label} already exists with different bytes`);
|
|
64
|
+
}
|
|
65
|
+
return existing;
|
|
66
|
+
}
|
|
67
|
+
const temporary = confinedPath(root, `${confined}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`, `${label} temporary file`);
|
|
68
|
+
let descriptor;
|
|
69
|
+
try {
|
|
70
|
+
descriptor = fs_1.default.openSync(temporary, "wx", 0o600);
|
|
71
|
+
fs_1.default.writeFileSync(descriptor, contents);
|
|
72
|
+
fs_1.default.fsyncSync(descriptor);
|
|
73
|
+
fs_1.default.closeSync(descriptor);
|
|
74
|
+
descriptor = undefined;
|
|
75
|
+
try {
|
|
76
|
+
fs_1.default.linkSync(temporary, confined);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if (error.code !== "EEXIST")
|
|
80
|
+
throw error;
|
|
81
|
+
const existing = readRegularBytes(confined, label);
|
|
82
|
+
if (!existing.equals(contents)) {
|
|
83
|
+
throw new Error(`${label} already exists with different bytes`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const stored = readRegularBytes(confined, label);
|
|
87
|
+
if (!stored.equals(contents)) {
|
|
88
|
+
throw new Error(`${label} does not match the committed source report`);
|
|
89
|
+
}
|
|
90
|
+
return stored;
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
if (descriptor !== undefined)
|
|
94
|
+
fs_1.default.closeSync(descriptor);
|
|
95
|
+
if (fs_1.default.existsSync(temporary))
|
|
96
|
+
fs_1.default.unlinkSync(temporary);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const validateManifestTransaction = (syncReport, options) => {
|
|
100
|
+
if (syncReport.version !== 1
|
|
101
|
+
|| syncReport.status !== "committed"
|
|
102
|
+
|| typeof syncReport.beforeHash !== "string"
|
|
103
|
+
|| typeof syncReport.afterHash !== "string"
|
|
104
|
+
|| !HASH.test(syncReport.beforeHash)
|
|
105
|
+
|| !HASH.test(syncReport.afterHash)) {
|
|
106
|
+
throw new Error("GateTool manifest transaction report is not committed evidence");
|
|
107
|
+
}
|
|
108
|
+
const manifestFile = stringField(syncReport, "manifestFile");
|
|
109
|
+
const expectedManifestRoot = path_1.default.resolve(options.root, options.manifestDir);
|
|
110
|
+
const resolvedManifest = path_1.default.resolve(options.root, manifestFile);
|
|
111
|
+
if (!resolvedManifest.startsWith(`${expectedManifestRoot}${path_1.default.sep}`)) {
|
|
112
|
+
throw new Error("GateTool sync wrote outside the target manifest directory");
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const validateEvidenceIdentity = (raw, options) => {
|
|
116
|
+
if (raw.version !== 1
|
|
117
|
+
|| raw.status !== "succeeded"
|
|
118
|
+
|| raw.evidenceName !== options.evidenceName
|
|
119
|
+
|| raw.scheme !== options.scheme
|
|
120
|
+
|| raw.network !== options.network
|
|
121
|
+
|| raw.target !== options.target
|
|
122
|
+
|| raw.manifestDir !== options.manifestDir
|
|
123
|
+
|| raw.contract !== options.contract
|
|
124
|
+
|| JSON.stringify(raw.constructorArgs) !== JSON.stringify(options.constructorArgs)
|
|
125
|
+
|| raw.transactionHash !== options.transactionHash.toLowerCase()
|
|
126
|
+
|| typeof raw.proxy !== "string"
|
|
127
|
+
|| typeof raw.implementation !== "string"
|
|
128
|
+
|| !sameAddress(raw.proxy, options.proxy)
|
|
129
|
+
|| !sameAddress(raw.implementation, options.implementation)) {
|
|
130
|
+
throw new Error("GateTool sync metadata identity does not match the immutable UUPS receipt");
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const validateEvidenceBinding = (raw, options, expectedSyncReportPath) => {
|
|
134
|
+
validateEvidenceIdentity(raw, options);
|
|
135
|
+
const syncReportPath = confinedPath(options.root, path_1.default.resolve(options.root, stringField(raw, "syncReportPath")), "GateTool manifest transaction report");
|
|
136
|
+
if (syncReportPath !== expectedSyncReportPath) {
|
|
137
|
+
throw new Error("GateTool sync evidence does not reference its immutable report snapshot");
|
|
138
|
+
}
|
|
139
|
+
const syncReport = record(raw.manifestTransaction, "GateTool sync manifest transaction");
|
|
140
|
+
validateManifestTransaction(syncReport, options);
|
|
141
|
+
const syncReportBytes = canonicalJsonBytes(syncReport);
|
|
142
|
+
const syncReportHash = crypto_1.default
|
|
143
|
+
.createHash("sha256")
|
|
144
|
+
.update(syncReportBytes)
|
|
145
|
+
.digest("hex");
|
|
146
|
+
if (raw.syncReportHash !== syncReportHash
|
|
147
|
+
|| raw.completedAt !== syncReport.completedAt) {
|
|
148
|
+
throw new Error("GateTool sync evidence does not match its committed manifest transaction");
|
|
149
|
+
}
|
|
150
|
+
return { syncReport, syncReportBytes };
|
|
151
|
+
};
|
|
152
|
+
const validateExistingEvidence = (raw, options, expectedSyncReportPath) => {
|
|
153
|
+
const binding = validateEvidenceBinding(raw, options, expectedSyncReportPath);
|
|
154
|
+
const storedBytes = readRegularBytes(expectedSyncReportPath, "GateTool manifest transaction snapshot");
|
|
155
|
+
if (!storedBytes.equals(binding.syncReportBytes)) {
|
|
156
|
+
throw new Error("GateTool sync evidence does not match its immutable report snapshot");
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const buildSyncEvidence = (options, syncReportPath, syncReportBytes, syncReport) => ({
|
|
160
|
+
version: 1,
|
|
161
|
+
status: "succeeded",
|
|
162
|
+
evidenceName: options.evidenceName,
|
|
163
|
+
scheme: options.scheme,
|
|
164
|
+
network: options.network,
|
|
165
|
+
target: options.target,
|
|
166
|
+
manifestDir: options.manifestDir,
|
|
167
|
+
proxy: options.proxy.toLowerCase(),
|
|
168
|
+
implementation: options.implementation.toLowerCase(),
|
|
169
|
+
contract: options.contract,
|
|
170
|
+
constructorArgs: options.constructorArgs,
|
|
171
|
+
transactionHash: options.transactionHash.toLowerCase(),
|
|
172
|
+
syncReportPath: path_1.default.relative(options.root, syncReportPath).split(path_1.default.sep).join("/"),
|
|
173
|
+
syncReportHash: crypto_1.default.createHash("sha256").update(syncReportBytes).digest("hex"),
|
|
174
|
+
manifestTransaction: syncReport,
|
|
175
|
+
completedAt: syncReport.completedAt,
|
|
176
|
+
});
|
|
177
|
+
const syncGateToolUups = async (options) => {
|
|
178
|
+
if (!SAFE_FILE_ID.test(options.evidenceName)) {
|
|
179
|
+
throw new Error(`GateTool sync evidenceName must match ${SAFE_FILE_ID}`);
|
|
180
|
+
}
|
|
181
|
+
if (!TRANSACTION_HASH.test(options.transactionHash)) {
|
|
182
|
+
throw new Error("GateTool sync requires a confirmed transaction hash");
|
|
183
|
+
}
|
|
184
|
+
const evidenceDir = confinedPath(options.root, options.evidenceDir, "GateTool sync evidence directory");
|
|
185
|
+
const outputPath = confinedPath(options.root, path_1.default.join(evidenceDir, `${options.evidenceName}-sync.json`), "GateTool sync evidence");
|
|
186
|
+
const syncReportSnapshotPath = confinedPath(options.root, path_1.default.join(evidenceDir, `${options.evidenceName}-manifest-transaction.json`), "GateTool manifest transaction snapshot");
|
|
187
|
+
const syncMetadataPath = confinedPath(options.root, path_1.default.join(evidenceDir, `${options.evidenceName}-manifest-transaction-metadata.json`), "GateTool manifest transaction metadata");
|
|
188
|
+
const relativeOutputPath = path_1.default.relative(options.root, outputPath).split(path_1.default.sep).join("/");
|
|
189
|
+
if (fs_1.default.existsSync(outputPath)) {
|
|
190
|
+
const outputBytes = readRegularBytes(outputPath, "GateTool sync evidence");
|
|
191
|
+
const data = jsonFromBytes(outputBytes, "GateTool sync evidence");
|
|
192
|
+
if (!fs_1.default.existsSync(syncMetadataPath)) {
|
|
193
|
+
throw new Error("GateTool sync evidence is missing its immutable identity metadata");
|
|
194
|
+
}
|
|
195
|
+
const metadataBytes = readRegularBytes(syncMetadataPath, "GateTool manifest transaction metadata");
|
|
196
|
+
if (!outputBytes.equals(metadataBytes)) {
|
|
197
|
+
throw new Error("GateTool sync evidence does not match its immutable identity metadata");
|
|
198
|
+
}
|
|
199
|
+
validateExistingEvidence(data, options, syncReportSnapshotPath);
|
|
200
|
+
return { outputPath: relativeOutputPath, data };
|
|
201
|
+
}
|
|
202
|
+
if (fs_1.default.existsSync(syncMetadataPath)) {
|
|
203
|
+
const metadataBytes = readRegularBytes(syncMetadataPath, "GateTool manifest transaction metadata");
|
|
204
|
+
const data = jsonFromBytes(metadataBytes, "GateTool manifest transaction metadata");
|
|
205
|
+
if (!metadataBytes.equals(canonicalJsonBytes(data))) {
|
|
206
|
+
throw new Error("GateTool manifest transaction metadata must be canonical JSON");
|
|
207
|
+
}
|
|
208
|
+
const binding = validateEvidenceBinding(data, options, syncReportSnapshotPath);
|
|
209
|
+
writeImmutableFile(syncReportSnapshotPath, binding.syncReportBytes, options.root, "GateTool manifest transaction snapshot");
|
|
210
|
+
validateExistingEvidence(data, options, syncReportSnapshotPath);
|
|
211
|
+
(0, config_1.writeJsonFile)(outputPath, data);
|
|
212
|
+
return { outputPath: relativeOutputPath, data };
|
|
213
|
+
}
|
|
214
|
+
if (fs_1.default.existsSync(syncReportSnapshotPath)) {
|
|
215
|
+
throw new Error("GateTool manifest transaction snapshot is missing immutable identity metadata");
|
|
216
|
+
}
|
|
217
|
+
const rawResult = record(await (0, sync_1.syncWithHre)({
|
|
218
|
+
scheme: options.scheme,
|
|
219
|
+
network: options.network,
|
|
220
|
+
target: options.target,
|
|
221
|
+
proxy: options.proxy,
|
|
222
|
+
contract: options.contract,
|
|
223
|
+
constructorArgs: options.constructorArgs,
|
|
224
|
+
...(options.scheme === "evm"
|
|
225
|
+
? { skipTxHash: true }
|
|
226
|
+
: { transactionHash: options.transactionHash }),
|
|
227
|
+
}, options.hre ?? projectHardhat_1.default, options.root), "GateTool sync result");
|
|
228
|
+
const returnedProxy = typeof rawResult.proxyAddress === "string"
|
|
229
|
+
? rawResult.proxyAddress
|
|
230
|
+
: stringField(rawResult, "proxy");
|
|
231
|
+
const returnedImplementation = typeof rawResult.implementationAddress === "string"
|
|
232
|
+
? rawResult.implementationAddress
|
|
233
|
+
: stringField(rawResult, "implementation");
|
|
234
|
+
if (!sameAddress(returnedProxy, options.proxy)
|
|
235
|
+
|| !sameAddress(returnedImplementation, options.implementation)) {
|
|
236
|
+
throw new Error("GateTool sync result does not match the confirmed UUPS chain state");
|
|
237
|
+
}
|
|
238
|
+
const returnedSyncReport = record(rawResult.manifestTransaction, "GateTool returned manifest transaction");
|
|
239
|
+
validateManifestTransaction(returnedSyncReport, options);
|
|
240
|
+
const returnedSyncReportBytes = canonicalJsonBytes(returnedSyncReport);
|
|
241
|
+
const syncReportPath = confinedPath(options.root, stringField(rawResult, "syncReport"), "GateTool manifest transaction report");
|
|
242
|
+
const sourceSyncReportBytes = readRegularBytes(syncReportPath, "GateTool manifest transaction report");
|
|
243
|
+
if (!sourceSyncReportBytes.equals(returnedSyncReportBytes)) {
|
|
244
|
+
throw new Error("GateTool source report does not match its returned manifest transaction");
|
|
245
|
+
}
|
|
246
|
+
const data = buildSyncEvidence(options, syncReportSnapshotPath, returnedSyncReportBytes, returnedSyncReport);
|
|
247
|
+
writeImmutableFile(syncMetadataPath, canonicalJsonBytes(data), options.root, "GateTool manifest transaction metadata");
|
|
248
|
+
writeImmutableFile(syncReportSnapshotPath, returnedSyncReportBytes, options.root, "GateTool manifest transaction snapshot");
|
|
249
|
+
(0, config_1.writeJsonFile)(outputPath, data);
|
|
250
|
+
return { outputPath: relativeOutputPath, data };
|
|
251
|
+
};
|
|
252
|
+
exports.syncGateToolUups = syncGateToolUups;
|
|
253
|
+
//# sourceMappingURL=gateToolSync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateToolSync.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/gateToolSync.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AACxB,0EAA2C;AAC3C,8CAAkD;AAClD,qCAAyC;AAyBzC,MAAM,YAAY,GAAG,mCAAmC,CAAC;AACzD,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAC9B,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAE/C,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,SAAiB,EAAE,KAAa,EAAU,EAAE;IAC9E,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,cAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IACvD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,cAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,kCAAkC,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,OAAO,GAAG,YAAY,CAAC;IAC3B,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,KA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CAC5B,OAAO,EACP,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,CACnB,CAAC;IACF,kBAAkB,CAChB,gBAAgB,EAChB,kBAAkB,CAAC,IAAI,CAAC,EACxB,OAAO,CAAC,IAAI,EACZ,wCAAwC,CACzC,CAAC;IACF,kBAAkB,CAChB,sBAAsB,EACtB,uBAAuB,EACvB,OAAO,CAAC,IAAI,EACZ,wCAAwC,CACzC,CAAC;IACF,IAAA,sBAAa,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAChC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;AAClD,CAAC,CAAC;AAhJW,QAAA,gBAAgB,oBAgJ3B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ReleaseFingerprint } from "./release";
|
|
2
|
+
import type { ExistingDeploymentPolicies } from "./parameters";
|
|
3
|
+
export interface ParameterLockTargetSnapshot {
|
|
4
|
+
network: string;
|
|
5
|
+
signer: string;
|
|
6
|
+
admin: string;
|
|
7
|
+
chainId?: number;
|
|
8
|
+
create2Scheme: "evm" | "zksync-eravm";
|
|
9
|
+
create2Factory?: string;
|
|
10
|
+
create2Caller?: string;
|
|
11
|
+
controlledMulticall?: string;
|
|
12
|
+
uupsPlaceholderImplementation?: string;
|
|
13
|
+
leadingZeroBytes?: number;
|
|
14
|
+
}
|
|
15
|
+
export type FinalSimulation = {
|
|
16
|
+
status: "pending";
|
|
17
|
+
} | {
|
|
18
|
+
status: "succeeded";
|
|
19
|
+
result: string;
|
|
20
|
+
simulatedAt: string;
|
|
21
|
+
executionPlanHash: string;
|
|
22
|
+
executionPlanPath: string;
|
|
23
|
+
};
|
|
24
|
+
export interface ParameterLockInput {
|
|
25
|
+
taskDir: string;
|
|
26
|
+
deploymentId: string;
|
|
27
|
+
executionId: string;
|
|
28
|
+
sourceSuperTaskId: string;
|
|
29
|
+
mergeCommit: string;
|
|
30
|
+
selectedExecuteNetworks: string[];
|
|
31
|
+
selectedStepIds: string[];
|
|
32
|
+
operator: string;
|
|
33
|
+
baselineParameters: Record<string, unknown>;
|
|
34
|
+
overrides: Record<string, unknown>;
|
|
35
|
+
resolvedParameters: Record<string, unknown>;
|
|
36
|
+
releaseFingerprint: ReleaseFingerprint;
|
|
37
|
+
finalSimulation: FinalSimulation;
|
|
38
|
+
targetSnapshot: ParameterLockTargetSnapshot;
|
|
39
|
+
existingDeploymentPolicies?: ExistingDeploymentPolicies;
|
|
40
|
+
implementationSalts?: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
export interface ParameterLockExecution extends Omit<ParameterLockInput, "taskDir" | "targetSnapshot"> {
|
|
43
|
+
manifestHash: string;
|
|
44
|
+
parameterHash: string;
|
|
45
|
+
lockedAt: string;
|
|
46
|
+
target: ParameterLockTargetSnapshot;
|
|
47
|
+
}
|
|
48
|
+
export declare const writeParameterLock: (input: ParameterLockInput) => void;
|
|
49
|
+
export declare const readParameterLockExecution: (taskDir: string, executionId: string) => ParameterLockExecution;
|
|
50
|
+
export declare const assertParameterLockExecutable: (execution: ParameterLockExecution, targetId: string, currentFingerprint: ReleaseFingerprint) => ParameterLockExecution;
|
|
51
|
+
export declare const recordParameterLockImplementationSalts: (taskDir: string, executionId: string, salts: Record<string, string>) => void;
|
|
52
|
+
export declare const markParameterLockSimulationSucceeded: (taskDir: string, executionId: string, result: string, simulatedAt: string, signerAddress: string, executionPlanHash: string, executionPlanPath: string) => void;
|
|
@@ -0,0 +1,269 @@
|
|
|
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.markParameterLockSimulationSucceeded = exports.recordParameterLockImplementationSalts = exports.assertParameterLockExecutable = exports.readParameterLockExecution = exports.writeParameterLock = 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 config_1 = require("./config");
|
|
11
|
+
const executionId_1 = require("./executionId");
|
|
12
|
+
const release_1 = require("./release");
|
|
13
|
+
const sha256 = (value) => {
|
|
14
|
+
return crypto_1.default.createHash("sha256").update(value).digest("hex");
|
|
15
|
+
};
|
|
16
|
+
const isRecord = (value) => {
|
|
17
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
18
|
+
};
|
|
19
|
+
const isNonZeroEvmAddress = (value) => {
|
|
20
|
+
return typeof value === "string"
|
|
21
|
+
&& /^0x[0-9a-fA-F]{40}$/.test(value)
|
|
22
|
+
&& value.toLowerCase() !== "0x0000000000000000000000000000000000000000";
|
|
23
|
+
};
|
|
24
|
+
const assertSignerBinding = (execution) => {
|
|
25
|
+
if (!isNonZeroEvmAddress(execution.operator)) {
|
|
26
|
+
throw new Error("Parameter lock operator must be a valid non-zero EVM address");
|
|
27
|
+
}
|
|
28
|
+
if (!isNonZeroEvmAddress(execution.target?.signer)) {
|
|
29
|
+
throw new Error("Parameter lock target signer must be a valid non-zero EVM address");
|
|
30
|
+
}
|
|
31
|
+
if (execution.operator.toLowerCase() !== execution.target.signer.toLowerCase()) {
|
|
32
|
+
throw new Error("Parameter lock operator does not match target signer");
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const assertCreate2Scheme = (value, required) => {
|
|
36
|
+
if (!required && value === undefined)
|
|
37
|
+
return;
|
|
38
|
+
if (value !== "evm" && value !== "zksync-eravm") {
|
|
39
|
+
throw new Error("Parameter lock target create2Scheme must be evm or zksync-eravm");
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const assertFinalSimulation = (execution) => {
|
|
43
|
+
const evidence = execution.finalSimulation;
|
|
44
|
+
if (!isRecord(evidence) || (evidence.status !== "pending" && evidence.status !== "succeeded")) {
|
|
45
|
+
throw new Error("Parameter lock finalSimulation is invalid");
|
|
46
|
+
}
|
|
47
|
+
if (evidence.status === "pending") {
|
|
48
|
+
if (Object.keys(evidence).length !== 1) {
|
|
49
|
+
throw new Error("Pending finalSimulation cannot contain execution evidence");
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (typeof evidence.result !== "string" || !evidence.result.trim()) {
|
|
54
|
+
throw new Error("Succeeded finalSimulation requires result");
|
|
55
|
+
}
|
|
56
|
+
if (typeof evidence.simulatedAt !== "string" || !Number.isFinite(Date.parse(evidence.simulatedAt))) {
|
|
57
|
+
throw new Error("Succeeded finalSimulation requires simulatedAt");
|
|
58
|
+
}
|
|
59
|
+
if (typeof evidence.executionPlanHash !== "string" || !/^[0-9a-f]{64}$/.test(evidence.executionPlanHash)) {
|
|
60
|
+
throw new Error("Succeeded finalSimulation requires executionPlanHash");
|
|
61
|
+
}
|
|
62
|
+
const expectedPlanPath = [
|
|
63
|
+
"results",
|
|
64
|
+
execution.target.network,
|
|
65
|
+
execution.executionId,
|
|
66
|
+
"execution-plan.json",
|
|
67
|
+
].join("/");
|
|
68
|
+
if (evidence.executionPlanPath !== expectedPlanPath) {
|
|
69
|
+
throw new Error("Succeeded finalSimulation executionPlanPath does not match its execution");
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const validateLockFile = (value) => {
|
|
73
|
+
if (!isRecord(value)) {
|
|
74
|
+
throw new Error("parameters.lock.json must be an object");
|
|
75
|
+
}
|
|
76
|
+
if (!Array.isArray(value.executions)) {
|
|
77
|
+
throw new Error("parameters.lock.json.executions must be an array");
|
|
78
|
+
}
|
|
79
|
+
const executionIds = new Set();
|
|
80
|
+
for (const [index, execution] of value.executions.entries()) {
|
|
81
|
+
if (!isRecord(execution)) {
|
|
82
|
+
throw new Error(`parameters.lock.json.executions[${index}] must be an object`);
|
|
83
|
+
}
|
|
84
|
+
const executionId = (0, executionId_1.validateExecutionId)(execution.executionId, `parameters.lock.json.executions[${index}].executionId`);
|
|
85
|
+
if (executionIds.has(executionId)) {
|
|
86
|
+
throw new Error("parameters.lock.json contains duplicate executionId: " + executionId);
|
|
87
|
+
}
|
|
88
|
+
executionIds.add(executionId);
|
|
89
|
+
assertSignerBinding(execution);
|
|
90
|
+
assertCreate2Scheme(isRecord(execution.target) ? execution.target.create2Scheme : undefined, false);
|
|
91
|
+
assertFinalSimulation(execution);
|
|
92
|
+
}
|
|
93
|
+
const latestExecutionId = (0, executionId_1.validateExecutionId)(value.latestExecutionId, "parameters.lock.json.latestExecutionId");
|
|
94
|
+
const latestMatches = value.executions.filter((execution) => execution.executionId === latestExecutionId).length;
|
|
95
|
+
if (latestMatches !== 1) {
|
|
96
|
+
throw new Error("parameters.lock.json.latestExecutionId must identify exactly one execution");
|
|
97
|
+
}
|
|
98
|
+
return value;
|
|
99
|
+
};
|
|
100
|
+
const writeLockFile = (filePath, lock) => {
|
|
101
|
+
(0, config_1.writeJsonFile)(filePath, validateLockFile(lock));
|
|
102
|
+
};
|
|
103
|
+
const readLockFile = (filePath) => {
|
|
104
|
+
if (!fs_1.default.existsSync(filePath))
|
|
105
|
+
return undefined;
|
|
106
|
+
let parsed;
|
|
107
|
+
try {
|
|
108
|
+
parsed = JSON.parse(fs_1.default.readFileSync(filePath, "utf8"));
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
throw new Error("parameters.lock.json must contain valid JSON: "
|
|
112
|
+
+ (error instanceof Error ? error.message : String(error)));
|
|
113
|
+
}
|
|
114
|
+
return validateLockFile(parsed);
|
|
115
|
+
};
|
|
116
|
+
const immutableExecutionHash = (execution) => {
|
|
117
|
+
const { finalSimulation: _finalSimulation, lockedAt: _lockedAt, ...immutable } = execution;
|
|
118
|
+
return (0, release_1.hashValue)(immutable);
|
|
119
|
+
};
|
|
120
|
+
const requireSingleNetwork = (networks) => {
|
|
121
|
+
if (networks.length !== 1 || !networks[0]) {
|
|
122
|
+
throw new Error("A parameter lock execution must select exactly one network");
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const buildExecution = (input, manifestHash, parameterHash) => {
|
|
126
|
+
const { taskDir: _taskDir, targetSnapshot, ...executionInput } = input;
|
|
127
|
+
return {
|
|
128
|
+
...executionInput,
|
|
129
|
+
manifestHash,
|
|
130
|
+
parameterHash,
|
|
131
|
+
lockedAt: new Date().toISOString(),
|
|
132
|
+
target: targetSnapshot,
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
const writeParameterLock = (input) => {
|
|
136
|
+
const executionId = (0, executionId_1.validateExecutionId)(input.executionId);
|
|
137
|
+
requireSingleNetwork(input.selectedExecuteNetworks);
|
|
138
|
+
assertCreate2Scheme(input.targetSnapshot.create2Scheme, true);
|
|
139
|
+
if (input.finalSimulation.status !== "pending") {
|
|
140
|
+
throw new Error("A new parameter lock execution must start with pending finalSimulation");
|
|
141
|
+
}
|
|
142
|
+
const manifest = fs_1.default.readFileSync(path_1.default.join(input.taskDir, "manifest.yaml"), "utf8");
|
|
143
|
+
const parameters = fs_1.default.readFileSync(path_1.default.join(input.taskDir, "parameters.yaml"), "utf8");
|
|
144
|
+
const manifestHash = sha256(manifest);
|
|
145
|
+
const parameterHash = sha256(parameters);
|
|
146
|
+
const lockPath = path_1.default.join(input.taskDir, "parameters.lock.json");
|
|
147
|
+
const existing = readLockFile(lockPath);
|
|
148
|
+
const execution = buildExecution(input, manifestHash, parameterHash);
|
|
149
|
+
const previousExecution = existing?.executions.find((item) => item.executionId === executionId);
|
|
150
|
+
if (previousExecution) {
|
|
151
|
+
if (immutableExecutionHash(previousExecution) !== immutableExecutionHash(execution)) {
|
|
152
|
+
throw new Error("executionId already exists with different content: " + executionId);
|
|
153
|
+
}
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
writeLockFile(lockPath, {
|
|
157
|
+
version: 2,
|
|
158
|
+
deploymentId: input.deploymentId,
|
|
159
|
+
latestExecutionId: executionId,
|
|
160
|
+
manifestHash,
|
|
161
|
+
parametersHash: parameterHash,
|
|
162
|
+
executions: [...(existing?.executions || []), execution],
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
exports.writeParameterLock = writeParameterLock;
|
|
166
|
+
const readParameterLockExecution = (taskDir, executionId) => {
|
|
167
|
+
const validatedExecutionId = (0, executionId_1.validateExecutionId)(executionId);
|
|
168
|
+
const lockPath = path_1.default.join(taskDir, "parameters.lock.json");
|
|
169
|
+
const lock = readLockFile(lockPath);
|
|
170
|
+
if (!lock) {
|
|
171
|
+
throw new Error("Missing parameters.lock.json");
|
|
172
|
+
}
|
|
173
|
+
const execution = lock.executions.find((item) => item.executionId === validatedExecutionId);
|
|
174
|
+
if (!execution) {
|
|
175
|
+
throw new Error("Unknown parameter lock executionId: " + validatedExecutionId);
|
|
176
|
+
}
|
|
177
|
+
return execution;
|
|
178
|
+
};
|
|
179
|
+
exports.readParameterLockExecution = readParameterLockExecution;
|
|
180
|
+
const assertParameterLockExecutable = (execution, targetId, currentFingerprint) => {
|
|
181
|
+
(0, executionId_1.validateExecutionId)(execution.executionId);
|
|
182
|
+
assertSignerBinding(execution);
|
|
183
|
+
if (execution.selectedExecuteNetworks.length !== 1
|
|
184
|
+
|| execution.selectedExecuteNetworks[0] !== targetId
|
|
185
|
+
|| execution.target.network !== targetId) {
|
|
186
|
+
throw new Error("Parameter lock target does not match requested network " + targetId);
|
|
187
|
+
}
|
|
188
|
+
for (const key of ["manifestHash", "artifactHash", "parametersHash", "configHash"]) {
|
|
189
|
+
if (execution.releaseFingerprint[key] !== currentFingerprint[key]) {
|
|
190
|
+
throw new Error("parameter lock fingerprint changed: " + key);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (execution.finalSimulation.status !== "succeeded") {
|
|
194
|
+
throw new Error("Parameter lock final simulation has not succeeded");
|
|
195
|
+
}
|
|
196
|
+
return execution;
|
|
197
|
+
};
|
|
198
|
+
exports.assertParameterLockExecutable = assertParameterLockExecutable;
|
|
199
|
+
const recordParameterLockImplementationSalts = (taskDir, executionId, salts) => {
|
|
200
|
+
const validatedExecutionId = (0, executionId_1.validateExecutionId)(executionId);
|
|
201
|
+
const lockPath = path_1.default.join(taskDir, "parameters.lock.json");
|
|
202
|
+
const lock = readLockFile(lockPath);
|
|
203
|
+
if (!lock)
|
|
204
|
+
throw new Error("Missing parameters.lock.json");
|
|
205
|
+
const index = lock.executions.findIndex((item) => item.executionId === validatedExecutionId);
|
|
206
|
+
if (index < 0) {
|
|
207
|
+
throw new Error("Unknown parameter lock executionId: " + validatedExecutionId);
|
|
208
|
+
}
|
|
209
|
+
const existing = lock.executions[index].implementationSalts || {};
|
|
210
|
+
const next = { ...existing };
|
|
211
|
+
for (const [key, salt] of Object.entries(salts)) {
|
|
212
|
+
if (!key.trim())
|
|
213
|
+
throw new Error("implementation salt key must not be empty");
|
|
214
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(salt)) {
|
|
215
|
+
throw new Error("implementation salt must be bytes32 for " + key);
|
|
216
|
+
}
|
|
217
|
+
if (existing[key] && existing[key].toLowerCase() !== salt.toLowerCase()) {
|
|
218
|
+
throw new Error("implementation salt already locked with different content: " + key);
|
|
219
|
+
}
|
|
220
|
+
next[key] = salt;
|
|
221
|
+
}
|
|
222
|
+
lock.executions[index] = {
|
|
223
|
+
...lock.executions[index],
|
|
224
|
+
implementationSalts: next,
|
|
225
|
+
};
|
|
226
|
+
writeLockFile(lockPath, lock);
|
|
227
|
+
};
|
|
228
|
+
exports.recordParameterLockImplementationSalts = recordParameterLockImplementationSalts;
|
|
229
|
+
const markParameterLockSimulationSucceeded = (taskDir, executionId, result, simulatedAt, signerAddress, executionPlanHash, executionPlanPath) => {
|
|
230
|
+
const validatedExecutionId = (0, executionId_1.validateExecutionId)(executionId);
|
|
231
|
+
const lockPath = path_1.default.join(taskDir, "parameters.lock.json");
|
|
232
|
+
const lock = readLockFile(lockPath);
|
|
233
|
+
if (!lock) {
|
|
234
|
+
throw new Error("Missing parameters.lock.json");
|
|
235
|
+
}
|
|
236
|
+
const index = lock.executions.findIndex((item) => item.executionId === validatedExecutionId);
|
|
237
|
+
if (index < 0) {
|
|
238
|
+
throw new Error("Unknown parameter lock executionId: " + validatedExecutionId);
|
|
239
|
+
}
|
|
240
|
+
const execution = lock.executions[index];
|
|
241
|
+
assertSignerBinding(execution);
|
|
242
|
+
if (!isNonZeroEvmAddress(signerAddress)
|
|
243
|
+
|| execution.operator.toLowerCase() !== signerAddress.toLowerCase()) {
|
|
244
|
+
throw new Error("Simulation signer does not match parameter lock operator");
|
|
245
|
+
}
|
|
246
|
+
const current = execution.finalSimulation;
|
|
247
|
+
if (current.status === "succeeded") {
|
|
248
|
+
if (current.result !== result
|
|
249
|
+
|| current.simulatedAt !== simulatedAt
|
|
250
|
+
|| current.executionPlanHash !== executionPlanHash
|
|
251
|
+
|| current.executionPlanPath !== executionPlanPath) {
|
|
252
|
+
throw new Error("finalSimulation already succeeded with different evidence");
|
|
253
|
+
}
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
lock.executions[index] = {
|
|
257
|
+
...lock.executions[index],
|
|
258
|
+
finalSimulation: {
|
|
259
|
+
status: "succeeded",
|
|
260
|
+
result,
|
|
261
|
+
simulatedAt,
|
|
262
|
+
executionPlanHash,
|
|
263
|
+
executionPlanPath,
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
writeLockFile(lockPath, lock);
|
|
267
|
+
};
|
|
268
|
+
exports.markParameterLockSimulationSucceeded = markParameterLockSimulationSucceeded;
|
|
269
|
+
//# sourceMappingURL=lock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/lock.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AACxB,qCAAyC;AACzC,+CAAoD;AACpD,uCAA0D;AAG1D,MAAM,MAAM,GAAG,CAAC,KAAa,EAAU,EAAE;IACvC,OAAO,gBAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MA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