Skip to content

Commit

Permalink
change to permanent urls
Browse files Browse the repository at this point in the history
  • Loading branch information
0xnakai committed Sep 23, 2023
1 parent 7a4a5af commit e013ac2
Showing 1 changed file with 15 additions and 13 deletions.
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)
console.log(wasmFileURL)
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,
}
}


0 comments on commit e013ac2

Please sign in to comment.