-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Introduce Rust/librustzcash into the zcash build system #2183
Conversation
@zkbot try |
⌛ Trying commit e1e9daa with merge 9638725... |
💔 Test failed - zcash |
@zkbot try |
[WIP] Introduce Rust into the zcash build system This is currently just an experiment to see what kind of weird linking and building problems might arise.
Can we call it librustzcash? |
I'm a little worried about the name we give it. There could be a ton of different things we'd want to call "zcash" or "rust-zcash" in the Rust namespace-land. |
☀️ Test successful - zcash |
48409a1
to
6a0c7ce
Compare
I named it |
⌛ Trying commit 6a0c7ce with merge a609d36... |
☀️ Test successful - zcash |
We should disable this by default since there is no actual rust based functionality yet. Add an option to build.sh to enable it. |
I was thinking that if we're sure that we will be using Rust in future, then we should include this by default and add an option to disable it, since then we'll see any build/dependency problems that users run into. |
I think we are absolutely going to be integrating Rust code into Zcash this year. We need to ensure that there aren't any problems with deterministic builds, linking, etc. and get versions of Zcash shipping with Rust before we start implementing or using Rust code in Zcash. As a result we absolutely should enable this by default. I would even argue against a |
Ideally, this PR could be accepted and placed into the 1.0.8 release. |
As release manager for 1.0.8, I'd accept this but only with a |
Concept ACK (and the code looks good too). Needs |
Alright, will add that soon. |
Done. @zkbot try |
Introduce Rust/librustzcash into the zcash build system Introduces Rust into the build system and brings a trivial xor operation into the code (near where we will likely be working).
☀️ Test successful - zcash |
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.
utACK.
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.
utACK, with non-blocking comments.
@@ -73,9 +76,17 @@ then | |||
shift | |||
fi | |||
|
|||
# If --disable-rust is the next argument, disable Rust code: |
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.
In #2120 I added a CONFIGURE_FLAGS
env var for passing flags to ./configure
; I think that's a more extensible way to proceed.
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.
Hmm, in this case it might be necessary because of the NO_RUST
argument to the depends system. So I'm non-blocking on this now, as it will be removed anyway once we make Rust a required dependency.
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 push to this PR with what you're talking about? I'm on my laptop. 😊
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.
Oh, you're saying it's not blocking. Never mind then.
@@ -88,6 +88,12 @@ AC_ARG_ENABLE([mining], | |||
[enable_mining=$enableval], | |||
[enable_mining=yes]) | |||
|
|||
AC_ARG_ENABLE([rust], | |||
[AS_HELP_STRING([--enable-rust], |
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.
Should be --disable-rust
here and in the help text (but leaving enable_rust
as-is), as the default is to enable. Upstream has fixed this for e.g. the wallet, and I should have done the same for -mining
when I added it. Non-blocking, as AC_ARG_ENABLE
transparently defines --disable-foo
as --enable-foo=no
.
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.
(In an engineering meeting we decided not to make --disable-rust
the default, but to add it to the User Guide instead. #2191)
@@ -96,6 +100,14 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param | |||
// H(I||V||... | |||
crypto_generichash_blake2b_update(&state, (unsigned char*)&ss[0], ss.size()); | |||
|
|||
#ifdef ENABLE_RUST |
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.
Non-blocking: indentation.
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 prefer this indentation while simultaneously disliking precompiler macros like this.
RUST_LIBS="-lrustzcash" | ||
fi | ||
|
||
LIBZCASH_LIBS="-lsnark -lgmp -lgmpxx -lboost_system-mt -lcrypto -lsodium -fopenmp $RUST_LIBS" |
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.
Is there a reason why -lrustzcash
is moved to the end? AFAICT it shouldn't make a difference, but when we revert this commit it might matter.
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 put it at the end deliberately because it should help when we need to link against libsodium in Rust. Nice observation though!
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.
Actually, I think the linker will want -lsodium
to appear after -lrustzcash
in that case. We can deal with it later.
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.
In that case, simply reverting the PR should be fine, because it will shift -lrustzcash
back before -lsodium
.
@zkbot r+ |
📌 Commit 802ea76 has been approved by |
⌛ Testing commit 802ea76 with merge acb65cd... |
💔 Test failed - zcash |
This PR previously passed the test suite. What's this about? |
@zkbot retry |
Introduce Rust/librustzcash into the zcash build system Introduces Rust into the build system and brings a trivial xor operation into the code (near where we will likely be working).
@ebfull wrote:
Race condition in the failing test? (rpc-tests/prioritisetransaction.py) |
☀️ Test successful - zcash |
Filed #2193 |
Introduces Rust into the build system and brings a trivial xor operation into the code (near where we will likely be working).