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,771 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { ethers, network } from "../../projectHardhat";
|
|
3
|
+
import type {
|
|
4
|
+
GateToolDeploymentPlan,
|
|
5
|
+
GateToolPreparationPlanV1,
|
|
6
|
+
GateToolPreparationRequestV1,
|
|
7
|
+
GateToolTransactionPlan,
|
|
8
|
+
} from "gate-evm-tools/workflow";
|
|
9
|
+
import type { WorkflowContext } from "../run";
|
|
10
|
+
import {
|
|
11
|
+
requireExistingDeploymentPolicy,
|
|
12
|
+
resolveExistingDeploymentPolicyAction,
|
|
13
|
+
resolveValue,
|
|
14
|
+
WorkflowStep,
|
|
15
|
+
} from "../lib/parameters";
|
|
16
|
+
import {
|
|
17
|
+
actualContractName,
|
|
18
|
+
contractInfoKey,
|
|
19
|
+
findDeploymentAddress,
|
|
20
|
+
} from "../lib/deployments";
|
|
21
|
+
import type { DeploymentChange } from "../lib/deploymentRecords";
|
|
22
|
+
import {
|
|
23
|
+
assertCreate2AddressPolicy,
|
|
24
|
+
Create2Options,
|
|
25
|
+
prepareControlledMulticallTransaction,
|
|
26
|
+
resolveCreate2Options,
|
|
27
|
+
sendPreparedControlledMulticallTransaction,
|
|
28
|
+
} from "../lib/create2";
|
|
29
|
+
import { assertReusableDeployment } from "../lib/checkCodeReport";
|
|
30
|
+
import { getERC1967Implementation } from "../lib/erc1967";
|
|
31
|
+
import { recordParameterLockImplementationSalts } from "../lib/lock";
|
|
32
|
+
import {
|
|
33
|
+
deriveImplementationSalt,
|
|
34
|
+
FirstUpgradeOptions,
|
|
35
|
+
ProxyOptions,
|
|
36
|
+
} from "../lib/proxy";
|
|
37
|
+
import { decideControlledMulticallAuthority } from "../lib/authority";
|
|
38
|
+
import { impersonateWorkflowSimulationSigner } from "../lib/signer";
|
|
39
|
+
import { prepareGateToolWorkflow } from "../lib/gateTool";
|
|
40
|
+
import { syncGateToolUups } from "../lib/gateToolSync";
|
|
41
|
+
import { resolvePendingUupsReuse } from "../lib/pendingDeploymentReuse";
|
|
42
|
+
|
|
43
|
+
const resolveInContext = (
|
|
44
|
+
context: WorkflowContext,
|
|
45
|
+
value: unknown,
|
|
46
|
+
): unknown => resolveValue(value, {
|
|
47
|
+
targetId: context.targetId,
|
|
48
|
+
target: context.target,
|
|
49
|
+
params: context.targetParams,
|
|
50
|
+
state: context.state,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const resolveArray = (
|
|
54
|
+
context: WorkflowContext,
|
|
55
|
+
value: unknown,
|
|
56
|
+
label: string,
|
|
57
|
+
): unknown[] => {
|
|
58
|
+
const resolved = resolveInContext(context, value || []);
|
|
59
|
+
if (!Array.isArray(resolved)) throw new Error(`${label} must resolve to an array`);
|
|
60
|
+
return resolved;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const resolveObject = (
|
|
64
|
+
context: WorkflowContext,
|
|
65
|
+
value: unknown,
|
|
66
|
+
): Record<string, unknown> => {
|
|
67
|
+
const resolved = resolveInContext(context, value || {});
|
|
68
|
+
if (!resolved || typeof resolved !== "object" || Array.isArray(resolved)) return {};
|
|
69
|
+
return resolved as Record<string, unknown>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const resolveProxyOptions = (
|
|
73
|
+
context: WorkflowContext,
|
|
74
|
+
step: WorkflowStep,
|
|
75
|
+
): { options: ProxyOptions } | undefined => {
|
|
76
|
+
if (step.proxy === undefined) return undefined;
|
|
77
|
+
const proxy = resolveObject(context, step.proxy);
|
|
78
|
+
const initializer = proxy.initializer === false
|
|
79
|
+
? false
|
|
80
|
+
: typeof proxy.initializer === "string"
|
|
81
|
+
? proxy.initializer
|
|
82
|
+
: undefined;
|
|
83
|
+
return {
|
|
84
|
+
options: {
|
|
85
|
+
kind: typeof proxy.kind === "string" ? proxy.kind : undefined,
|
|
86
|
+
initializer,
|
|
87
|
+
unsafeAllow: Array.isArray(proxy.unsafeAllow)
|
|
88
|
+
? proxy.unsafeAllow.map((item) => String(item))
|
|
89
|
+
: undefined,
|
|
90
|
+
constructorArgs: proxy.constructorArgs === undefined
|
|
91
|
+
? undefined
|
|
92
|
+
: resolveArray(context, proxy.constructorArgs, `Step ${step.id} proxy.constructorArgs`),
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const assertCreate2Options = (
|
|
98
|
+
step: WorkflowStep,
|
|
99
|
+
options: Create2Options | undefined,
|
|
100
|
+
): Create2Options => {
|
|
101
|
+
if (!options) throw new Error(`Deploy step ${step.id} requires strategy: create2`);
|
|
102
|
+
return options;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const setDeploymentState = (
|
|
106
|
+
context: WorkflowContext,
|
|
107
|
+
names: string[],
|
|
108
|
+
value: Record<string, unknown>,
|
|
109
|
+
): void => {
|
|
110
|
+
for (const name of new Set(names)) context.state.set(name, value);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const stringObjectField = (
|
|
114
|
+
source: Record<string, unknown>,
|
|
115
|
+
key: string,
|
|
116
|
+
): string | undefined => {
|
|
117
|
+
const value = source[key];
|
|
118
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const resolveFirstUpgradeOptions = (
|
|
122
|
+
context: WorkflowContext,
|
|
123
|
+
step: WorkflowStep,
|
|
124
|
+
): FirstUpgradeOptions | undefined => {
|
|
125
|
+
if (step.firstUpgrade === undefined) return undefined;
|
|
126
|
+
const firstUpgrade = resolveObject(context, step.firstUpgrade);
|
|
127
|
+
const contractName = stringObjectField(firstUpgrade, "contract");
|
|
128
|
+
if (!contractName) throw new Error(`Deploy step ${step.id} firstUpgrade requires contract`);
|
|
129
|
+
const callObject = resolveObject(context, firstUpgrade.call);
|
|
130
|
+
const fn = stringObjectField(callObject, "fn") || stringObjectField(callObject, "method");
|
|
131
|
+
return {
|
|
132
|
+
contractName,
|
|
133
|
+
call: fn
|
|
134
|
+
? {
|
|
135
|
+
fn,
|
|
136
|
+
args: resolveArray(
|
|
137
|
+
context,
|
|
138
|
+
callObject.args || [],
|
|
139
|
+
`Step ${step.id} firstUpgrade.call.args`,
|
|
140
|
+
),
|
|
141
|
+
}
|
|
142
|
+
: undefined,
|
|
143
|
+
constructorArgs: resolveArray(
|
|
144
|
+
context,
|
|
145
|
+
firstUpgrade.constructorArgs || [],
|
|
146
|
+
`Step ${step.id} firstUpgrade.constructorArgs`,
|
|
147
|
+
),
|
|
148
|
+
unsafeAllow: Array.isArray(firstUpgrade.unsafeAllow)
|
|
149
|
+
? firstUpgrade.unsafeAllow.map((item) => String(item))
|
|
150
|
+
: undefined,
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const applyExistingDeploymentPolicy = async (
|
|
155
|
+
context: WorkflowContext,
|
|
156
|
+
step: WorkflowStep,
|
|
157
|
+
saveAs: string,
|
|
158
|
+
preparedChange: DeploymentChange,
|
|
159
|
+
create2Options: Create2Options,
|
|
160
|
+
declaredUpgradeable: boolean,
|
|
161
|
+
): Promise<{
|
|
162
|
+
completed: boolean;
|
|
163
|
+
create2Options: Create2Options;
|
|
164
|
+
existingAddress?: string;
|
|
165
|
+
redeployReason?: string;
|
|
166
|
+
}> => {
|
|
167
|
+
const existing = findDeploymentAddress(context.root, context.config, context.targetId, saveAs);
|
|
168
|
+
if (!existing) return { completed: false, create2Options };
|
|
169
|
+
const policy = requireExistingDeploymentPolicy(context.existingDeploymentPolicies, saveAs);
|
|
170
|
+
const implementationAddress = await getERC1967Implementation(ethers.provider, existing);
|
|
171
|
+
const action = resolveExistingDeploymentPolicyAction(policy, {
|
|
172
|
+
instanceId: saveAs,
|
|
173
|
+
existingAddress: existing,
|
|
174
|
+
currentSalt: create2Options.salt,
|
|
175
|
+
upgradeable: declaredUpgradeable || implementationAddress !== undefined,
|
|
176
|
+
});
|
|
177
|
+
if (action.mode === "reuse") {
|
|
178
|
+
if (!context.releaseArtifactHash) {
|
|
179
|
+
throw new Error(
|
|
180
|
+
`Deploy step ${step.id} cannot reuse ${context.targetId}.${saveAs} without an execution artifactHash`,
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
const evidence = assertReusableDeployment(context.root, {
|
|
184
|
+
network: context.targetId,
|
|
185
|
+
scheme: create2Options.scheme,
|
|
186
|
+
instanceId: saveAs,
|
|
187
|
+
address: existing,
|
|
188
|
+
artifactHash: context.releaseArtifactHash,
|
|
189
|
+
});
|
|
190
|
+
context.deploymentRecorder?.prepare(preparedChange);
|
|
191
|
+
context.deploymentRecorder?.apply({
|
|
192
|
+
...preparedChange,
|
|
193
|
+
address: existing,
|
|
194
|
+
proxyAddress: implementationAddress ? existing : undefined,
|
|
195
|
+
implementationAddress,
|
|
196
|
+
reused: true,
|
|
197
|
+
alreadyDeployed: true,
|
|
198
|
+
gateTool: {
|
|
199
|
+
outputPath: "scripts/checkcode/index.json",
|
|
200
|
+
data: { runId: evidence.runId, artifactHash: evidence.artifactHash },
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
setDeploymentState(context, [saveAs], {
|
|
204
|
+
address: existing,
|
|
205
|
+
implementationAddress,
|
|
206
|
+
reused: true,
|
|
207
|
+
alreadyDeployed: true,
|
|
208
|
+
});
|
|
209
|
+
context.reporter.result("execution", {
|
|
210
|
+
stepId: step.id,
|
|
211
|
+
kind: step.kind,
|
|
212
|
+
contract: preparedChange.actualContract,
|
|
213
|
+
saveAs,
|
|
214
|
+
strategy: "reuse",
|
|
215
|
+
address: existing,
|
|
216
|
+
implementationAddress,
|
|
217
|
+
checkCodeRunId: evidence.runId,
|
|
218
|
+
reused: true,
|
|
219
|
+
alreadyDeployed: true,
|
|
220
|
+
});
|
|
221
|
+
return { completed: true, create2Options, existingAddress: existing };
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
completed: false,
|
|
225
|
+
existingAddress: existing,
|
|
226
|
+
redeployReason: action.reason,
|
|
227
|
+
create2Options: {
|
|
228
|
+
...create2Options,
|
|
229
|
+
salt: action.salt,
|
|
230
|
+
expectedAddress: action.expectedAddress,
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const deploymentForRole = (
|
|
236
|
+
plan: GateToolPreparationPlanV1,
|
|
237
|
+
role: GateToolDeploymentPlan["role"],
|
|
238
|
+
): GateToolDeploymentPlan => {
|
|
239
|
+
const deployment = plan.deployments.find((entry) => entry.role === role);
|
|
240
|
+
if (!deployment) throw new Error(`GateTool plan is missing ${role} deployment evidence`);
|
|
241
|
+
return deployment;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const assertDeployedCode = async (
|
|
245
|
+
label: string,
|
|
246
|
+
address: string,
|
|
247
|
+
): Promise<void> => {
|
|
248
|
+
const code = await ethers.provider.getCode(address);
|
|
249
|
+
if (!code || code === "0x") {
|
|
250
|
+
throw new Error(`${label} is missing deployed code at ${address}`);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const gateToolEvidenceDir = (context: WorkflowContext): string => path.join(
|
|
255
|
+
context.taskDir,
|
|
256
|
+
"results",
|
|
257
|
+
context.targetId,
|
|
258
|
+
context.executionId,
|
|
259
|
+
"gate-tool",
|
|
260
|
+
context.mode,
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
const runGateToolControlledMulticall = async (
|
|
264
|
+
context: WorkflowContext,
|
|
265
|
+
step: WorkflowStep,
|
|
266
|
+
create2: Create2Options,
|
|
267
|
+
transactions: GateToolTransactionPlan[],
|
|
268
|
+
): Promise<{ external: boolean; transactionId?: string; txHash?: string }> => {
|
|
269
|
+
if (transactions.length === 0) return { external: false };
|
|
270
|
+
if (!create2.controlledMulticall) {
|
|
271
|
+
throw new Error(`Deploy step ${step.id} requires controlledMulticall`);
|
|
272
|
+
}
|
|
273
|
+
if (!context.signer || !context.signerAddress) {
|
|
274
|
+
throw new Error(`Deploy step ${step.id} requires a signer`);
|
|
275
|
+
}
|
|
276
|
+
const prepared = prepareControlledMulticallTransaction(
|
|
277
|
+
create2.controlledMulticall,
|
|
278
|
+
transactions.map((transaction) => ({
|
|
279
|
+
target: transaction.to,
|
|
280
|
+
value: transaction.value,
|
|
281
|
+
data: transaction.data,
|
|
282
|
+
...(transaction.factoryDeps === undefined
|
|
283
|
+
? {}
|
|
284
|
+
: { factoryDeps: transaction.factoryDeps }),
|
|
285
|
+
})),
|
|
286
|
+
create2.scheme,
|
|
287
|
+
);
|
|
288
|
+
const multicall = await ethers.getContractAt(
|
|
289
|
+
"Multicall3",
|
|
290
|
+
create2.controlledMulticall,
|
|
291
|
+
context.signer,
|
|
292
|
+
);
|
|
293
|
+
const authority = await decideControlledMulticallAuthority(
|
|
294
|
+
multicall as unknown as {
|
|
295
|
+
callers: (caller: string) => Promise<boolean>;
|
|
296
|
+
factoryCallers: (factoryAddress: string, caller: string) => Promise<boolean>;
|
|
297
|
+
owner?: () => Promise<unknown>;
|
|
298
|
+
},
|
|
299
|
+
create2.factory,
|
|
300
|
+
context.target,
|
|
301
|
+
context.signerAddress,
|
|
302
|
+
);
|
|
303
|
+
const executor = authority.mode === "execute" ? context.signerAddress : authority.executor;
|
|
304
|
+
if (!executor) throw new Error(`Deploy step ${step.id} cannot resolve its required executor`);
|
|
305
|
+
if (create2.scheme === "zksync-eravm" && authority.mode !== "execute") {
|
|
306
|
+
throw new Error(
|
|
307
|
+
`Deploy step ${step.id} requires unsupported zkSync external Admin execution`,
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (!context.executionPlanner) {
|
|
312
|
+
if (authority.mode !== "execute") {
|
|
313
|
+
throw new Error(`Deploy step ${step.id} requires a locked mixed-authority execution plan`);
|
|
314
|
+
}
|
|
315
|
+
const transaction = await sendPreparedControlledMulticallTransaction(prepared, context.signer);
|
|
316
|
+
return { external: false, txHash: transaction.hash };
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const planned = context.executionPlanner.add({
|
|
320
|
+
stepId: step.id,
|
|
321
|
+
executor,
|
|
322
|
+
to: prepared.target,
|
|
323
|
+
value: prepared.value,
|
|
324
|
+
data: prepared.data,
|
|
325
|
+
operation: 0,
|
|
326
|
+
...(prepared.scheme === undefined ? {} : { scheme: prepared.scheme }),
|
|
327
|
+
...(prepared.factoryDeps === undefined ? {} : { factoryDeps: prepared.factoryDeps }),
|
|
328
|
+
});
|
|
329
|
+
if (planned.executionAction === "replay") {
|
|
330
|
+
return {
|
|
331
|
+
external: planned.route === "external",
|
|
332
|
+
transactionId: planned.transactionId,
|
|
333
|
+
txHash: planned.transactionHash,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
if (planned.route === "external" && context.mode !== "simulate") {
|
|
337
|
+
context.externalCalls.push({
|
|
338
|
+
transactionId: planned.transactionId,
|
|
339
|
+
stepId: planned.stepId,
|
|
340
|
+
to: planned.to,
|
|
341
|
+
value: planned.value,
|
|
342
|
+
data: planned.data,
|
|
343
|
+
operation: planned.operation,
|
|
344
|
+
method: prepared.method,
|
|
345
|
+
args: prepared.calls,
|
|
346
|
+
executor: planned.executor,
|
|
347
|
+
reason: authority.reason,
|
|
348
|
+
});
|
|
349
|
+
return { external: true, transactionId: planned.transactionId };
|
|
350
|
+
}
|
|
351
|
+
const selectedSigner = planned.route === "external"
|
|
352
|
+
? await impersonateWorkflowSimulationSigner(planned.executor)
|
|
353
|
+
: context.signer;
|
|
354
|
+
const transaction = await sendPreparedControlledMulticallTransaction(prepared, selectedSigner);
|
|
355
|
+
if (context.mode === "execute" && planned.route === "operator") {
|
|
356
|
+
context.operatorReceipts.push({
|
|
357
|
+
transactionId: planned.transactionId,
|
|
358
|
+
transactionHash: transaction.hash,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
return {
|
|
362
|
+
external: false,
|
|
363
|
+
transactionId: planned.transactionId,
|
|
364
|
+
txHash: transaction.hash,
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
const addressPolicy = (options: Create2Options) => (
|
|
369
|
+
options.expectedAddress === undefined && options.leadingZeroBytes === undefined
|
|
370
|
+
? undefined
|
|
371
|
+
: {
|
|
372
|
+
...(options.expectedAddress === undefined
|
|
373
|
+
? {}
|
|
374
|
+
: { expectedAddress: options.expectedAddress }),
|
|
375
|
+
...(options.leadingZeroBytes === undefined
|
|
376
|
+
? {}
|
|
377
|
+
: { leadingZeroBytes: options.leadingZeroBytes }),
|
|
378
|
+
}
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
const gateToolChange = (
|
|
382
|
+
context: WorkflowContext,
|
|
383
|
+
planPath: string,
|
|
384
|
+
plan: GateToolPreparationPlanV1,
|
|
385
|
+
) => ({
|
|
386
|
+
outputPath: path.relative(context.root, planPath).split(path.sep).join("/"),
|
|
387
|
+
data: plan as unknown as Record<string, unknown>,
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
export const runDeployStep = async (
|
|
391
|
+
context: WorkflowContext,
|
|
392
|
+
step: WorkflowStep,
|
|
393
|
+
): Promise<void> => {
|
|
394
|
+
const contractName = String(step.contract);
|
|
395
|
+
const saveAs = typeof step.saveAs === "string" ? step.saveAs.trim() : "";
|
|
396
|
+
if (!saveAs) throw new Error(`Deploy step ${step.id} requires saveAs`);
|
|
397
|
+
const create2Options = assertCreate2Options(step, resolveCreate2Options(context, step));
|
|
398
|
+
const proxy = resolveProxyOptions(context, step);
|
|
399
|
+
const recorder = context.mode === "execute" ? context.deploymentRecorder : undefined;
|
|
400
|
+
if (context.mode === "execute" && !recorder) {
|
|
401
|
+
throw new Error(`Deploy step ${step.id} requires an execution deployment recorder`);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (proxy) {
|
|
405
|
+
const firstUpgrade = resolveFirstUpgradeOptions(context, step);
|
|
406
|
+
if (step.upgradeableStrategy !== "uups-placeholder-proxy" || !firstUpgrade) {
|
|
407
|
+
throw new Error(`Deploy step ${step.id} requires firstUpgrade for uups-placeholder-proxy`);
|
|
408
|
+
}
|
|
409
|
+
if ((proxy.options.kind || "uups") !== "uups") {
|
|
410
|
+
throw new Error(`Deploy step ${step.id} only supports UUPS placeholder proxies`);
|
|
411
|
+
}
|
|
412
|
+
if (proxy.options.initializer !== false) {
|
|
413
|
+
throw new Error(
|
|
414
|
+
`Deploy step ${step.id} must use proxy.initializer: false for uups-placeholder-proxy`,
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
if (!create2Options.controlledMulticall) {
|
|
418
|
+
throw new Error(`Deploy step ${step.id} requires controlledMulticall for atomic firstUpgrade`);
|
|
419
|
+
}
|
|
420
|
+
if (!create2Options.uupsPlaceholderImplementation) {
|
|
421
|
+
throw new Error(`Deploy step ${step.id} requires target.uups.placeholderImplementation`);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const actualContract = actualContractName(firstUpgrade.contractName);
|
|
425
|
+
const registryKey = contractInfoKey(saveAs, firstUpgrade.contractName);
|
|
426
|
+
const preparedChange: DeploymentChange = {
|
|
427
|
+
stepId: step.id,
|
|
428
|
+
kind: "deploy",
|
|
429
|
+
instanceId: saveAs,
|
|
430
|
+
actualContract,
|
|
431
|
+
contractInfoKey: registryKey,
|
|
432
|
+
strategy: "create2",
|
|
433
|
+
proxyKind: "uups",
|
|
434
|
+
factory: create2Options.factory,
|
|
435
|
+
multicall: create2Options.controlledMulticall,
|
|
436
|
+
salt: create2Options.salt,
|
|
437
|
+
expectedAddress: create2Options.expectedAddress,
|
|
438
|
+
leadingZeroBytes: create2Options.leadingZeroBytes,
|
|
439
|
+
placeholderImplementationAddress: create2Options.uupsPlaceholderImplementation,
|
|
440
|
+
};
|
|
441
|
+
const existingResolution = await applyExistingDeploymentPolicy(
|
|
442
|
+
context,
|
|
443
|
+
step,
|
|
444
|
+
saveAs,
|
|
445
|
+
preparedChange,
|
|
446
|
+
create2Options,
|
|
447
|
+
true,
|
|
448
|
+
);
|
|
449
|
+
if (existingResolution.completed) return;
|
|
450
|
+
const effectiveCreate2 = existingResolution.create2Options;
|
|
451
|
+
const pendingReuse = context.parameterLockExecutionId
|
|
452
|
+
? await resolvePendingUupsReuse({
|
|
453
|
+
root: context.root,
|
|
454
|
+
taskDir: context.taskDir,
|
|
455
|
+
taskId: context.taskId,
|
|
456
|
+
currentExecutionId: context.parameterLockExecutionId,
|
|
457
|
+
network: context.targetId,
|
|
458
|
+
stepId: step.id,
|
|
459
|
+
instanceId: saveAs,
|
|
460
|
+
actualContract,
|
|
461
|
+
contractInfoKey: registryKey,
|
|
462
|
+
scheme: effectiveCreate2.scheme,
|
|
463
|
+
factory: effectiveCreate2.factory,
|
|
464
|
+
multicall: effectiveCreate2.controlledMulticall!,
|
|
465
|
+
proxySalt: effectiveCreate2.salt,
|
|
466
|
+
expectedAddress: effectiveCreate2.expectedAddress,
|
|
467
|
+
placeholderImplementationAddress: effectiveCreate2.uupsPlaceholderImplementation!,
|
|
468
|
+
provider: ethers.provider,
|
|
469
|
+
blockTag: context.mode === "simulate"
|
|
470
|
+
? context.simulation.snapshot?.blockNumber
|
|
471
|
+
: undefined,
|
|
472
|
+
})
|
|
473
|
+
: undefined;
|
|
474
|
+
const implementationSalt = pendingReuse?.implementationSalt ?? deriveImplementationSalt(
|
|
475
|
+
context.executionId,
|
|
476
|
+
firstUpgrade.contractName,
|
|
477
|
+
effectiveCreate2.salt,
|
|
478
|
+
);
|
|
479
|
+
const request: GateToolPreparationRequestV1 = {
|
|
480
|
+
version: 1,
|
|
481
|
+
kind: "uups-placeholder-deploy",
|
|
482
|
+
scheme: effectiveCreate2.scheme,
|
|
483
|
+
network: network.name,
|
|
484
|
+
target: context.targetId,
|
|
485
|
+
contract: firstUpgrade.contractName,
|
|
486
|
+
constructorArgs: firstUpgrade.constructorArgs || [],
|
|
487
|
+
factory: effectiveCreate2.factory,
|
|
488
|
+
proxyKind: "uups",
|
|
489
|
+
implementationSalt,
|
|
490
|
+
proxySalt: effectiveCreate2.salt,
|
|
491
|
+
placeholderImplementation: effectiveCreate2.uupsPlaceholderImplementation!,
|
|
492
|
+
...(firstUpgrade.unsafeAllow || proxy.options.unsafeAllow
|
|
493
|
+
? { unsafeAllow: firstUpgrade.unsafeAllow || proxy.options.unsafeAllow }
|
|
494
|
+
: {}),
|
|
495
|
+
...(addressPolicy(effectiveCreate2)
|
|
496
|
+
? { proxyAddressPolicy: addressPolicy(effectiveCreate2) }
|
|
497
|
+
: {}),
|
|
498
|
+
...(firstUpgrade.call
|
|
499
|
+
? { call: { method: firstUpgrade.call.fn, args: firstUpgrade.call.args } }
|
|
500
|
+
: {}),
|
|
501
|
+
};
|
|
502
|
+
const prepared = await prepareGateToolWorkflow({
|
|
503
|
+
root: context.root,
|
|
504
|
+
evidenceDir: gateToolEvidenceDir(context),
|
|
505
|
+
evidenceName: step.id,
|
|
506
|
+
request,
|
|
507
|
+
readBlockTag: context.mode === "simulate"
|
|
508
|
+
? context.simulation.snapshot?.blockNumber
|
|
509
|
+
: undefined,
|
|
510
|
+
});
|
|
511
|
+
const implementation = deploymentForRole(prepared.plan, "implementation");
|
|
512
|
+
const proxyDeployment = deploymentForRole(prepared.plan, "proxy");
|
|
513
|
+
if (pendingReuse && (
|
|
514
|
+
prepared.plan.transactions.length !== 0
|
|
515
|
+
|| prepared.plan.artifact.digest !== pendingReuse.evidence.artifactDigest
|
|
516
|
+
|| implementation.address.toLowerCase() !== pendingReuse.implementationAddress.toLowerCase()
|
|
517
|
+
|| proxyDeployment.address.toLowerCase() !== pendingReuse.proxyAddress.toLowerCase()
|
|
518
|
+
)) {
|
|
519
|
+
throw new Error(
|
|
520
|
+
`Deploy step ${step.id} current GateTool plan does not match trusted pending reuse evidence`,
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
assertCreate2AddressPolicy(
|
|
524
|
+
`${firstUpgrade.contractName} proxy`,
|
|
525
|
+
proxyDeployment.address,
|
|
526
|
+
effectiveCreate2,
|
|
527
|
+
);
|
|
528
|
+
if (
|
|
529
|
+
existingResolution.existingAddress
|
|
530
|
+
&& proxyDeployment.address.toLowerCase() === existingResolution.existingAddress.toLowerCase()
|
|
531
|
+
) {
|
|
532
|
+
throw new Error(`Deploy step ${step.id} redeploy predicted the existing address`);
|
|
533
|
+
}
|
|
534
|
+
const gateTool = gateToolChange(context, prepared.planPath, prepared.plan);
|
|
535
|
+
const plannedChange: DeploymentChange = {
|
|
536
|
+
...preparedChange,
|
|
537
|
+
salt: effectiveCreate2.salt,
|
|
538
|
+
previousAddress: existingResolution.existingAddress,
|
|
539
|
+
redeployReason: existingResolution.redeployReason,
|
|
540
|
+
implementationAddress: implementation.address,
|
|
541
|
+
implementationSalt,
|
|
542
|
+
constructorArgs: firstUpgrade.constructorArgs || [],
|
|
543
|
+
predictedAddress: proxyDeployment.address,
|
|
544
|
+
gateTool,
|
|
545
|
+
...(pendingReuse ? { pendingReuse: pendingReuse.evidence } : {}),
|
|
546
|
+
};
|
|
547
|
+
if (context.parameterLockExecutionId) {
|
|
548
|
+
recordParameterLockImplementationSalts(
|
|
549
|
+
context.taskDir,
|
|
550
|
+
context.parameterLockExecutionId,
|
|
551
|
+
{ [`${step.id}.implementation`]: implementationSalt },
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
recorder?.prepare(plannedChange);
|
|
555
|
+
if (context.mode === "execute") {
|
|
556
|
+
recorder?.stageAddressCandidate(plannedChange, proxyDeployment.address);
|
|
557
|
+
}
|
|
558
|
+
const execution = await runGateToolControlledMulticall(
|
|
559
|
+
context,
|
|
560
|
+
step,
|
|
561
|
+
effectiveCreate2,
|
|
562
|
+
prepared.plan.transactions,
|
|
563
|
+
);
|
|
564
|
+
if (context.mode === "execute" && execution.transactionId) {
|
|
565
|
+
recorder?.bindProxyTransaction(step.id, execution.transactionId);
|
|
566
|
+
}
|
|
567
|
+
if (!execution.external) {
|
|
568
|
+
await assertDeployedCode(
|
|
569
|
+
`${firstUpgrade.contractName} implementation`,
|
|
570
|
+
implementation.address,
|
|
571
|
+
);
|
|
572
|
+
await assertDeployedCode("ERC1967Proxy", proxyDeployment.address);
|
|
573
|
+
const currentImplementation = await getERC1967Implementation(
|
|
574
|
+
ethers.provider,
|
|
575
|
+
proxyDeployment.address,
|
|
576
|
+
);
|
|
577
|
+
if (
|
|
578
|
+
!currentImplementation
|
|
579
|
+
|| currentImplementation.toLowerCase() !== implementation.address.toLowerCase()
|
|
580
|
+
) {
|
|
581
|
+
throw new Error(
|
|
582
|
+
`ERC1967Proxy ${proxyDeployment.address} does not point to GateTool implementation ${implementation.address}`,
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
const gateToolSync = context.mode === "execute"
|
|
587
|
+
&& !execution.external
|
|
588
|
+
&& proxyDeployment.status !== "reused"
|
|
589
|
+
? await syncGateToolUups({
|
|
590
|
+
root: context.root,
|
|
591
|
+
evidenceDir: gateToolEvidenceDir(context),
|
|
592
|
+
evidenceName: step.id,
|
|
593
|
+
scheme: prepared.plan.scheme,
|
|
594
|
+
network: network.name,
|
|
595
|
+
target: context.targetId,
|
|
596
|
+
manifestDir: context.target.openzeppelin.manifestDir,
|
|
597
|
+
proxy: proxyDeployment.address,
|
|
598
|
+
implementation: implementation.address,
|
|
599
|
+
contract: actualContract,
|
|
600
|
+
constructorArgs: firstUpgrade.constructorArgs || [],
|
|
601
|
+
transactionHash: execution.txHash || "",
|
|
602
|
+
})
|
|
603
|
+
: undefined;
|
|
604
|
+
if (context.mode === "execute" && !execution.external) {
|
|
605
|
+
recorder?.applyAddress({
|
|
606
|
+
...plannedChange,
|
|
607
|
+
address: proxyDeployment.address,
|
|
608
|
+
proxyAddress: proxyDeployment.address,
|
|
609
|
+
txHash: execution.txHash,
|
|
610
|
+
gateToolSync,
|
|
611
|
+
reused: proxyDeployment.status === "reused",
|
|
612
|
+
alreadyDeployed: proxyDeployment.status === "reused",
|
|
613
|
+
}, proxyDeployment.address);
|
|
614
|
+
}
|
|
615
|
+
setDeploymentState(context, [saveAs], {
|
|
616
|
+
address: proxyDeployment.address,
|
|
617
|
+
proxyAddress: proxyDeployment.address,
|
|
618
|
+
implementationAddress: implementation.address,
|
|
619
|
+
implementationSalt,
|
|
620
|
+
placeholderImplementationAddress: effectiveCreate2.uupsPlaceholderImplementation,
|
|
621
|
+
txHash: execution.txHash,
|
|
622
|
+
external: execution.external,
|
|
623
|
+
});
|
|
624
|
+
context.reporter.result("execution", {
|
|
625
|
+
stepId: step.id,
|
|
626
|
+
kind: step.kind,
|
|
627
|
+
mode: execution.external ? "external" : context.mode,
|
|
628
|
+
transactionId: execution.transactionId,
|
|
629
|
+
contract: contractName,
|
|
630
|
+
actualContract,
|
|
631
|
+
saveAs,
|
|
632
|
+
contractInfoKey: registryKey,
|
|
633
|
+
strategy: "create2",
|
|
634
|
+
scheme: prepared.plan.scheme,
|
|
635
|
+
proxy: "uups",
|
|
636
|
+
address: proxyDeployment.address,
|
|
637
|
+
implementationAddress: implementation.address,
|
|
638
|
+
firstUpgradeImplementationAddress: implementation.address,
|
|
639
|
+
placeholderImplementationAddress: effectiveCreate2.uupsPlaceholderImplementation,
|
|
640
|
+
predictedAddress: proxyDeployment.address,
|
|
641
|
+
reused: proxyDeployment.status === "reused",
|
|
642
|
+
alreadyDeployed: proxyDeployment.status === "reused",
|
|
643
|
+
txHash: execution.txHash,
|
|
644
|
+
gateToolPlan: gateTool.outputPath,
|
|
645
|
+
gateToolSync: gateToolSync?.outputPath,
|
|
646
|
+
pendingReuse: pendingReuse?.evidence,
|
|
647
|
+
});
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
const args = resolveArray(context, step.args || [], `Step ${step.id} args`);
|
|
652
|
+
const actualContract = actualContractName(contractName);
|
|
653
|
+
const registryKey = contractInfoKey(saveAs, contractName);
|
|
654
|
+
let preparedChange: DeploymentChange = {
|
|
655
|
+
stepId: step.id,
|
|
656
|
+
kind: "deploy",
|
|
657
|
+
instanceId: saveAs,
|
|
658
|
+
actualContract,
|
|
659
|
+
contractInfoKey: registryKey,
|
|
660
|
+
strategy: "create2",
|
|
661
|
+
factory: create2Options.factory,
|
|
662
|
+
multicall: create2Options.controlledMulticall,
|
|
663
|
+
salt: create2Options.salt,
|
|
664
|
+
expectedAddress: create2Options.expectedAddress,
|
|
665
|
+
leadingZeroBytes: create2Options.leadingZeroBytes,
|
|
666
|
+
};
|
|
667
|
+
const existingResolution = await applyExistingDeploymentPolicy(
|
|
668
|
+
context,
|
|
669
|
+
step,
|
|
670
|
+
saveAs,
|
|
671
|
+
preparedChange,
|
|
672
|
+
create2Options,
|
|
673
|
+
false,
|
|
674
|
+
);
|
|
675
|
+
if (existingResolution.completed) return;
|
|
676
|
+
const effectiveCreate2 = existingResolution.create2Options;
|
|
677
|
+
const request: GateToolPreparationRequestV1 = {
|
|
678
|
+
version: 1,
|
|
679
|
+
kind: "create2-deploy",
|
|
680
|
+
scheme: effectiveCreate2.scheme,
|
|
681
|
+
network: network.name,
|
|
682
|
+
target: context.targetId,
|
|
683
|
+
contract: contractName,
|
|
684
|
+
constructorArgs: args,
|
|
685
|
+
factory: effectiveCreate2.factory,
|
|
686
|
+
salt: effectiveCreate2.salt,
|
|
687
|
+
...(effectiveCreate2.create2ForwardValue === undefined
|
|
688
|
+
? {}
|
|
689
|
+
: { create2ForwardValue: effectiveCreate2.create2ForwardValue }),
|
|
690
|
+
...(effectiveCreate2.callForwardValue === undefined
|
|
691
|
+
? {}
|
|
692
|
+
: { callForwardValue: effectiveCreate2.callForwardValue }),
|
|
693
|
+
...(addressPolicy(effectiveCreate2)
|
|
694
|
+
? { addressPolicy: addressPolicy(effectiveCreate2) }
|
|
695
|
+
: {}),
|
|
696
|
+
};
|
|
697
|
+
const prepared = await prepareGateToolWorkflow({
|
|
698
|
+
root: context.root,
|
|
699
|
+
evidenceDir: gateToolEvidenceDir(context),
|
|
700
|
+
evidenceName: step.id,
|
|
701
|
+
request,
|
|
702
|
+
readBlockTag: context.mode === "simulate"
|
|
703
|
+
? context.simulation.snapshot?.blockNumber
|
|
704
|
+
: undefined,
|
|
705
|
+
});
|
|
706
|
+
const deployment = deploymentForRole(prepared.plan, "contract");
|
|
707
|
+
assertCreate2AddressPolicy(contractName, deployment.address, effectiveCreate2);
|
|
708
|
+
if (
|
|
709
|
+
existingResolution.existingAddress
|
|
710
|
+
&& deployment.address.toLowerCase() === existingResolution.existingAddress.toLowerCase()
|
|
711
|
+
) {
|
|
712
|
+
throw new Error(`Deploy step ${step.id} redeploy predicted the existing address`);
|
|
713
|
+
}
|
|
714
|
+
const gateTool = gateToolChange(context, prepared.planPath, prepared.plan);
|
|
715
|
+
preparedChange = {
|
|
716
|
+
...preparedChange,
|
|
717
|
+
salt: effectiveCreate2.salt,
|
|
718
|
+
expectedAddress: effectiveCreate2.expectedAddress,
|
|
719
|
+
previousAddress: existingResolution.existingAddress,
|
|
720
|
+
redeployReason: existingResolution.redeployReason,
|
|
721
|
+
predictedAddress: deployment.address,
|
|
722
|
+
gateTool,
|
|
723
|
+
};
|
|
724
|
+
recorder?.prepare(preparedChange);
|
|
725
|
+
if (context.mode === "execute") {
|
|
726
|
+
recorder?.stageAddressCandidate(preparedChange, deployment.address);
|
|
727
|
+
}
|
|
728
|
+
const execution = await runGateToolControlledMulticall(
|
|
729
|
+
context,
|
|
730
|
+
step,
|
|
731
|
+
effectiveCreate2,
|
|
732
|
+
prepared.plan.transactions,
|
|
733
|
+
);
|
|
734
|
+
if (!execution.external) {
|
|
735
|
+
await assertDeployedCode(contractName, deployment.address);
|
|
736
|
+
}
|
|
737
|
+
if (context.mode === "execute" && !execution.external) {
|
|
738
|
+
recorder?.applyAddress({
|
|
739
|
+
...preparedChange,
|
|
740
|
+
address: deployment.address,
|
|
741
|
+
txHash: execution.txHash,
|
|
742
|
+
reused: deployment.status === "reused",
|
|
743
|
+
alreadyDeployed: deployment.status === "reused",
|
|
744
|
+
}, deployment.address);
|
|
745
|
+
}
|
|
746
|
+
context.state.set(saveAs, {
|
|
747
|
+
address: deployment.address,
|
|
748
|
+
predictedAddress: deployment.address,
|
|
749
|
+
txHash: execution.txHash,
|
|
750
|
+
external: execution.external,
|
|
751
|
+
alreadyDeployed: deployment.status === "reused",
|
|
752
|
+
});
|
|
753
|
+
context.reporter.result("execution", {
|
|
754
|
+
stepId: step.id,
|
|
755
|
+
kind: step.kind,
|
|
756
|
+
mode: execution.external ? "external" : context.mode,
|
|
757
|
+
transactionId: execution.transactionId,
|
|
758
|
+
contract: contractName,
|
|
759
|
+
actualContract,
|
|
760
|
+
saveAs,
|
|
761
|
+
contractInfoKey: registryKey,
|
|
762
|
+
strategy: "create2",
|
|
763
|
+
scheme: prepared.plan.scheme,
|
|
764
|
+
address: deployment.address,
|
|
765
|
+
predictedAddress: deployment.address,
|
|
766
|
+
reused: deployment.status === "reused",
|
|
767
|
+
alreadyDeployed: deployment.status === "reused",
|
|
768
|
+
txHash: execution.txHash,
|
|
769
|
+
gateToolPlan: gateTool.outputPath,
|
|
770
|
+
});
|
|
771
|
+
};
|