Skip to content
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

Merged
merged 2 commits into from
Mar 21, 2017

Conversation

ebfull
Copy link
Contributor

@ebfull ebfull commented Mar 15, 2017

Introduces Rust into the build system and brings a trivial xor operation into the code (near where we will likely be working).

@ebfull
Copy link
Contributor Author

ebfull commented Mar 15, 2017

@zkbot try

@zkbot
Copy link
Contributor

zkbot commented Mar 15, 2017

⌛ Trying commit e1e9daa with merge 9638725...

@zkbot
Copy link
Contributor

zkbot commented Mar 15, 2017

💔 Test failed - zcash

@ebfull
Copy link
Contributor Author

ebfull commented Mar 15, 2017

@zkbot try

@zkbot
Copy link
Contributor

zkbot commented Mar 15, 2017

⌛ Trying commit 48409a1 with merge a9f6c45...

zkbot added a commit that referenced this pull request Mar 15, 2017
[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.
@daira
Copy link
Contributor

daira commented Mar 15, 2017

Can we call it librustzcash?

@ebfull
Copy link
Contributor Author

ebfull commented Mar 15, 2017

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.

@zkbot
Copy link
Contributor

zkbot commented Mar 15, 2017

☀️ Test successful - zcash

@ebfull ebfull changed the title [WIP] Introduce Rust into the zcash build system Introduce Rust/librustzcash into the zcash build system Mar 17, 2017
@ebfull
Copy link
Contributor Author

ebfull commented Mar 17, 2017

I named it librustzcash and this PR is ready for review.

@zkbot
Copy link
Contributor

zkbot commented Mar 17, 2017

⌛ Trying commit 6a0c7ce with merge a609d36...

@zkbot
Copy link
Contributor

zkbot commented Mar 17, 2017

☀️ Test successful - zcash

@bitcartel
Copy link
Contributor

We should disable this by default since there is no actual rust based functionality yet. Add an option to build.sh to enable it.

@daira
Copy link
Contributor

daira commented Mar 18, 2017

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.

@ebfull
Copy link
Contributor Author

ebfull commented Mar 18, 2017

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 --disable-rust flag unless users experience problems. This is because I don't want us to get in the habit of making Rust an optional dependency and keeping track of consistency between duplicated Rust and C++ functionality. Also, I don't forsee long before features are integrated into Zcash that are only written in Rust, so such a flag would be short lived anyway.

@ebfull
Copy link
Contributor Author

ebfull commented Mar 18, 2017

Ideally, this PR could be accepted and placed into the 1.0.8 release.

@daira
Copy link
Contributor

daira commented Mar 18, 2017

As release manager for 1.0.8, I'd accept this but only with a --disable-rust flag, because I want us to be able to tell people to use that if they do encounter problems. Later we'll remove the flag (at the point where we start depending on Rust for anything that isn't optional).

@daira
Copy link
Contributor

daira commented Mar 18, 2017

Concept ACK (and the code looks good too). Needs --disable-rust to go into 1.0.8.

@daira daira added this to the 1.0.8 milestone Mar 18, 2017
@ebfull
Copy link
Contributor Author

ebfull commented Mar 18, 2017

Alright, will add that soon.

@ebfull
Copy link
Contributor Author

ebfull commented Mar 18, 2017

Done.

@zkbot try

@zkbot
Copy link
Contributor

zkbot commented Mar 18, 2017

⌛ Trying commit 802ea76 with merge 92b65dc...

zkbot added a commit that referenced this pull request Mar 18, 2017
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).
@zkbot
Copy link
Contributor

zkbot commented Mar 18, 2017

☀️ Test successful - zcash

Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK.

Copy link
Contributor

@str4d str4d left a 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:
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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. 😊

Copy link
Contributor Author

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],
Copy link
Contributor

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.

Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: indentation.

Copy link
Contributor Author

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"
Copy link
Contributor

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.

Copy link
Contributor Author

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!

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@ebfull
Copy link
Contributor Author

ebfull commented Mar 21, 2017

@zkbot r+

@zkbot
Copy link
Contributor

zkbot commented Mar 21, 2017

📌 Commit 802ea76 has been approved by ebfull

@zkbot
Copy link
Contributor

zkbot commented Mar 21, 2017

⌛ Testing commit 802ea76 with merge acb65cd...

@zkbot
Copy link
Contributor

zkbot commented Mar 21, 2017

💔 Test failed - zcash

@ebfull
Copy link
Contributor Author

ebfull commented Mar 21, 2017

This PR previously passed the test suite. What's this about?

@ebfull
Copy link
Contributor Author

ebfull commented Mar 21, 2017

@zkbot retry

@zkbot
Copy link
Contributor

zkbot commented Mar 21, 2017

⌛ Testing commit 802ea76 with merge 3b11e24...

zkbot added a commit that referenced this pull request Mar 21, 2017
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).
@daira
Copy link
Contributor

daira commented Mar 21, 2017

@ebfull wrote:

This PR previously passed the test suite. What's this about?

Race condition in the failing test? (rpc-tests/prioritisetransaction.py)

@zkbot
Copy link
Contributor

zkbot commented Mar 21, 2017

☀️ Test successful - zcash

@ebfull
Copy link
Contributor Author

ebfull commented Mar 21, 2017

Filed #2193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L-rust Involves Rust code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants