Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change to permanent urls #107

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions src/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
import axios from 'axios'

type ICircuitParams = {
wasmFile: string | Uint8Array,
finalZkey: string | Uint8Array,
wasmFile: string | Uint8Array;
finalZkey: string | Uint8Array;
}

type IRLNParams = ICircuitParams & { verificationKey: VerificationKey }
type IWithdrawParams = ICircuitParams

// TODO: Change to a more permanent URL after trusted setup is complete
const resourcesURL = 'https://rln-resources-temp.s3.us-west-1.amazonaws.com/resources'
const resourcesURL =
'https://rln-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits'
const rln20URL = `${resourcesURL}/rln-20`
const withdrawURL = `${resourcesURL}/withdraw`
const withdrawURL = `${resourcesURL}/rln-withdraw`
const treeDepthToDefaultRLNParamsURL = {
'20': rln20URL,
}
Expand All @@ -23,7 +23,7 @@
return new Uint8Array(resp.data)
}

function parseVerificationKeyJSON(o: any): VerificationKey {

Check warning on line 26 in src/resources.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
// NOTE: This is not a complete check, to do better we can check values are of the correct type
if (!o.protocol) throw new Error('Verification key has no protocol')
if (!o.curve) throw new Error('Verification key has no curve')
Expand All @@ -32,7 +32,8 @@
if (!o.vk_beta_2) throw new Error('Verification key has no vk_beta_2')
if (!o.vk_gamma_2) throw new Error('Verification key has no vk_gamma_2')
if (!o.vk_delta_2) throw new Error('Verification key has no vk_delta_2')
if (!o.vk_alphabeta_12) throw new Error('Verification key has no vk_alphabeta_12')
if (!o.vk_alphabeta_12)
throw new Error('Verification key has no vk_alphabeta_12')
if (!o.IC) throw new Error('Verification key has no IC')
return o
}
Expand All @@ -47,9 +48,9 @@
if (!url) {
return undefined
}
const wasmFileURL = `${url}/circuit.wasm`
const finalZkeyURL = `${url}/final.zkey`
const verificationKeyURL = `${url}/verification_key.json`
const wasmFileURL = `${url}/RLN-20.wasm`
const finalZkeyURL = `${url}/contributions/rln-20_final.zkey`
const verificationKeyURL = `${url}/rln-20_vkey.json`
const verificationKey = await downloadVerificationKey(verificationKeyURL)
const [wasmFile, finalZkey] = await Promise.all([
downloadBinary(wasmFileURL),
Expand All @@ -63,8 +64,8 @@
}

export async function getDefaultWithdrawParams(): Promise<IWithdrawParams> {
const wasmFileURL = `${withdrawURL}/circuit.wasm`
const finalZkeyURL = `${withdrawURL}/final.zkey`
const wasmFileURL = `${withdrawURL}/RLN-Withdraw.wasm`
const finalZkeyURL = `${withdrawURL}/contributions/rln-withdraw_final.zkey`
const [wasmFile, finalZkey] = await Promise.all([
downloadBinary(wasmFileURL),
downloadBinary(finalZkeyURL),
Expand All @@ -74,5 +75,3 @@
finalZkey,
}
}


Loading