This commit is contained in:
0xtsukino
2022-10-11 14:52:03 -05:00
parent 97a9001957
commit b652a83bdb
2 changed files with 33 additions and 8 deletions

View File

@@ -307,15 +307,16 @@ export const submitZKPRPost = (post: Post) => async (dispatch: Dispatch, getStat
} = post.toJSON();
const externalNullifier = genExternalNullifier('POST');
const wasmFilePath = `${config.indexerAPI}/dev/semaphore_wasm`;
const finalZkeyPath = `${config.indexerAPI}/dev/semaphore_final_zkey`;
const wasmFilePath = `${config.indexerAPI}/circuits/rln/wasm`;
const finalZkeyPath = `${config.indexerAPI}/circuits/rln/zkey`;
const { fullProof } = await zkpr.semaphoreProof(
const {proof, publicSignals} = await zkpr.rlnProof(
externalNullifier,
hash,
wasmFilePath,
finalZkeyPath,
'',
await sha256('zkpost'),
{
root: root.toString(),
leaf: identityCommitment,
@@ -324,10 +325,10 @@ export const submitZKPRPost = (post: Post) => async (dispatch: Dispatch, getStat
}
)
const {
proof,
publicSignals,
} = fullProof;
// const {
// proof,
// publicSignals,
// } = fullProof;
try {
// @ts-ignore

View File

@@ -7,7 +7,7 @@ import {Identity} from "../serviceWorkers/identity";
import {postWorkerMessage} from "../util/sw";
import {selectIdentity, setIdentity} from "../serviceWorkers/util";
import {Dispatch} from "redux";
import {SemaphoreFullProof, SemaphoreSolidityProof, MerkleProof} from "@zk-kit/protocols";
import {SemaphoreFullProof, SemaphoreSolidityProof, MerkleProof, RLNFullProof} from "@zk-kit/protocols";
enum ActionTypes {
SET_LOADING = 'zkpr/setLoading',
@@ -257,4 +257,28 @@ export class ZKPR {
merkleProof,
);
}
async rlnProof(
externalNullifier: string,
signal: string,
circuitFilePath: string,
zkeyFilePath: string,
merkleProofArtifactsOrStorageAddress: string | {
leaves: string[];
depth: number;
leavesPerNode: number;
},
rlnIdentifier: string,
merkleProof?: MerkleProof,
): Promise<RLNFullProof> {
return this.client.rlnProof(
externalNullifier,
signal,
circuitFilePath,
zkeyFilePath,
merkleProofArtifactsOrStorageAddress,
rlnIdentifier,
merkleProof,
);
}
}