gate-evm-tools 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -11
- package/bin/workflow.cjs +19 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +21 -57
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/checkBatch.d.ts +4 -0
- package/dist/commands/checkBatch.d.ts.map +1 -0
- package/dist/commands/checkBatch.js +57 -0
- package/dist/commands/checkBatch.js.map +1 -0
- package/dist/commands/checkOptions.d.ts +3 -0
- package/dist/commands/checkOptions.d.ts.map +1 -1
- package/dist/commands/checkOptions.js +10 -1
- package/dist/commands/checkOptions.js.map +1 -1
- package/dist/commands/prepare.d.ts +1 -2
- package/dist/commands/prepare.d.ts.map +1 -1
- package/dist/commands/prepare.js +2 -17
- package/dist/commands/prepare.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +2 -17
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +2 -17
- package/dist/commands/validate.js.map +1 -1
- 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/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/hardhat.d.ts +4 -0
- package/dist/utils/hardhat.d.ts.map +1 -0
- package/dist/utils/hardhat.js +9 -0
- package/dist/utils/hardhat.js.map +1 -0
- package/dist-runtime/config/hardhatAdapters.d.ts +5 -0
- package/dist-runtime/config/hardhatAdapters.js +53 -0
- package/dist-runtime/config/hardhatAdapters.js.map +1 -0
- package/dist-runtime/config/networks.d.ts +8 -0
- package/dist-runtime/config/networks.js +269 -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/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 +322 -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 +595 -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 +465 -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/package.json +26 -5
- package/runtime/config/hardhatAdapters.ts +50 -0
- package/runtime/config/networks.ts +296 -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/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 +437 -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 +771 -0
- package/runtime/workflow/steps/upgrade.ts +598 -0
- package/runtime/workflow/steps/view.ts +10 -0
|
@@ -0,0 +1,240 @@
|
|
|
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.getDeploymentAddress = exports.findDeploymentAddress = exports.resolveDeployment = exports.planDeploymentAddress = exports.saveContractInfo = exports.loadContractInfo = exports.contractInfoKey = exports.deploymentInstanceId = exports.actualContractName = exports.cloneContractInfo = exports.validateContractInfo = exports.withContractInfoLock = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const ethers_1 = require("ethers");
|
|
10
|
+
const config_1 = require("./config");
|
|
11
|
+
const contractInfoPath = (root) => {
|
|
12
|
+
return path_1.default.join(root, "contractInfo.json");
|
|
13
|
+
};
|
|
14
|
+
const sleepSync = (milliseconds) => {
|
|
15
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, milliseconds);
|
|
16
|
+
};
|
|
17
|
+
const errorCode = (error) => {
|
|
18
|
+
return error && typeof error === "object" && "code" in error
|
|
19
|
+
? String(error.code)
|
|
20
|
+
: undefined;
|
|
21
|
+
};
|
|
22
|
+
const lockOwnerIsAlive = (lockPath) => {
|
|
23
|
+
let ownerPid;
|
|
24
|
+
try {
|
|
25
|
+
ownerPid = Number.parseInt(fs_1.default.readFileSync(lockPath, "utf8").split("-", 1)[0], 10);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (errorCode(error) === "ENOENT")
|
|
29
|
+
return false;
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
if (!Number.isSafeInteger(ownerPid) || ownerPid <= 0)
|
|
33
|
+
return undefined;
|
|
34
|
+
try {
|
|
35
|
+
process.kill(ownerPid, 0);
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (errorCode(error) === "ESRCH")
|
|
40
|
+
return false;
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const withContractInfoLock = (root, operation) => {
|
|
45
|
+
const filePath = contractInfoPath(root);
|
|
46
|
+
const lockPath = `${filePath}.lock`;
|
|
47
|
+
const token = `${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
48
|
+
const startedAt = Date.now();
|
|
49
|
+
const timeoutMs = 10_000;
|
|
50
|
+
const staleMs = 30_000;
|
|
51
|
+
let lockFile;
|
|
52
|
+
fs_1.default.mkdirSync(path_1.default.dirname(lockPath), { recursive: true });
|
|
53
|
+
while (lockFile === undefined) {
|
|
54
|
+
try {
|
|
55
|
+
const candidate = fs_1.default.openSync(lockPath, "wx");
|
|
56
|
+
try {
|
|
57
|
+
fs_1.default.writeFileSync(candidate, `${token}\n`);
|
|
58
|
+
lockFile = candidate;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
fs_1.default.closeSync(candidate);
|
|
62
|
+
fs_1.default.unlinkSync(lockPath);
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (errorCode(error) !== "EEXIST")
|
|
68
|
+
throw error;
|
|
69
|
+
try {
|
|
70
|
+
const ownerAlive = lockOwnerIsAlive(lockPath);
|
|
71
|
+
const lockAgeMs = Date.now() - fs_1.default.statSync(lockPath).mtimeMs;
|
|
72
|
+
if (ownerAlive === false ||
|
|
73
|
+
(ownerAlive === undefined && lockAgeMs > staleMs)) {
|
|
74
|
+
fs_1.default.unlinkSync(lockPath);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (statError) {
|
|
79
|
+
if (errorCode(statError) === "ENOENT")
|
|
80
|
+
continue;
|
|
81
|
+
throw statError;
|
|
82
|
+
}
|
|
83
|
+
if (Date.now() - startedAt >= timeoutMs) {
|
|
84
|
+
throw new Error(`Timed out waiting for contractInfo lock: ${lockPath}`);
|
|
85
|
+
}
|
|
86
|
+
sleepSync(25);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
let operationFailed = false;
|
|
90
|
+
try {
|
|
91
|
+
return operation();
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
operationFailed = true;
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
try {
|
|
99
|
+
fs_1.default.closeSync(lockFile);
|
|
100
|
+
if (fs_1.default.readFileSync(lockPath, "utf8").trim() === token) {
|
|
101
|
+
fs_1.default.unlinkSync(lockPath);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
if (!operationFailed && errorCode(error) !== "ENOENT")
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
exports.withContractInfoLock = withContractInfoLock;
|
|
111
|
+
const isRecord = (value) => {
|
|
112
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
113
|
+
};
|
|
114
|
+
const validateContractInfo = (value) => {
|
|
115
|
+
if (!isRecord(value)) {
|
|
116
|
+
throw new Error("contractInfo.json must contain an object keyed by network");
|
|
117
|
+
}
|
|
118
|
+
const contractInfo = {};
|
|
119
|
+
for (const [targetId, targetValue] of Object.entries(value)) {
|
|
120
|
+
if (!isRecord(targetValue)) {
|
|
121
|
+
throw new Error(`contractInfo.json network ${targetId} must contain an object`);
|
|
122
|
+
}
|
|
123
|
+
const entries = {};
|
|
124
|
+
const instanceIds = new Set();
|
|
125
|
+
for (const [name, address] of Object.entries(targetValue)) {
|
|
126
|
+
const keyParts = name.split(":");
|
|
127
|
+
if (keyParts.length > 2 ||
|
|
128
|
+
keyParts.some((part) => !part.trim() || part !== part.trim())) {
|
|
129
|
+
throw new Error(`contractInfo.json key ${targetId}.${name} must use Contract or saveAs:Contract format`);
|
|
130
|
+
}
|
|
131
|
+
const instanceId = keyParts[0];
|
|
132
|
+
if (instanceIds.has(instanceId)) {
|
|
133
|
+
throw new Error(`contractInfo.json network ${targetId} defines deployment instance ${instanceId} more than once`);
|
|
134
|
+
}
|
|
135
|
+
instanceIds.add(instanceId);
|
|
136
|
+
if (typeof address !== "string" || !(0, ethers_1.isAddress)(address)) {
|
|
137
|
+
throw new Error(`contractInfo.json entry ${targetId}.${name} must be an address string with a valid EVM address`);
|
|
138
|
+
}
|
|
139
|
+
entries[name] = address;
|
|
140
|
+
}
|
|
141
|
+
contractInfo[targetId] = entries;
|
|
142
|
+
}
|
|
143
|
+
return contractInfo;
|
|
144
|
+
};
|
|
145
|
+
exports.validateContractInfo = validateContractInfo;
|
|
146
|
+
const cloneContractInfo = (contractInfo) => {
|
|
147
|
+
return Object.fromEntries(Object.entries(contractInfo).map(([targetId, entries]) => [
|
|
148
|
+
targetId,
|
|
149
|
+
{ ...entries },
|
|
150
|
+
]));
|
|
151
|
+
};
|
|
152
|
+
exports.cloneContractInfo = cloneContractInfo;
|
|
153
|
+
const actualContractName = (contractName) => {
|
|
154
|
+
const trimmed = contractName.trim();
|
|
155
|
+
if (!trimmed) {
|
|
156
|
+
throw new Error("Actual contract name must not be empty");
|
|
157
|
+
}
|
|
158
|
+
const separator = trimmed.lastIndexOf(":");
|
|
159
|
+
const actual = separator >= 0 ? trimmed.slice(separator + 1).trim() : trimmed;
|
|
160
|
+
if (!actual) {
|
|
161
|
+
throw new Error(`Invalid fully qualified contract name: ${contractName}`);
|
|
162
|
+
}
|
|
163
|
+
return actual;
|
|
164
|
+
};
|
|
165
|
+
exports.actualContractName = actualContractName;
|
|
166
|
+
const deploymentInstanceId = (instanceId) => {
|
|
167
|
+
const normalizedInstanceId = instanceId.trim();
|
|
168
|
+
if (!normalizedInstanceId) {
|
|
169
|
+
throw new Error("Deployment saveAs must not be empty");
|
|
170
|
+
}
|
|
171
|
+
if (normalizedInstanceId.includes(":")) {
|
|
172
|
+
throw new Error(`Deployment saveAs "${normalizedInstanceId}" must not contain ":"`);
|
|
173
|
+
}
|
|
174
|
+
return normalizedInstanceId;
|
|
175
|
+
};
|
|
176
|
+
exports.deploymentInstanceId = deploymentInstanceId;
|
|
177
|
+
const contractInfoKey = (instanceId, contractName) => {
|
|
178
|
+
const normalizedInstanceId = (0, exports.deploymentInstanceId)(instanceId);
|
|
179
|
+
const actual = (0, exports.actualContractName)(contractName);
|
|
180
|
+
return normalizedInstanceId === actual
|
|
181
|
+
? actual
|
|
182
|
+
: `${normalizedInstanceId}:${actual}`;
|
|
183
|
+
};
|
|
184
|
+
exports.contractInfoKey = contractInfoKey;
|
|
185
|
+
const loadContractInfo = (root, _config) => {
|
|
186
|
+
const filePath = contractInfoPath(root);
|
|
187
|
+
if (!fs_1.default.existsSync(filePath))
|
|
188
|
+
return {};
|
|
189
|
+
return (0, exports.validateContractInfo)((0, config_1.readJsonFile)(filePath));
|
|
190
|
+
};
|
|
191
|
+
exports.loadContractInfo = loadContractInfo;
|
|
192
|
+
const saveContractInfo = (root, contractInfo) => {
|
|
193
|
+
(0, config_1.writeJsonFile)(contractInfoPath(root), (0, exports.validateContractInfo)(contractInfo));
|
|
194
|
+
};
|
|
195
|
+
exports.saveContractInfo = saveContractInfo;
|
|
196
|
+
const planDeploymentAddress = (contractInfo, targetId, instanceId, contractName, address) => {
|
|
197
|
+
const key = (0, exports.contractInfoKey)(instanceId, contractName);
|
|
198
|
+
const normalizedInstanceId = (0, exports.deploymentInstanceId)(instanceId);
|
|
199
|
+
const planned = (0, exports.cloneContractInfo)(contractInfo);
|
|
200
|
+
const targetEntries = { ...(planned[targetId] || {}) };
|
|
201
|
+
for (const existingKey of Object.keys(targetEntries)) {
|
|
202
|
+
if (existingKey === normalizedInstanceId ||
|
|
203
|
+
existingKey.startsWith(`${normalizedInstanceId}:`)) {
|
|
204
|
+
delete targetEntries[existingKey];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
targetEntries[key] = address;
|
|
208
|
+
planned[targetId] = targetEntries;
|
|
209
|
+
return { key, contractInfo: planned };
|
|
210
|
+
};
|
|
211
|
+
exports.planDeploymentAddress = planDeploymentAddress;
|
|
212
|
+
const resolveDeployment = (contractInfo, targetId, name) => {
|
|
213
|
+
const entries = contractInfo[targetId] || {};
|
|
214
|
+
const exactAddress = entries[name];
|
|
215
|
+
if (exactAddress) {
|
|
216
|
+
return { key: name, address: exactAddress };
|
|
217
|
+
}
|
|
218
|
+
const aliases = Object.entries(entries).filter(([key]) => key.startsWith(`${name}:`));
|
|
219
|
+
if (aliases.length > 1) {
|
|
220
|
+
throw new Error(`Ambiguous contractInfo deployment ${targetId}.${name}; matches ${aliases.map(([key]) => key).join(", ")}`);
|
|
221
|
+
}
|
|
222
|
+
if (aliases.length === 1) {
|
|
223
|
+
return { key: aliases[0][0], address: aliases[0][1] };
|
|
224
|
+
}
|
|
225
|
+
return undefined;
|
|
226
|
+
};
|
|
227
|
+
exports.resolveDeployment = resolveDeployment;
|
|
228
|
+
const findDeploymentAddress = (root, config, targetId, name) => {
|
|
229
|
+
return (0, exports.resolveDeployment)((0, exports.loadContractInfo)(root, config), targetId, name)?.address;
|
|
230
|
+
};
|
|
231
|
+
exports.findDeploymentAddress = findDeploymentAddress;
|
|
232
|
+
const getDeploymentAddress = (root, config, targetId, name) => {
|
|
233
|
+
const deployment = (0, exports.resolveDeployment)((0, exports.loadContractInfo)(root, config), targetId, name);
|
|
234
|
+
if (!deployment) {
|
|
235
|
+
throw new Error(`Missing contractInfo address: ${targetId}.${name}`);
|
|
236
|
+
}
|
|
237
|
+
return deployment.address;
|
|
238
|
+
};
|
|
239
|
+
exports.getDeploymentAddress = getDeploymentAddress;
|
|
240
|
+
//# sourceMappingURL=deployments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployments.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/deployments.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,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W,QAAA,iBAAiB,qBAqB5B;AAEK,MAAM,qBAAqB,GAAG,CACnC,IAAY,EACZ,MAAsB,EACtB,QAAgB,EAChB,IAAY,EACQ,EAAE;IACtB,OAAO,IAAA,yBAAiB,EAAC,IAAA,wBAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC;AACpF,CAAC,CAAC;AAPW,QAAA,qBAAqB,yBAOhC;AAEK,MAAM,oBAAoB,GAAG,CAClC,IAAY,EACZ,MAAsB,EACtB,QAAgB,EAChB,IAAY,EACJ,EAAE;IACV,MAAM,UAAU,GAAG,IAAA,yBAAiB,EAAC,IAAA,wBAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IACrF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,iCAAiC,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,UAAU,CAAC,OAAO,CAAC;AAC5B,CAAC,CAAC;AAXW,QAAA,oBAAoB,wBAW/B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Provider } from "ethers";
|
|
2
|
+
export declare const ERC1967_IMPLEMENTATION_SLOT = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc";
|
|
3
|
+
export declare const ERC1967_ADMIN_SLOT = "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103";
|
|
4
|
+
export declare const getERC1967Implementation: (provider: Pick<Provider, "getStorage">, proxyAddress: string, blockTag?: number) => Promise<string | undefined>;
|
|
5
|
+
export declare const getERC1967Admin: (provider: Pick<Provider, "getStorage">, proxyAddress: string, blockTag?: number) => Promise<string | undefined>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getERC1967Admin = exports.getERC1967Implementation = exports.ERC1967_ADMIN_SLOT = exports.ERC1967_IMPLEMENTATION_SLOT = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
exports.ERC1967_IMPLEMENTATION_SLOT = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc";
|
|
6
|
+
exports.ERC1967_ADMIN_SLOT = "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103";
|
|
7
|
+
const getERC1967Address = async (provider, proxyAddress, slot, label, blockTag) => {
|
|
8
|
+
if (!(0, ethers_1.isAddress)(proxyAddress)) {
|
|
9
|
+
throw new Error("Invalid proxy candidate address: " + proxyAddress);
|
|
10
|
+
}
|
|
11
|
+
const storage = await provider.getStorage(proxyAddress, slot, blockTag);
|
|
12
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(storage)) {
|
|
13
|
+
throw new Error(`Invalid ERC1967 ${label} slot value for ${proxyAddress}`);
|
|
14
|
+
}
|
|
15
|
+
const storedAddress = "0x" + storage.slice(-40);
|
|
16
|
+
if (storedAddress.toLowerCase() === "0x" + "00".repeat(20)) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
return (0, ethers_1.getAddress)(storedAddress);
|
|
20
|
+
};
|
|
21
|
+
const getERC1967Implementation = async (provider, proxyAddress, blockTag) => {
|
|
22
|
+
return getERC1967Address(provider, proxyAddress, exports.ERC1967_IMPLEMENTATION_SLOT, "implementation", blockTag);
|
|
23
|
+
};
|
|
24
|
+
exports.getERC1967Implementation = getERC1967Implementation;
|
|
25
|
+
const getERC1967Admin = async (provider, proxyAddress, blockTag) => {
|
|
26
|
+
return getERC1967Address(provider, proxyAddress, exports.ERC1967_ADMIN_SLOT, "admin", blockTag);
|
|
27
|
+
};
|
|
28
|
+
exports.getERC1967Admin = getERC1967Admin;
|
|
29
|
+
//# sourceMappingURL=erc1967.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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EAClC,QAAsC,EACtC,YAAoB,EACpB,QAAiB,EACY,EAAE;IAC/B,OAAO,iBAAiB,CACtB,QAAQ,EACR,YAAY,EACZ,0BAAkB,EAClB,OAAO,EACP,QAAQ,CACT,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,eAAe,mBAY1B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type WorkflowErrorType = "transient" | "check_failed" | "parameter_error" | "config_error" | "contract_error" | "execution_reverted" | "unknown";
|
|
2
|
+
export interface WorkflowErrorClassification {
|
|
3
|
+
errorType: WorkflowErrorType;
|
|
4
|
+
retryable: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const classifyWorkflowError: (error: unknown) => WorkflowErrorClassification;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classifyWorkflowError = void 0;
|
|
4
|
+
const messageOf = (error) => {
|
|
5
|
+
return error instanceof Error ? error.message : String(error);
|
|
6
|
+
};
|
|
7
|
+
const matchesAny = (message, patterns) => {
|
|
8
|
+
return patterns.some((pattern) => pattern.test(message));
|
|
9
|
+
};
|
|
10
|
+
const classifyWorkflowError = (error) => {
|
|
11
|
+
const message = messageOf(error);
|
|
12
|
+
if (matchesAny(message, [
|
|
13
|
+
/timeout/i,
|
|
14
|
+
/timed out/i,
|
|
15
|
+
/rate limit/i,
|
|
16
|
+
/too many requests/i,
|
|
17
|
+
/\b429\b/,
|
|
18
|
+
/\b503\b/,
|
|
19
|
+
/ECONNRESET/i,
|
|
20
|
+
/ETIMEDOUT/i,
|
|
21
|
+
/EAI_AGAIN/i,
|
|
22
|
+
/header not found/i,
|
|
23
|
+
/missing trie node/i,
|
|
24
|
+
/could not detect network/i,
|
|
25
|
+
/network error/i,
|
|
26
|
+
/connection/i,
|
|
27
|
+
])) {
|
|
28
|
+
return { errorType: "transient", retryable: true };
|
|
29
|
+
}
|
|
30
|
+
if (matchesAny(message, [
|
|
31
|
+
/Check failed/i,
|
|
32
|
+
])) {
|
|
33
|
+
return { errorType: "check_failed", retryable: false };
|
|
34
|
+
}
|
|
35
|
+
if (matchesAny(message, [
|
|
36
|
+
/Missing parameters/i,
|
|
37
|
+
/Reference not found/i,
|
|
38
|
+
/must resolve to an array/i,
|
|
39
|
+
/Invalid admin address/i,
|
|
40
|
+
/requires saveAs/i,
|
|
41
|
+
/Duplicate deploy saveAs/i,
|
|
42
|
+
])) {
|
|
43
|
+
return { errorType: "parameter_error", retryable: false };
|
|
44
|
+
}
|
|
45
|
+
if (matchesAny(message, [
|
|
46
|
+
/Missing config\.yaml/i,
|
|
47
|
+
/Missing hardhat\.config\.ts network/i,
|
|
48
|
+
/cannot be forked/i,
|
|
49
|
+
/no factory address/i,
|
|
50
|
+
/no salt/i,
|
|
51
|
+
/simulation callers?/i,
|
|
52
|
+
/releaseTargetNetworks/i,
|
|
53
|
+
/release-target simulation/i,
|
|
54
|
+
])) {
|
|
55
|
+
return { errorType: "config_error", retryable: false };
|
|
56
|
+
}
|
|
57
|
+
if (matchesAny(message, [
|
|
58
|
+
/Contract does not expose method/i,
|
|
59
|
+
/missing upgradeToAndCall/i,
|
|
60
|
+
/missing newImplementation/i,
|
|
61
|
+
/Unsupported step kind/i,
|
|
62
|
+
])) {
|
|
63
|
+
return { errorType: "contract_error", retryable: false };
|
|
64
|
+
}
|
|
65
|
+
if (matchesAny(message, [
|
|
66
|
+
/revert/i,
|
|
67
|
+
/reverted/i,
|
|
68
|
+
/CALL_EXCEPTION/i,
|
|
69
|
+
/transaction failed/i,
|
|
70
|
+
/gate-tool validate failed/i,
|
|
71
|
+
])) {
|
|
72
|
+
return { errorType: "execution_reverted", retryable: false };
|
|
73
|
+
}
|
|
74
|
+
return { errorType: "unknown", retryable: false };
|
|
75
|
+
};
|
|
76
|
+
exports.classifyWorkflowError = classifyWorkflowError;
|
|
77
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
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E,SAAS,EAAE,KAAK,EAAE,CAAC;IAC5D,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,EAAE;QACtB,uBAAuB;QACvB,sCAAsC;QACtC,mBAAmB;QACnB,qBAAqB;QACrB,UAAU;QACV,sBAAsB;QACtB,wBAAwB;QACxB,4BAA4B;KAC7B,CAAC,EAAE,CAAC;QACH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACzD,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,EAAE;QACtB,kCAAkC;QAClC,2BAA2B;QAC3B,4BAA4B;QAC5B,wBAAwB;KACzB,CAAC,EAAE,CAAC;QACH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IAC3D,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,EAAE;QACtB,SAAS;QACT,WAAW;QACX,iBAAiB;QACjB,qBAAqB;QACrB,4BAA4B;KAC7B,CAAC,EAAE,CAAC;QACH,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IAC/D,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACpD,CAAC,CAAC;AAxEW,QAAA,qBAAqB,yBAwEhC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface BuildExecutionIdOptions {
|
|
2
|
+
now?: Date;
|
|
3
|
+
random?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const validateExecutionId: (value: unknown, label?: string) => string;
|
|
6
|
+
export declare const buildExecutionId: (targetId: string, options?: BuildExecutionIdOptions) => string;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildExecutionId = exports.validateExecutionId = void 0;
|
|
4
|
+
const EXECUTION_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,199}$/;
|
|
5
|
+
const MAX_EXECUTION_ID_LENGTH = 200;
|
|
6
|
+
const validateExecutionId = (value, label = "executionId") => {
|
|
7
|
+
if (typeof value !== "string" || !EXECUTION_ID_PATTERN.test(value)) {
|
|
8
|
+
throw new Error(`${label} must match the canonical execution ID rule: `
|
|
9
|
+
+ "1-200 letters, numbers, underscores, or hyphens, beginning with a letter or number");
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
};
|
|
13
|
+
exports.validateExecutionId = validateExecutionId;
|
|
14
|
+
const buildExecutionId = (targetId, options = {}) => {
|
|
15
|
+
const timestamp = (options.now || new Date()).toISOString().replace(/\D/g, "");
|
|
16
|
+
const random = options.random ?? Math.random();
|
|
17
|
+
const nonce = random.toString(36).slice(2).padEnd(8, "0").slice(0, 8);
|
|
18
|
+
const prefix = `exec-${timestamp}-${nonce}`;
|
|
19
|
+
const targetBudget = MAX_EXECUTION_ID_LENGTH - prefix.length - 1;
|
|
20
|
+
const targetSlug = targetId
|
|
21
|
+
.replace(/[^A-Za-z0-9_-]/g, "-")
|
|
22
|
+
.slice(0, targetBudget);
|
|
23
|
+
return (0, exports.validateExecutionId)(`${prefix}-${targetSlug}`);
|
|
24
|
+
};
|
|
25
|
+
exports.buildExecutionId = buildExecutionId;
|
|
26
|
+
//# sourceMappingURL=executionId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executionId.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/executionId.ts"],"names":[],"mappings":";;;AAAA,MAAM,oBAAoB,GAAG,mCAAmC,CAAC;AACjE,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAO7B,MAAM,mBAAmB,GAAG,CACjC,KAAc,EACd,KAAK,GAAG,aAAa,EACb,EAAE;IACV,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,+CAA+C;cACrD,oFAAoF,CACvF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAXW,QAAA,mBAAmB,uBAW9B;AAEK,MAAM,gBAAgB,GAAG,CAC9B,QAAgB,EAChB,UAAmC,EAAE,EAC7B,EAAE;IACV,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/E,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;IAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,QAAQ,SAAS,IAAI,KAAK,EAAE,CAAC;IAC5C,MAAM,YAAY,GAAG,uBAAuB,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IACjE,MAAM,UAAU,GAAG,QAAQ;SACxB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC;SAC/B,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAC1B,OAAO,IAAA,2BAAmB,EAAC,GAAG,MAAM,IAAI,UAAU,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export type ReleaseKind = "development" | "admin_release";
|
|
2
|
+
export type ExecutionRoute = "operator" | "external";
|
|
3
|
+
export interface ReleaseExecutionTransaction {
|
|
4
|
+
transactionId: string;
|
|
5
|
+
stepId: string;
|
|
6
|
+
transactionIndex: number;
|
|
7
|
+
route: ExecutionRoute;
|
|
8
|
+
executor: string;
|
|
9
|
+
to: string;
|
|
10
|
+
value: string;
|
|
11
|
+
data: string;
|
|
12
|
+
operation: 0 | 1;
|
|
13
|
+
scheme?: "zksync-eravm";
|
|
14
|
+
factoryDeps?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface ReleaseExecutionPlan {
|
|
17
|
+
version: 1;
|
|
18
|
+
taskId: string;
|
|
19
|
+
target: string;
|
|
20
|
+
executionId: string;
|
|
21
|
+
releaseKind: ReleaseKind;
|
|
22
|
+
operator: string;
|
|
23
|
+
transactions: ReleaseExecutionTransaction[];
|
|
24
|
+
planHash: string;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
}
|
|
27
|
+
type PlanBody = Omit<ReleaseExecutionPlan, "planHash" | "createdAt">;
|
|
28
|
+
export interface ReleaseExecutionTransactionInput {
|
|
29
|
+
stepId: string;
|
|
30
|
+
executor: string;
|
|
31
|
+
to: string;
|
|
32
|
+
value: string;
|
|
33
|
+
data: string;
|
|
34
|
+
operation: 0 | 1;
|
|
35
|
+
scheme?: "zksync-eravm";
|
|
36
|
+
factoryDeps?: string[];
|
|
37
|
+
}
|
|
38
|
+
export interface CompletedExecutionTransaction {
|
|
39
|
+
transactionId: string;
|
|
40
|
+
transactionHash: string;
|
|
41
|
+
}
|
|
42
|
+
export interface PlannedExecutionTransaction extends ReleaseExecutionTransaction {
|
|
43
|
+
executionAction: "execute" | "package" | "replay";
|
|
44
|
+
transactionHash?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare class ExecutionSegmentDeferred extends Error {
|
|
47
|
+
readonly transactionId: string;
|
|
48
|
+
constructor(transactionId: string);
|
|
49
|
+
}
|
|
50
|
+
export declare class ReleaseExecutionPlanner {
|
|
51
|
+
private readonly body;
|
|
52
|
+
private readonly expected?;
|
|
53
|
+
private readonly transactions;
|
|
54
|
+
private readonly segmentedExecution;
|
|
55
|
+
private readonly completedTransactions;
|
|
56
|
+
private readonly segmentEnd;
|
|
57
|
+
constructor(input: {
|
|
58
|
+
taskId: string;
|
|
59
|
+
target: string;
|
|
60
|
+
executionId: string;
|
|
61
|
+
releaseKind: ReleaseKind;
|
|
62
|
+
operator: string;
|
|
63
|
+
expectedPlan?: ReleaseExecutionPlan;
|
|
64
|
+
segmentedExecution?: boolean;
|
|
65
|
+
completedTransactions?: CompletedExecutionTransaction[];
|
|
66
|
+
});
|
|
67
|
+
add(input: ReleaseExecutionTransactionInput): PlannedExecutionTransaction;
|
|
68
|
+
complete(options?: {
|
|
69
|
+
allowPartial?: boolean;
|
|
70
|
+
}): PlanBody;
|
|
71
|
+
}
|
|
72
|
+
export declare const writeReleaseExecutionPlan: (input: {
|
|
73
|
+
root: string;
|
|
74
|
+
taskDir: string;
|
|
75
|
+
plan: PlanBody;
|
|
76
|
+
}) => ReleaseExecutionPlan;
|
|
77
|
+
export declare const loadReleaseExecutionPlan: (input: {
|
|
78
|
+
root: string;
|
|
79
|
+
taskDir: string;
|
|
80
|
+
target: string;
|
|
81
|
+
executionId: string;
|
|
82
|
+
expectedHash?: string;
|
|
83
|
+
}) => ReleaseExecutionPlan;
|
|
84
|
+
export declare const releaseExecutionPlanRelativePath: (taskDir: string, plan: Pick<ReleaseExecutionPlan, "target" | "executionId">) => string;
|
|
85
|
+
export {};
|