-
Notifications
You must be signed in to change notification settings - Fork 554
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
[Nix] package snarkyjs, client_sdk, mina-signer #11092
Conversation
sed -i 's/function failwith(s){throw \[0,Failure,s\]/function failwith(s){throw joo_global_object.Error(s.c)/' "$BINDINGS_PATH"/snarky_js_node.bc.js | ||
sed -i 's/function invalid_arg(s){throw \[0,Invalid_argument,s\]/function invalid_arg(s){throw joo_global_object.Error(s.c)/' "$BINDINGS_PATH"/snarky_js_node.bc.js | ||
sed -i 's/return \[0,Exn,t\]/return joo_global_object.Error(t.c)/' "$BINDINGS_PATH"/snarky_js_node.bc.js |
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.
Eww
But I see why it's needed
c282c8f
to
b082f0e
Compare
No, I'd prefer if they stay where they are
This is not important, that script is not documented to the outside world, only used for snarkyjs development right now |
a9830f0
to
68014c1
Compare
b8844d8
to
2132add
Compare
4338c49
to
530eae6
Compare
724e652
to
0b0c5fe
Compare
dfbe8cf
to
8501943
Compare
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.
Not really a fan of this. Can you make a version that doesn't change what dune is doing?
packages.snarky_js = nix-npm-buildPackage.buildNpmPackage { | ||
src = ./src/lib/snarky_js_bindings/snarkyjs; | ||
preBuild = '' | ||
BINDINGS_PATH=./dist/server/node_bindings |
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.
Isn't there a script that we can run to do this? Or does it need to be inlined 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.
It's currently inside ./scripts/build-snarkyjs-node.sh
, but it should probably be somewhere else, possibly on the ocaml side.
(target dune-build-root) | ||
(deps (sandbox none)) | ||
(action | ||
(system "echo -n $(realpath %{workspace_root}/..) > %{target}"))) |
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.
Can you revert this? The workspace root isn't necessarily at the top of the project if its vendored.
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.
I want to set the cargo target path explicitly (to _build/cargo_...
), instead of letting cargo find one, because, depending on the build order, it sometimes finds _build/default/src/lib/crypto/target
, if that workspace Cargo.toml
file happens to be copied over. Also because cargo metadata
does some checks that depend on the entire workspace.
Maybe %{project_root}
could be the way to go?
fcb1131
to
0e86061
Compare
@mrmr1993 I'd like to talk about this some more. I basically need a Cargo.lock file for the Would you be open to discuss ways to improve this situation? |
Previously, we were letting cargo autodetect a cargo directory, which was dependent on the workspace. dune would not copy src/lib/crypto/Cargo.toml, and so cargo would find the mina root workspace (/Cargo.toml) from the source directory. However, we shouldn't rely on dune not copying this file, or use the target directory from this workspace. Now, we calculate the path _build/cargo_kimchi_{wasm,bindgen,stubs}, and provide it to cargo via $CARGO_TARGET_DIR. This simplifies some code and allows for more determinism.
Tested using dune build --sandbox=symlinks
0e86061
to
e00ff8d
Compare
The Nix code was still missing builds for client_sdk, snarkyjs and mina-signer. This PR:
jest
as a dependency)Things left to do:
snarky-run
work with this package