Chris Duncan [Sun, 23 Mar 2025 07:31:12 +0000 (00:31 -0700)]
Implement lazy initialization of both APIs. Parse CLI output with regex and try to print as JSON before falling back to text. Fix CLI statements that were causing issues with older versions of node. Fix getter type.
Chris Duncan [Thu, 20 Mar 2025 21:56:55 +0000 (14:56 -0700)]
Set up for v4
Add two new methods which align with Nano node RPC actions. Return more data from hash result. Indicate a more specific `threshold` by passing a full 16-character string to the new `work_` methods. Changed `NanoPowGl.size` property to return total pixel count. Add typings for request and response objects consumed by new `work_` methods. Add more tests for receive threshold edge cases. Improve build process. Expand documentation.
Chris Duncan [Sun, 16 Mar 2025 06:22:33 +0000 (23:22 -0700)]
Reorganize source directory structure.
Put documentation and test files into top-level folders. Divide PoW modules by API instead of by file type. Update file paths accordingly. Replace a duplicate sample blockhash.
Chris Duncan [Sat, 15 Mar 2025 19:22:11 +0000 (12:22 -0700)]
Updated cli to accept input from stdin like redirects and pipes. Add JSON output option to cli. Updated documentation for new cli features. Refactor gl draw shader to align with gpu compute shader on blake2b initialization. Update README license section. Rename file of test blockhashes since they are not work seeds.
Chris Duncan [Thu, 13 Mar 2025 16:31:26 +0000 (09:31 -0700)]
At just 2.8 KiB, the Terms page is the most lightweight chrome:// URL, so use it for CLI instead of chrome://newtab which is over 25 times larger at 74.0 KiB.
Chris Duncan [Thu, 13 Mar 2025 15:29:40 +0000 (08:29 -0700)]
Fix incorrect final digest XOR in threshold comparison to properly use initialized state instead of using default state without the necessary parameter block.
Chris Duncan [Thu, 13 Mar 2025 15:28:30 +0000 (08:28 -0700)]
Flip compute shader UBO property order to be consistent with GL draw shader and to allow properties to be added later without messing up alignment too much.
Chris Duncan [Thu, 13 Mar 2025 01:34:01 +0000 (18:34 -0700)]
Merge cli into main
Create command line tool using puppeteer that can be executed when
installed globally.
Write man page for cli.
Fix subtle bug in final XOR line of compute shader only observed when
using max threshold value.
Added test cases to check for max threshold bug in the future.
Reorganize compute shader v initialization to improve clarity.
Add more debugging output when flag is enabled.
Delay GL canvas initialization to allow it to fail gracefully in
unsupported environments.
Fix JSdoc comments.
Add bug report email to README.
Update dependencies.
Chris Duncan [Wed, 12 Mar 2025 21:09:52 +0000 (14:09 -0700)]
Fix subtle but important carry bit bug that allowed valid nonces to be generated that were technically incorrect but close enough to the correct value that it wasn't caught until now.
Chris Duncan [Tue, 11 Mar 2025 18:03:56 +0000 (11:03 -0700)]
Apply fix for WebGPU not loading in about:blank page but also rejecting HTML content overwrites in trusted chrome:// pages. Switch from complete overwrite of content to script injection.
Chris Duncan [Sun, 9 Mar 2025 09:20:49 +0000 (01:20 -0800)]
Use file contents injected directly into HTML string to load NanoPow into puppeteer browser page instance. Add flags marked by Chrome dev team. WebGPU still does not seem to work; this is using WebGL, but it is at least working.
Chris Duncan [Sat, 1 Mar 2025 06:19:48 +0000 (22:19 -0800)]
Overhaul both WebGPU and WebGL to use vec4 for parallel operation hinting on supported hardware. Refactor WebGL BLAKE2b to simplify pixel-coordinate-based nonce variation, to unroll main G mix function loop for performance, and to better differentiate between search and validate processes. Simplify vertex shader now that it is only required for drawing the fullscreen quad and not for pixel coordinates. Create new downsampling fragment shader which enables larger canvases and more nonces per frame without introducing lag due to synchronous readback. Maintain canvas between draw calls unless effort has changed. Attempt to handle WebGL context loss, with improved reset function, by reinitializing class. Reduce promise stack increases when waiting for query result. Fix color buffer clearing by using correct API function. Improve nonce seed generation in both WebGL and WebGPU by switching from crypto random to insecure random which is OK in the context of PoW. Reduce garbage collection by reusing static variables. Add debugging throughout that obeys user-provided debug flag which is now stored as a static variable as well. Add Typescript typings for new WebGL types. Fix minor issues with test page. Add benchmark results table.
Chris Duncan [Wed, 5 Feb 2025 14:18:33 +0000 (06:18 -0800)]
Found the culprit. Atomic exchange is actually 40ms slower than atomic load, so revert to conditional load-and-store. Makes sense, it's doing two operations.
Chris Duncan [Wed, 5 Feb 2025 05:01:41 +0000 (21:01 -0800)]
Benchmarking shows vec4 version actually ended up being slower, probably due to increased overhead and register pressure. Revert to vec2 implementation.