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,329 @@
|
|
|
1
|
+
import crypto from "crypto";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
export const normalizeCreate2Scheme = (value: unknown): "evm" | "zksync-eravm" => {
|
|
6
|
+
if (value === undefined || value === null || value === "" || value === "evm") {
|
|
7
|
+
return "evm";
|
|
8
|
+
}
|
|
9
|
+
if (value === "zksync-eravm") return value;
|
|
10
|
+
throw new Error("CREATE2 scheme must be evm or zksync-eravm");
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export interface ReleaseFingerprint {
|
|
14
|
+
manifestHash: string;
|
|
15
|
+
artifactHash: string;
|
|
16
|
+
parametersHash: string;
|
|
17
|
+
configHash: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ArtifactFingerprintInput {
|
|
21
|
+
contract: string;
|
|
22
|
+
bytecode: string;
|
|
23
|
+
deployedBytecode: string;
|
|
24
|
+
linkReferences: unknown;
|
|
25
|
+
deployedLinkReferences: unknown;
|
|
26
|
+
solcVersion: string;
|
|
27
|
+
optimizer: unknown;
|
|
28
|
+
evmVersion?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ReleaseFingerprintInput {
|
|
32
|
+
manifest: string;
|
|
33
|
+
artifacts: ArtifactFingerprintInput[];
|
|
34
|
+
parameters: Record<string, unknown>;
|
|
35
|
+
network: string;
|
|
36
|
+
chainId?: number;
|
|
37
|
+
target: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ReleaseNetwork extends Partial<ReleaseFingerprint> {
|
|
41
|
+
status: string;
|
|
42
|
+
simulationResult: string;
|
|
43
|
+
simulatedAt: string;
|
|
44
|
+
simulationCallerNetworkHash?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface DeploymentRelease {
|
|
48
|
+
version: 1;
|
|
49
|
+
sourceSuperTaskId: string;
|
|
50
|
+
developmentNetwork: string;
|
|
51
|
+
manifestHash: string;
|
|
52
|
+
artifactHash: string;
|
|
53
|
+
networks: Record<string, ReleaseNetwork>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ReleaseTargetSimulationRecordInput {
|
|
57
|
+
taskDir: string;
|
|
58
|
+
network: string;
|
|
59
|
+
executionId: string;
|
|
60
|
+
simulationResult: string;
|
|
61
|
+
simulatedAt: string;
|
|
62
|
+
simulationCallerNetworkHash: string;
|
|
63
|
+
fingerprint: ReleaseFingerprint;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const asObject = (value: unknown, label: string): Record<string, unknown> => {
|
|
67
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
68
|
+
throw new Error(label + " must be an object");
|
|
69
|
+
}
|
|
70
|
+
return value as Record<string, unknown>;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const requiredString = (source: Record<string, unknown>, key: string, label: string): string => {
|
|
74
|
+
const value = source[key];
|
|
75
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
76
|
+
throw new Error(label + "." + key + " must be a non-empty string");
|
|
77
|
+
}
|
|
78
|
+
return value.trim();
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const normalizeForJson = (value: unknown): unknown => {
|
|
82
|
+
if (Array.isArray(value)) {
|
|
83
|
+
return value.map((item) => normalizeForJson(item));
|
|
84
|
+
}
|
|
85
|
+
if (value && typeof value === "object") {
|
|
86
|
+
return Object.fromEntries(
|
|
87
|
+
Object.keys(value as Record<string, unknown>)
|
|
88
|
+
.sort()
|
|
89
|
+
.filter((key) => (value as Record<string, unknown>)[key] !== undefined)
|
|
90
|
+
.map((key) => [key, normalizeForJson((value as Record<string, unknown>)[key])]),
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
return value;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const stableJson = (value: unknown): string => {
|
|
97
|
+
return JSON.stringify(normalizeForJson(value));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const hashValue = (value: unknown): string => {
|
|
101
|
+
return crypto.createHash("sha256").update(stableJson(value)).digest("hex");
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const hashText = (value: string): string => {
|
|
105
|
+
return crypto.createHash("sha256").update(value).digest("hex");
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const optionalObject = (value: unknown): Record<string, unknown> => {
|
|
109
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
110
|
+
? value as Record<string, unknown>
|
|
111
|
+
: {};
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const normalizedAddress = (value: unknown): unknown => {
|
|
115
|
+
return typeof value === "string" ? value.toLowerCase() : value;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const hashArtifactInputs = (artifacts: ArtifactFingerprintInput[]): string => {
|
|
119
|
+
const normalized = artifacts
|
|
120
|
+
.map((artifact) => ({
|
|
121
|
+
contract: artifact.contract,
|
|
122
|
+
bytecode: artifact.bytecode,
|
|
123
|
+
deployedBytecode: artifact.deployedBytecode,
|
|
124
|
+
linkReferences: artifact.linkReferences,
|
|
125
|
+
deployedLinkReferences: artifact.deployedLinkReferences,
|
|
126
|
+
solcVersion: artifact.solcVersion,
|
|
127
|
+
optimizer: artifact.optimizer,
|
|
128
|
+
evmVersion: artifact.evmVersion || null,
|
|
129
|
+
}))
|
|
130
|
+
.sort((left, right) => left.contract.localeCompare(right.contract));
|
|
131
|
+
return hashValue(normalized);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const hashTargetConfig = (
|
|
135
|
+
network: string,
|
|
136
|
+
chainId: number | undefined,
|
|
137
|
+
target: Record<string, unknown>,
|
|
138
|
+
): string => {
|
|
139
|
+
const create2 = optionalObject(target.create2);
|
|
140
|
+
const multicall = optionalObject(target.multicall);
|
|
141
|
+
const uups = optionalObject(target.uups);
|
|
142
|
+
return hashValue({
|
|
143
|
+
network,
|
|
144
|
+
chainId: chainId ?? null,
|
|
145
|
+
create2: {
|
|
146
|
+
scheme: normalizeCreate2Scheme(create2.scheme),
|
|
147
|
+
factory: normalizedAddress(create2.factory),
|
|
148
|
+
caller: normalizedAddress(create2.caller),
|
|
149
|
+
leadingZeroBytes: create2.leadingZeroBytes,
|
|
150
|
+
},
|
|
151
|
+
controlledMulticall: normalizedAddress(multicall.controlledMulticall),
|
|
152
|
+
uupsPlaceholderImplementation: normalizedAddress(uups.placeholderImplementation),
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const buildReleaseFingerprint = (
|
|
157
|
+
input: ReleaseFingerprintInput,
|
|
158
|
+
): ReleaseFingerprint => {
|
|
159
|
+
return {
|
|
160
|
+
manifestHash: hashText(input.manifest),
|
|
161
|
+
artifactHash: hashArtifactInputs(input.artifacts),
|
|
162
|
+
parametersHash: hashValue(input.parameters),
|
|
163
|
+
configHash: hashTargetConfig(input.network, input.chainId, input.target),
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const validateRelease = (value: unknown): DeploymentRelease => {
|
|
168
|
+
const release = asObject(value, "release.json");
|
|
169
|
+
if (release.version !== 1) {
|
|
170
|
+
throw new Error("release.json.version must be 1");
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const networksValue = asObject(release.networks, "release.json.networks");
|
|
174
|
+
const networks: Record<string, ReleaseNetwork> = {};
|
|
175
|
+
for (const [network, networkValue] of Object.entries(networksValue)) {
|
|
176
|
+
const entry = asObject(networkValue, "release.json.networks." + network);
|
|
177
|
+
const parsed: ReleaseNetwork = {
|
|
178
|
+
status: requiredString(entry, "status", "release.json.networks." + network),
|
|
179
|
+
simulationResult: requiredString(entry, "simulationResult", "release.json.networks." + network),
|
|
180
|
+
simulatedAt: requiredString(entry, "simulatedAt", "release.json.networks." + network),
|
|
181
|
+
};
|
|
182
|
+
for (const key of ["manifestHash", "artifactHash", "parametersHash", "configHash"] as const) {
|
|
183
|
+
if (entry[key] !== undefined) {
|
|
184
|
+
parsed[key] = requiredString(entry, key, "release.json.networks." + network);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (entry.simulationCallerNetworkHash !== undefined) {
|
|
188
|
+
parsed.simulationCallerNetworkHash = requiredString(
|
|
189
|
+
entry,
|
|
190
|
+
"simulationCallerNetworkHash",
|
|
191
|
+
"release.json.networks." + network,
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
networks[network] = parsed;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return {
|
|
198
|
+
version: 1,
|
|
199
|
+
sourceSuperTaskId: requiredString(release, "sourceSuperTaskId", "release.json"),
|
|
200
|
+
developmentNetwork: requiredString(release, "developmentNetwork", "release.json"),
|
|
201
|
+
manifestHash: requiredString(release, "manifestHash", "release.json"),
|
|
202
|
+
artifactHash: requiredString(release, "artifactHash", "release.json"),
|
|
203
|
+
networks,
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export const loadRelease = (taskDir: string): DeploymentRelease => {
|
|
208
|
+
const filePath = path.join(taskDir, "release.json");
|
|
209
|
+
if (!fs.existsSync(filePath)) {
|
|
210
|
+
throw new Error("Missing release.json in deployment task");
|
|
211
|
+
}
|
|
212
|
+
try {
|
|
213
|
+
return validateRelease(JSON.parse(fs.readFileSync(filePath, "utf8")));
|
|
214
|
+
} catch (error) {
|
|
215
|
+
if (error instanceof SyntaxError) {
|
|
216
|
+
throw new Error("release.json must contain valid JSON: " + error.message);
|
|
217
|
+
}
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const safeResultPathSegment = (value: string, label: string): string => {
|
|
223
|
+
if (
|
|
224
|
+
!value
|
|
225
|
+
|| value === "."
|
|
226
|
+
|| value === ".."
|
|
227
|
+
|| !/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(value)
|
|
228
|
+
) {
|
|
229
|
+
throw new Error(label + " must be a safe path segment");
|
|
230
|
+
}
|
|
231
|
+
return value;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const writeReleaseAtomically = (filePath: string, value: DeploymentRelease): void => {
|
|
235
|
+
const contents = `${JSON.stringify(value, null, 2)}\n`;
|
|
236
|
+
const tempPath = `${filePath}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`;
|
|
237
|
+
let descriptor: number | undefined;
|
|
238
|
+
try {
|
|
239
|
+
descriptor = fs.openSync(tempPath, "wx");
|
|
240
|
+
fs.writeFileSync(descriptor, contents);
|
|
241
|
+
fs.fsyncSync(descriptor);
|
|
242
|
+
fs.closeSync(descriptor);
|
|
243
|
+
descriptor = undefined;
|
|
244
|
+
fs.renameSync(tempPath, filePath);
|
|
245
|
+
} catch (error) {
|
|
246
|
+
if (descriptor !== undefined) fs.closeSync(descriptor);
|
|
247
|
+
if (fs.existsSync(tempPath)) fs.unlinkSync(tempPath);
|
|
248
|
+
throw error;
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
export const recordReleaseTargetSimulationSucceeded = (
|
|
253
|
+
input: ReleaseTargetSimulationRecordInput,
|
|
254
|
+
): DeploymentRelease => {
|
|
255
|
+
const network = safeResultPathSegment(input.network, "release network");
|
|
256
|
+
const executionId = safeResultPathSegment(input.executionId, "simulation executionId");
|
|
257
|
+
const expectedResult = `results/${network}/${executionId}/simulation/execution.json`;
|
|
258
|
+
if (input.simulationResult !== expectedResult) {
|
|
259
|
+
throw new Error("Release target requires a canonical simulation result path");
|
|
260
|
+
}
|
|
261
|
+
if (!Number.isFinite(Date.parse(input.simulatedAt))) {
|
|
262
|
+
throw new Error("Release target simulatedAt is invalid");
|
|
263
|
+
}
|
|
264
|
+
if (!/^[0-9a-f]{64}$/.test(input.simulationCallerNetworkHash)) {
|
|
265
|
+
throw new Error("Release target simulation caller network hash is invalid");
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const release = loadRelease(input.taskDir);
|
|
269
|
+
const current = release.networks[network];
|
|
270
|
+
if (!current) throw new Error("Release target is not present in release.json");
|
|
271
|
+
const recordedFingerprint: ReleaseFingerprint = {
|
|
272
|
+
manifestHash: current.manifestHash || release.manifestHash,
|
|
273
|
+
artifactHash: current.artifactHash || release.artifactHash,
|
|
274
|
+
parametersHash: current.parametersHash || "",
|
|
275
|
+
configHash: current.configHash || "",
|
|
276
|
+
};
|
|
277
|
+
for (const key of ["manifestHash", "artifactHash", "parametersHash", "configHash"] as const) {
|
|
278
|
+
if (!input.fingerprint[key] || recordedFingerprint[key] !== input.fingerprint[key]) {
|
|
279
|
+
throw new Error("Release target fingerprint changed: " + key);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const next = validateRelease({
|
|
284
|
+
...release,
|
|
285
|
+
networks: {
|
|
286
|
+
...release.networks,
|
|
287
|
+
[network]: {
|
|
288
|
+
...current,
|
|
289
|
+
status: "simulated",
|
|
290
|
+
...input.fingerprint,
|
|
291
|
+
simulationCallerNetworkHash: input.simulationCallerNetworkHash,
|
|
292
|
+
simulationResult: expectedResult,
|
|
293
|
+
simulatedAt: input.simulatedAt,
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
writeReleaseAtomically(path.join(input.taskDir, "release.json"), next);
|
|
298
|
+
return next;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
export const assertReleaseNetworkReady = (
|
|
302
|
+
release: DeploymentRelease,
|
|
303
|
+
network: string,
|
|
304
|
+
currentFingerprint: ReleaseFingerprint,
|
|
305
|
+
): ReleaseNetwork => {
|
|
306
|
+
const entry = release.networks[network];
|
|
307
|
+
if (!entry) {
|
|
308
|
+
throw new Error("Network " + network + " is not present in release.json");
|
|
309
|
+
}
|
|
310
|
+
if (entry.status !== "ready") {
|
|
311
|
+
throw new Error("Network " + network + " is not release-ready");
|
|
312
|
+
}
|
|
313
|
+
if (!entry.simulationCallerNetworkHash || !/^[0-9a-f]{64}$/.test(entry.simulationCallerNetworkHash)) {
|
|
314
|
+
throw new Error("Network " + network + " release caller network hash is missing or invalid");
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const expected: ReleaseFingerprint = {
|
|
318
|
+
manifestHash: entry.manifestHash || release.manifestHash,
|
|
319
|
+
artifactHash: entry.artifactHash || release.artifactHash,
|
|
320
|
+
parametersHash: entry.parametersHash || "",
|
|
321
|
+
configHash: entry.configHash || "",
|
|
322
|
+
};
|
|
323
|
+
for (const key of ["manifestHash", "artifactHash", "parametersHash", "configHash"] as const) {
|
|
324
|
+
if (!expected[key] || expected[key] !== currentFingerprint[key]) {
|
|
325
|
+
throw new Error("Network " + network + " release fingerprint changed: " + key);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return entry;
|
|
329
|
+
};
|