-
Couldn't load subscription status.
- Fork 162
[DNM] [native-prover] add a canary value to native prover, and then run it in a unit test #2591
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
Conversation
src/bindings/native/index.js
Outdated
| @@ -0,0 +1,3 @@ | |||
| const native = require('./index.node'); | |||
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.
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.
Ah I see, it needs to be loaded and built in mina
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "packageName": "plonk-napi" | |||
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.
So this is so you can import the canary in the unit test as import PlonkNapi from 'plonk-napi';?
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.
Yes correct
this is because the napi-rs package expects us to export this native module as a standalone npm package, rather than bundled together with our JS code.
I believe its so npm can decide which native bundle to download for the end-user, that way they don't grab every compiled binary for every version. (Also so they don't need rust to build and install an npm package).
I'm not sure what our plan for packaged and release was here, but we might need to do something like this, or we're going to implement the OS/ARCH switching ourselves?
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.
Maybe related to this issue #2415, linking here for future reference
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.
Ah perfect
| # package.json requires an empty `napi` object in order to read the config JSON | ||
| # we specify here | ||
| DEBUG="napi:*" napi build \ | ||
| --manifest-path ./src/mina/src/lib/crypto/proof-systems/plonk-napi/Cargo.toml \ |
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.
So should this replace
cargo build \
--manifest-path "${PLONK_NAPI_ROOT}/Cargo.toml" \
--release
I suppose the napi cli takes care of the different extensions for the dynamic library (depending on OS) and renames it to .node without needing us to do it manually?
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.
Yes correct.
We can also have it setup individual npm packages for us by specifying output locations and architectures (since I believe rust supports cross-compilation -- could also use docker/buildkit here)
It won't change the import paths, and as long as we have the js side exposed, everyone should be happy here
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.
Yes, that's a good idea, having separate folders for different architectures.
Regarding the replacement, then feel free to update the build.sh script so it won't build the dynamic library twice once we go for this approach.
fa819a9 to
d3e6aa6
Compare
d3e6aa6 to
d649643
Compare
|
Did several more inches of work here: I'm opting to leave the current loading for The JSOO process to compile the native plonk_wasm.js file requires that its a static JS file locally so that This process will allow us to load it in later in I hope I'm not jumping the gun here, but this is probably the right way to continue, since I'm OK to leave this as draft for now, since we also have a unit-test in |
|
request: decision
|
|
closing this because #2596 does this but way better |
No description provided.