Introduce librustzcash and Rust to depends system.
This commit is contained in:
@@ -751,7 +751,7 @@ CPPFLAGS="-I$LIBSNARK_INCDIR $CPPFLAGS"
|
|||||||
AC_CHECK_HEADER([libsnark/gadgetlib1/gadget.hpp],,AC_MSG_ERROR(libsnark headers missing))
|
AC_CHECK_HEADER([libsnark/gadgetlib1/gadget.hpp],,AC_MSG_ERROR(libsnark headers missing))
|
||||||
AC_CHECK_LIB([snark],[main],LIBSNARK_LIBS=-lsnark, [AC_MSG_ERROR(libsnark missing)], [-lgmpxx])
|
AC_CHECK_LIB([snark],[main],LIBSNARK_LIBS=-lsnark, [AC_MSG_ERROR(libsnark missing)], [-lgmpxx])
|
||||||
|
|
||||||
LIBZCASH_LIBS="-lsnark -lgmp -lgmpxx -lboost_system-mt -lcrypto -lsodium -fopenmp"
|
LIBZCASH_LIBS="-lrustzcash -lsnark -lgmp -lgmpxx -lboost_system-mt -lcrypto -lsodium -fopenmp"
|
||||||
|
|
||||||
CXXFLAGS_TEMP="$CXXFLAGS"
|
CXXFLAGS_TEMP="$CXXFLAGS"
|
||||||
LIBS_TEMP="$LIBS"
|
LIBS_TEMP="$LIBS"
|
||||||
|
|||||||
19
depends/packages/librustzcash.mk
Normal file
19
depends/packages/librustzcash.mk
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package=librustzcash
|
||||||
|
$(package)_version=0.1
|
||||||
|
$(package)_download_path=https://github.com/zcash/$(package)/archive/
|
||||||
|
$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
|
||||||
|
$(package)_download_file=$($(package)_git_commit).tar.gz
|
||||||
|
$(package)_sha256_hash=a5760a90d4a1045c8944204f29fa2a3cf2f800afee400f88bf89bbfe2cce1279
|
||||||
|
$(package)_git_commit=91348647a86201a9482ad4ad68398152dc3d635e
|
||||||
|
$(package)_dependencies=rust
|
||||||
|
|
||||||
|
define $(package)_build_cmds
|
||||||
|
cargo build --release
|
||||||
|
endef
|
||||||
|
|
||||||
|
define $(package)_stage_cmds
|
||||||
|
mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
||||||
|
mkdir $($(package)_staging_dir)$(host_prefix)/include/ && \
|
||||||
|
cp target/release/librustzcash.a $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
||||||
|
cp include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/
|
||||||
|
endef
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
zcash_packages := libsnark libgmp libsodium
|
zcash_packages := libsnark libgmp libsodium rust librustzcash
|
||||||
packages := boost openssl zeromq $(zcash_packages) googletest googlemock
|
packages := boost openssl zeromq $(zcash_packages) googletest googlemock
|
||||||
native_packages := native_ccache
|
native_packages := native_ccache
|
||||||
|
|
||||||
|
|||||||
9
depends/packages/rust.mk
Normal file
9
depends/packages/rust.mk
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package=rust
|
||||||
|
$(package)_version=1.16.0
|
||||||
|
$(package)_download_path=https://static.rust-lang.org/dist
|
||||||
|
$(package)_file_name=rust-$($(package)_version)-x86_64-unknown-linux-gnu.tar.gz
|
||||||
|
$(package)_sha256_hash=48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd
|
||||||
|
|
||||||
|
define $(package)_stage_cmds
|
||||||
|
./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
|
||||||
|
endef
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "pow.h"
|
#include "pow.h"
|
||||||
|
|
||||||
|
#include "librustzcash.h"
|
||||||
|
|
||||||
#include "arith_uint256.h"
|
#include "arith_uint256.h"
|
||||||
#include "chain.h"
|
#include "chain.h"
|
||||||
#include "chainparams.h"
|
#include "chainparams.h"
|
||||||
@@ -96,6 +98,12 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param
|
|||||||
// H(I||V||...
|
// H(I||V||...
|
||||||
crypto_generichash_blake2b_update(&state, (unsigned char*)&ss[0], ss.size());
|
crypto_generichash_blake2b_update(&state, (unsigned char*)&ss[0], ss.size());
|
||||||
|
|
||||||
|
// Ensure that our Rust interactions are working in production builds. This is
|
||||||
|
// temporary and should be removed.
|
||||||
|
{
|
||||||
|
assert(librustzcash_xor(0x0f0f0f0f0f0f0f0f, 0x1111111111111111) == 0x1e1e1e1e1e1e1e1e);
|
||||||
|
}
|
||||||
|
|
||||||
bool isValid;
|
bool isValid;
|
||||||
EhIsValidSolution(n, k, state, pblock->nSolution, isValid);
|
EhIsValidSolution(n, k, state, pblock->nSolution, isValid);
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
|
|||||||
Reference in New Issue
Block a user