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,428 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import type { Provider } from "ethers";
|
|
4
|
+
import {
|
|
5
|
+
canonicalPreparationJson,
|
|
6
|
+
hashPreparationRequest,
|
|
7
|
+
normalizePreparationPlan,
|
|
8
|
+
normalizePreparationRequest,
|
|
9
|
+
type GateToolPreparationPlanV1,
|
|
10
|
+
} from "gate-evm-tools/workflow";
|
|
11
|
+
import { readJsonFile } from "./config";
|
|
12
|
+
import {
|
|
13
|
+
validateContractInfoCandidate,
|
|
14
|
+
type ContractInfoCandidate,
|
|
15
|
+
} from "./contractInfoCandidates";
|
|
16
|
+
import {
|
|
17
|
+
loadDeploymentExecutionRecord,
|
|
18
|
+
type DeploymentChange,
|
|
19
|
+
type PendingDeploymentReuseEvidence,
|
|
20
|
+
} from "./deploymentRecords";
|
|
21
|
+
import { getERC1967Implementation } from "./erc1967";
|
|
22
|
+
import { loadReleaseExecutionPlan } from "./executionPlan";
|
|
23
|
+
import { readParameterLockExecution } from "./lock";
|
|
24
|
+
import { loadOperatorExecutionResult } from "./operatorExecution";
|
|
25
|
+
import type { ReleaseFingerprint } from "./release";
|
|
26
|
+
|
|
27
|
+
interface PendingUupsReuseInput {
|
|
28
|
+
root: string;
|
|
29
|
+
taskDir: string;
|
|
30
|
+
taskId: string;
|
|
31
|
+
currentExecutionId: string;
|
|
32
|
+
network: string;
|
|
33
|
+
stepId: string;
|
|
34
|
+
instanceId: string;
|
|
35
|
+
actualContract: string;
|
|
36
|
+
contractInfoKey: string;
|
|
37
|
+
scheme: "evm" | "zksync-eravm";
|
|
38
|
+
factory: string;
|
|
39
|
+
multicall: string;
|
|
40
|
+
proxySalt: string;
|
|
41
|
+
expectedAddress?: string;
|
|
42
|
+
placeholderImplementationAddress: string;
|
|
43
|
+
provider: Pick<Provider, "getCode" | "getStorage">;
|
|
44
|
+
blockTag?: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ResolvedPendingUupsReuse {
|
|
48
|
+
implementationAddress: string;
|
|
49
|
+
implementationSalt: string;
|
|
50
|
+
proxyAddress: string;
|
|
51
|
+
evidence: PendingDeploymentReuseEvidence;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const isRecord = (value: unknown): value is Record<string, unknown> => (
|
|
55
|
+
!!value && typeof value === "object" && !Array.isArray(value)
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const sameAddress = (left: unknown, right: unknown): boolean => (
|
|
59
|
+
typeof left === "string"
|
|
60
|
+
&& typeof right === "string"
|
|
61
|
+
&& left.toLowerCase() === right.toLowerCase()
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const sameFingerprint = (left: ReleaseFingerprint, right: ReleaseFingerprint): boolean => (
|
|
65
|
+
left.manifestHash === right.manifestHash
|
|
66
|
+
&& left.artifactHash === right.artifactHash
|
|
67
|
+
&& left.parametersHash === right.parametersHash
|
|
68
|
+
&& left.configHash === right.configHash
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const relativePath = (root: string, filePath: string): string => {
|
|
72
|
+
const relative = path.relative(path.resolve(root), path.resolve(filePath));
|
|
73
|
+
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) {
|
|
74
|
+
throw new Error("Pending deployment reuse evidence escapes the project root");
|
|
75
|
+
}
|
|
76
|
+
return relative.split(path.sep).join("/");
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const confinedEvidencePath = (root: string, filePath: string): string => {
|
|
80
|
+
const resolved = path.resolve(root, filePath);
|
|
81
|
+
relativePath(root, resolved);
|
|
82
|
+
const stat = fs.lstatSync(resolved);
|
|
83
|
+
if (!stat.isFile() || stat.isSymbolicLink()) {
|
|
84
|
+
throw new Error("Pending deployment reuse evidence must be a regular file: " + filePath);
|
|
85
|
+
}
|
|
86
|
+
return resolved;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const pendingCandidateFiles = (root: string): string[] => fs.readdirSync(root)
|
|
90
|
+
.filter((name) => /^contractInfo\.pending\.[A-Za-z0-9][A-Za-z0-9_-]{0,199}\.json$/.test(name))
|
|
91
|
+
.map((name) => path.join(root, name));
|
|
92
|
+
|
|
93
|
+
const planDeployment = (
|
|
94
|
+
plan: GateToolPreparationPlanV1,
|
|
95
|
+
role: "implementation" | "proxy",
|
|
96
|
+
) => {
|
|
97
|
+
const matches = plan.deployments.filter((deployment) => deployment.role === role);
|
|
98
|
+
if (matches.length !== 1) {
|
|
99
|
+
throw new Error(`GateTool plan must contain exactly one ${role} deployment`);
|
|
100
|
+
}
|
|
101
|
+
return matches[0];
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const assertSuccessfulVerification = (
|
|
105
|
+
input: PendingUupsReuseInput,
|
|
106
|
+
executionId: string,
|
|
107
|
+
): string => {
|
|
108
|
+
const filePath = path.join(
|
|
109
|
+
input.taskDir,
|
|
110
|
+
"results",
|
|
111
|
+
input.network,
|
|
112
|
+
executionId,
|
|
113
|
+
"execute",
|
|
114
|
+
"verification.json",
|
|
115
|
+
);
|
|
116
|
+
const result = readJsonFile<unknown>(confinedEvidencePath(input.root, filePath));
|
|
117
|
+
if (!isRecord(result) || !Array.isArray(result.steps)) {
|
|
118
|
+
throw new Error("Execute verification evidence is invalid");
|
|
119
|
+
}
|
|
120
|
+
if (
|
|
121
|
+
result.taskId !== input.taskId
|
|
122
|
+
|| result.target !== input.network
|
|
123
|
+
|| result.executionId !== executionId
|
|
124
|
+
|| result.mode !== "execute"
|
|
125
|
+
|| result.steps.length === 0
|
|
126
|
+
) {
|
|
127
|
+
throw new Error("Execute verification evidence identity or steps are invalid");
|
|
128
|
+
}
|
|
129
|
+
for (const [stepIndex, rawStep] of result.steps.entries()) {
|
|
130
|
+
if (!isRecord(rawStep) || !isRecord(rawStep.results)) {
|
|
131
|
+
throw new Error(`Execute verification step ${stepIndex} is invalid`);
|
|
132
|
+
}
|
|
133
|
+
for (const [checkId, rawCheck] of Object.entries(rawStep.results)) {
|
|
134
|
+
if (
|
|
135
|
+
!isRecord(rawCheck)
|
|
136
|
+
|| JSON.stringify(rawCheck.actual) !== JSON.stringify(rawCheck.expected)
|
|
137
|
+
) {
|
|
138
|
+
throw new Error(`Execute verification check ${checkId} did not succeed`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return relativePath(input.root, filePath);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const assertExecutionResult = (
|
|
146
|
+
input: PendingUupsReuseInput,
|
|
147
|
+
executionId: string,
|
|
148
|
+
change: DeploymentChange,
|
|
149
|
+
): string => {
|
|
150
|
+
const filePath = path.join(
|
|
151
|
+
input.taskDir,
|
|
152
|
+
"results",
|
|
153
|
+
input.network,
|
|
154
|
+
executionId,
|
|
155
|
+
"execute",
|
|
156
|
+
"execution.json",
|
|
157
|
+
);
|
|
158
|
+
const result = readJsonFile<unknown>(confinedEvidencePath(input.root, filePath));
|
|
159
|
+
if (!isRecord(result) || !Array.isArray(result.steps)) {
|
|
160
|
+
throw new Error("Execute result evidence is invalid");
|
|
161
|
+
}
|
|
162
|
+
const matching = result.steps.filter((rawStep) => (
|
|
163
|
+
isRecord(rawStep)
|
|
164
|
+
&& rawStep.stepId === input.stepId
|
|
165
|
+
&& sameAddress(rawStep.address, change.address)
|
|
166
|
+
&& sameAddress(rawStep.implementationAddress, change.implementationAddress)
|
|
167
|
+
));
|
|
168
|
+
if (
|
|
169
|
+
result.taskId !== input.taskId
|
|
170
|
+
|| result.target !== input.network
|
|
171
|
+
|| result.executionId !== executionId
|
|
172
|
+
|| result.mode !== "execute"
|
|
173
|
+
|| matching.length !== 1
|
|
174
|
+
) {
|
|
175
|
+
throw new Error("Execute result does not prove the pending UUPS deployment");
|
|
176
|
+
}
|
|
177
|
+
return relativePath(input.root, filePath);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const assertCandidateIdentity = (
|
|
181
|
+
input: PendingUupsReuseInput,
|
|
182
|
+
candidate: ContractInfoCandidate,
|
|
183
|
+
): DeploymentChange => {
|
|
184
|
+
if (
|
|
185
|
+
candidate.status !== "pending"
|
|
186
|
+
|| candidate.deploymentId !== input.taskId
|
|
187
|
+
|| candidate.network !== input.network
|
|
188
|
+
) {
|
|
189
|
+
throw new Error("Pending candidate identity does not match this deployment task");
|
|
190
|
+
}
|
|
191
|
+
const replacements = candidate.replacements.filter((replacement) => (
|
|
192
|
+
replacement.network === input.network && replacement.instanceId === input.instanceId
|
|
193
|
+
));
|
|
194
|
+
if (replacements.length !== 1) {
|
|
195
|
+
throw new Error("Pending candidate must contain exactly one matching replacement");
|
|
196
|
+
}
|
|
197
|
+
const replacement = replacements[0];
|
|
198
|
+
if (
|
|
199
|
+
replacement.candidateKey !== input.contractInfoKey
|
|
200
|
+
|| (input.expectedAddress && !sameAddress(replacement.candidateAddress, input.expectedAddress))
|
|
201
|
+
) {
|
|
202
|
+
throw new Error("Pending candidate replacement does not match the current deployment");
|
|
203
|
+
}
|
|
204
|
+
const record = loadDeploymentExecutionRecord({
|
|
205
|
+
taskDir: input.taskDir,
|
|
206
|
+
taskId: input.taskId,
|
|
207
|
+
network: input.network,
|
|
208
|
+
executionId: candidate.executionId,
|
|
209
|
+
});
|
|
210
|
+
const changes = record.changes.filter((change) => (
|
|
211
|
+
change.stepId === input.stepId && change.instanceId === input.instanceId
|
|
212
|
+
));
|
|
213
|
+
if (
|
|
214
|
+
record.status !== "waiting_code_check"
|
|
215
|
+
|| record.candidateStatus !== "pending"
|
|
216
|
+
|| record.candidatePath !== `contractInfo.pending.${candidate.executionId}.json`
|
|
217
|
+
|| changes.length !== 1
|
|
218
|
+
) {
|
|
219
|
+
throw new Error("Pending deployment record is not waiting for CheckCode");
|
|
220
|
+
}
|
|
221
|
+
const change = changes[0];
|
|
222
|
+
if (
|
|
223
|
+
change.status !== "waiting_code_check"
|
|
224
|
+
|| change.kind !== "deploy"
|
|
225
|
+
|| change.actualContract !== input.actualContract
|
|
226
|
+
|| change.contractInfoKey !== input.contractInfoKey
|
|
227
|
+
|| change.strategy !== "create2"
|
|
228
|
+
|| change.proxyKind !== "uups"
|
|
229
|
+
|| !sameAddress(change.address, replacement.candidateAddress)
|
|
230
|
+
|| !sameAddress(change.proxyAddress, replacement.candidateAddress)
|
|
231
|
+
|| !sameAddress(change.factory, input.factory)
|
|
232
|
+
|| !sameAddress(change.multicall, input.multicall)
|
|
233
|
+
|| change.salt?.toLowerCase() !== input.proxySalt.toLowerCase()
|
|
234
|
+
|| !sameAddress(
|
|
235
|
+
change.placeholderImplementationAddress,
|
|
236
|
+
input.placeholderImplementationAddress,
|
|
237
|
+
)
|
|
238
|
+
|| typeof change.implementationSalt !== "string"
|
|
239
|
+
|| !/^0x[0-9a-fA-F]{64}$/.test(change.implementationSalt)
|
|
240
|
+
|| typeof change.implementationAddress !== "string"
|
|
241
|
+
) {
|
|
242
|
+
throw new Error("Pending deployment change does not match the current UUPS release");
|
|
243
|
+
}
|
|
244
|
+
return change;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const verifyCandidate = async (
|
|
248
|
+
input: PendingUupsReuseInput,
|
|
249
|
+
candidatePath: string,
|
|
250
|
+
candidate: ContractInfoCandidate,
|
|
251
|
+
): Promise<ResolvedPendingUupsReuse> => {
|
|
252
|
+
const change = assertCandidateIdentity(input, candidate);
|
|
253
|
+
const currentLock = readParameterLockExecution(input.taskDir, input.currentExecutionId);
|
|
254
|
+
const sourceLock = readParameterLockExecution(input.taskDir, candidate.executionId);
|
|
255
|
+
if (
|
|
256
|
+
!sameFingerprint(currentLock.releaseFingerprint, sourceLock.releaseFingerprint)
|
|
257
|
+
|| sourceLock.finalSimulation.status !== "succeeded"
|
|
258
|
+
|| !sourceLock.selectedStepIds.includes(input.stepId)
|
|
259
|
+
|| sourceLock.target.network !== input.network
|
|
260
|
+
|| sourceLock.target.create2Scheme !== input.scheme
|
|
261
|
+
|| !sameAddress(sourceLock.target.create2Factory, input.factory)
|
|
262
|
+
|| !sameAddress(sourceLock.target.controlledMulticall, input.multicall)
|
|
263
|
+
|| !sameAddress(
|
|
264
|
+
sourceLock.target.uupsPlaceholderImplementation,
|
|
265
|
+
input.placeholderImplementationAddress,
|
|
266
|
+
)
|
|
267
|
+
) {
|
|
268
|
+
throw new Error("Pending deployment parameter lock does not match the current release");
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (!isRecord(change.gateTool) || typeof change.gateTool.outputPath !== "string") {
|
|
272
|
+
throw new Error("Pending deployment is missing GateTool evidence");
|
|
273
|
+
}
|
|
274
|
+
const planPath = confinedEvidencePath(input.root, change.gateTool.outputPath);
|
|
275
|
+
const rawPlan = readJsonFile<unknown>(planPath);
|
|
276
|
+
const plan = normalizePreparationPlan(rawPlan);
|
|
277
|
+
if (canonicalPreparationJson(plan) !== canonicalPreparationJson(change.gateTool.data)) {
|
|
278
|
+
throw new Error("Pending deployment embedded GateTool plan differs from its evidence file");
|
|
279
|
+
}
|
|
280
|
+
const requestPath = path.join(path.dirname(planPath), `${input.stepId}-request.json`);
|
|
281
|
+
const request = normalizePreparationRequest(readJsonFile<unknown>(
|
|
282
|
+
confinedEvidencePath(input.root, requestPath),
|
|
283
|
+
));
|
|
284
|
+
const implementation = planDeployment(plan, "implementation");
|
|
285
|
+
const proxy = planDeployment(plan, "proxy");
|
|
286
|
+
if (
|
|
287
|
+
plan.kind !== "uups-placeholder-deploy"
|
|
288
|
+
|| plan.scheme !== input.scheme
|
|
289
|
+
|| plan.network !== input.network
|
|
290
|
+
|| plan.target !== input.network
|
|
291
|
+
|| request.kind !== "uups-placeholder-deploy"
|
|
292
|
+
|| request.scheme !== input.scheme
|
|
293
|
+
|| request.network !== input.network
|
|
294
|
+
|| request.target !== input.network
|
|
295
|
+
|| hashPreparationRequest(request) !== plan.requestHash
|
|
296
|
+
|| !sameAddress(request.factory, input.factory)
|
|
297
|
+
|| request.proxySalt.toLowerCase() !== input.proxySalt.toLowerCase()
|
|
298
|
+
|| request.implementationSalt.toLowerCase() !== change.implementationSalt!.toLowerCase()
|
|
299
|
+
|| !sameAddress(request.placeholderImplementation, input.placeholderImplementationAddress)
|
|
300
|
+
|| !sameAddress(proxy.address, change.address)
|
|
301
|
+
|| proxy.salt.toLowerCase() !== input.proxySalt.toLowerCase()
|
|
302
|
+
|| !sameAddress(implementation.address, change.implementationAddress)
|
|
303
|
+
|| implementation.salt.toLowerCase() !== change.implementationSalt!.toLowerCase()
|
|
304
|
+
|| !/^[0-9a-f]{64}$/.test(plan.artifact.digest)
|
|
305
|
+
) {
|
|
306
|
+
throw new Error("Pending GateTool evidence does not match the current UUPS deployment");
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const executionPlan = loadReleaseExecutionPlan({
|
|
310
|
+
root: input.root,
|
|
311
|
+
taskDir: input.taskDir,
|
|
312
|
+
target: input.network,
|
|
313
|
+
executionId: candidate.executionId,
|
|
314
|
+
expectedHash: sourceLock.finalSimulation.executionPlanHash,
|
|
315
|
+
});
|
|
316
|
+
const operatorTransactions = executionPlan.transactions.filter((transaction) => (
|
|
317
|
+
transaction.route === "operator"
|
|
318
|
+
));
|
|
319
|
+
let operatorExecutionPath: string | undefined;
|
|
320
|
+
if (operatorTransactions.length > 0) {
|
|
321
|
+
const operatorResult = loadOperatorExecutionResult({ taskDir: input.taskDir, plan: executionPlan });
|
|
322
|
+
if (operatorResult.receipts.length !== operatorTransactions.length) {
|
|
323
|
+
throw new Error("Pending deployment operator execution is incomplete");
|
|
324
|
+
}
|
|
325
|
+
operatorExecutionPath = relativePath(input.root, path.join(
|
|
326
|
+
input.taskDir,
|
|
327
|
+
"results",
|
|
328
|
+
input.network,
|
|
329
|
+
candidate.executionId,
|
|
330
|
+
"operator-execution.json",
|
|
331
|
+
));
|
|
332
|
+
}
|
|
333
|
+
if (
|
|
334
|
+
executionPlan.transactions.some((transaction) => transaction.route === "external")
|
|
335
|
+
) {
|
|
336
|
+
const record = loadDeploymentExecutionRecord({
|
|
337
|
+
taskDir: input.taskDir,
|
|
338
|
+
taskId: input.taskId,
|
|
339
|
+
network: input.network,
|
|
340
|
+
executionId: candidate.executionId,
|
|
341
|
+
});
|
|
342
|
+
if (!isRecord(record.external?.reconciliation) || record.external?.reconciliation.status !== "reconciled") {
|
|
343
|
+
throw new Error("Pending deployment external execution is not reconciled");
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const proxyCode = await input.provider.getCode(proxy.address, input.blockTag);
|
|
348
|
+
const implementationCode = await input.provider.getCode(implementation.address, input.blockTag);
|
|
349
|
+
const currentImplementation = await getERC1967Implementation(
|
|
350
|
+
input.provider,
|
|
351
|
+
proxy.address,
|
|
352
|
+
input.blockTag,
|
|
353
|
+
);
|
|
354
|
+
if (
|
|
355
|
+
!proxyCode || proxyCode === "0x"
|
|
356
|
+
|| !implementationCode || implementationCode === "0x"
|
|
357
|
+
|| !sameAddress(currentImplementation, implementation.address)
|
|
358
|
+
) {
|
|
359
|
+
throw new Error("Pending deployment does not match current on-chain UUPS state");
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const deploymentRecordPath = path.join(
|
|
363
|
+
input.taskDir,
|
|
364
|
+
"results",
|
|
365
|
+
`${input.network}.${candidate.executionId}.deployment.json`,
|
|
366
|
+
);
|
|
367
|
+
return {
|
|
368
|
+
implementationAddress: implementation.address,
|
|
369
|
+
implementationSalt: implementation.salt,
|
|
370
|
+
proxyAddress: proxy.address,
|
|
371
|
+
evidence: {
|
|
372
|
+
status: "verified",
|
|
373
|
+
sourceExecutionId: candidate.executionId,
|
|
374
|
+
sourceCandidatePath: relativePath(input.root, candidatePath),
|
|
375
|
+
sourceDeploymentRecordPath: relativePath(input.root, deploymentRecordPath),
|
|
376
|
+
sourceExecutionPlanPath: relativePath(input.root, path.join(
|
|
377
|
+
input.taskDir,
|
|
378
|
+
"results",
|
|
379
|
+
input.network,
|
|
380
|
+
candidate.executionId,
|
|
381
|
+
"execution-plan.json",
|
|
382
|
+
)),
|
|
383
|
+
...(operatorExecutionPath ? { sourceOperatorExecutionPath: operatorExecutionPath } : {}),
|
|
384
|
+
sourceExecutionResultPath: assertExecutionResult(input, candidate.executionId, change),
|
|
385
|
+
sourceVerificationPath: assertSuccessfulVerification(input, candidate.executionId),
|
|
386
|
+
releaseFingerprint: currentLock.releaseFingerprint,
|
|
387
|
+
artifactDigest: plan.artifact.digest,
|
|
388
|
+
proxyAddress: proxy.address,
|
|
389
|
+
implementationAddress: implementation.address,
|
|
390
|
+
},
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
export const resolvePendingUupsReuse = async (
|
|
395
|
+
input: PendingUupsReuseInput,
|
|
396
|
+
): Promise<ResolvedPendingUupsReuse | undefined> => {
|
|
397
|
+
const conflicts: Array<{ path: string; candidate: ContractInfoCandidate }> = [];
|
|
398
|
+
for (const candidatePath of pendingCandidateFiles(input.root)) {
|
|
399
|
+
const candidate = validateContractInfoCandidate(readJsonFile<unknown>(candidatePath));
|
|
400
|
+
if (candidate.executionId === input.currentExecutionId || candidate.status !== "pending") continue;
|
|
401
|
+
if (candidate.replacements.some((replacement) => (
|
|
402
|
+
replacement.network === input.network && replacement.instanceId === input.instanceId
|
|
403
|
+
))) {
|
|
404
|
+
conflicts.push({ path: candidatePath, candidate });
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (conflicts.length === 0) return undefined;
|
|
408
|
+
|
|
409
|
+
const verified: ResolvedPendingUupsReuse[] = [];
|
|
410
|
+
const failures: string[] = [];
|
|
411
|
+
for (const conflict of conflicts) {
|
|
412
|
+
try {
|
|
413
|
+
verified.push(await verifyCandidate(input, conflict.path, conflict.candidate));
|
|
414
|
+
} catch (error) {
|
|
415
|
+
failures.push(
|
|
416
|
+
`${path.basename(conflict.path)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
if (verified.length !== 1) {
|
|
421
|
+
throw new Error(
|
|
422
|
+
verified.length > 1
|
|
423
|
+
? `Multiple trusted pending deployments match ${input.network}.${input.instanceId}`
|
|
424
|
+
: `Pending deployment for ${input.network}.${input.instanceId} cannot be reused: ${failures.join("; ")}`,
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
return verified[0];
|
|
428
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { keccak256, toUtf8Bytes } from "ethers";
|
|
2
|
+
import { ethers } from "../../projectHardhat";
|
|
3
|
+
import {
|
|
4
|
+
getERC1967Admin,
|
|
5
|
+
getERC1967Implementation,
|
|
6
|
+
} from "./erc1967";
|
|
7
|
+
|
|
8
|
+
export interface ProxyOptions {
|
|
9
|
+
kind?: string;
|
|
10
|
+
initializer?: string | false;
|
|
11
|
+
unsafeAllow?: string[];
|
|
12
|
+
constructorArgs?: unknown[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface FirstUpgradeOptions {
|
|
16
|
+
contractName: string;
|
|
17
|
+
call?: {
|
|
18
|
+
fn: string;
|
|
19
|
+
args: unknown[];
|
|
20
|
+
};
|
|
21
|
+
constructorArgs?: unknown[];
|
|
22
|
+
unsafeAllow?: string[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const deriveImplementationSalt = (
|
|
26
|
+
executionId: string,
|
|
27
|
+
contractName: string,
|
|
28
|
+
scope: string,
|
|
29
|
+
): string => keccak256(
|
|
30
|
+
toUtf8Bytes(`gateflow:${executionId}:${contractName}:${scope}`),
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export const getImplementationAddress = async (
|
|
34
|
+
proxyAddress: string,
|
|
35
|
+
): Promise<string> => {
|
|
36
|
+
const implementation = await getERC1967Implementation(ethers.provider, proxyAddress);
|
|
37
|
+
if (!implementation) {
|
|
38
|
+
throw new Error(`Proxy ${proxyAddress} has no ERC-1967 implementation`);
|
|
39
|
+
}
|
|
40
|
+
return implementation;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const getProxyAdminAddress = async (
|
|
44
|
+
proxyAddress: string,
|
|
45
|
+
): Promise<string | undefined> => getERC1967Admin(ethers.provider, proxyAddress);
|