-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
47 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "halo2-wasm" | ||
version = "0.2.11-rc.1" | ||
version = "0.2.12-alpha.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as os from "os"; | ||
import * as path from "path"; | ||
import * as fs from "fs"; | ||
import { fetchAndConvertToUint8Array } from "../shared/utils"; | ||
|
||
export const getKzgParams = async (k: number): Promise<Uint8Array> => { | ||
const home = os.homedir(); | ||
const axiomSrsPath = path.join( | ||
home, | ||
".axiom", | ||
"srs", | ||
"challenge_0085", | ||
`kzg_bn254_${k}.srs` | ||
); | ||
const exists = fs.existsSync(axiomSrsPath); | ||
if (exists) { | ||
const buffer = fs.readFileSync(axiomSrsPath); | ||
return new Uint8Array(buffer); | ||
} | ||
const folderPath = path.dirname(axiomSrsPath); | ||
if (!fs.existsSync(folderPath)) { | ||
fs.mkdirSync(folderPath, { recursive: true }); | ||
} | ||
if (k < 6 || k > 19) { | ||
throw new Error(`k=${k} is not supported`); | ||
} | ||
const srs = await fetchAndConvertToUint8Array( | ||
`https://axiom-crypto.s3.amazonaws.com/challenge_0085/kzg_bn254_${k}.srs` | ||
); | ||
fs.writeFileSync(axiomSrsPath, srs); | ||
|
||
return srs; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { fetchAndConvertToUint8Array } from "../shared/utils"; | ||
|
||
export const getKzgParams = async (k: number): Promise<Uint8Array> => { | ||
if (k < 6 || k > 19) { | ||
throw new Error(`k=${k} is not supported`); | ||
} | ||
return fetchAndConvertToUint8Array(`https://axiom-crypto.s3.amazonaws.com/challenge_0085/kzg_bn254_${k}.srs`); | ||
}; |