Commit Graph

415 Commits

Author SHA1 Message Date
Daira Emma Hopwood c111bff3d7 Implement `GetUnpaidActionCount` and `GetWeightRatio` for ZIP 317.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-19 20:04:51 +01:00
Jack Grigg b1dc94249c rust: Migrate Ed25519 FFI to `cxx` 2023-04-11 16:36:26 +00:00
Jack Grigg 7b005aaa7a Expand `CppStream` to cover all `Stream`-like C++ types
In its existing usage, `CppStream` was only used in a context where the
C++ `READWRITE` macro was being called with a `CDataStream`. However, in
other contexts the macro can be called with various other types with a
stream-like interface. Since we can't expose C++ templates across the
`cxx` bridge (or FFI generally), we instead turn `CppStream` into an
enum that covers all of the stream-like types we may want to use.
2023-04-06 21:30:38 +00:00
Jack Grigg 33367709f7 Merge most `cxx::bridge` definitions into a single bridge
This enables us to use Rust types across more bridged APIs, which we
can't do with multiple bridge definitions until `cxx` adds support.
2023-04-05 10:50:35 +00:00
Kris Nuttycombe b3dbfb1ddd
Merge pull request #6527 from daira/zip317-computations
ZIP 317 preparation: fix bitrotted miner tests and add conventional fee computations
2023-04-04 16:30:51 -06:00
Greg Pfeil 1aac7c0c32
Split C++ generated from Rust into own lib
This allows us to compile it with different flags. In particular, there are
warnings we can’t easily fix in the generated code.
2023-04-03 18:09:30 -06:00
Daira Emma Hopwood 4fd3493291 Implement ZIP 317 computations.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-03 23:05:50 +01:00
Greg Pfeil 666a8d1b37
Merge pull request #6377 from sellout/wallet_tx_builder/z_sendmany
Extract common transaction logic from z_sendmany
2023-03-22 11:24:33 -06:00
Kris Nuttycombe 659030aa46
Merge pull request #6460 from daira/generalize-weighted-map
Refactoring to split the weighted tx tree out of mempool_limit.{cpp,h} and make it more reusable
2023-03-14 13:47:48 -06:00
Kris Nuttycombe 98391a3a92
Merge pull request #6478 from zcash/fix/distclean_rust_gen
Fix `make distclean` to recursively remove `rust/gen`
2023-03-13 17:02:33 -06:00
Kris Nuttycombe 245f35e034 Fix `make distclean` to recursively remove `rust/gen`
`make distclean` currently fails with:

```
rm -f rust/gen
rm: cannot remove 'rust/gen': Is a directory
make[2]: *** [Makefile:10025: clean-local] Error 1
```
2023-03-13 10:12:01 -06:00
Kris Nuttycombe 228ba99150 Fix a longstanding zcashd build warning
Fixes zcash/zcash#2348
2023-03-13 10:11:26 -06:00
Evan Klitzke 4966b7a221 Fix automake warnings when running autogen.sh
(cherry picked from commit f8c66972ddc2a70f5015497436870e2af6833ecc)
2023-03-13 10:11:26 -06:00
Kris Nuttycombe 78e76f1332
Add a wallet-aware transaction builder.
This factors several pieces out from asyncrpcoperation_sendmany
to form the foundation of a new two-stage transaction construction
process.
2023-03-09 13:03:48 -07:00
Daira Hopwood 16099d66b6 Refactoring to split the weighted tx tree out of mempool_limit.{cpp,h}
and make it more reusable.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2023-03-08 16:03:34 +00:00
Jack Grigg 817276c02f rust: Migrate `OrchardMerkleFrontier` to `cxx`
Closes zcash/zcash#6333.
2023-01-24 21:04:48 +00:00
Jack Grigg 908675b5b9 rust: Add `cxx` version of `RustStream` 2023-01-24 04:15:09 +00:00
Kris Nuttycombe 9c600a5582 Factor out memo parsing from asyncrpcoperation_sendmany 2022-12-06 15:23:55 -07:00
Jack Grigg 5609706d9b build: Build Rust library and binaries at the same time
This enables `cargo` to parallelize the library and binary builds
internally, reducing the Rust build time by the build time of the
binaries (because they are overall faster than the library build).

Part of zcash/zcash#6065.
2022-08-29 11:27:20 +00:00
Kris Nuttycombe f84a57e71b
Merge pull request #6106 from centromere/fix-compile-and-linker-errors
Fix compile and linker errors
2022-08-23 07:36:06 -06:00
Jack Grigg a125180a50 rust: Add P2PKH signature checking to `zcash-inspect`
Co-authored-by: ying tong <yingtong@z.cash>
2022-08-19 04:13:05 +00:00
Jack Grigg 8d82cee9c8 rust: Add `zcash-inspect` binary for inspecting Zcash data
Currently supports Zcash blocks, block headers, and transactions. Some
consensus rules are also checked, and a JSON context object can be
optionally passed to provide any necessary details for extra contextual
consensus checks.
2022-08-19 04:13:05 +00:00
Kris Nuttycombe df6e05173e
Merge pull request #6083 from zcash/leveldb-1.22
Update LevelDB to 1.22+
2022-08-10 18:14:43 -06:00
Alex Wied f5c93e7d1d build: Reorder link targets to properly build on Nix 2022-07-29 15:30:58 -04:00
sasha d326b8ba45 Add cuckoocache.h to Makefile.am
Like c85fae833e, the missing header ref
means that the `make dist` step of gitian builds don't include it in the
tarball, causing an error upon build.
2022-07-22 18:00:59 -07:00
Kris Nuttycombe e3e5465438
Merge pull request #6088 from str4d/wallet-batch-scanner
Use multithreaded batched trial decryption for Sapling outputs
2022-07-22 14:09:50 -06:00
Jack Grigg 8190815526 rust: Implement multithreaded batched trial decryption for Sapling 2022-07-22 15:46:41 +00:00
Wladimir J. van der Laan e657d91020 build: CRC32C build system integration
(cherry picked from commit bitcoin/bitcoin@9ebdf04757)
2022-07-16 11:47:21 +00:00
Pieter Wuille 3dd25777f4 Add SHA256 implementation using using Intel SHA intrinsics
(cherry picked from commit bitcoin/bitcoin@4c935e2eee)
2022-07-16 10:13:26 +00:00
Pieter Wuille ae3dc3f134 8-way AVX2 implementation for double SHA256 on 64-byte inputs
(cherry picked from commit bitcoin/bitcoin@4437d6e1f3)
2022-07-16 10:13:26 +00:00
Pieter Wuille 25dc154eef 4-way SSE4.1 implementation for double SHA256 on 64-byte inputs
(cherry picked from commit bitcoin/bitcoin@230294bf5f)
2022-07-16 10:13:26 +00:00
Wladimir J. van der Laan 22b28e2e30 build: Rename --enable-experimental-asm to --enable-asm and enable by default
Now that 0.15 is branched off, enable assembler SHA256 optimizations by default.

(cherry picked from commit bitcoin/bitcoin@ce5381e7fe)
2022-07-16 10:13:26 +00:00
Pieter Wuille 7b93eb28fa Protect SSE4 code behind a compile-time flag
(cherry picked from commit bitcoin/bitcoin@6b8d872e5e)
2022-07-16 10:13:26 +00:00
Pieter Wuille c9b583bc0d Add SSE4 based SHA256
(cherry picked from commit bitcoin/bitcoin@c1ccb15b0e)
2022-07-16 10:13:26 +00:00
Jack Grigg 087c85ec03 Cache Sapling and Orchard bundle validation
This adds two new CuckooCaches in validation, each caching whether all
of a transaction bundle's proofs and signatures were valid.

Bundles which match the validation cache never have proofs or signatures
added to the batch validators. For blocks where all transactions have
been previously observed in the mempool, the final validation of the
batches should be a no-op.

Part of zcash/zcash#6049.
2022-07-13 15:49:37 +00:00
Pieter Wuille a8086dd41f Add merkle.{h,cpp}, generic merkle root/branch algorithm
(cherry picked from commit bitcoin/bitcoin@ee60e5625b)
2022-07-08 22:24:19 +00:00
Kris Nuttycombe e03b964abf
Merge pull request #6043 from nuttycom/backport/14555-move_util_files_to_dir
scripted-diff: Move util files to separate directory.
2022-07-06 12:00:14 -06:00
Kris Nuttycombe 71b6a59ec3 scripted-diff: Move utiltest to src/util
-BEGIN VERIFY SCRIPT-
git mv src/utiltest.h src/util/test.h
git mv src/utiltest.cpp src/util/test.cpp
sed -i -e 's/"utiltest\.h"/"util\/test\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/ZCASH_UTILTEST_H/ZCASH_UTIL_TEST_H/g' src/util/test.h
sed -i -e 's/utiltest\.\(h\|cpp\)/util\/test\.\1/g' src/Makefile.am
-END VERIFY SCRIPT-
2022-07-06 10:25:28 -06:00
Sean Bowe 6c51df37b4 Introduce new Sapling verification API via cxx and switch consensus rules to use the new API. 2022-07-03 22:38:32 -06:00
Jim Posen 9a7e2c153d scripted-diff: Move util files to separate directory.
-BEGIN VERIFY SCRIPT-
mkdir -p src/util
git mv src/util.h src/util/system.h
git mv src/util.cpp src/util/system.cpp
git mv src/utilmoneystr.h src/util/moneystr.h
git mv src/utilmoneystr.cpp src/util/moneystr.cpp
git mv src/utilstrencodings.h src/util/strencodings.h
git mv src/utilstrencodings.cpp src/util/strencodings.cpp
git mv src/utiltime.h src/util/time.h
git mv src/utiltime.cpp src/util/time.cpp

sed -i -e 's/"util\.h"/"util\/system\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
git checkout HEAD -- src/secp256k1 # exclude secp256k1, which has its own "util.h"
sed -i -e 's/"utilmoneystr\.h"/"util\/moneystr\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/"utilstrencodings\.h"/"util\/strencodings\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/"utiltime\.h"/"util\/time\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')

sed -i -e 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
sed -i -e 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
sed -i -e 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
sed -i -e 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h

sed -i -e 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
sed -i -e 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
sed -i -e 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
sed -i -e 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am

sed -i -e 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i -e 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i -e 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
-END VERIFY SCRIPT-
2022-07-01 17:50:09 -06:00
therealyingtong d18fcc7092 Add orchard_bundle FFI.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2022-07-01 08:50:34 -04:00
Jack Grigg df08281f25 Migrate BLAKE2b Rust FFI to `cxx` 2022-05-27 20:15:05 +00:00
Jack Grigg 54aeb2c408 Migrate Equihash Rust FFI to `cxx`
This integrates `cxxbridge` into the build system, adding its generated
source files to `libzcash`. We currently need to manually specify each
Rust file containing a bridge description.
2022-05-27 20:15:05 +00:00
Jack Grigg 7a46e8365f build: Add non-verbose output for `cargo build`
Now that we're passing a bunch of extra environment variables, it makes
more sense to have the same verbosity level as for C++ compilation.
2022-05-27 20:15:05 +00:00
Jack Grigg b91caeb5b5 build: Pass `CC` etc. flags through to `cargo build`
These are needed by cxx so that when it builds its internal C++ glue
logic, it uses the same C++ compiler and flags as our top-level build.
In particular, this ensures that it links against the libc++ symbols.
2022-05-27 20:15:05 +00:00
sasha c85fae833e Add missing wallet/orchard.h to src/Makefile.am
Like 562f5add87, the missing header ref
means that the make dist step of gitian builds don't include it in the
tarball, causing an error upon build.
2022-03-22 17:03:16 -07:00
Kris Nuttycombe b73ca36c45 Merge remote-tracking branch 'upstream/master' into feature/wallet_orchard 2022-03-18 19:19:50 -06:00
Jack Grigg 562f5add87 build: Add missing `util/match.h` to `src/Makefile.am`
The missing header reference meant that Gitian builds didn't include the
file in its distribution step, causing subsequent builds to fail with a
'file not found' error.

Closes zcash/zcash#5697.
2022-03-18 02:54:26 +00:00
Kris Nuttycombe 80324bc653 Merge remote-tracking branch 'upstream/master' into feature/wallet_orchard-merge_master 2022-03-17 16:52:49 -06:00
Jack Grigg 22c6bf88a3 build: Fix `zcash/address/orchard.hpp` filename in `src/Makefile.am`
The incorrect extension caused `make distdir-am` to fail due to a
missing rule for the header file.

Closes zcash/zcash#5694.
2022-03-17 19:38:10 +00:00