Chris Duncan [Fri, 27 Jun 2025 00:54:38 +0000 (17:54 -0700)]
Refactor BLAKE2b codegen.
Combine API-specific blake code generation files into one abstracted script.
Reset hashes between score benchmark runs so it doesn't pull from cache.
Chris Duncan [Sat, 21 Jun 2025 06:17:08 +0000 (23:17 -0700)]
Fix WASM in puppeteer.
The puppeteer browser instance loads NanoPow with a script and includes CSP. While it specifically uses WebGPU for performance, it was discovered that WASM would not load due to missing required CSP directives, so they have been added.
The reduced WASM iteration count has been reverted since it seems to be an issue with Firefox and not Chromium.
Adjust logging.
Chris Duncan [Fri, 20 Jun 2025 08:55:58 +0000 (01:55 -0700)]
Fix WASM workers.
Worker was removing listener when stopped but was then deaf to main thread, so restore listener after posting its message back.
Reduce WASM module iterations to get results more often from slower hardware.
Chris Duncan [Wed, 18 Jun 2025 20:21:44 +0000 (13:21 -0700)]
Unblock CPU loop.
CPU work_generate now returns a promise and iterates a limited loop before re-calling itself on the next animation frame. This unblocks the main thread and allows the environment to reload properly, i.e. refresh the browser tab.
Chris Duncan [Wed, 18 Jun 2025 14:29:42 +0000 (07:29 -0700)]
Move server execution into npm script.
This simplifies the bash script. It also allows the example systemd service to use a Type of "simple" and eliminates the PIDFile requirement. The console output is unnecessary when using systemd since the expectation is that logs go to the journal only.
Chris Duncan [Wed, 18 Jun 2025 14:29:42 +0000 (07:29 -0700)]
Move server execution into npm script.
This simplifies the bash script. It also allows the example systemd service to use a Type of "simple" and eliminates the PIDFile requirement. The console output is unnecessary when using systemd since the expectation is that logs go to the journal only.
Chris Duncan [Sat, 14 Jun 2025 18:41:48 +0000 (11:41 -0700)]
Add and update available APIs.
Add WASM and CPU implementations.
Add API options parameter.
Add scripts to generate shaders and AssemblyScript.
Add sample systemd service for server.
Add Logger and Queue utility classes.
Fix CLI and server IPC.
Add WorkErrorResponse type.
Improve type checking and config checking.
Move generate APIs into their own directory.
Chris Duncan [Tue, 6 May 2025 21:41:36 +0000 (14:41 -0700)]
Extract some basic shared code into utils file and bundle it. Simplify lib exports. Introduce new typings for server config and PoW results. Clean up CLI and fix some minor issues. Limit Node heap to improve CLI and server performance. Refactor server to extract code into manageable helper functions, improve organization, and fix some minor issues. Restrict difficulty to maximum of network difficulty to mitigate DoS attacks. Merge shared code in work calls in GPU implementation and extract it into modular functions. Implement work queue to better manage inbound requests. Fix nonce check in compute shader. Fix test page benchmark results from not being sorted properly. Update server test script.
Chris Duncan [Tue, 22 Apr 2025 21:52:14 +0000 (14:52 -0700)]
In CLI, capture logging from spawned server process. In compute shader, fix difficulty comparison of low bits, reduce workgroup size to 64, and update doc comments. In GPU, fix bug in load loop that checks for the GPU device, share bind group as static variable between pipelines, dispatch once on setup to compile and cache shader prior to actual work calls, save compute results in static variable to reduce memory footprint, lower timeout when tool is busy, allow difficulty of zero, eliminate a Math.random() call by implementing a sliding randomness value for the search seed, and throw an error if work to validate does not match nonce returned by compute result. In launch script, add max HTTP header size limit to protect server process. In test script, check more generate calls. In package, reduce run size of benchmark. In server, replace temp file for puppeteer page with intercepted HTTPS request to gain secure context for WebGPU, send logs over IPC to CLI, implement more constants for attack vector protection, add rate limiter using tokens per IP address, tweak error messaging, cache NanoPow library in puppeteer handle, split work calls by action for puppeteer evaluation, tweak puppeteer browser launch flags, and explicitly listen on localhost.
Chris Duncan [Mon, 14 Apr 2025 16:32:52 +0000 (09:32 -0700)]
Save server logs by day instead of by execution. Display server process ID on every log entry instead of just once when starting server. Adjust log timestamp formatting.
Chris Duncan [Mon, 14 Apr 2025 15:27:45 +0000 (08:27 -0700)]
Use SIGHUP to reload config except PORT which requires relaunching the server. Refactor CLI to spawn server as child process and get port from OS dynamically using IPC. Fix fast exit by handling SIGINT and SIGTERM ourselves.