From a03350f08592abd0d405ba1c24389cb0c5c92725 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Wed, 15 Jul 2026 19:10:23 -0700 Subject: [PATCH] Whitespace and documentation. --- src/lib/generate/webgpu/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/generate/webgpu/index.ts b/src/lib/generate/webgpu/index.ts index 881b423..f773c53 100644 --- a/src/lib/generate/webgpu/index.ts +++ b/src/lib/generate/webgpu/index.ts @@ -243,7 +243,6 @@ async function check (dispatchIndex: number): Promise { logger.log('OUTPUT', resultViews[dispatchIndex]) if (resultViews[dispatchIndex] == null) throw new Error('failed to get data from resultBuffer.') return !!resultViews[dispatchIndex].getUint32(0, true) - } catch (err) { logger.log(err) throw new Error('failed to read results from compute pass', { cause: err }) @@ -251,8 +250,8 @@ async function check (dispatchIndex: number): Promise { } /** -* Map CPU buffer to GPU, read results to static result object, and unmap. -*/ + * Map CPU buffer to GPU, read results to static result object, and unmap. + */ function read (dispatchIndex: number): { work: bigint, difficulty: bigint } { logger.log('reading results from compute pass') try { @@ -269,6 +268,12 @@ function read (dispatchIndex: number): { work: bigint, difficulty: bigint } { /** * Nano proof-of-work using WebGPU. + * + * @param {bigint} hash - 32-byte BLAKE2b hash of Nano block + * @param {bigint} difficulty - 8-byte work threshold + * @param {number} effort - threads per dispatch (256n)² + * @param {boolean} debug - enables or disables logger output + * @returns {Promise} */ export async function generate (hash: bigint, difficulty: bigint, effort: number, debug: boolean): Promise { logger.isEnabled = debug -- 2.52.0