Skip to content

Commit 199e872

Browse files
committed
bindings: logs for srs functions for debugging
1 parent 550855a commit 199e872

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/bindings/crypto/bindings/srs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function srsPerField(f: 'fp' | 'fq', wasm: Wasm, conversion: RustConversion) {
104104
let maybeLagrangeCommitment = (srs: WasmSrs, domain_size: number, i: number) => {
105105
try {
106106
console.log(3);
107-
console.log('srs', srs);
107+
console.log('srs wasm', srs);
108108
let bytes = (wasm as any)[`caml_${f}_srs_to_bytes_external`](srs);
109109
console.log('bytes', bytes);
110110
let wasmSrs = undefined;

src/bindings/crypto/napi-srs.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,18 @@ function srsPerField(f: 'fp' | 'fq', napi: Napi, conversion: RustConversion) {
103103

104104
let maybeLagrangeCommitment = (srs: NapiSrs, domain_size: number, i: number) => {
105105
try {
106-
return napi[`caml_${f}_srs_maybe_lagrange_commitment`](srs, domain_size, i);
106+
console.log(3);
107+
console.log('srs napi', srs);
108+
109+
/*let bytes = (napi as any)[`caml_${f}_srs_to_bytes`](srs);
110+
console.log('bytes', bytes);
111+
let wasmSrs = undefined;
112+
if (f === 'fp') wasmSrs = (napi as any)[`caml_${f}_srs_from_bytes`](bytes);
113+
else wasmSrs = (napi as any)[`caml_fq_srs_from_bytes`](bytes);
114+
*/
115+
let s = napi[`caml_${f}_srs_maybe_lagrange_commitment`](srs, domain_size, i);
116+
console.log('S', s);
117+
return s;
107118
} catch (error) {
108119
console.error(`Error in SRS maybe lagrange commitment for field ${f}`);
109120
throw error;
@@ -197,7 +208,8 @@ function srsPerField(f: 'fp' | 'fq', napi: Napi, conversion: RustConversion) {
197208
// happy, fast case: if basis is already stored on the srs, return the ith commitment
198209
let commitment = maybeLagrangeCommitment(srs, domainSize, i);
199210

200-
if (commitment === undefined) {
211+
if (commitment === undefined || commitment === null) {
212+
console.log("comm was undefined");
201213
if (cache === undefined) {
202214
// if there is no cache, recompute and store basis in memory
203215
commitment = lagrangeCommitment(srs, domainSize, i);
@@ -235,6 +247,7 @@ function srsPerField(f: 'fp' | 'fq', napi: Napi, conversion: RustConversion) {
235247
commitment = c;
236248
}
237249
}
250+
console.log("commitment was not undefined");
238251

239252
// edge case for when we have a writeable cache and the basis was already stored on the srs
240253
// but we didn't store it in the cache separately yet

0 commit comments

Comments
 (0)