gate-evm-tools 1.0.26 → 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 +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 +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 +25 -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,598 @@
|
|
|
1
|
+
import { isAddress } from "ethers";
|
|
2
|
+
import { ethers, network } from "../../projectHardhat";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import type {
|
|
5
|
+
GateToolDeploymentPlan,
|
|
6
|
+
GateToolPreparationRequestV1,
|
|
7
|
+
GateToolTransactionPlan,
|
|
8
|
+
} from "gate-evm-tools/workflow";
|
|
9
|
+
import {
|
|
10
|
+
assertSelectedSimulationSignerAuthorized,
|
|
11
|
+
decideAuthority,
|
|
12
|
+
decideControlledMulticallAuthority,
|
|
13
|
+
} from "../lib/authority";
|
|
14
|
+
import {
|
|
15
|
+
actualContractName,
|
|
16
|
+
contractInfoKey,
|
|
17
|
+
deploymentInstanceId,
|
|
18
|
+
loadContractInfo,
|
|
19
|
+
resolveDeployment,
|
|
20
|
+
} from "../lib/deployments";
|
|
21
|
+
import type { DeploymentChange } from "../lib/deploymentRecords";
|
|
22
|
+
import { prepareGateToolWorkflow } from "../lib/gateTool";
|
|
23
|
+
import { syncGateToolUups } from "../lib/gateToolSync";
|
|
24
|
+
import { getERC1967Implementation } from "../lib/erc1967";
|
|
25
|
+
import { recordParameterLockImplementationSalts } from "../lib/lock";
|
|
26
|
+
import { resolveValue, WorkflowStep } from "../lib/parameters";
|
|
27
|
+
import {
|
|
28
|
+
prepareControlledMulticallTransaction,
|
|
29
|
+
sendPreparedControlledMulticallTransaction,
|
|
30
|
+
sendPreparedWorkflowTransaction,
|
|
31
|
+
} from "../lib/create2";
|
|
32
|
+
import { deriveImplementationSalt, ProxyOptions } from "../lib/proxy";
|
|
33
|
+
import type { WorkflowContext } from "../run";
|
|
34
|
+
import { impersonateWorkflowSimulationSigner } from "../lib/signer";
|
|
35
|
+
import { assertSimulationUupsSourceState } from "../lib/simulation";
|
|
36
|
+
|
|
37
|
+
const resolveInContext = (
|
|
38
|
+
context: WorkflowContext,
|
|
39
|
+
value: unknown,
|
|
40
|
+
): unknown => resolveValue(value, {
|
|
41
|
+
targetId: context.targetId,
|
|
42
|
+
target: context.target,
|
|
43
|
+
params: context.targetParams,
|
|
44
|
+
state: context.state,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const resolveObject = (
|
|
48
|
+
context: WorkflowContext,
|
|
49
|
+
value: unknown,
|
|
50
|
+
): Record<string, unknown> => {
|
|
51
|
+
const resolved = resolveInContext(context, value || {});
|
|
52
|
+
if (!resolved || typeof resolved !== "object" || Array.isArray(resolved)) return {};
|
|
53
|
+
return resolved as Record<string, unknown>;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const resolveArray = (
|
|
57
|
+
context: WorkflowContext,
|
|
58
|
+
value: unknown,
|
|
59
|
+
label: string,
|
|
60
|
+
): unknown[] => {
|
|
61
|
+
const resolved = resolveInContext(context, value || []);
|
|
62
|
+
if (!Array.isArray(resolved)) throw new Error(`${label} must resolve to an array`);
|
|
63
|
+
return resolved;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const stringField = (
|
|
67
|
+
source: Record<string, unknown>,
|
|
68
|
+
key: string,
|
|
69
|
+
): string | undefined => (
|
|
70
|
+
typeof source[key] === "string" && source[key] ? String(source[key]) : undefined
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const proxyReference = (
|
|
74
|
+
context: WorkflowContext,
|
|
75
|
+
step: WorkflowStep,
|
|
76
|
+
): {
|
|
77
|
+
proxyAddress: string;
|
|
78
|
+
saveAs: string;
|
|
79
|
+
contractInfoKey: string;
|
|
80
|
+
proxy: ProxyOptions;
|
|
81
|
+
} => {
|
|
82
|
+
const proxyObject = resolveObject(context, step.proxy);
|
|
83
|
+
const rawProxy = stringField(proxyObject, "address")
|
|
84
|
+
|| stringField(proxyObject, "name")
|
|
85
|
+
|| stringField(proxyObject, "contract")
|
|
86
|
+
|| (typeof step.proxy === "string" ? String(resolveInContext(context, step.proxy)) : undefined)
|
|
87
|
+
|| (typeof step.address === "string" ? String(resolveInContext(context, step.address)) : undefined);
|
|
88
|
+
if (!rawProxy) throw new Error(`Step ${step.id} requires proxy address or deployment name`);
|
|
89
|
+
|
|
90
|
+
const registryDeployment = isAddress(rawProxy)
|
|
91
|
+
? undefined
|
|
92
|
+
: resolveDeployment(loadContractInfo(context.root, context.config), context.targetId, rawProxy);
|
|
93
|
+
if (!isAddress(rawProxy) && !registryDeployment) {
|
|
94
|
+
throw new Error(`Missing contractInfo address: ${context.targetId}.${rawProxy}`);
|
|
95
|
+
}
|
|
96
|
+
const proxyAddress = isAddress(rawProxy) ? rawProxy : registryDeployment!.address;
|
|
97
|
+
const defaultSaveAs = isAddress(rawProxy)
|
|
98
|
+
? actualContractName(String(step.contract))
|
|
99
|
+
: registryDeployment!.key.split(":", 1)[0];
|
|
100
|
+
const saveAs = deploymentInstanceId(String(step.saveAs || defaultSaveAs));
|
|
101
|
+
const registryKey = registryDeployment?.key || contractInfoKey(saveAs, String(step.contract));
|
|
102
|
+
return {
|
|
103
|
+
proxyAddress,
|
|
104
|
+
saveAs,
|
|
105
|
+
contractInfoKey: registryKey,
|
|
106
|
+
proxy: {
|
|
107
|
+
kind: stringField(proxyObject, "kind")
|
|
108
|
+
|| (typeof step.proxyKind === "string" ? step.proxyKind : "uups"),
|
|
109
|
+
initializer: proxyObject.initializer === false
|
|
110
|
+
? false
|
|
111
|
+
: stringField(proxyObject, "initializer"),
|
|
112
|
+
unsafeAllow: Array.isArray(proxyObject.unsafeAllow)
|
|
113
|
+
? proxyObject.unsafeAllow.map((item) => String(item))
|
|
114
|
+
: undefined,
|
|
115
|
+
constructorArgs: proxyObject.constructorArgs === undefined
|
|
116
|
+
? undefined
|
|
117
|
+
: resolveArray(context, proxyObject.constructorArgs, `Step ${step.id} proxy.constructorArgs`),
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const upgradeCall = (
|
|
123
|
+
context: WorkflowContext,
|
|
124
|
+
step: WorkflowStep,
|
|
125
|
+
): { fn: string; args: unknown[] } | undefined => {
|
|
126
|
+
const call = resolveObject(context, step.call);
|
|
127
|
+
const fn = stringField(call, "fn") || stringField(call, "method");
|
|
128
|
+
return fn
|
|
129
|
+
? { fn, args: resolveArray(context, call.args || [], `Step ${step.id} call.args`) }
|
|
130
|
+
: undefined;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const requiredPlanTransaction = (
|
|
134
|
+
transactions: GateToolTransactionPlan[],
|
|
135
|
+
purpose: GateToolTransactionPlan["purpose"],
|
|
136
|
+
): GateToolTransactionPlan => {
|
|
137
|
+
const selected = transactions.filter((transaction) => transaction.purpose === purpose);
|
|
138
|
+
if (selected.length !== 1) {
|
|
139
|
+
throw new Error(`GateTool plan must contain exactly one ${purpose} transaction`);
|
|
140
|
+
}
|
|
141
|
+
return selected[0];
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const implementationDeployment = (
|
|
145
|
+
deployments: GateToolDeploymentPlan[],
|
|
146
|
+
): GateToolDeploymentPlan => {
|
|
147
|
+
const selected = deployments.filter((deployment) => deployment.role === "implementation");
|
|
148
|
+
if (selected.length !== 1) {
|
|
149
|
+
throw new Error("GateTool plan must contain exactly one implementation deployment");
|
|
150
|
+
}
|
|
151
|
+
return selected[0];
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const transactionEnvelope = (transaction: GateToolTransactionPlan) => ({
|
|
155
|
+
target: transaction.to,
|
|
156
|
+
value: transaction.value,
|
|
157
|
+
data: transaction.data,
|
|
158
|
+
operation: transaction.operation,
|
|
159
|
+
...(transaction.factoryDeps === undefined
|
|
160
|
+
? {}
|
|
161
|
+
: { scheme: "zksync-eravm" as const, factoryDeps: transaction.factoryDeps }),
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const assertUupsChainState = async (
|
|
165
|
+
proxy: string,
|
|
166
|
+
implementation: string,
|
|
167
|
+
): Promise<void> => {
|
|
168
|
+
const [proxyCode, implementationCode, currentImplementation] = await Promise.all([
|
|
169
|
+
ethers.provider.getCode(proxy),
|
|
170
|
+
ethers.provider.getCode(implementation),
|
|
171
|
+
getERC1967Implementation(ethers.provider, proxy),
|
|
172
|
+
]);
|
|
173
|
+
if (!proxyCode || proxyCode === "0x") {
|
|
174
|
+
throw new Error(`UUPS proxy is missing deployed code at ${proxy}`);
|
|
175
|
+
}
|
|
176
|
+
if (!implementationCode || implementationCode === "0x") {
|
|
177
|
+
throw new Error(`UUPS implementation is missing deployed code at ${implementation}`);
|
|
178
|
+
}
|
|
179
|
+
if (
|
|
180
|
+
!currentImplementation
|
|
181
|
+
|| currentImplementation.toLowerCase() !== implementation.toLowerCase()
|
|
182
|
+
) {
|
|
183
|
+
throw new Error(
|
|
184
|
+
`UUPS proxy ${proxy} does not point to GateTool implementation ${implementation}`,
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const runUpgradeStep = async (
|
|
190
|
+
context: WorkflowContext,
|
|
191
|
+
step: WorkflowStep,
|
|
192
|
+
): Promise<void> => {
|
|
193
|
+
if (!context.signer || !context.signerAddress) {
|
|
194
|
+
throw new Error(`Upgrade step ${step.id} requires a signer`);
|
|
195
|
+
}
|
|
196
|
+
const contractName = String(step.contract);
|
|
197
|
+
const proxy = proxyReference(context, step);
|
|
198
|
+
if ((proxy.proxy.kind || "uups") !== "uups") {
|
|
199
|
+
throw new Error(`Upgrade step ${step.id} only supports UUPS proxies`);
|
|
200
|
+
}
|
|
201
|
+
if (context.mode === "simulate") {
|
|
202
|
+
await assertSimulationUupsSourceState(context.simulation, proxy.proxyAddress);
|
|
203
|
+
}
|
|
204
|
+
const call = upgradeCall(context, step);
|
|
205
|
+
const actualContract = actualContractName(contractName);
|
|
206
|
+
const targetCreate2 = context.target.create2;
|
|
207
|
+
const targetMulticall = context.target.multicall;
|
|
208
|
+
const scheme = targetCreate2?.scheme || "evm";
|
|
209
|
+
if (scheme !== "evm" && scheme !== "zksync-eravm") {
|
|
210
|
+
throw new Error(`Upgrade step ${step.id} target create2 scheme is invalid`);
|
|
211
|
+
}
|
|
212
|
+
if (!targetCreate2?.factory || !targetMulticall?.controlledMulticall) {
|
|
213
|
+
throw new Error(
|
|
214
|
+
`Upgrade step ${step.id} requires target create2 factory and controlledMulticall`,
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
const constructorArgs = resolveArray(
|
|
218
|
+
context,
|
|
219
|
+
step.constructorArgs || proxy.proxy.constructorArgs || [],
|
|
220
|
+
`Step ${step.id} constructorArgs`,
|
|
221
|
+
);
|
|
222
|
+
const implementationSalt = deriveImplementationSalt(
|
|
223
|
+
context.executionId,
|
|
224
|
+
contractName,
|
|
225
|
+
proxy.proxyAddress,
|
|
226
|
+
);
|
|
227
|
+
const request: GateToolPreparationRequestV1 = {
|
|
228
|
+
version: 1,
|
|
229
|
+
kind: "uups-upgrade",
|
|
230
|
+
scheme,
|
|
231
|
+
network: network.name,
|
|
232
|
+
target: context.targetId,
|
|
233
|
+
contract: contractName,
|
|
234
|
+
constructorArgs,
|
|
235
|
+
factory: targetCreate2.factory,
|
|
236
|
+
proxyKind: "uups",
|
|
237
|
+
proxy: proxy.proxyAddress,
|
|
238
|
+
implementationSalt,
|
|
239
|
+
...(proxy.proxy.unsafeAllow ? { unsafeAllow: proxy.proxy.unsafeAllow } : {}),
|
|
240
|
+
...(call ? { call: { method: call.fn, args: call.args } } : {}),
|
|
241
|
+
};
|
|
242
|
+
const gateToolEvidenceDir = path.join(
|
|
243
|
+
context.taskDir,
|
|
244
|
+
"results",
|
|
245
|
+
context.targetId,
|
|
246
|
+
context.executionId,
|
|
247
|
+
"gate-tool",
|
|
248
|
+
context.mode,
|
|
249
|
+
);
|
|
250
|
+
const prepared = await prepareGateToolWorkflow({
|
|
251
|
+
root: context.root,
|
|
252
|
+
evidenceDir: gateToolEvidenceDir,
|
|
253
|
+
evidenceName: step.id,
|
|
254
|
+
request,
|
|
255
|
+
readBlockTag: context.mode === "simulate"
|
|
256
|
+
? context.simulation.snapshot?.blockNumber
|
|
257
|
+
: undefined,
|
|
258
|
+
});
|
|
259
|
+
const implementation = implementationDeployment(prepared.plan.deployments);
|
|
260
|
+
const implementationCall = prepared.plan.transactions.find(
|
|
261
|
+
(transaction) => transaction.purpose === "deploy-implementation",
|
|
262
|
+
);
|
|
263
|
+
const proxyUpgradeCall = requiredPlanTransaction(prepared.plan.transactions, "upgrade-proxy");
|
|
264
|
+
const gateToolPlan = path.relative(context.root, prepared.planPath).split(path.sep).join("/");
|
|
265
|
+
const preparedChange: DeploymentChange = {
|
|
266
|
+
stepId: step.id,
|
|
267
|
+
kind: "upgrade",
|
|
268
|
+
instanceId: proxy.saveAs,
|
|
269
|
+
actualContract,
|
|
270
|
+
contractInfoKey: proxy.contractInfoKey,
|
|
271
|
+
strategy: "gate-tool",
|
|
272
|
+
proxyKind: "uups",
|
|
273
|
+
proxyAddress: proxy.proxyAddress,
|
|
274
|
+
implementationAddress: implementation.address,
|
|
275
|
+
implementationSalt,
|
|
276
|
+
constructorArgs,
|
|
277
|
+
factory: targetCreate2.factory,
|
|
278
|
+
gateTool: {
|
|
279
|
+
outputPath: gateToolPlan,
|
|
280
|
+
data: prepared.plan as unknown as Record<string, unknown>,
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
if (context.parameterLockExecutionId) {
|
|
284
|
+
recordParameterLockImplementationSalts(
|
|
285
|
+
context.taskDir,
|
|
286
|
+
context.parameterLockExecutionId,
|
|
287
|
+
{ [`${step.id}.implementation`]: implementationSalt },
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
const recorder = context.mode === "execute" ? context.deploymentRecorder : undefined;
|
|
291
|
+
if (context.mode === "execute" && !recorder) {
|
|
292
|
+
throw new Error(`Upgrade step ${step.id} requires an execution deployment recorder`);
|
|
293
|
+
}
|
|
294
|
+
recorder?.prepare(preparedChange);
|
|
295
|
+
|
|
296
|
+
const proxyContract = await ethers.getContractAt(
|
|
297
|
+
String(step.abi || contractName),
|
|
298
|
+
proxy.proxyAddress,
|
|
299
|
+
context.signer,
|
|
300
|
+
);
|
|
301
|
+
const upgradeAuthority = await decideAuthority(
|
|
302
|
+
proxyContract,
|
|
303
|
+
context.target,
|
|
304
|
+
context.signerAddress,
|
|
305
|
+
);
|
|
306
|
+
if (
|
|
307
|
+
context.mode === "simulate"
|
|
308
|
+
&& !context.configuredSimulationCaller
|
|
309
|
+
&& !context.executionPlanner
|
|
310
|
+
) {
|
|
311
|
+
assertSelectedSimulationSignerAuthorized(upgradeAuthority, step.id);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const implementationMulticall = implementationCall
|
|
315
|
+
? prepareControlledMulticallTransaction(
|
|
316
|
+
targetMulticall.controlledMulticall,
|
|
317
|
+
[{
|
|
318
|
+
target: implementationCall.to,
|
|
319
|
+
value: implementationCall.value,
|
|
320
|
+
data: implementationCall.data,
|
|
321
|
+
...(implementationCall.factoryDeps === undefined
|
|
322
|
+
? {}
|
|
323
|
+
: { factoryDeps: implementationCall.factoryDeps }),
|
|
324
|
+
}],
|
|
325
|
+
scheme,
|
|
326
|
+
)
|
|
327
|
+
: undefined;
|
|
328
|
+
const multicall = implementationMulticall
|
|
329
|
+
? await ethers.getContractAt(
|
|
330
|
+
"Multicall3",
|
|
331
|
+
targetMulticall.controlledMulticall,
|
|
332
|
+
context.signer,
|
|
333
|
+
)
|
|
334
|
+
: undefined;
|
|
335
|
+
const implementationAuthority = multicall
|
|
336
|
+
? await decideControlledMulticallAuthority(
|
|
337
|
+
multicall as unknown as {
|
|
338
|
+
callers: (caller: string) => Promise<boolean>;
|
|
339
|
+
factoryCallers: (factoryAddress: string, caller: string) => Promise<boolean>;
|
|
340
|
+
owner?: () => Promise<unknown>;
|
|
341
|
+
},
|
|
342
|
+
targetCreate2.factory,
|
|
343
|
+
context.target,
|
|
344
|
+
context.signerAddress,
|
|
345
|
+
)
|
|
346
|
+
: undefined;
|
|
347
|
+
if (
|
|
348
|
+
scheme === "zksync-eravm"
|
|
349
|
+
&& (
|
|
350
|
+
upgradeAuthority.mode !== "execute"
|
|
351
|
+
|| implementationAuthority?.mode === "calldata"
|
|
352
|
+
)
|
|
353
|
+
) {
|
|
354
|
+
throw new Error(
|
|
355
|
+
`Upgrade step ${step.id} requires unsupported zkSync external Admin execution`,
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (!context.executionPlanner) {
|
|
360
|
+
const configuredCallerSimulation = context.mode === "simulate"
|
|
361
|
+
&& context.configuredSimulationCaller === true;
|
|
362
|
+
if (
|
|
363
|
+
!configuredCallerSimulation
|
|
364
|
+
&& (
|
|
365
|
+
upgradeAuthority.mode !== "execute"
|
|
366
|
+
|| implementationAuthority?.mode === "calldata"
|
|
367
|
+
)
|
|
368
|
+
) {
|
|
369
|
+
throw new Error(`Upgrade step ${step.id} requires a locked mixed-authority execution plan`);
|
|
370
|
+
}
|
|
371
|
+
let implementationTxHash: string | undefined;
|
|
372
|
+
if (implementationMulticall) {
|
|
373
|
+
const tx = await sendPreparedControlledMulticallTransaction(
|
|
374
|
+
implementationMulticall,
|
|
375
|
+
context.signer,
|
|
376
|
+
);
|
|
377
|
+
implementationTxHash = tx.hash;
|
|
378
|
+
}
|
|
379
|
+
const upgradeTx = await sendPreparedWorkflowTransaction(
|
|
380
|
+
transactionEnvelope(proxyUpgradeCall),
|
|
381
|
+
context.signer,
|
|
382
|
+
);
|
|
383
|
+
await assertUupsChainState(proxy.proxyAddress, implementation.address);
|
|
384
|
+
const gateToolSync = context.mode === "execute"
|
|
385
|
+
? await syncGateToolUups({
|
|
386
|
+
root: context.root,
|
|
387
|
+
evidenceDir: gateToolEvidenceDir,
|
|
388
|
+
evidenceName: step.id,
|
|
389
|
+
scheme: prepared.plan.scheme,
|
|
390
|
+
network: network.name,
|
|
391
|
+
target: context.targetId,
|
|
392
|
+
manifestDir: context.target.openzeppelin.manifestDir,
|
|
393
|
+
proxy: proxy.proxyAddress,
|
|
394
|
+
implementation: implementation.address,
|
|
395
|
+
contract: actualContract,
|
|
396
|
+
constructorArgs,
|
|
397
|
+
transactionHash: upgradeTx.hash,
|
|
398
|
+
})
|
|
399
|
+
: undefined;
|
|
400
|
+
if (context.mode === "execute") {
|
|
401
|
+
recorder?.apply({
|
|
402
|
+
...preparedChange,
|
|
403
|
+
implementationTxHash,
|
|
404
|
+
txHash: upgradeTx.hash,
|
|
405
|
+
gateToolSync,
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
context.state.set(`${proxy.saveAs}Upgrade`, {
|
|
409
|
+
proxyAddress: proxy.proxyAddress,
|
|
410
|
+
implementationAddress: implementation.address,
|
|
411
|
+
implementationSalt,
|
|
412
|
+
implementationTxHash,
|
|
413
|
+
txHash: upgradeTx.hash,
|
|
414
|
+
gateToolPlan,
|
|
415
|
+
gateToolSync: gateToolSync?.outputPath,
|
|
416
|
+
});
|
|
417
|
+
context.reporter.result("execution", {
|
|
418
|
+
stepId: step.id,
|
|
419
|
+
kind: step.kind,
|
|
420
|
+
mode: "execute",
|
|
421
|
+
scheme,
|
|
422
|
+
contract: contractName,
|
|
423
|
+
actualContract,
|
|
424
|
+
saveAs: proxy.saveAs,
|
|
425
|
+
contractInfoKey: proxy.contractInfoKey,
|
|
426
|
+
proxy: proxy.proxyAddress,
|
|
427
|
+
implementationAddress: implementation.address,
|
|
428
|
+
implementationTxHash,
|
|
429
|
+
txHash: upgradeTx.hash,
|
|
430
|
+
gateToolPlan,
|
|
431
|
+
});
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
let implementationTransactionId: string | undefined;
|
|
436
|
+
let implementationTxHash: string | undefined;
|
|
437
|
+
let implementationExternal = false;
|
|
438
|
+
if (implementationMulticall && implementationAuthority) {
|
|
439
|
+
const implementationExecutor = implementationAuthority.mode === "execute"
|
|
440
|
+
? context.signerAddress
|
|
441
|
+
: implementationAuthority.executor;
|
|
442
|
+
if (!implementationExecutor) {
|
|
443
|
+
throw new Error(`Upgrade step ${step.id} cannot resolve implementation executor`);
|
|
444
|
+
}
|
|
445
|
+
const planned = context.executionPlanner.add({
|
|
446
|
+
stepId: `${step.id}-implementation`,
|
|
447
|
+
executor: implementationExecutor,
|
|
448
|
+
to: implementationMulticall.target,
|
|
449
|
+
value: implementationMulticall.value,
|
|
450
|
+
data: implementationMulticall.data,
|
|
451
|
+
operation: 0,
|
|
452
|
+
...(implementationMulticall.scheme === undefined
|
|
453
|
+
? {}
|
|
454
|
+
: { scheme: implementationMulticall.scheme }),
|
|
455
|
+
...(implementationMulticall.factoryDeps === undefined
|
|
456
|
+
? {}
|
|
457
|
+
: { factoryDeps: implementationMulticall.factoryDeps }),
|
|
458
|
+
});
|
|
459
|
+
implementationTransactionId = planned.transactionId;
|
|
460
|
+
implementationExternal = planned.route === "external";
|
|
461
|
+
if (planned.executionAction === "replay") {
|
|
462
|
+
implementationTxHash = planned.transactionHash;
|
|
463
|
+
} else if (planned.route === "external" && context.mode !== "simulate") {
|
|
464
|
+
context.externalCalls.push({
|
|
465
|
+
transactionId: planned.transactionId,
|
|
466
|
+
stepId: planned.stepId,
|
|
467
|
+
to: planned.to,
|
|
468
|
+
value: planned.value,
|
|
469
|
+
data: planned.data,
|
|
470
|
+
operation: planned.operation,
|
|
471
|
+
method: implementationMulticall.method,
|
|
472
|
+
args: implementationMulticall.calls,
|
|
473
|
+
executor: planned.executor,
|
|
474
|
+
reason: implementationAuthority.reason,
|
|
475
|
+
});
|
|
476
|
+
} else {
|
|
477
|
+
const selectedSigner = planned.route === "external"
|
|
478
|
+
? await impersonateWorkflowSimulationSigner(planned.executor)
|
|
479
|
+
: context.signer;
|
|
480
|
+
const tx = await sendPreparedControlledMulticallTransaction(
|
|
481
|
+
implementationMulticall,
|
|
482
|
+
selectedSigner,
|
|
483
|
+
);
|
|
484
|
+
implementationTxHash = tx.hash;
|
|
485
|
+
if (context.mode === "execute" && planned.route === "operator") {
|
|
486
|
+
context.operatorReceipts.push({
|
|
487
|
+
transactionId: planned.transactionId,
|
|
488
|
+
transactionHash: tx.hash,
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
const upgradeExecutor = upgradeAuthority.mode === "execute"
|
|
495
|
+
? context.signerAddress
|
|
496
|
+
: upgradeAuthority.executor;
|
|
497
|
+
if (!upgradeExecutor) throw new Error(`Upgrade step ${step.id} cannot resolve proxy executor`);
|
|
498
|
+
const upgradeEnvelope = transactionEnvelope(proxyUpgradeCall);
|
|
499
|
+
const upgradeTransaction = context.executionPlanner.add({
|
|
500
|
+
stepId: step.id,
|
|
501
|
+
executor: upgradeExecutor,
|
|
502
|
+
to: upgradeEnvelope.target,
|
|
503
|
+
value: upgradeEnvelope.value,
|
|
504
|
+
data: upgradeEnvelope.data,
|
|
505
|
+
operation: 0,
|
|
506
|
+
...(upgradeEnvelope.scheme === undefined ? {} : { scheme: upgradeEnvelope.scheme }),
|
|
507
|
+
...(upgradeEnvelope.factoryDeps === undefined
|
|
508
|
+
? {}
|
|
509
|
+
: { factoryDeps: upgradeEnvelope.factoryDeps }),
|
|
510
|
+
});
|
|
511
|
+
if (context.mode === "execute") {
|
|
512
|
+
recorder?.bindProxyTransaction(step.id, upgradeTransaction.transactionId);
|
|
513
|
+
}
|
|
514
|
+
let upgradeTxHash: string | undefined;
|
|
515
|
+
if (upgradeTransaction.executionAction === "replay") {
|
|
516
|
+
upgradeTxHash = upgradeTransaction.transactionHash;
|
|
517
|
+
} else if (upgradeTransaction.route === "external" && context.mode !== "simulate") {
|
|
518
|
+
context.externalCalls.push({
|
|
519
|
+
transactionId: upgradeTransaction.transactionId,
|
|
520
|
+
stepId: upgradeTransaction.stepId,
|
|
521
|
+
to: upgradeTransaction.to,
|
|
522
|
+
value: upgradeTransaction.value,
|
|
523
|
+
data: upgradeTransaction.data,
|
|
524
|
+
operation: upgradeTransaction.operation,
|
|
525
|
+
method: "upgradeToAndCall",
|
|
526
|
+
args: [implementation.address],
|
|
527
|
+
executor: upgradeTransaction.executor,
|
|
528
|
+
reason: upgradeAuthority.reason,
|
|
529
|
+
});
|
|
530
|
+
} else {
|
|
531
|
+
const selectedSigner = upgradeTransaction.route === "external"
|
|
532
|
+
? await impersonateWorkflowSimulationSigner(upgradeTransaction.executor)
|
|
533
|
+
: context.signer;
|
|
534
|
+
const tx = await sendPreparedWorkflowTransaction(upgradeEnvelope, selectedSigner);
|
|
535
|
+
upgradeTxHash = tx.hash;
|
|
536
|
+
if (context.mode === "execute" && upgradeTransaction.route === "operator") {
|
|
537
|
+
context.operatorReceipts.push({
|
|
538
|
+
transactionId: upgradeTransaction.transactionId,
|
|
539
|
+
transactionHash: tx.hash,
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
if (
|
|
544
|
+
context.mode === "execute"
|
|
545
|
+
&& !implementationExternal
|
|
546
|
+
&& upgradeTransaction.route === "operator"
|
|
547
|
+
) {
|
|
548
|
+
await assertUupsChainState(proxy.proxyAddress, implementation.address);
|
|
549
|
+
const gateToolSync = await syncGateToolUups({
|
|
550
|
+
root: context.root,
|
|
551
|
+
evidenceDir: gateToolEvidenceDir,
|
|
552
|
+
evidenceName: step.id,
|
|
553
|
+
scheme: prepared.plan.scheme,
|
|
554
|
+
network: network.name,
|
|
555
|
+
target: context.targetId,
|
|
556
|
+
manifestDir: context.target.openzeppelin.manifestDir,
|
|
557
|
+
proxy: proxy.proxyAddress,
|
|
558
|
+
implementation: implementation.address,
|
|
559
|
+
contract: actualContract,
|
|
560
|
+
constructorArgs,
|
|
561
|
+
transactionHash: upgradeTxHash || "",
|
|
562
|
+
});
|
|
563
|
+
recorder?.apply({
|
|
564
|
+
...preparedChange,
|
|
565
|
+
implementationTxHash,
|
|
566
|
+
txHash: upgradeTxHash,
|
|
567
|
+
gateToolSync,
|
|
568
|
+
});
|
|
569
|
+
} else if (context.mode === "simulate") {
|
|
570
|
+
await assertUupsChainState(proxy.proxyAddress, implementation.address);
|
|
571
|
+
}
|
|
572
|
+
context.state.set(`${proxy.saveAs}Upgrade`, {
|
|
573
|
+
proxyAddress: proxy.proxyAddress,
|
|
574
|
+
implementationAddress: implementation.address,
|
|
575
|
+
implementationSalt,
|
|
576
|
+
implementationTxHash,
|
|
577
|
+
txHash: upgradeTxHash,
|
|
578
|
+
external: implementationExternal || upgradeTransaction.route === "external",
|
|
579
|
+
gateToolPlan,
|
|
580
|
+
});
|
|
581
|
+
context.reporter.result("execution", {
|
|
582
|
+
stepId: step.id,
|
|
583
|
+
kind: step.kind,
|
|
584
|
+
mode: upgradeTransaction.route,
|
|
585
|
+
scheme,
|
|
586
|
+
implementationTransactionId,
|
|
587
|
+
upgradeTransactionId: upgradeTransaction.transactionId,
|
|
588
|
+
contract: contractName,
|
|
589
|
+
actualContract,
|
|
590
|
+
saveAs: proxy.saveAs,
|
|
591
|
+
contractInfoKey: proxy.contractInfoKey,
|
|
592
|
+
proxy: proxy.proxyAddress,
|
|
593
|
+
implementationAddress: implementation.address,
|
|
594
|
+
implementationTxHash,
|
|
595
|
+
txHash: upgradeTxHash,
|
|
596
|
+
gateToolPlan,
|
|
597
|
+
});
|
|
598
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WorkflowContext } from "../run";
|
|
2
|
+
import { WorkflowStep } from "../lib/parameters";
|
|
3
|
+
import { runContractViewCalls } from "../lib/calls";
|
|
4
|
+
|
|
5
|
+
export const runViewStep = async (
|
|
6
|
+
context: WorkflowContext,
|
|
7
|
+
step: WorkflowStep,
|
|
8
|
+
): Promise<void> => {
|
|
9
|
+
await runContractViewCalls(context, step);
|
|
10
|
+
};
|