-
-
Notifications
You must be signed in to change notification settings - Fork 387
feat: add non-SHA256 proof of work challenge method #1151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check-spelling found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Yes hello I would like to complain about the fact it still uses Go. Can't the rest of it be rewritten in Rust, so it can be more portable? |
With enough money, anything is possible :) |
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
…ng to go to bed Signed-off-by: Xe Iaso <[email protected]>
Update: wasm2js has a weird bug involving parsing the output of the Rust compiler. Gonna debug tomorrow when I'm not dog tired. I may need help from a WebAssembly expert on this. |
Trying this instead: https://www.npmjs.com/package/webassemblyjs |
Signed-off-by: Xe Iaso <[email protected]>
I broke the pure JS flow out into #1159. |
Closes #1159 This uses the binaryen tool wasm2js to compile the Anubis WASM blobs to JavaScript. This produces biblically large (520Ki) outputs when you inline both hashx and sha256 solvers, but this is a tradeoff that I'm willing to accept. The performance is good enough in my testing with JIT enabled. I fear that this may end up being terrible with JIT disabled. I have no idea if this will work on big endian or not. Signed-off-by: Xe Iaso <[email protected]>
Aha! I figured it out! I have to use wasm2js on the "baseline" build. This causes everything to work correctly. |
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
check-spelling run (pull_request) for Xe/wasm3 Signed-off-by: check-spelling-bot <[email protected]> on-behalf-of: @check-spelling <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
} | ||
|
||
// Example usage: | ||
const data = hexToUint8Array("98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4"); |
Check warning
Code scanning / check-spelling
Candidate Pattern Warning
} | ||
|
||
// Example usage: | ||
const data = hexToUint8Array("98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4"); |
Check warning
Code scanning / check-spelling
Candidate Pattern Warning
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
|
||
Anubis offers the following WebAssembly proof of work functions: | ||
|
||
- [hashx](#hashx) (via the [`hashx`](https://docs.rs/hashx/latest/hashx/index.html) crate) |
Check warning
Code scanning / check-spelling
Candidate Pattern Warning documentation
|
||
:::note | ||
|
||
The difficulty values for the WebAssembly based checks are going to be much higher than the equivalent difficulty values for the [JavaScript based checks](./proof-of-work.mdx). Generally these count the number of leading _bits_ that much match instead of the number of leading _nibbles_ that must match. Here's a rough translation table: |
Check failure
Code scanning / check-spelling
Forbidden Pattern Error documentation
|
||
:::note | ||
|
||
This is included mostly as a fallback for usecases that specifically require this hashing function. There are known tools that solve this particular challenge. Prefer [hashx](#hashx) unless you know what you are doing. |
Check failure
Code scanning / check-spelling
Unrecognized Spelling Error documentation
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
Closes #283
Closes #1116
Closes #1159
This adds Rust to the build closure of Anubis. Any complaints about this will be deleted.
Checklist:
[Unreleased]
section of docs/docs/CHANGELOG.mdnpm run test:integration
(unsupported on Windows, please use WSL)