gate-evm-tools 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -11
- package/bin/workflow.cjs +19 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +21 -57
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/checkBatch.d.ts +4 -0
- package/dist/commands/checkBatch.d.ts.map +1 -0
- package/dist/commands/checkBatch.js +57 -0
- package/dist/commands/checkBatch.js.map +1 -0
- package/dist/commands/checkOptions.d.ts +3 -0
- package/dist/commands/checkOptions.d.ts.map +1 -1
- package/dist/commands/checkOptions.js +10 -1
- package/dist/commands/checkOptions.js.map +1 -1
- package/dist/commands/prepare.d.ts +1 -2
- package/dist/commands/prepare.d.ts.map +1 -1
- package/dist/commands/prepare.js +2 -17
- package/dist/commands/prepare.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +2 -17
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +2 -17
- package/dist/commands/validate.js.map +1 -1
- package/dist/core/BytecodeChecker.d.ts.map +1 -1
- package/dist/core/BytecodeChecker.js +16 -1
- package/dist/core/BytecodeChecker.js.map +1 -1
- package/dist/core/legacyProxyArtifact.d.ts +6 -0
- package/dist/core/legacyProxyArtifact.d.ts.map +1 -0
- package/dist/core/legacyProxyArtifact.js +36 -0
- package/dist/core/legacyProxyArtifact.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/hardhat.d.ts +4 -0
- package/dist/utils/hardhat.d.ts.map +1 -0
- package/dist/utils/hardhat.js +9 -0
- package/dist/utils/hardhat.js.map +1 -0
- package/dist-runtime/config/hardhatAdapters.d.ts +5 -0
- package/dist-runtime/config/hardhatAdapters.js +53 -0
- package/dist-runtime/config/hardhatAdapters.js.map +1 -0
- package/dist-runtime/config/networks.d.ts +8 -0
- package/dist-runtime/config/networks.js +269 -0
- package/dist-runtime/config/networks.js.map +1 -0
- package/dist-runtime/config/openzeppelin.d.ts +28 -0
- package/dist-runtime/config/openzeppelin.js +144 -0
- package/dist-runtime/config/openzeppelin.js.map +1 -0
- package/dist-runtime/config/rpc.d.ts +7 -0
- package/dist-runtime/config/rpc.js +19 -0
- package/dist-runtime/config/rpc.js.map +1 -0
- package/dist-runtime/config/zksyncSolcPath.d.ts +1 -0
- package/dist-runtime/config/zksyncSolcPath.js +61 -0
- package/dist-runtime/config/zksyncSolcPath.js.map +1 -0
- package/dist-runtime/migrate.d.ts +13 -0
- package/dist-runtime/migrate.js +208 -0
- package/dist-runtime/migrate.js.map +1 -0
- package/dist-runtime/package.json +1 -0
- package/dist-runtime/projectHardhat.d.ts +4 -0
- package/dist-runtime/projectHardhat.js +16 -0
- package/dist-runtime/projectHardhat.js.map +1 -0
- package/dist-runtime/runtime-identity.json +4 -0
- package/dist-runtime/template-migration.json +293 -0
- package/dist-runtime/workflow/checkCode.d.ts +1 -0
- package/dist-runtime/workflow/checkCode.js +16 -0
- package/dist-runtime/workflow/checkCode.js.map +1 -0
- package/dist-runtime/workflow/checkCodeFinalize.d.ts +1 -0
- package/dist-runtime/workflow/checkCodeFinalize.js +11 -0
- package/dist-runtime/workflow/checkCodeFinalize.js.map +1 -0
- package/dist-runtime/workflow/checkCodePlan.d.ts +1 -0
- package/dist-runtime/workflow/checkCodePlan.js +11 -0
- package/dist-runtime/workflow/checkCodePlan.js.map +1 -0
- package/dist-runtime/workflow/cli.d.ts +1 -0
- package/dist-runtime/workflow/cli.js +302 -0
- package/dist-runtime/workflow/cli.js.map +1 -0
- package/dist-runtime/workflow/commitContractInfo.d.ts +1 -0
- package/dist-runtime/workflow/commitContractInfo.js +64 -0
- package/dist-runtime/workflow/commitContractInfo.js.map +1 -0
- package/dist-runtime/workflow/create2Hashes.d.ts +1 -0
- package/dist-runtime/workflow/create2Hashes.js +76 -0
- package/dist-runtime/workflow/create2Hashes.js.map +1 -0
- package/dist-runtime/workflow/forkSourceProxy.d.ts +1 -0
- package/dist-runtime/workflow/forkSourceProxy.js +151 -0
- package/dist-runtime/workflow/forkSourceProxy.js.map +1 -0
- package/dist-runtime/workflow/importState.d.ts +1 -0
- package/dist-runtime/workflow/importState.js +193 -0
- package/dist-runtime/workflow/importState.js.map +1 -0
- package/dist-runtime/workflow/lib/authority.d.ts +28 -0
- package/dist-runtime/workflow/lib/authority.js +122 -0
- package/dist-runtime/workflow/lib/authority.js.map +1 -0
- package/dist-runtime/workflow/lib/calldata.d.ts +2 -0
- package/dist-runtime/workflow/lib/calldata.js +8 -0
- package/dist-runtime/workflow/lib/calldata.js.map +1 -0
- package/dist-runtime/workflow/lib/calls.d.ts +23 -0
- package/dist-runtime/workflow/lib/calls.js +316 -0
- package/dist-runtime/workflow/lib/calls.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/args.d.ts +2 -0
- package/dist-runtime/workflow/lib/checkCode/args.js +68 -0
- package/dist-runtime/workflow/lib/checkCode/args.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/command.d.ts +5 -0
- package/dist-runtime/workflow/lib/checkCode/command.js +35 -0
- package/dist-runtime/workflow/lib/checkCode/command.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/dependencies.d.ts +6 -0
- package/dist-runtime/workflow/lib/checkCode/dependencies.js +125 -0
- package/dist-runtime/workflow/lib/checkCode/dependencies.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/finalize.d.ts +17 -0
- package/dist-runtime/workflow/lib/checkCode/finalize.js +174 -0
- package/dist-runtime/workflow/lib/checkCode/finalize.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/index.d.ts +3 -0
- package/dist-runtime/workflow/lib/checkCode/index.js +20 -0
- package/dist-runtime/workflow/lib/checkCode/index.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/plan.d.ts +22 -0
- package/dist-runtime/workflow/lib/checkCode/plan.js +145 -0
- package/dist-runtime/workflow/lib/checkCode/plan.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCodeReport.d.ts +25 -0
- package/dist-runtime/workflow/lib/checkCodeReport.js +102 -0
- package/dist-runtime/workflow/lib/checkCodeReport.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCodeRunner.d.ts +87 -0
- package/dist-runtime/workflow/lib/checkCodeRunner.js +964 -0
- package/dist-runtime/workflow/lib/checkCodeRunner.js.map +1 -0
- package/dist-runtime/workflow/lib/cliTool.d.ts +10 -0
- package/dist-runtime/workflow/lib/cliTool.js +25 -0
- package/dist-runtime/workflow/lib/cliTool.js.map +1 -0
- package/dist-runtime/workflow/lib/config.d.ts +33 -0
- package/dist-runtime/workflow/lib/config.js +100 -0
- package/dist-runtime/workflow/lib/config.js.map +1 -0
- package/dist-runtime/workflow/lib/contractInfoCandidates.d.ts +82 -0
- package/dist-runtime/workflow/lib/contractInfoCandidates.js +441 -0
- package/dist-runtime/workflow/lib/contractInfoCandidates.js.map +1 -0
- package/dist-runtime/workflow/lib/create2.d.ts +49 -0
- package/dist-runtime/workflow/lib/create2.js +194 -0
- package/dist-runtime/workflow/lib/create2.js.map +1 -0
- package/dist-runtime/workflow/lib/create2Hashes.d.ts +22 -0
- package/dist-runtime/workflow/lib/create2Hashes.js +57 -0
- package/dist-runtime/workflow/lib/create2Hashes.js.map +1 -0
- package/dist-runtime/workflow/lib/deploymentInfo.d.ts +40 -0
- package/dist-runtime/workflow/lib/deploymentInfo.js +240 -0
- package/dist-runtime/workflow/lib/deploymentInfo.js.map +1 -0
- package/dist-runtime/workflow/lib/deploymentRecords.d.ts +137 -0
- package/dist-runtime/workflow/lib/deploymentRecords.js +374 -0
- package/dist-runtime/workflow/lib/deploymentRecords.js.map +1 -0
- package/dist-runtime/workflow/lib/deployments.d.ts +21 -0
- package/dist-runtime/workflow/lib/deployments.js +240 -0
- package/dist-runtime/workflow/lib/deployments.js.map +1 -0
- package/dist-runtime/workflow/lib/erc1967.d.ts +5 -0
- package/dist-runtime/workflow/lib/erc1967.js +29 -0
- package/dist-runtime/workflow/lib/erc1967.js.map +1 -0
- package/dist-runtime/workflow/lib/errors.d.ts +6 -0
- package/dist-runtime/workflow/lib/errors.js +77 -0
- package/dist-runtime/workflow/lib/errors.js.map +1 -0
- package/dist-runtime/workflow/lib/executionId.d.ts +7 -0
- package/dist-runtime/workflow/lib/executionId.js +26 -0
- package/dist-runtime/workflow/lib/executionId.js.map +1 -0
- package/dist-runtime/workflow/lib/executionPlan.d.ts +85 -0
- package/dist-runtime/workflow/lib/executionPlan.js +450 -0
- package/dist-runtime/workflow/lib/executionPlan.js.map +1 -0
- package/dist-runtime/workflow/lib/executionProgress.d.ts +5 -0
- package/dist-runtime/workflow/lib/executionProgress.js +100 -0
- package/dist-runtime/workflow/lib/executionProgress.js.map +1 -0
- package/dist-runtime/workflow/lib/external.d.ts +62 -0
- package/dist-runtime/workflow/lib/external.js +282 -0
- package/dist-runtime/workflow/lib/external.js.map +1 -0
- package/dist-runtime/workflow/lib/externalExecutionScanner.d.ts +64 -0
- package/dist-runtime/workflow/lib/externalExecutionScanner.js +638 -0
- package/dist-runtime/workflow/lib/externalExecutionScanner.js.map +1 -0
- package/dist-runtime/workflow/lib/forkSnapshot.d.ts +34 -0
- package/dist-runtime/workflow/lib/forkSnapshot.js +167 -0
- package/dist-runtime/workflow/lib/forkSnapshot.js.map +1 -0
- package/dist-runtime/workflow/lib/gateTool.d.ts +16 -0
- package/dist-runtime/workflow/lib/gateTool.js +177 -0
- package/dist-runtime/workflow/lib/gateTool.js.map +1 -0
- package/dist-runtime/workflow/lib/gateToolSync.d.ts +22 -0
- package/dist-runtime/workflow/lib/gateToolSync.js +253 -0
- package/dist-runtime/workflow/lib/gateToolSync.js.map +1 -0
- package/dist-runtime/workflow/lib/lock.d.ts +52 -0
- package/dist-runtime/workflow/lib/lock.js +269 -0
- package/dist-runtime/workflow/lib/lock.js.map +1 -0
- package/dist-runtime/workflow/lib/migrationState.d.ts +103 -0
- package/dist-runtime/workflow/lib/migrationState.js +920 -0
- package/dist-runtime/workflow/lib/migrationState.js.map +1 -0
- package/dist-runtime/workflow/lib/operatorExecution.d.ts +28 -0
- package/dist-runtime/workflow/lib/operatorExecution.js +134 -0
- package/dist-runtime/workflow/lib/operatorExecution.js.map +1 -0
- package/dist-runtime/workflow/lib/parameters.d.ts +58 -0
- package/dist-runtime/workflow/lib/parameters.js +322 -0
- package/dist-runtime/workflow/lib/parameters.js.map +1 -0
- package/dist-runtime/workflow/lib/pendingDeploymentReuse.d.ts +29 -0
- package/dist-runtime/workflow/lib/pendingDeploymentReuse.js +277 -0
- package/dist-runtime/workflow/lib/pendingDeploymentReuse.js.map +1 -0
- package/dist-runtime/workflow/lib/proxy.d.ts +18 -0
- package/dist-runtime/workflow/lib/proxy.js +19 -0
- package/dist-runtime/workflow/lib/proxy.js.map +1 -0
- package/dist-runtime/workflow/lib/registryCommit.d.ts +33 -0
- package/dist-runtime/workflow/lib/registryCommit.js +319 -0
- package/dist-runtime/workflow/lib/registryCommit.js.map +1 -0
- package/dist-runtime/workflow/lib/release.d.ts +57 -0
- package/dist-runtime/workflow/lib/release.js +256 -0
- package/dist-runtime/workflow/lib/release.js.map +1 -0
- package/dist-runtime/workflow/lib/releaseFinalize.d.ts +14 -0
- package/dist-runtime/workflow/lib/releaseFinalize.js +571 -0
- package/dist-runtime/workflow/lib/releaseFinalize.js.map +1 -0
- package/dist-runtime/workflow/lib/releaseParameters.d.ts +43 -0
- package/dist-runtime/workflow/lib/releaseParameters.js +184 -0
- package/dist-runtime/workflow/lib/releaseParameters.js.map +1 -0
- package/dist-runtime/workflow/lib/reporter.d.ts +39 -0
- package/dist-runtime/workflow/lib/reporter.js +452 -0
- package/dist-runtime/workflow/lib/reporter.js.map +1 -0
- package/dist-runtime/workflow/lib/resultPaths.d.ts +17 -0
- package/dist-runtime/workflow/lib/resultPaths.js +29 -0
- package/dist-runtime/workflow/lib/resultPaths.js.map +1 -0
- package/dist-runtime/workflow/lib/runtimeVersion.d.ts +10 -0
- package/dist-runtime/workflow/lib/runtimeVersion.js +46 -0
- package/dist-runtime/workflow/lib/runtimeVersion.js.map +1 -0
- package/dist-runtime/workflow/lib/signer.d.ts +10 -0
- package/dist-runtime/workflow/lib/signer.js +105 -0
- package/dist-runtime/workflow/lib/signer.js.map +1 -0
- package/dist-runtime/workflow/lib/signerIdentity.d.ts +1 -0
- package/dist-runtime/workflow/lib/signerIdentity.js +23 -0
- package/dist-runtime/workflow/lib/signerIdentity.js.map +1 -0
- package/dist-runtime/workflow/lib/simulation.d.ts +35 -0
- package/dist-runtime/workflow/lib/simulation.js +282 -0
- package/dist-runtime/workflow/lib/simulation.js.map +1 -0
- package/dist-runtime/workflow/lib/simulationCallers.d.ts +44 -0
- package/dist-runtime/workflow/lib/simulationCallers.js +260 -0
- package/dist-runtime/workflow/lib/simulationCallers.js.map +1 -0
- package/dist-runtime/workflow/lib/sourceRpcPolicy.d.ts +1 -0
- package/dist-runtime/workflow/lib/sourceRpcPolicy.js +43 -0
- package/dist-runtime/workflow/lib/sourceRpcPolicy.js.map +1 -0
- package/dist-runtime/workflow/lib/state.d.ts +6 -0
- package/dist-runtime/workflow/lib/state.js +25 -0
- package/dist-runtime/workflow/lib/state.js.map +1 -0
- package/dist-runtime/workflow/lib/staticValidation.d.ts +22 -0
- package/dist-runtime/workflow/lib/staticValidation.js +124 -0
- package/dist-runtime/workflow/lib/staticValidation.js.map +1 -0
- package/dist-runtime/workflow/lib/zksyncForkCapability.d.ts +27 -0
- package/dist-runtime/workflow/lib/zksyncForkCapability.js +52 -0
- package/dist-runtime/workflow/lib/zksyncForkCapability.js.map +1 -0
- package/dist-runtime/workflow/lib/zksyncForkRunner.d.ts +57 -0
- package/dist-runtime/workflow/lib/zksyncForkRunner.js +344 -0
- package/dist-runtime/workflow/lib/zksyncForkRunner.js.map +1 -0
- package/dist-runtime/workflow/reconcileExternal.d.ts +1 -0
- package/dist-runtime/workflow/reconcileExternal.js +87 -0
- package/dist-runtime/workflow/reconcileExternal.js.map +1 -0
- package/dist-runtime/workflow/reconcileExternalRun.d.ts +1 -0
- package/dist-runtime/workflow/reconcileExternalRun.js +77 -0
- package/dist-runtime/workflow/reconcileExternalRun.js.map +1 -0
- package/dist-runtime/workflow/releaseFinalize.d.ts +1 -0
- package/dist-runtime/workflow/releaseFinalize.js +11 -0
- package/dist-runtime/workflow/releaseFinalize.js.map +1 -0
- package/dist-runtime/workflow/run.d.ts +40 -0
- package/dist-runtime/workflow/run.js +858 -0
- package/dist-runtime/workflow/run.js.map +1 -0
- package/dist-runtime/workflow/staticValidate.d.ts +1 -0
- package/dist-runtime/workflow/staticValidate.js +26 -0
- package/dist-runtime/workflow/staticValidate.js.map +1 -0
- package/dist-runtime/workflow/steps/call.d.ts +3 -0
- package/dist-runtime/workflow/steps/call.js +9 -0
- package/dist-runtime/workflow/steps/call.js.map +1 -0
- package/dist-runtime/workflow/steps/check.d.ts +3 -0
- package/dist-runtime/workflow/steps/check.js +9 -0
- package/dist-runtime/workflow/steps/check.js.map +1 -0
- package/dist-runtime/workflow/steps/custom.d.ts +3 -0
- package/dist-runtime/workflow/steps/custom.js +33 -0
- package/dist-runtime/workflow/steps/custom.js.map +1 -0
- package/dist-runtime/workflow/steps/deploy.d.ts +3 -0
- package/dist-runtime/workflow/steps/deploy.js +595 -0
- package/dist-runtime/workflow/steps/deploy.js.map +1 -0
- package/dist-runtime/workflow/steps/upgrade.d.ts +3 -0
- package/dist-runtime/workflow/steps/upgrade.js +465 -0
- package/dist-runtime/workflow/steps/upgrade.js.map +1 -0
- package/dist-runtime/workflow/steps/view.d.ts +3 -0
- package/dist-runtime/workflow/steps/view.js +9 -0
- package/dist-runtime/workflow/steps/view.js.map +1 -0
- package/package.json +26 -5
- package/runtime/config/hardhatAdapters.ts +50 -0
- package/runtime/config/networks.ts +296 -0
- package/runtime/config/openzeppelin.ts +173 -0
- package/runtime/config/rpc.ts +27 -0
- package/runtime/config/zksyncSolcPath.ts +59 -0
- package/runtime/hardhat-types.d.ts +2 -0
- package/runtime/migrate.ts +154 -0
- package/runtime/projectHardhat.ts +10 -0
- package/runtime/template-migration.json +293 -0
- package/runtime/workflow/checkCode.ts +13 -0
- package/runtime/workflow/checkCodeFinalize.ts +8 -0
- package/runtime/workflow/checkCodePlan.ts +8 -0
- package/runtime/workflow/cli.ts +356 -0
- package/runtime/workflow/commitContractInfo.ts +63 -0
- package/runtime/workflow/create2Hashes.ts +79 -0
- package/runtime/workflow/forkSourceProxy.ts +193 -0
- package/runtime/workflow/importState.ts +190 -0
- package/runtime/workflow/lib/authority.ts +170 -0
- package/runtime/workflow/lib/calldata.ts +9 -0
- package/runtime/workflow/lib/calls.ts +407 -0
- package/runtime/workflow/lib/checkCode/args.ts +76 -0
- package/runtime/workflow/lib/checkCode/command.ts +36 -0
- package/runtime/workflow/lib/checkCode/dependencies.ts +112 -0
- package/runtime/workflow/lib/checkCode/finalize.ts +198 -0
- package/runtime/workflow/lib/checkCode/index.ts +18 -0
- package/runtime/workflow/lib/checkCode/plan.ts +163 -0
- package/runtime/workflow/lib/checkCodeReport.ts +133 -0
- package/runtime/workflow/lib/checkCodeRunner.ts +1225 -0
- package/runtime/workflow/lib/cliTool.ts +31 -0
- package/runtime/workflow/lib/config.ts +130 -0
- package/runtime/workflow/lib/contractInfoCandidates.ts +690 -0
- package/runtime/workflow/lib/create2.ts +278 -0
- package/runtime/workflow/lib/create2Hashes.ts +83 -0
- package/runtime/workflow/lib/deploymentInfo.ts +286 -0
- package/runtime/workflow/lib/deploymentRecords.ts +576 -0
- package/runtime/workflow/lib/deployments.ts +276 -0
- package/runtime/workflow/lib/erc1967.ts +57 -0
- package/runtime/workflow/lib/errors.ts +95 -0
- package/runtime/workflow/lib/executionId.ts +35 -0
- package/runtime/workflow/lib/executionPlan.ts +550 -0
- package/runtime/workflow/lib/executionProgress.ts +127 -0
- package/runtime/workflow/lib/external.ts +372 -0
- package/runtime/workflow/lib/externalExecutionScanner.ts +892 -0
- package/runtime/workflow/lib/forkSnapshot.ts +231 -0
- package/runtime/workflow/lib/gateTool.ts +261 -0
- package/runtime/workflow/lib/gateToolSync.ts +398 -0
- package/runtime/workflow/lib/lock.ts +388 -0
- package/runtime/workflow/lib/migrationState.ts +1246 -0
- package/runtime/workflow/lib/operatorExecution.ts +174 -0
- package/runtime/workflow/lib/parameters.ts +437 -0
- package/runtime/workflow/lib/pendingDeploymentReuse.ts +428 -0
- package/runtime/workflow/lib/proxy.ts +45 -0
- package/runtime/workflow/lib/registryCommit.ts +455 -0
- package/runtime/workflow/lib/release.ts +329 -0
- package/runtime/workflow/lib/releaseFinalize.ts +711 -0
- package/runtime/workflow/lib/releaseParameters.ts +248 -0
- package/runtime/workflow/lib/reporter.ts +502 -0
- package/runtime/workflow/lib/resultPaths.ts +49 -0
- package/runtime/workflow/lib/runtimeVersion.ts +28 -0
- package/runtime/workflow/lib/signer.ts +124 -0
- package/runtime/workflow/lib/signerIdentity.ts +22 -0
- package/runtime/workflow/lib/simulation.ts +415 -0
- package/runtime/workflow/lib/simulationCallers.ts +335 -0
- package/runtime/workflow/lib/sourceRpcPolicy.ts +41 -0
- package/runtime/workflow/lib/state.ts +25 -0
- package/runtime/workflow/lib/staticValidation.ts +142 -0
- package/runtime/workflow/lib/zksyncForkCapability.ts +80 -0
- package/runtime/workflow/lib/zksyncForkRunner.ts +505 -0
- package/runtime/workflow/reconcileExternal.ts +86 -0
- package/runtime/workflow/reconcileExternalRun.ts +88 -0
- package/runtime/workflow/releaseFinalize.ts +8 -0
- package/runtime/workflow/run.ts +1072 -0
- package/runtime/workflow/staticValidate.ts +23 -0
- package/runtime/workflow/steps/call.ts +10 -0
- package/runtime/workflow/steps/check.ts +10 -0
- package/runtime/workflow/steps/custom.ts +43 -0
- package/runtime/workflow/steps/deploy.ts +771 -0
- package/runtime/workflow/steps/upgrade.ts +598 -0
- package/runtime/workflow/steps/view.ts +10 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
export type DerivePolicy = "copy" | "manual" | "computed";
|
|
2
|
+
|
|
3
|
+
export interface ParameterSchema {
|
|
4
|
+
type?: string;
|
|
5
|
+
format?: string;
|
|
6
|
+
required?: string[];
|
|
7
|
+
properties?: Record<string, ParameterSchema>;
|
|
8
|
+
items?: ParameterSchema;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface DerivedReleaseParameters {
|
|
13
|
+
values: Record<string, unknown>;
|
|
14
|
+
missing: string[];
|
|
15
|
+
computed: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Create2MiningRequest {
|
|
19
|
+
requestId: string;
|
|
20
|
+
factory: string;
|
|
21
|
+
initCodeHash: string;
|
|
22
|
+
leadingZeroBytes: number;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Create2MiningResult {
|
|
27
|
+
factory: string;
|
|
28
|
+
initCodeHash: string;
|
|
29
|
+
leadingZeroBytes: number;
|
|
30
|
+
salt: string;
|
|
31
|
+
expectedAddress: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type Create2ComputedResolution =
|
|
35
|
+
| { status: "reused"; salt: string; expectedAddress: string }
|
|
36
|
+
| { status: "mining_required"; request: Create2MiningRequest };
|
|
37
|
+
|
|
38
|
+
interface TaskParameters {
|
|
39
|
+
params?: Record<string, Record<string, unknown>>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const isObject = (value: unknown): value is Record<string, unknown> => {
|
|
43
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const cloneValue = (value: unknown): unknown => {
|
|
47
|
+
if (Array.isArray(value)) return value.map((item) => cloneValue(item));
|
|
48
|
+
if (isObject(value)) {
|
|
49
|
+
return Object.fromEntries(
|
|
50
|
+
Object.entries(value).map(([key, item]) => [key, cloneValue(item)]),
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const validateDerivePolicies = (schema: ParameterSchema, parentPath = ""): void => {
|
|
57
|
+
for (const [key, propertySchema] of Object.entries(schema.properties || {})) {
|
|
58
|
+
const fieldPath = parentPath ? parentPath + "." + key : key;
|
|
59
|
+
const policy = propertySchema["x-gateflow-derive"];
|
|
60
|
+
if (policy !== "copy" && policy !== "manual" && policy !== "computed") {
|
|
61
|
+
throw new Error(
|
|
62
|
+
"Parameter " + fieldPath + " requires x-gateflow-derive: copy | manual | computed",
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
validateDerivePolicies(propertySchema, fieldPath);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const deriveReleaseParameters = (
|
|
70
|
+
schema: ParameterSchema,
|
|
71
|
+
developmentValues: Record<string, unknown>,
|
|
72
|
+
): DerivedReleaseParameters => {
|
|
73
|
+
validateDerivePolicies(schema);
|
|
74
|
+
const properties = schema.properties || {};
|
|
75
|
+
const required = new Set(schema.required || []);
|
|
76
|
+
const values: Record<string, unknown> = {};
|
|
77
|
+
const missing: string[] = [];
|
|
78
|
+
const computed: string[] = [];
|
|
79
|
+
|
|
80
|
+
for (const [key, propertySchema] of Object.entries(properties)) {
|
|
81
|
+
const policy = propertySchema["x-gateflow-derive"];
|
|
82
|
+
if (policy === "copy") {
|
|
83
|
+
if (Object.prototype.hasOwnProperty.call(developmentValues, key)) {
|
|
84
|
+
values[key] = cloneValue(developmentValues[key]);
|
|
85
|
+
} else if (required.has(key)) {
|
|
86
|
+
missing.push(key);
|
|
87
|
+
}
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (policy === "manual") {
|
|
91
|
+
missing.push(key);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
computed.push(key);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return { values, missing, computed };
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const isHexBytes = (value: unknown, bytes: number): value is string => {
|
|
101
|
+
return typeof value === "string"
|
|
102
|
+
&& new RegExp("^0x[0-9a-fA-F]{" + (bytes * 2) + "}$").test(value);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const equalHex = (left: string, right: string): boolean => {
|
|
106
|
+
return left.toLowerCase() === right.toLowerCase();
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const validLeadingZeroPolicy = (value: number): boolean => {
|
|
110
|
+
return Number.isInteger(value) && value >= 0 && value <= 20;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const resolveCreate2ComputedParameter = (
|
|
114
|
+
source: Create2MiningResult,
|
|
115
|
+
target: Create2MiningRequest,
|
|
116
|
+
): Create2ComputedResolution => {
|
|
117
|
+
if (!isHexBytes(target.factory, 20)) {
|
|
118
|
+
throw new Error("CREATE2 mining request factory must be an EVM address");
|
|
119
|
+
}
|
|
120
|
+
if (!isHexBytes(target.initCodeHash, 32)) {
|
|
121
|
+
throw new Error("CREATE2 mining request initCodeHash must be bytes32");
|
|
122
|
+
}
|
|
123
|
+
if (!validLeadingZeroPolicy(target.leadingZeroBytes)) {
|
|
124
|
+
throw new Error("CREATE2 mining request leadingZeroBytes must be an integer from 0 to 20");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const expectedPrefix = "0x" + "00".repeat(target.leadingZeroBytes);
|
|
128
|
+
const reusable = isHexBytes(source.factory, 20)
|
|
129
|
+
&& isHexBytes(source.initCodeHash, 32)
|
|
130
|
+
&& isHexBytes(source.salt, 32)
|
|
131
|
+
&& isHexBytes(source.expectedAddress, 20)
|
|
132
|
+
&& validLeadingZeroPolicy(source.leadingZeroBytes)
|
|
133
|
+
&& equalHex(source.factory, target.factory)
|
|
134
|
+
&& equalHex(source.initCodeHash, target.initCodeHash)
|
|
135
|
+
&& source.leadingZeroBytes === target.leadingZeroBytes
|
|
136
|
+
&& source.expectedAddress.toLowerCase().startsWith(expectedPrefix);
|
|
137
|
+
|
|
138
|
+
return reusable
|
|
139
|
+
? {
|
|
140
|
+
status: "reused",
|
|
141
|
+
salt: source.salt,
|
|
142
|
+
expectedAddress: source.expectedAddress,
|
|
143
|
+
}
|
|
144
|
+
: {
|
|
145
|
+
status: "mining_required",
|
|
146
|
+
request: cloneValue(target) as Create2MiningRequest,
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const valueType = (value: unknown): string => {
|
|
151
|
+
if (Array.isArray(value)) return "array";
|
|
152
|
+
if (value === null) return "null";
|
|
153
|
+
return typeof value;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const validateValue = (value: unknown, schema: ParameterSchema, path: string): void => {
|
|
157
|
+
if (value === undefined) return;
|
|
158
|
+
if (schema.type === "object") {
|
|
159
|
+
if (!isObject(value)) {
|
|
160
|
+
throw new Error(path + " must be an object");
|
|
161
|
+
}
|
|
162
|
+
const properties = schema.properties || {};
|
|
163
|
+
for (const requiredKey of schema.required || []) {
|
|
164
|
+
if (!Object.prototype.hasOwnProperty.call(value, requiredKey) || value[requiredKey] === undefined) {
|
|
165
|
+
throw new Error(path + "." + requiredKey + " is required");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
169
|
+
if (properties[key]) validateValue(nestedValue, properties[key], path + "." + key);
|
|
170
|
+
}
|
|
171
|
+
} else if (schema.type === "array") {
|
|
172
|
+
if (!Array.isArray(value)) {
|
|
173
|
+
throw new Error(path + " must be an array");
|
|
174
|
+
}
|
|
175
|
+
if (schema.items) {
|
|
176
|
+
value.forEach((item, index) => validateValue(item, schema.items as ParameterSchema, path + "[" + index + "]"));
|
|
177
|
+
}
|
|
178
|
+
} else if (schema.type === "integer") {
|
|
179
|
+
if (typeof value !== "number" || !Number.isInteger(value)) {
|
|
180
|
+
throw new Error(path + " must be an integer");
|
|
181
|
+
}
|
|
182
|
+
} else if (schema.type === "number") {
|
|
183
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
184
|
+
throw new Error(path + " must be a number");
|
|
185
|
+
}
|
|
186
|
+
} else if (schema.type && valueType(value) !== schema.type) {
|
|
187
|
+
throw new Error(path + " must be a " + schema.type);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (schema.format === "address") {
|
|
191
|
+
if (typeof value !== "string" || !/^0x[0-9a-fA-F]{40}$/.test(value)) {
|
|
192
|
+
throw new Error(path + " must be an EVM address");
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const validateOverrideKeys = (
|
|
198
|
+
overrides: Record<string, unknown>,
|
|
199
|
+
schema: ParameterSchema,
|
|
200
|
+
path: string,
|
|
201
|
+
): void => {
|
|
202
|
+
const properties = schema.properties || {};
|
|
203
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
204
|
+
if (!Object.prototype.hasOwnProperty.call(properties, key)) {
|
|
205
|
+
throw new Error("Unknown override key: " + (path ? path + "." : "") + key);
|
|
206
|
+
}
|
|
207
|
+
const propertySchema = properties[key];
|
|
208
|
+
if (isObject(value) && propertySchema.type === "object") {
|
|
209
|
+
validateOverrideKeys(value, propertySchema, path ? path + "." + key : key);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const mergeValues = (
|
|
215
|
+
baseline: Record<string, unknown>,
|
|
216
|
+
overrides: Record<string, unknown>,
|
|
217
|
+
): Record<string, unknown> => {
|
|
218
|
+
const merged = cloneValue(baseline) as Record<string, unknown>;
|
|
219
|
+
for (const [key, override] of Object.entries(overrides)) {
|
|
220
|
+
const current = merged[key];
|
|
221
|
+
merged[key] = isObject(current) && isObject(override)
|
|
222
|
+
? mergeValues(current, override)
|
|
223
|
+
: cloneValue(override);
|
|
224
|
+
}
|
|
225
|
+
return merged;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export const resolveExecutionParameters = (
|
|
229
|
+
parameters: TaskParameters,
|
|
230
|
+
targetId: string,
|
|
231
|
+
overrides: Record<string, unknown>,
|
|
232
|
+
schema: ParameterSchema,
|
|
233
|
+
): Record<string, unknown> => {
|
|
234
|
+
const allParams = parameters.params || {};
|
|
235
|
+
const networkParams = allParams[targetId];
|
|
236
|
+
if (!networkParams) {
|
|
237
|
+
throw new Error("Missing parameters for target " + targetId);
|
|
238
|
+
}
|
|
239
|
+
const baseline = {
|
|
240
|
+
...cloneValue(networkParams) as Record<string, unknown>,
|
|
241
|
+
global: cloneValue(allParams.global || {}),
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
validateOverrideKeys(overrides, schema, "");
|
|
245
|
+
const resolved = mergeValues(baseline, overrides);
|
|
246
|
+
validateValue(resolved, { ...schema, type: schema.type || "object" }, "parameters");
|
|
247
|
+
return resolved;
|
|
248
|
+
};
|