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,190 @@
|
|
|
1
|
+
import { spawnSync } from "child_process";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { JsonRpcProvider, Provider } from "ethers";
|
|
5
|
+
import { loadConfig, readJsonFile, writeJsonFile } from "./lib/config";
|
|
6
|
+
import {
|
|
7
|
+
importMigrationState,
|
|
8
|
+
migrationConfirmationToken,
|
|
9
|
+
MigrationContractPlan,
|
|
10
|
+
resolveConfinedMigrationPath,
|
|
11
|
+
resolveGateToolCandidateCheck,
|
|
12
|
+
validateMigrationStatePlan,
|
|
13
|
+
} from "./lib/migrationState";
|
|
14
|
+
import {
|
|
15
|
+
getERC1967Admin,
|
|
16
|
+
getERC1967Implementation,
|
|
17
|
+
} from "./lib/erc1967";
|
|
18
|
+
|
|
19
|
+
type ParsedArgs = Record<string, string[]>;
|
|
20
|
+
|
|
21
|
+
const parseArgs = (argv: string[]): ParsedArgs => {
|
|
22
|
+
const parsed: ParsedArgs = {};
|
|
23
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
24
|
+
const item = argv[index];
|
|
25
|
+
if (!item.startsWith("--")) throw new Error(`Unsupported argument: ${item}`);
|
|
26
|
+
const equalIndex = item.indexOf("=");
|
|
27
|
+
const key = item.slice(2, equalIndex > 2 ? equalIndex : undefined);
|
|
28
|
+
const inlineValue = equalIndex > 2 ? item.slice(equalIndex + 1) : undefined;
|
|
29
|
+
const next = argv[index + 1];
|
|
30
|
+
const value = inlineValue ?? (
|
|
31
|
+
next && !next.startsWith("--") ? next : "true"
|
|
32
|
+
);
|
|
33
|
+
if (inlineValue === undefined && next && !next.startsWith("--")) index += 1;
|
|
34
|
+
(parsed[key] ||= []).push(value);
|
|
35
|
+
}
|
|
36
|
+
return parsed;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const singleArg = (
|
|
40
|
+
args: ParsedArgs,
|
|
41
|
+
key: string,
|
|
42
|
+
options: { required?: boolean } = {},
|
|
43
|
+
): string | undefined => {
|
|
44
|
+
const values = args[key] || [];
|
|
45
|
+
if (values.length > 1) throw new Error(`--${key} may be provided only once`);
|
|
46
|
+
const value = values[0]?.trim();
|
|
47
|
+
if (options.required && (!value || value === "true")) {
|
|
48
|
+
throw new Error(`--${key} is required`);
|
|
49
|
+
}
|
|
50
|
+
return value && value !== "true" ? value : undefined;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const confinedPlanPath = (root: string, requested: string): string => {
|
|
54
|
+
return resolveConfinedMigrationPath(root, requested, {
|
|
55
|
+
label: "Migration plan",
|
|
56
|
+
requireFile: true,
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const commandName = (command: string): string => (
|
|
61
|
+
process.platform === "win32" ? `${command}.cmd` : command
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const main = async (): Promise<void> => {
|
|
65
|
+
const args = parseArgs(process.argv.slice(2));
|
|
66
|
+
const root = path.resolve(singleArg(args, "root") || process.cwd());
|
|
67
|
+
const planPath = confinedPlanPath(
|
|
68
|
+
root,
|
|
69
|
+
singleArg(args, "plan", { required: true }) as string,
|
|
70
|
+
);
|
|
71
|
+
const plan = validateMigrationStatePlan(readJsonFile<unknown>(planPath));
|
|
72
|
+
const confirmations = Object.keys(plan.networks).sort().map((network) => ({
|
|
73
|
+
network,
|
|
74
|
+
token: migrationConfirmationToken(plan, network),
|
|
75
|
+
}));
|
|
76
|
+
|
|
77
|
+
if (args["print-confirmations"]?.length) {
|
|
78
|
+
console.log(JSON.stringify({ migrationId: plan.migrationId, confirmations }, null, 2));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
process.env.GATE_MIGRATION_READ_ONLY = "1";
|
|
83
|
+
const {
|
|
84
|
+
artifacts,
|
|
85
|
+
config: hardhatConfig,
|
|
86
|
+
ethers: hardhatEthers,
|
|
87
|
+
network: hardhatNetwork,
|
|
88
|
+
run: hardhatRun,
|
|
89
|
+
} = await import("../projectHardhat");
|
|
90
|
+
|
|
91
|
+
const workflowConfig = loadConfig(root);
|
|
92
|
+
const rpcProviders = new Map<string, JsonRpcProvider>();
|
|
93
|
+
const providerFor = (
|
|
94
|
+
networkName: string,
|
|
95
|
+
): Pick<Provider, "getCode" | "getNetwork" | "getStorage"> => {
|
|
96
|
+
if (networkName === hardhatNetwork.name) return hardhatEthers.provider;
|
|
97
|
+
const existing = rpcProviders.get(networkName);
|
|
98
|
+
if (existing) return existing;
|
|
99
|
+
const networkConfig = hardhatConfig.networks[networkName];
|
|
100
|
+
if (!networkConfig || !("url" in networkConfig) || typeof networkConfig.url !== "string") {
|
|
101
|
+
throw new Error(`Hardhat network ${networkName} does not define an HTTP RPC URL`);
|
|
102
|
+
}
|
|
103
|
+
const provider = new JsonRpcProvider(networkConfig.url);
|
|
104
|
+
rpcProviders.set(networkName, provider);
|
|
105
|
+
return provider;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const inspect = async (
|
|
109
|
+
networkName: string,
|
|
110
|
+
contract: MigrationContractPlan,
|
|
111
|
+
) => {
|
|
112
|
+
const provider = providerFor(networkName);
|
|
113
|
+
const chainId = Number((await provider.getNetwork()).chainId);
|
|
114
|
+
const implementationAddress = await getERC1967Implementation(provider, contract.address);
|
|
115
|
+
const adminAddress = implementationAddress
|
|
116
|
+
? await getERC1967Admin(provider, contract.address)
|
|
117
|
+
: undefined;
|
|
118
|
+
const proxyKind = implementationAddress
|
|
119
|
+
? (adminAddress ? "transparent" as const : "uups" as const)
|
|
120
|
+
: "none" as const;
|
|
121
|
+
const contractCode = await provider.getCode(contract.address);
|
|
122
|
+
const implementationCode = implementationAddress
|
|
123
|
+
? await provider.getCode(implementationAddress)
|
|
124
|
+
: undefined;
|
|
125
|
+
let artifactExists = true;
|
|
126
|
+
try {
|
|
127
|
+
await artifacts.readArtifact(contract.actualContract);
|
|
128
|
+
} catch {
|
|
129
|
+
artifactExists = false;
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
chainId,
|
|
133
|
+
hasCode: contractCode !== "0x"
|
|
134
|
+
&& (implementationCode === undefined || implementationCode !== "0x"),
|
|
135
|
+
artifactExists,
|
|
136
|
+
proxyKind,
|
|
137
|
+
...(implementationAddress ? { implementationAddress } : {}),
|
|
138
|
+
address: contract.address,
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
await hardhatRun("compile", { quiet: true });
|
|
143
|
+
try {
|
|
144
|
+
const evidence = await importMigrationState({
|
|
145
|
+
root,
|
|
146
|
+
plan,
|
|
147
|
+
targets: workflowConfig,
|
|
148
|
+
confirmations: args.confirm || [],
|
|
149
|
+
inspect,
|
|
150
|
+
verifyCandidate: async (contractInfo) => {
|
|
151
|
+
const checkRoot = fs.mkdtempSync(path.join(root, ".gate-migration-check-"));
|
|
152
|
+
const candidatePath = path.join(checkRoot, "contractInfo.json");
|
|
153
|
+
const reportPath = path.join(checkRoot, "bytecode-check.json");
|
|
154
|
+
try {
|
|
155
|
+
writeJsonFile(candidatePath, contractInfo);
|
|
156
|
+
const result = spawnSync(commandName("npx"), [
|
|
157
|
+
"--no-install",
|
|
158
|
+
"gate-tool",
|
|
159
|
+
"check",
|
|
160
|
+
"--config",
|
|
161
|
+
candidatePath,
|
|
162
|
+
"--output",
|
|
163
|
+
reportPath,
|
|
164
|
+
], {
|
|
165
|
+
cwd: root,
|
|
166
|
+
env: process.env,
|
|
167
|
+
stdio: "inherit",
|
|
168
|
+
});
|
|
169
|
+
return resolveGateToolCandidateCheck(result, reportPath);
|
|
170
|
+
} finally {
|
|
171
|
+
fs.rmSync(checkRoot, { recursive: true, force: true });
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
console.log(JSON.stringify({
|
|
176
|
+
status: evidence.status,
|
|
177
|
+
migrationId: evidence.migrationId,
|
|
178
|
+
planHash: evidence.planHash,
|
|
179
|
+
evidencePath: `scripts/migrations/${evidence.migrationId}/state-import.json`,
|
|
180
|
+
}));
|
|
181
|
+
} finally {
|
|
182
|
+
for (const provider of rpcProviders.values()) provider.destroy();
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
void main().catch((error) => {
|
|
187
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
188
|
+
console.error("Use --print-confirmations with the same --plan before importing state.");
|
|
189
|
+
process.exitCode = 1;
|
|
190
|
+
});
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { BaseContract } from "ethers";
|
|
2
|
+
import { getAddress, isAddress } from "ethers";
|
|
3
|
+
import { TargetConfig, resolveAdmin } from "./config";
|
|
4
|
+
|
|
5
|
+
export interface AuthorityDecision {
|
|
6
|
+
mode: "execute" | "calldata";
|
|
7
|
+
signer: string;
|
|
8
|
+
configuredAdmin: string;
|
|
9
|
+
chainAdmin?: string;
|
|
10
|
+
executor?: string;
|
|
11
|
+
reason: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const assertSelectedSimulationSignerAuthorized = (
|
|
15
|
+
decision: AuthorityDecision,
|
|
16
|
+
stepId: string,
|
|
17
|
+
): void => {
|
|
18
|
+
if (decision.mode === "execute") return;
|
|
19
|
+
const requiredExecutor = decision.executor || decision.configuredAdmin;
|
|
20
|
+
throw new Error(
|
|
21
|
+
`selected simulation signer is not authorized for step ${stepId}; required executor ${requiredExecutor}`,
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const readChainAdmin = async (
|
|
26
|
+
contract: BaseContract,
|
|
27
|
+
blockTag?: number,
|
|
28
|
+
): Promise<string | undefined> => {
|
|
29
|
+
const callable = contract as unknown as Record<string, unknown>;
|
|
30
|
+
|
|
31
|
+
for (const methodName of ["owner", "admin"]) {
|
|
32
|
+
const method = callable[methodName];
|
|
33
|
+
if (typeof method !== "function") continue;
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
const value = await (method as (...args: unknown[]) => Promise<unknown>)(
|
|
37
|
+
...(blockTag === undefined ? [] : [{ blockTag }]),
|
|
38
|
+
);
|
|
39
|
+
if (typeof value === "string" && isAddress(value)) {
|
|
40
|
+
return getAddress(value);
|
|
41
|
+
}
|
|
42
|
+
} catch {
|
|
43
|
+
// Some proxy admin methods intentionally revert for non-admin callers.
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
interface ControlledMulticallAuthorityContract {
|
|
51
|
+
callers: (caller: string, overrides?: { blockTag: number }) => Promise<boolean>;
|
|
52
|
+
factoryCallers: (
|
|
53
|
+
factory: string,
|
|
54
|
+
caller: string,
|
|
55
|
+
overrides?: { blockTag: number },
|
|
56
|
+
) => Promise<boolean>;
|
|
57
|
+
owner?: (overrides?: { blockTag: number }) => Promise<unknown>;
|
|
58
|
+
admin?: (overrides?: { blockTag: number }) => Promise<unknown>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const decideControlledMulticallAuthority = async (
|
|
62
|
+
contract: ControlledMulticallAuthorityContract,
|
|
63
|
+
factory: string,
|
|
64
|
+
target: TargetConfig,
|
|
65
|
+
signerAddress: string,
|
|
66
|
+
blockTag?: number,
|
|
67
|
+
): Promise<AuthorityDecision> => {
|
|
68
|
+
const normalizedSignerAddress = getAddress(signerAddress);
|
|
69
|
+
const normalizedFactory = getAddress(factory);
|
|
70
|
+
let callerAllowed: boolean;
|
|
71
|
+
let factoryAllowed: boolean;
|
|
72
|
+
try {
|
|
73
|
+
[callerAllowed, factoryAllowed] = await Promise.all([
|
|
74
|
+
blockTag === undefined
|
|
75
|
+
? contract.callers(normalizedSignerAddress)
|
|
76
|
+
: contract.callers(normalizedSignerAddress, { blockTag }),
|
|
77
|
+
blockTag === undefined
|
|
78
|
+
? contract.factoryCallers(normalizedFactory, normalizedSignerAddress)
|
|
79
|
+
: contract.factoryCallers(normalizedFactory, normalizedSignerAddress, { blockTag }),
|
|
80
|
+
]);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
throw new Error(
|
|
83
|
+
"Cannot determine controlled multicall authority: "
|
|
84
|
+
+ (error instanceof Error ? error.message : String(error)),
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const configuredAdmin = resolveAdmin(target, normalizedSignerAddress);
|
|
89
|
+
const chainAdmin = await readChainAdmin(contract as unknown as BaseContract, blockTag);
|
|
90
|
+
if (callerAllowed && factoryAllowed) {
|
|
91
|
+
return {
|
|
92
|
+
mode: "execute",
|
|
93
|
+
signer: normalizedSignerAddress,
|
|
94
|
+
configuredAdmin,
|
|
95
|
+
chainAdmin,
|
|
96
|
+
reason: "operator has controlled multicall caller and factory authority",
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const explicitConfiguredAdmin = typeof target.admin === "string" && isAddress(target.admin)
|
|
101
|
+
? getAddress(target.admin)
|
|
102
|
+
: undefined;
|
|
103
|
+
const executor = chainAdmin || explicitConfiguredAdmin;
|
|
104
|
+
if (!executor || executor.toLowerCase() === normalizedSignerAddress.toLowerCase()) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
"Controlled multicall permissions are missing and cannot resolve an external executor",
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
mode: "calldata",
|
|
111
|
+
signer: normalizedSignerAddress,
|
|
112
|
+
configuredAdmin,
|
|
113
|
+
chainAdmin,
|
|
114
|
+
executor,
|
|
115
|
+
reason: [
|
|
116
|
+
"controlled multicall authority requires external execution",
|
|
117
|
+
callerAllowed ? undefined : "caller permission missing",
|
|
118
|
+
factoryAllowed ? undefined : "factory caller permission missing",
|
|
119
|
+
].filter(Boolean).join("; "),
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const decideAuthority = async (
|
|
124
|
+
contract: BaseContract,
|
|
125
|
+
target: TargetConfig,
|
|
126
|
+
signerAddress: string,
|
|
127
|
+
blockTag?: number,
|
|
128
|
+
): Promise<AuthorityDecision> => {
|
|
129
|
+
const normalizedSignerAddress = getAddress(signerAddress);
|
|
130
|
+
const configuredAdmin = resolveAdmin(target, normalizedSignerAddress);
|
|
131
|
+
const chainAdmin = await readChainAdmin(contract, blockTag);
|
|
132
|
+
|
|
133
|
+
if (chainAdmin) {
|
|
134
|
+
if (chainAdmin.toLowerCase() === normalizedSignerAddress.toLowerCase()) {
|
|
135
|
+
return {
|
|
136
|
+
mode: "execute",
|
|
137
|
+
signer: normalizedSignerAddress,
|
|
138
|
+
configuredAdmin,
|
|
139
|
+
chainAdmin,
|
|
140
|
+
reason: "signer is chain admin",
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
mode: "calldata",
|
|
146
|
+
signer: normalizedSignerAddress,
|
|
147
|
+
configuredAdmin,
|
|
148
|
+
chainAdmin,
|
|
149
|
+
executor: chainAdmin,
|
|
150
|
+
reason: "signer is not chain admin",
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (configuredAdmin.toLowerCase() !== normalizedSignerAddress.toLowerCase()) {
|
|
155
|
+
return {
|
|
156
|
+
mode: "calldata",
|
|
157
|
+
signer: normalizedSignerAddress,
|
|
158
|
+
configuredAdmin,
|
|
159
|
+
executor: configuredAdmin,
|
|
160
|
+
reason: "configured admin differs from signer",
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
mode: "execute",
|
|
166
|
+
signer: normalizedSignerAddress,
|
|
167
|
+
configuredAdmin,
|
|
168
|
+
reason: "no chain admin check available",
|
|
169
|
+
};
|
|
170
|
+
};
|