mirror of
https://github.com/vacp2p/rln-interep-contract.git
synced 2025-02-28 06:00:43 +00:00
feat: add the old snark artifacts that interep uses
This commit is contained in:
parent
6c972f51b6
commit
82888ab3ba
@ -3,7 +3,6 @@ import { ethers } from "ethers";
|
||||
import { createInterepProof, sToBytes32 } from "../common";
|
||||
// @ts-ignore circom
|
||||
import { poseidon } from "circomlibjs";
|
||||
import fs from "fs";
|
||||
|
||||
import { address, abi } from "../deployments/localhost_integration/RLN.json";
|
||||
|
||||
|
13
e2e/get-proof.ts
Normal file
13
e2e/get-proof.ts
Normal file
@ -0,0 +1,13 @@
|
||||
async function main() {
|
||||
const { getProof } = await import("./utils");
|
||||
const proof = await getProof();
|
||||
console.log(proof);
|
||||
console.log("SOLIDITY PROOF: ", JSON.stringify(proof.solidityProof));
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
42
e2e/utils.ts
Normal file
42
e2e/utils.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import createIdentity from "@interep/identity";
|
||||
import createProof from "@interep/proof";
|
||||
import { ethers } from "ethers";
|
||||
// @ts-ignore
|
||||
import { poseidon } from "circomlibjs";
|
||||
import { sToBytes32 } from "../common";
|
||||
|
||||
// if length is not 64 pad with 0
|
||||
const pad = (str: string): string => (str.length === 64 ? str : pad("0" + str));
|
||||
|
||||
export async function getCredentials() {
|
||||
const signer = new ethers.Wallet("0x" + process.env.PRIVATE_KEY);
|
||||
const identity = await createIdentity(
|
||||
(msg) => signer.signMessage(msg),
|
||||
"Github"
|
||||
);
|
||||
console.log("ID COMMITMENT: " + pad(identity.getCommitment().toString(16)));
|
||||
console.log(
|
||||
"ID KEY: " +
|
||||
pad(
|
||||
poseidon([identity.getNullifier(), identity.getTrapdoor()]).toString(16)
|
||||
)
|
||||
);
|
||||
return identity;
|
||||
}
|
||||
|
||||
export async function getProof() {
|
||||
const identity = await getCredentials();
|
||||
const proof = await createProof(
|
||||
identity,
|
||||
"github",
|
||||
"bronze",
|
||||
1,
|
||||
sToBytes32("foo"),
|
||||
{
|
||||
wasmFilePath: "./test/oldSnarkArtifacts/semaphore.wasm",
|
||||
zkeyFilePath: "./test/oldSnarkArtifacts/semaphore.zkey",
|
||||
},
|
||||
"goerli"
|
||||
);
|
||||
return proof;
|
||||
}
|
BIN
test/oldSnarkArtifacts/semaphore.wasm
Normal file
BIN
test/oldSnarkArtifacts/semaphore.wasm
Normal file
Binary file not shown.
BIN
test/oldSnarkArtifacts/semaphore.zkey
Normal file
BIN
test/oldSnarkArtifacts/semaphore.zkey
Normal file
Binary file not shown.
@ -386,13 +386,13 @@
|
||||
const checkChain = async (chainId) => {
|
||||
retrieveRLNDetailsButton.disabled = retrievedRLNEvents || chainId !== 5;
|
||||
registerButton.disabled = !(chainId === 5 && retrievedRLNEvents);
|
||||
if (chainId !== 31337) {
|
||||
alert("Switch to Localhost");
|
||||
if (chainId !== 5) {
|
||||
alert("Switch to Goerli");
|
||||
}
|
||||
};
|
||||
|
||||
const rlnDeployBlk = 0;
|
||||
const rlnAddress = "0x962a95edCDdcEBbB5A703f1357494009F1A10244";
|
||||
const rlnDeployBlk = 8059743;
|
||||
const rlnAddress = "0xCd41a0aC28c5c025779eAC3208D0bF23baa3a5b6";
|
||||
const rlnAbi = [
|
||||
{
|
||||
inputs: [
|
||||
|
Loading…
x
Reference in New Issue
Block a user