Skip to content

Commit dbf6979

Browse files
committed
fix: populate SHA256 Prover.toml and show public inputs in demo UI
1 parent 3050b3b commit dbf6979

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
input = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2+
3+
expected = [102, 104, 122, 173, 248, 98, 189, 119, 108, 143, 193, 139, 142, 159, 142, 32, 8, 151, 20, 133, 110, 226, 51, 179, 144, 42, 89, 29, 13, 95, 41, 37]

playground/wasm-demo/src/demo-web.mjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,29 @@ async function runDemo() {
442442
log(`Proof size: ${(proofSize / 1024).toFixed(1)} KB`);
443443
log(`Proving time: ${(proofTime / 1000).toFixed(2)}s`);
444444

445+
try {
446+
const proofJson = JSON.parse(new TextDecoder().decode(proofBytes));
447+
const pi = proofJson.public_inputs;
448+
if (pi && pi.length > 0) {
449+
const values = pi.map(hex => {
450+
const be = hex.match(/.{2}/g).slice().reverse().join('');
451+
return BigInt('0x' + be);
452+
});
453+
const allBytes = values.every(v => v < 256n);
454+
if (allBytes) {
455+
const hexStr = values.map(v => v.toString(16).padStart(2, '0')).join('');
456+
log(`Public inputs (${pi.length}): 0x${hexStr}`);
457+
} else {
458+
log(`Public inputs (${pi.length}):`);
459+
for (let i = 0; i < values.length; i++) {
460+
log(` [${i}]: 0x${values[i].toString(16)}`);
461+
}
462+
}
463+
}
464+
} catch (_) {
465+
// non-critical — proof bytes may not be JSON in all modes
466+
}
467+
445468
updateStep(4, `Done (${(proofTime / 1000).toFixed(2)}s)`, "success");
446469

447470
lastProofBytes = proofBytes;

0 commit comments

Comments
 (0)