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 1 commit
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
28 changes: 15 additions & 13 deletions src/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { VerificationKey } from './types'
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 @@ -32,7 +32,8 @@ function parseVerificationKeyJSON(o: any): VerificationKey {
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,12 @@ export async function getDefaultRLNParams(treeDepth: number): Promise<IRLNParams
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`
console.log(url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(url)

Could you remove the console.logs?

console.log(wasmFileURL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(wasmFileURL)

console.log(finalZkeyURL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(finalZkeyURL)

const verificationKeyURL = `${url}/rln-20_vkey.json`
const verificationKey = await downloadVerificationKey(verificationKeyURL)
const [wasmFile, finalZkey] = await Promise.all([
downloadBinary(wasmFileURL),
Expand All @@ -63,8 +67,8 @@ export async function getDefaultRLNParams(treeDepth: number): Promise<IRLNParams
}

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 +78,3 @@ export async function getDefaultWithdrawParams(): Promise<IWithdrawParams> {
finalZkey,
}
}