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,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveWorkflowSigner = exports.impersonateWorkflowSimulationSigner = exports.resolveSimulationSignerAddress = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const custody_1 = require("gate-evm-tools/custody");
|
|
6
|
+
const projectHardhat_1 = require("../../projectHardhat");
|
|
7
|
+
const signerIdentity_1 = require("./signerIdentity");
|
|
8
|
+
const SIMULATION_SIGNER_BALANCE = "0x3635C9ADC5DEA00000";
|
|
9
|
+
const normalizedSimulationAddress = (value) => {
|
|
10
|
+
if (value === undefined)
|
|
11
|
+
return undefined;
|
|
12
|
+
const candidate = value.trim();
|
|
13
|
+
if (!(0, ethers_1.isAddress)(candidate) || (0, ethers_1.getAddress)(candidate) === ethers_1.ZeroAddress) {
|
|
14
|
+
throw new Error("simulation signer must be a valid non-zero EVM address");
|
|
15
|
+
}
|
|
16
|
+
return (0, ethers_1.getAddress)(candidate);
|
|
17
|
+
};
|
|
18
|
+
const resolveSimulationSignerAddress = (options) => {
|
|
19
|
+
const explicitAddress = normalizedSimulationAddress(options.explicitAddress);
|
|
20
|
+
const taskAddress = options.useLock
|
|
21
|
+
? undefined
|
|
22
|
+
: normalizedSimulationAddress(options.taskAddress);
|
|
23
|
+
if (explicitAddress
|
|
24
|
+
&& taskAddress
|
|
25
|
+
&& explicitAddress.toLowerCase() !== taskAddress.toLowerCase()) {
|
|
26
|
+
throw new Error("simulation signer sources do not match");
|
|
27
|
+
}
|
|
28
|
+
const selectedAddress = explicitAddress || taskAddress;
|
|
29
|
+
if (!selectedAddress) {
|
|
30
|
+
throw new Error("Simulation requires an explicit signer address");
|
|
31
|
+
}
|
|
32
|
+
return selectedAddress;
|
|
33
|
+
};
|
|
34
|
+
exports.resolveSimulationSignerAddress = resolveSimulationSignerAddress;
|
|
35
|
+
const impersonateWorkflowSimulationSigner = async (signerAddress) => {
|
|
36
|
+
if (projectHardhat_1.network.name !== "hardhat" && projectHardhat_1.network.name !== "zkFork") {
|
|
37
|
+
throw new Error("Simulation signer impersonation requires a local fork network");
|
|
38
|
+
}
|
|
39
|
+
await projectHardhat_1.network.provider.request({
|
|
40
|
+
method: "hardhat_impersonateAccount",
|
|
41
|
+
params: [signerAddress],
|
|
42
|
+
});
|
|
43
|
+
await projectHardhat_1.network.provider.request({
|
|
44
|
+
method: "hardhat_setBalance",
|
|
45
|
+
params: [signerAddress, SIMULATION_SIGNER_BALANCE],
|
|
46
|
+
});
|
|
47
|
+
if (projectHardhat_1.network.name === "zkFork") {
|
|
48
|
+
return (0, custody_1.createZkSyncNodeSigner)({
|
|
49
|
+
provider: projectHardhat_1.ethers.provider,
|
|
50
|
+
address: signerAddress,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return projectHardhat_1.ethers.getSigner(signerAddress);
|
|
54
|
+
};
|
|
55
|
+
exports.impersonateWorkflowSimulationSigner = impersonateWorkflowSimulationSigner;
|
|
56
|
+
const resolveWorkflowSigner = async (mode, options = {}) => {
|
|
57
|
+
if (mode === "simulate") {
|
|
58
|
+
return (0, exports.impersonateWorkflowSimulationSigner)((0, exports.resolveSimulationSignerAddress)(options));
|
|
59
|
+
}
|
|
60
|
+
const executionCredential = mode === "execute"
|
|
61
|
+
? (0, custody_1.resolveWalletCredential)(process.env)
|
|
62
|
+
: undefined;
|
|
63
|
+
const zkSync = projectHardhat_1.network.config.zksync === true;
|
|
64
|
+
if (mode === "execute" && zkSync) {
|
|
65
|
+
if (!executionCredential) {
|
|
66
|
+
throw new Error("zkSync development execution requires an explicit wallet credential");
|
|
67
|
+
}
|
|
68
|
+
const baseUrl = process.env.CUSTODY_API_BASE_URL?.trim() || undefined;
|
|
69
|
+
if (executionCredential.kind === "custody" && !baseUrl) {
|
|
70
|
+
throw new Error("Custody wallet mode requires CUSTODY_API_BASE_URL");
|
|
71
|
+
}
|
|
72
|
+
const credential = executionCredential.kind === "private-key"
|
|
73
|
+
? executionCredential.privateKey
|
|
74
|
+
: `custody:${executionCredential.secret}:${executionCredential.address}`;
|
|
75
|
+
const signer = (0, custody_1.createZkSyncSigner)({
|
|
76
|
+
ethers: projectHardhat_1.ethers,
|
|
77
|
+
credential,
|
|
78
|
+
provider: projectHardhat_1.ethers.provider,
|
|
79
|
+
baseUrl,
|
|
80
|
+
});
|
|
81
|
+
(0, signerIdentity_1.assertExecutionSignerAddress)(await signer.getAddress(), options.taskAddress);
|
|
82
|
+
return signer;
|
|
83
|
+
}
|
|
84
|
+
if (executionCredential) {
|
|
85
|
+
const baseUrl = process.env.CUSTODY_API_BASE_URL?.trim() || undefined;
|
|
86
|
+
if (executionCredential.kind === "custody" && !baseUrl) {
|
|
87
|
+
throw new Error("Custody wallet mode requires CUSTODY_API_BASE_URL");
|
|
88
|
+
}
|
|
89
|
+
const credential = executionCredential.kind === "private-key"
|
|
90
|
+
? executionCredential.privateKey
|
|
91
|
+
: `custody:${executionCredential.secret}:${executionCredential.address}`;
|
|
92
|
+
const signer = (0, custody_1.createSigner)({
|
|
93
|
+
ethers: projectHardhat_1.ethers,
|
|
94
|
+
credential,
|
|
95
|
+
provider: projectHardhat_1.ethers.provider,
|
|
96
|
+
baseUrl,
|
|
97
|
+
});
|
|
98
|
+
(0, signerIdentity_1.assertExecutionSignerAddress)(await signer.getAddress(), options.taskAddress);
|
|
99
|
+
return signer;
|
|
100
|
+
}
|
|
101
|
+
const [signer] = await projectHardhat_1.ethers.getSigners();
|
|
102
|
+
return signer;
|
|
103
|
+
};
|
|
104
|
+
exports.resolveWorkflowSigner = resolveWorkflowSigner;
|
|
105
|
+
//# sourceMappingURL=signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/signer.ts"],"names":[],"mappings":";;;AAAA,mCAA4D;AAE5D,oDAKgC;AAChC,yDAAuD;AACvD,qDAAgE;AAGhE,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAQzD,MAAM,2BAA2B,GAAG,CAAC,KAAyB,EAAsB,EAAE;IACpF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC/B,IAAI,CAAC,IAAA,kBAAS,EAAC,SAAS,CAAC,IAAI,IAAA,mBAAU,EAAC,SAAS,CAAC,KAAK,oBAAW,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,IAAA,mBAAU,EAAC,SAAS,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEK,MAAM,8BAA8B,GAAG,CAAC,OAA8B,EAAU,EAAE;IACvF,MAAM,eAAe,GAAG,2BAA2B,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7E,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO;QACjC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,2BAA2B,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACrD,IACE,eAAe;WACZ,WAAW;WACX,eAAe,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,WAAW,EAA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AAI,mBAAmB,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,UAAU,GAAG,mBAAmB,CAAC,IAAI,KAAK,aAAa;YAC3D,CAAC,CAAC,mBAAmB,CAAC,UAAU;YAChC,CAAC,CAAC,WAAW,mBAAmB,CAAC,MAAM,IAAI,mBAAmB,CAAC,OAAO,EAAE,CAAC;QAC3E,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC;YAC1B,MAAM,EAAN,uBAAM;YACN,UAAU;YACV,QAAQ,EAAE,uBAAM,CAAC,QAAQ;YACzB,OAAO;SACR,CAAW,CAAC;QACb,IAAA,6CAA4B,EAAC,MAAM,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAC7E,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,uBAAM,CAAC,UAAU,EAAE,CAAC;IAC3C,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AApDW,QAAA,qBAAqB,yBAoDhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const assertExecutionSignerAddress: (actualAddress: string, expectedTaskAddress?: string) => string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertExecutionSignerAddress = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const normalizedAddress = (value, label) => {
|
|
6
|
+
const candidate = value.trim();
|
|
7
|
+
if (!(0, ethers_1.isAddress)(candidate) || (0, ethers_1.getAddress)(candidate) === ethers_1.ZeroAddress) {
|
|
8
|
+
throw new Error(`${label} must be a valid non-zero EVM address`);
|
|
9
|
+
}
|
|
10
|
+
return (0, ethers_1.getAddress)(candidate);
|
|
11
|
+
};
|
|
12
|
+
const assertExecutionSignerAddress = (actualAddress, expectedTaskAddress) => {
|
|
13
|
+
const actual = normalizedAddress(actualAddress, "execution signer");
|
|
14
|
+
if (expectedTaskAddress === undefined)
|
|
15
|
+
return actual;
|
|
16
|
+
const expected = normalizedAddress(expectedTaskAddress, "deployment signer address");
|
|
17
|
+
if (actual.toLowerCase() !== expected.toLowerCase()) {
|
|
18
|
+
throw new Error("execution signer does not match deployment signer address");
|
|
19
|
+
}
|
|
20
|
+
return actual;
|
|
21
|
+
};
|
|
22
|
+
exports.assertExecutionSignerAddress = assertExecutionSignerAddress;
|
|
23
|
+
//# sourceMappingURL=signerIdentity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signerIdentity.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/signerIdentity.ts"],"names":[],"mappings":";;;AAAA,mCAA4D;AAE5D,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,KAAa,EAAU,EAAE;IACjE,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC/B,IAAI,CAAC,IAAA,kBAAS,EAAC,SAAS,CAAC,IAAI,IAAA,mBAAU,EAAC,SAAS,CAAC,KAAK,oBAAW,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,uCAAuC,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,IAAA,mBAAU,EAAC,SAAS,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEK,MAAM,4BAA4B,GAAG,CAC1C,aAAqB,EACrB,mBAA4B,EACpB,EAAE;IACV,MAAM,MAAM,GAAG,iBAAiB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;IACpE,IAAI,mBAAmB,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACrD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,mBAAmB,EAAE,2BAA2B,CAAC,CAAC;IACrF,IAAI,MAAM,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAXW,QAAA,4BAA4B,gCAWvC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CapturedChainSnapshotV1, ForkSnapshotV1 } from "./forkSnapshot";
|
|
2
|
+
export type WorkflowMode = "execute" | "simulate" | "verify";
|
|
3
|
+
export interface SimulationFork {
|
|
4
|
+
snapshot?: ForkSnapshotV1;
|
|
5
|
+
}
|
|
6
|
+
type WithoutVersion<T> = T extends unknown ? Omit<T, "version"> : never;
|
|
7
|
+
type ZkSyncForkSnapshot = Extract<ForkSnapshotV1, {
|
|
8
|
+
runner: {
|
|
9
|
+
kind: "anvil-zksync";
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
type EvmForkSnapshot = Exclude<ForkSnapshotV1, ZkSyncForkSnapshot>;
|
|
13
|
+
export type SimulationForkEvidence = WithoutVersion<EvmForkSnapshot> | (WithoutVersion<ZkSyncForkSnapshot> & {
|
|
14
|
+
runnerProtocolVersion: number;
|
|
15
|
+
});
|
|
16
|
+
export declare const resolveWorkflowMode: (args: Record<string, string | boolean>) => WorkflowMode;
|
|
17
|
+
interface SimulationInfrastructureTarget {
|
|
18
|
+
create2?: {
|
|
19
|
+
factory?: string;
|
|
20
|
+
};
|
|
21
|
+
multicall?: {
|
|
22
|
+
controlledMulticall?: string;
|
|
23
|
+
};
|
|
24
|
+
uups?: {
|
|
25
|
+
placeholderImplementation?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare const assertCurrentStateInfrastructure: (targetId: string, target: SimulationInfrastructureTarget, snapshot: CapturedChainSnapshotV1 | undefined) => Promise<void>;
|
|
29
|
+
export declare const assertSimulationSourceInfrastructure: (targetId: string, target: SimulationInfrastructureTarget, simulation: SimulationFork) => Promise<void>;
|
|
30
|
+
export declare const assertCurrentStateUupsSourceState: (snapshot: CapturedChainSnapshotV1 | undefined, proxy: string) => Promise<void>;
|
|
31
|
+
export declare const assertSimulationUupsSourceState: (simulation: SimulationFork, proxy: string) => Promise<void>;
|
|
32
|
+
export declare const verifySimulationForkSnapshot: (simulation: SimulationFork) => Promise<void>;
|
|
33
|
+
export declare const simulationForkEvidence: (simulation: SimulationFork) => SimulationForkEvidence | undefined;
|
|
34
|
+
export declare const setupSimulationFork: (targetId: string) => Promise<SimulationFork>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupSimulationFork = exports.simulationForkEvidence = exports.verifySimulationForkSnapshot = exports.assertSimulationUupsSourceState = exports.assertCurrentStateUupsSourceState = exports.assertSimulationSourceInfrastructure = exports.assertCurrentStateInfrastructure = exports.resolveWorkflowMode = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const projectHardhat_1 = require("../../projectHardhat");
|
|
6
|
+
const forkSnapshot_1 = require("./forkSnapshot");
|
|
7
|
+
const erc1967_1 = require("./erc1967");
|
|
8
|
+
const zksyncForkCapability_1 = require("./zksyncForkCapability");
|
|
9
|
+
const zksyncForkRunner_1 = require("./zksyncForkRunner");
|
|
10
|
+
const resolveWorkflowMode = (args) => {
|
|
11
|
+
const mode = typeof args.mode === "string" ? args.mode : "execute";
|
|
12
|
+
if (mode !== "execute"
|
|
13
|
+
&& mode !== "simulate"
|
|
14
|
+
&& mode !== "verify") {
|
|
15
|
+
throw new Error(`Unsupported workflow mode: ${mode}`);
|
|
16
|
+
}
|
|
17
|
+
return mode;
|
|
18
|
+
};
|
|
19
|
+
exports.resolveWorkflowMode = resolveWorkflowMode;
|
|
20
|
+
const sourceProxyUrl = () => {
|
|
21
|
+
const value = process.env.GATE_SIMULATION_SOURCE_RPC_URL?.trim();
|
|
22
|
+
if (!value)
|
|
23
|
+
throw new Error("Simulation source-chain proxy URL is missing");
|
|
24
|
+
let parsed;
|
|
25
|
+
try {
|
|
26
|
+
parsed = new URL(value);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
throw new Error("Simulation source-chain proxy URL is invalid");
|
|
30
|
+
}
|
|
31
|
+
if (parsed.protocol !== "http:"
|
|
32
|
+
|| parsed.hostname !== "127.0.0.1"
|
|
33
|
+
|| !parsed.port
|
|
34
|
+
|| parsed.pathname === "/"
|
|
35
|
+
|| parsed.username
|
|
36
|
+
|| parsed.password
|
|
37
|
+
|| parsed.search
|
|
38
|
+
|| parsed.hash) {
|
|
39
|
+
throw new Error("Simulation source-chain proxy must use a tokenized loopback URL");
|
|
40
|
+
}
|
|
41
|
+
return parsed.toString();
|
|
42
|
+
};
|
|
43
|
+
const rpcRequest = async (url, method, params) => {
|
|
44
|
+
let response;
|
|
45
|
+
try {
|
|
46
|
+
response = await fetch(url, {
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: { "content-type": "application/json" },
|
|
49
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
throw new Error(`Simulation source RPC ${method} request failed`);
|
|
54
|
+
}
|
|
55
|
+
if (!response.ok) {
|
|
56
|
+
throw new Error(`Simulation source RPC ${method} request failed`);
|
|
57
|
+
}
|
|
58
|
+
let body;
|
|
59
|
+
try {
|
|
60
|
+
body = await response.json();
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
throw new Error(`Simulation source RPC ${method} returned invalid JSON`);
|
|
64
|
+
}
|
|
65
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
66
|
+
throw new Error(`Simulation source RPC ${method} returned an invalid response`);
|
|
67
|
+
}
|
|
68
|
+
const envelope = body;
|
|
69
|
+
if (envelope.error !== undefined || envelope.result === undefined) {
|
|
70
|
+
throw new Error(`Simulation source RPC ${method} failed`);
|
|
71
|
+
}
|
|
72
|
+
return envelope.result;
|
|
73
|
+
};
|
|
74
|
+
const blockTag = (blockNumber) => `0x${blockNumber.toString(16)}`;
|
|
75
|
+
const rpcQuantity = (value, label) => {
|
|
76
|
+
if (typeof value !== "string" || !/^0x(?:0|[1-9a-fA-F][0-9a-fA-F]*)$/.test(value)) {
|
|
77
|
+
throw new Error(`${label} must be a canonical RPC quantity`);
|
|
78
|
+
}
|
|
79
|
+
const parsed = BigInt(value);
|
|
80
|
+
if (parsed > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
81
|
+
throw new Error(`${label} exceeds the safe integer range`);
|
|
82
|
+
}
|
|
83
|
+
return Number(parsed);
|
|
84
|
+
};
|
|
85
|
+
const assertBlockHash = (block, snapshot, label) => {
|
|
86
|
+
if (!block || typeof block !== "object" || Array.isArray(block)) {
|
|
87
|
+
throw new Error(`${label} fork block is missing`);
|
|
88
|
+
}
|
|
89
|
+
const hash = block.hash;
|
|
90
|
+
if (typeof hash !== "string"
|
|
91
|
+
|| hash.toLowerCase() !== snapshot.blockHash.toLowerCase()) {
|
|
92
|
+
throw new Error(`${label} fork block hash mismatch at ${snapshot.blockNumber}`);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const requiredInfrastructureAddress = (value, label) => {
|
|
96
|
+
if (!value || !(0, ethers_1.isAddress)(value)) {
|
|
97
|
+
throw new Error(`${label} must be configured as an EVM address for simulation`);
|
|
98
|
+
}
|
|
99
|
+
return value;
|
|
100
|
+
};
|
|
101
|
+
const assertCurrentStateInfrastructure = async (targetId, target, snapshot) => {
|
|
102
|
+
if (!snapshot)
|
|
103
|
+
return;
|
|
104
|
+
const infrastructure = [
|
|
105
|
+
{
|
|
106
|
+
label: "CREATE2 Factory",
|
|
107
|
+
address: requiredInfrastructureAddress(target.create2?.factory, "CREATE2 Factory"),
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
label: "Controlled Multicall",
|
|
111
|
+
address: requiredInfrastructureAddress(target.multicall?.controlledMulticall, "Controlled Multicall"),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: "UUPS Placeholder",
|
|
115
|
+
address: requiredInfrastructureAddress(target.uups?.placeholderImplementation, "UUPS Placeholder"),
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
const code = await Promise.all(infrastructure.map((entry) => (projectHardhat_1.ethers.provider.getCode(entry.address, snapshot.blockNumber))));
|
|
119
|
+
for (const [index, entry] of infrastructure.entries()) {
|
|
120
|
+
if (!code[index] || code[index] === "0x") {
|
|
121
|
+
throw new Error(`${entry.label} on ${targetId} captured block ${snapshot.blockNumber} is missing code at ${entry.address}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
exports.assertCurrentStateInfrastructure = assertCurrentStateInfrastructure;
|
|
126
|
+
const assertSimulationSourceInfrastructure = async (targetId, target, simulation) => (0, exports.assertCurrentStateInfrastructure)(targetId, target, simulation.snapshot);
|
|
127
|
+
exports.assertSimulationSourceInfrastructure = assertSimulationSourceInfrastructure;
|
|
128
|
+
const assertCurrentStateUupsSourceState = async (snapshot, proxy) => {
|
|
129
|
+
if (!snapshot)
|
|
130
|
+
return;
|
|
131
|
+
const [proxyCode, oldImplementation] = await Promise.all([
|
|
132
|
+
projectHardhat_1.ethers.provider.getCode(proxy, snapshot.blockNumber),
|
|
133
|
+
(0, erc1967_1.getERC1967Implementation)(projectHardhat_1.ethers.provider, proxy, snapshot.blockNumber),
|
|
134
|
+
]);
|
|
135
|
+
if (!proxyCode || proxyCode === "0x") {
|
|
136
|
+
throw new Error(`UUPS proxy ${proxy} is missing code at captured block ${snapshot.blockNumber}`);
|
|
137
|
+
}
|
|
138
|
+
if (!oldImplementation) {
|
|
139
|
+
throw new Error(`UUPS proxy ${proxy} has no implementation at captured block ${snapshot.blockNumber}`);
|
|
140
|
+
}
|
|
141
|
+
const implementationCode = await projectHardhat_1.ethers.provider.getCode(oldImplementation, snapshot.blockNumber);
|
|
142
|
+
if (!implementationCode || implementationCode === "0x") {
|
|
143
|
+
throw new Error(`UUPS implementation ${oldImplementation} is missing code at captured block ${snapshot.blockNumber}`);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
exports.assertCurrentStateUupsSourceState = assertCurrentStateUupsSourceState;
|
|
147
|
+
const assertSimulationUupsSourceState = async (simulation, proxy) => (0, exports.assertCurrentStateUupsSourceState)(simulation.snapshot, proxy);
|
|
148
|
+
exports.assertSimulationUupsSourceState = assertSimulationUupsSourceState;
|
|
149
|
+
const verifySimulationForkSnapshot = async (simulation) => {
|
|
150
|
+
const snapshot = simulation.snapshot;
|
|
151
|
+
if (!snapshot)
|
|
152
|
+
return;
|
|
153
|
+
const [sourceBlock, localBlock, sourceZkSyncBlockDetails] = await Promise.all([
|
|
154
|
+
rpcRequest(sourceProxyUrl(), "eth_getBlockByNumber", [blockTag(snapshot.blockNumber), false]),
|
|
155
|
+
projectHardhat_1.network.provider.request({
|
|
156
|
+
method: "eth_getBlockByNumber",
|
|
157
|
+
params: [blockTag(snapshot.blockNumber), false],
|
|
158
|
+
}),
|
|
159
|
+
snapshot.runner.kind === "anvil-zksync"
|
|
160
|
+
? rpcRequest(sourceProxyUrl(), "zks_getBlockDetails", [snapshot.blockNumber])
|
|
161
|
+
: Promise.resolve(undefined),
|
|
162
|
+
]);
|
|
163
|
+
assertBlockHash(sourceBlock, snapshot, "Source-chain");
|
|
164
|
+
assertBlockHash(localBlock, snapshot, snapshot.runner.kind === "hardhat" ? "Local EVM" : "Local EraVM");
|
|
165
|
+
if (snapshot.runner.kind === "anvil-zksync"
|
|
166
|
+
&& (0, forkSnapshot_1.isCapturedZkSyncChainSnapshot)(snapshot)) {
|
|
167
|
+
const metadata = (0, forkSnapshot_1.parseZkSyncBlockDetails)(sourceZkSyncBlockDetails, snapshot.blockNumber);
|
|
168
|
+
if (metadata.protocolVersion !== snapshot.protocolVersion
|
|
169
|
+
|| metadata.l1BatchNumber !== snapshot.l1BatchNumber) {
|
|
170
|
+
throw new Error("Source-chain zkSync protocol metadata mismatch");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
exports.verifySimulationForkSnapshot = verifySimulationForkSnapshot;
|
|
175
|
+
const simulationForkEvidence = (simulation) => {
|
|
176
|
+
const snapshot = simulation.snapshot;
|
|
177
|
+
if (!snapshot)
|
|
178
|
+
return undefined;
|
|
179
|
+
if (snapshot.runner.kind === "anvil-zksync") {
|
|
180
|
+
if (!(0, forkSnapshot_1.isCapturedZkSyncChainSnapshot)(snapshot)) {
|
|
181
|
+
throw new Error("zkSync simulation snapshot is missing protocol metadata");
|
|
182
|
+
}
|
|
183
|
+
const capability = (0, zksyncForkCapability_1.resolveZkSyncForkCapability)(snapshot.protocolVersion);
|
|
184
|
+
if (!capability || capability.runner.version !== snapshot.runner.version) {
|
|
185
|
+
throw new Error(`zkSync protocol ${snapshot.protocolVersion} does not have an approved fork runner`);
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
sourceNetwork: snapshot.sourceNetwork,
|
|
189
|
+
chainId: snapshot.chainId,
|
|
190
|
+
blockNumber: snapshot.blockNumber,
|
|
191
|
+
blockHash: snapshot.blockHash,
|
|
192
|
+
protocolVersion: snapshot.protocolVersion,
|
|
193
|
+
runnerProtocolVersion: capability.runnerProtocolVersion,
|
|
194
|
+
l1BatchNumber: snapshot.l1BatchNumber,
|
|
195
|
+
runner: { ...snapshot.runner },
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
sourceNetwork: snapshot.sourceNetwork,
|
|
200
|
+
chainId: snapshot.chainId,
|
|
201
|
+
blockNumber: snapshot.blockNumber,
|
|
202
|
+
blockHash: snapshot.blockHash,
|
|
203
|
+
runner: { ...snapshot.runner },
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
exports.simulationForkEvidence = simulationForkEvidence;
|
|
207
|
+
const setupSimulationFork = async (targetId) => {
|
|
208
|
+
const targetNetwork = projectHardhat_1.config.networks[targetId];
|
|
209
|
+
if (targetNetwork?.zksync === true) {
|
|
210
|
+
if (projectHardhat_1.network.name !== "zkFork"
|
|
211
|
+
|| projectHardhat_1.network.config.zksync !== true) {
|
|
212
|
+
throw new Error(`zkSync target "${targetId}" requires the pinned EraVM fork network`);
|
|
213
|
+
}
|
|
214
|
+
const snapshot = (0, forkSnapshot_1.parseForkSnapshotJson)(process.env.GATE_SIMULATION_FORK_SNAPSHOT_JSON, targetId);
|
|
215
|
+
if (snapshot.runner.kind !== "anvil-zksync"
|
|
216
|
+
|| !(0, forkSnapshot_1.isCapturedZkSyncChainSnapshot)(snapshot)) {
|
|
217
|
+
throw new Error(`zkSync target "${targetId}" requires an anvil-zksync fork snapshot`);
|
|
218
|
+
}
|
|
219
|
+
const approvedRunner = (0, zksyncForkRunner_1.resolveZkSyncForkRunner)(snapshot.protocolVersion);
|
|
220
|
+
if (!approvedRunner || snapshot.runner.version !== approvedRunner.version) {
|
|
221
|
+
throw new Error(`zkSync protocol ${snapshot.protocolVersion} does not have an approved fork runner`);
|
|
222
|
+
}
|
|
223
|
+
const [runtimeChainId, forkBlock] = await Promise.all([
|
|
224
|
+
projectHardhat_1.network.provider.request({ method: "eth_chainId", params: [] }),
|
|
225
|
+
projectHardhat_1.network.provider.request({
|
|
226
|
+
method: "eth_getBlockByNumber",
|
|
227
|
+
params: [blockTag(snapshot.blockNumber), false],
|
|
228
|
+
}),
|
|
229
|
+
]);
|
|
230
|
+
if (typeof runtimeChainId !== "string"
|
|
231
|
+
|| !/^0x[0-9a-fA-F]+$/.test(runtimeChainId)
|
|
232
|
+
|| BigInt(runtimeChainId) !== BigInt(snapshot.chainId)) {
|
|
233
|
+
throw new Error(`EraVM simulation chainId does not match target chainId ${snapshot.chainId}`);
|
|
234
|
+
}
|
|
235
|
+
assertBlockHash(forkBlock, snapshot, "Local EraVM");
|
|
236
|
+
return { snapshot };
|
|
237
|
+
}
|
|
238
|
+
if (projectHardhat_1.network.name !== "hardhat") {
|
|
239
|
+
throw new Error("Simulation mode must run with --network hardhat");
|
|
240
|
+
}
|
|
241
|
+
if (targetId === "hardhat") {
|
|
242
|
+
return {};
|
|
243
|
+
}
|
|
244
|
+
const snapshot = (0, forkSnapshot_1.parseForkSnapshotJson)(process.env.GATE_SIMULATION_FORK_SNAPSHOT_JSON, targetId);
|
|
245
|
+
if (snapshot.runner.kind !== "hardhat") {
|
|
246
|
+
throw new Error(`EVM target "${targetId}" requires a Hardhat fork snapshot`);
|
|
247
|
+
}
|
|
248
|
+
const forkRpcUrl = sourceProxyUrl();
|
|
249
|
+
const sourceBlock = await rpcRequest(forkRpcUrl, "eth_getBlockByNumber", [blockTag(snapshot.blockNumber), false]);
|
|
250
|
+
assertBlockHash(sourceBlock, snapshot, "Source-chain");
|
|
251
|
+
await projectHardhat_1.network.provider.request({
|
|
252
|
+
method: "hardhat_reset",
|
|
253
|
+
params: [
|
|
254
|
+
{
|
|
255
|
+
forking: {
|
|
256
|
+
jsonRpcUrl: forkRpcUrl,
|
|
257
|
+
blockNumber: snapshot.blockNumber,
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
});
|
|
262
|
+
const [runtimeChainId, forkBlock] = await Promise.all([
|
|
263
|
+
projectHardhat_1.network.provider.request({ method: "eth_chainId", params: [] }),
|
|
264
|
+
projectHardhat_1.network.provider.request({
|
|
265
|
+
method: "eth_getBlockByNumber",
|
|
266
|
+
params: [blockTag(snapshot.blockNumber), false],
|
|
267
|
+
}),
|
|
268
|
+
]);
|
|
269
|
+
if (typeof runtimeChainId !== "string"
|
|
270
|
+
|| !/^0x[0-9a-fA-F]+$/.test(runtimeChainId)
|
|
271
|
+
|| BigInt(runtimeChainId) !== BigInt(snapshot.chainId)) {
|
|
272
|
+
throw new Error(`Simulation fork chainId does not match target chainId ${snapshot.chainId}`);
|
|
273
|
+
}
|
|
274
|
+
assertBlockHash(forkBlock, snapshot, "Local EVM");
|
|
275
|
+
await projectHardhat_1.network.provider.request({
|
|
276
|
+
method: "hardhat_mine",
|
|
277
|
+
params: ["0x1"],
|
|
278
|
+
});
|
|
279
|
+
return { snapshot };
|
|
280
|
+
};
|
|
281
|
+
exports.setupSimulationFork = setupSimulationFork;
|
|
282
|
+
//# sourceMappingURL=simulation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulation.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/simulation.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,yDAAgF;AAChF,iDAMwB;AACxB,uCAAqD;AACrD,iEAAqE;AACrE,yDAA6D;AAoBtD,MAAM,mBAAmB,GAAG,CACjC,IAAsC,EACxB,EAAE;IAChB,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,IACE,IAAI,KAAK,SAAS;WACf,IAAI,KAAK,UAAU;WACnB,IAAI,KAAK,QAAQ,EACpB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAZW,QAAA,mBAAmB,uBAY9B;AAEF,MAAM,cAAc,GAAG,GAAW,EAAE;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,IAAI,EAAE,CAAC;IACjE,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAC5E,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IACD,IACE,MAAM,CAAC,QAAQ,KAAK,OAAO;WACxB,MAAM,CAAC,QAA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/B,CAAC,kBAAkB,CAAC,IAAI,CAAC,cAAc,CAAC;WACxC,MAAM,CAAC,cAAc,CAAC,KAAK,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EACtD,CAAC;QACD,MAAM,IAAI,KAAK,CACb,yDAAyD,QAAQ,CAAC,OAAO,EAAE,CAC5E,CAAC;IACJ,CAAC;IACD,eAAe,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAElD,MAAM,wBAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC7B,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,CAAC,KAAK,CAAC;KAChB,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,CAAC;AACtB,CAAC,CAAC;AAzGW,QAAA,mBAAmB,uBAyG9B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface SimulationCallerNetworkInput {
|
|
2
|
+
default: string;
|
|
3
|
+
steps?: Record<string, string>;
|
|
4
|
+
}
|
|
5
|
+
export interface SimulationCallersDocument {
|
|
6
|
+
version: 1;
|
|
7
|
+
networks: Record<string, SimulationCallerNetworkInput>;
|
|
8
|
+
}
|
|
9
|
+
export interface ResolvedSimulationCaller {
|
|
10
|
+
stepId: string;
|
|
11
|
+
callerAddress: string;
|
|
12
|
+
source: "step" | "network_default";
|
|
13
|
+
}
|
|
14
|
+
export interface SimulationCallerNetworkBinding {
|
|
15
|
+
network: string;
|
|
16
|
+
manifestHash: string;
|
|
17
|
+
defaultAddress: string;
|
|
18
|
+
resolved: ResolvedSimulationCaller[];
|
|
19
|
+
networkHash: string;
|
|
20
|
+
}
|
|
21
|
+
interface ManifestStepInput {
|
|
22
|
+
id: string;
|
|
23
|
+
kind: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const parseSimulationCallersYaml: (text: string) => SimulationCallersDocument;
|
|
26
|
+
export declare const validateSimulationCallersDocument: (input: {
|
|
27
|
+
document: SimulationCallersDocument;
|
|
28
|
+
targetNetworks: string[];
|
|
29
|
+
manifestSteps: ManifestStepInput[];
|
|
30
|
+
}) => SimulationCallersDocument;
|
|
31
|
+
export declare const buildSimulationCallerNetworkBinding: (input: {
|
|
32
|
+
document: SimulationCallersDocument;
|
|
33
|
+
network: string;
|
|
34
|
+
manifestText: string;
|
|
35
|
+
manifestSteps: ManifestStepInput[];
|
|
36
|
+
}) => SimulationCallerNetworkBinding;
|
|
37
|
+
export declare const loadSimulationCallerNetwork: (input: {
|
|
38
|
+
taskDir: string;
|
|
39
|
+
targetNetworks: string[];
|
|
40
|
+
network: string;
|
|
41
|
+
manifestText: string;
|
|
42
|
+
manifestSteps: ManifestStepInput[];
|
|
43
|
+
}) => SimulationCallerNetworkBinding;
|
|
44
|
+
export {};
|