Skip to content

Commit adec220

Browse files
committed
Set precompute to 0 (faster initialization)
1 parent fd5da31 commit adec220

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The `loadKZG()` function returns an object that implements the KZG interface wit
3535

3636
#### `loadTrustedSetup(trustedSetup?, precompute?)`
3737
```ts
38-
loadTrustedSetup(trustedSetup: TrustedSetup = mainnetTrustedSetup, precompute: number = 8): number
38+
loadTrustedSetup(trustedSetup: TrustedSetup = mainnetTrustedSetup, precompute: number = 0): number
3939
```
4040
Loads a trusted setup for KZG operations. Returns 0 on success, non-zero on failure.
4141

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const BYTES_PER_CELL = 2048
2929
*
3030
* @returns object - the KZG methods required for all 4844 related operations
3131
*/
32-
export const loadKZG = async (precompute: number = 8, trustedSetup: TrustedSetup = mainnetTrustedSetup) => {
32+
export const loadKZG = async (precompute: number = 0, trustedSetup: TrustedSetup = mainnetTrustedSetup) => {
3333
// In Node.js environment, preload the WASM binary to avoid path resolution issues
3434
let wasmBinary = await loadWasmModule();
3535

@@ -55,7 +55,7 @@ export const loadKZG = async (precompute: number = 8, trustedSetup: TrustedSetup
5555
* @param trustedSetup - an optional trusted setup parameter provided by the user
5656
* @returns 0 if loaded successfully or non zero otherwise
5757
*/
58-
const loadTrustedSetup = (precompute: number = 8, trustedSetup: TrustedSetup = mainnetTrustedSetup) => {
58+
const loadTrustedSetup = (precompute: number = 0, trustedSetup: TrustedSetup = mainnetTrustedSetup) => {
5959
if(trustedSetup.g1_monomial.length != 48 * 4096 * 2) {
6060
throw new Error(`trusted setup g1_monomial must be 48 * 4096 bytes long, not ${trustedSetup.g1_monomial.length}`)
6161
}

test/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('kzg initialization', () => {
2222

2323
it('should throw when invalid trusted setup is provided', () => {
2424
assert.throws(() => {
25-
kzg.loadTrustedSetup(8, { g1_monomial: 'x12', g1_lagrange: 'bad coordinates', g2_monomial: 'x12'})
25+
kzg.loadTrustedSetup(0, { g1_monomial: 'x12', g1_lagrange: 'bad coordinates', g2_monomial: 'x12'})
2626
})
2727
})
2828
})

0 commit comments

Comments
 (0)