@tokamak-private-dapps/private-state-cli 0.1.0 → 0.1.1
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/CHANGELOG.md +4 -0
- package/README.md +4 -0
- package/package.json +1 -1
- package/private-state-bridge-cli.mjs +3 -48
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -59,6 +59,10 @@ Wallet data is encrypted with the password supplied to `join-channel` or `recove
|
|
|
59
59
|
Proof-backed commands require installed bridge, DApp, and Groth16 artifacts. Run `private-state-cli --install` before
|
|
60
60
|
using bridge-facing commands on a new machine.
|
|
61
61
|
|
|
62
|
+
Channel balance commands such as `deposit-channel` and `withdraw-channel` use the installed Groth16 runtime workspace
|
|
63
|
+
directly. Proof generation writes to the fixed workspace paths under `~/tokamak-private-channels/groth16/proof`; the CLI
|
|
64
|
+
does not pass custom `--zkey`, proof-output, or public-output paths to the Groth16 prover.
|
|
65
|
+
|
|
62
66
|
Release order matters for npm publication. `@tokamak-private-dapps/common-library` and
|
|
63
67
|
`@tokamak-private-dapps/groth16` must be published before this package version.
|
|
64
68
|
|
package/package.json
CHANGED
|
@@ -3351,7 +3351,6 @@ async function assertWorkspaceAlignedWithChain(context) {
|
|
|
3351
3351
|
}
|
|
3352
3352
|
|
|
3353
3353
|
async function buildGrothTransition({ operationDir, workspace, stateManager, vaultAddress, keyHex, nextValue }) {
|
|
3354
|
-
const grothArtifacts = loadGroth16UpdateTreeArtifacts(Number(workspace.chainId));
|
|
3355
3354
|
const vaultAddressObj = createAddressFromString(vaultAddress);
|
|
3356
3355
|
const keyBigInt = ethers.toBigInt(keyHex);
|
|
3357
3356
|
const proof = stateManager.merkleTrees.getProof(vaultAddressObj, keyBigInt);
|
|
@@ -3378,22 +3377,14 @@ async function buildGrothTransition({ operationDir, workspace, stateManager, vau
|
|
|
3378
3377
|
};
|
|
3379
3378
|
|
|
3380
3379
|
const inputPath = path.join(operationDir, "input.json");
|
|
3381
|
-
const proofOutputPath = path.join(operationDir, "proof.json");
|
|
3382
|
-
const publicOutputPath = path.join(operationDir, "public.json");
|
|
3383
3380
|
writeJson(inputPath, input);
|
|
3384
|
-
await generateUpdateTreeProof([
|
|
3381
|
+
const proofManifest = await generateUpdateTreeProof([
|
|
3385
3382
|
"--input",
|
|
3386
3383
|
inputPath,
|
|
3387
|
-
"--zkey",
|
|
3388
|
-
grothArtifacts.zkeyPath,
|
|
3389
|
-
"--proof-output",
|
|
3390
|
-
proofOutputPath,
|
|
3391
|
-
"--public-output",
|
|
3392
|
-
publicOutputPath,
|
|
3393
3384
|
]);
|
|
3394
3385
|
|
|
3395
|
-
const proofJson = readJson(
|
|
3396
|
-
const publicSignals = readJson(
|
|
3386
|
+
const proofJson = readJson(proofManifest.proofPath);
|
|
3387
|
+
const publicSignals = readJson(proofManifest.publicPath);
|
|
3397
3388
|
|
|
3398
3389
|
return {
|
|
3399
3390
|
input,
|
|
@@ -4153,42 +4144,6 @@ function networkNameFromChainId(chainId) {
|
|
|
4153
4144
|
throw new Error(`Unsupported chain ID for private-state bridge CLI: ${chainId}`);
|
|
4154
4145
|
}
|
|
4155
4146
|
|
|
4156
|
-
function groth16UpdateTreeManifestPath(chainId) {
|
|
4157
|
-
return requireFlatDeploymentArtifactPathsForChainId(chainId).grothManifestPath;
|
|
4158
|
-
}
|
|
4159
|
-
|
|
4160
|
-
function resolveDeployManifestArtifactPath(manifestPath, artifactPath) {
|
|
4161
|
-
expect(
|
|
4162
|
-
typeof artifactPath === "string" && artifactPath.length > 0,
|
|
4163
|
-
`Invalid artifact path entry in ${manifestPath}.`,
|
|
4164
|
-
);
|
|
4165
|
-
return path.isAbsolute(artifactPath)
|
|
4166
|
-
? artifactPath
|
|
4167
|
-
: path.resolve(path.dirname(manifestPath), artifactPath);
|
|
4168
|
-
}
|
|
4169
|
-
|
|
4170
|
-
function loadGroth16UpdateTreeArtifacts(chainId) {
|
|
4171
|
-
const manifestPath = groth16UpdateTreeManifestPath(chainId);
|
|
4172
|
-
expect(
|
|
4173
|
-
fs.existsSync(manifestPath),
|
|
4174
|
-
`Missing Groth16 updateTree manifest for chain ${chainId}: ${manifestPath}.`,
|
|
4175
|
-
);
|
|
4176
|
-
|
|
4177
|
-
const manifest = readJson(manifestPath);
|
|
4178
|
-
const zkeyPath = resolveDeployManifestArtifactPath(manifestPath, manifest.artifacts?.zkeyPath);
|
|
4179
|
-
|
|
4180
|
-
for (const [label, artifactPath] of [
|
|
4181
|
-
["Groth16 updateTree proving key", zkeyPath],
|
|
4182
|
-
]) {
|
|
4183
|
-
expect(fs.existsSync(artifactPath), `Missing ${label} for chain ${chainId}: ${artifactPath}.`);
|
|
4184
|
-
}
|
|
4185
|
-
|
|
4186
|
-
return {
|
|
4187
|
-
manifestPath,
|
|
4188
|
-
zkeyPath,
|
|
4189
|
-
};
|
|
4190
|
-
}
|
|
4191
|
-
|
|
4192
4147
|
function findStorageSlot(storageLayoutManifest, contractName, label) {
|
|
4193
4148
|
const contract = storageLayoutManifest.contracts[contractName];
|
|
4194
4149
|
if (!contract) {
|