Commit Graph

84 Commits

Author SHA1 Message Date
Greg Pfeil d0522df5c0
Many z_mergetoaddress updates
- add ZIP 317 support
- address review comments
- restructure `AsyncRPCOperation_mergetoaddress` (removing the just-added
  `prepare`)
2023-04-20 01:24:39 -06:00
Greg Pfeil 94f5bfc595
Update z_mergetoaddress to use WalletTxBuilder
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Co-authored-by: Jack Grigg <jack@z.cash>
2023-04-19 22:26:42 -06:00
Jack Grigg b1dc94249c rust: Migrate Ed25519 FFI to `cxx` 2023-04-11 16:36:26 +00:00
Daira Emma Hopwood 6bb8c60f41 Use the new `examine` macro to replace all instances of
`std::visit(match {...}, specimen)`, improving code readability.

For ease of review, this commit includes only obviously correct
transformations that all follow the same pattern.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-04 21:26:39 +01:00
Kris Nuttycombe 3cec519ce4 scripted-diff: Update Zcash copyrights to 2023
-BEGIN VERIFY SCRIPT-
for party in "The Zcash developers" "The Bitcoin Core developers" "Bitcoin Developers"; do
  sed -i"" -e "s#Copyright (c) \([0-9]\{4\}\)\(-[0-9]\{4\}\)\? $party#Copyright (c) \1-2023 $party#" COPYING
  sed -i"" -e "s#\(.*\)\([0-9]\{4\}\)\(-[0-9]\{4\}\)\, $party#\1\2-2023, $party#" contrib/debian/copyright
done

sed -i"" -e "s/define(_COPYRIGHT_YEAR, [0-9]\{4\})/define(_COPYRIGHT_YEAR, 2023)/" configure.ac
sed -i"" -e "s/#define COPYRIGHT_YEAR [0-9]\{4\}/#define COPYRIGHT_YEAR 2023/" src/clientversion.h

git grep "^// Copyright (c) .* The Zcash developers" \
  | awk -F ':' '{print $1}' \
  | xargs -I {} sed -i"" -e "s#// Copyright (c) \([0-9]\{4\}\)\(-[0-9]\{4\}\)\? The Zcash developers#// Copyright (c) \1-2023 The Zcash developers#" {}
-END VERIFY SCRIPT-
2023-01-23 11:31:54 -07:00
Greg Pfeil 659077aff2 Propagate asOfHeight to all relevant RPC calls
This removes the default `std::nullopt`[^1] and threads `asOfHeight` through the
call graph, only using `std::nullopt` where it is unconditionally correct (e.g.,
where we would be creating a tx, and thus need the actual chain tip).

This does not change deprecated or legacy operations.

[^1]: Having a default makes it easy to miss call sites that should be
      updated. If a default is deemed useful, it should be added in a separate
      commit, so that all call sites can be reviewed in an earlier commit.
2022-11-18 01:20:00 -07: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
Kris Nuttycombe 5ae1772d2b scripted-diff: Update Zcash copyrights to 2022
-BEGIN VERIFY SCRIPT-
git grep "// Copyright (c) .* The Zcash developers" \
  | awk -F ':' '{print $1}' \
  | xargs -I {} sed -i"" -e "s#// Copyright (c) \([0-9]\{4\}\)\(-[0-9]\{4\}\)\? The Zcash developers#// Copyright (c) \1-2022 The Zcash developers#" {}
-END VERIFY SCRIPT-
2022-05-11 16:47:12 -06:00
Kris Nuttycombe 99e41f36c1 Gracefully handle Get(Sprout/Sapling)NoteWitnesses failure. 2022-05-05 12:29:40 -06:00
Kris Nuttycombe 90fc0eaa43 Add anchor depth parameter to Get*NoteWitnesses 2022-05-04 16:04:21 -06:00
Jack Grigg 9e9f58b26f Merge branch 'master' into unify-nu5-consensus-changes 2022-03-23 02:57:16 +00:00
Jack Grigg bb4e792c84 Merge branch 'master' into feature/wallet_orchard-orchard_sendmany 2022-02-25 00:33:28 +00:00
Kris Nuttycombe 73a75a37fe Make SaveRecipientMappings polymorphic in RecipientMapping type. 2022-02-17 08:55:59 -07:00
Jack Grigg 96d6ee0b8f Update ZIP 244 implementation
This brings in the changes that align the transparent parts of ZIP 244
with BIP 341.
2022-02-16 03:29:42 +00:00
Jack Grigg 2da0856e6f Add Orchard recipient support to the transaction builder
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2022-02-15 23:28:55 +00:00
Jack Grigg 80f478e67e Make `PrecomputedTransactionData` a required argument of `SignatureHash`
The ZIP 244 changes mean that we're going to need to alter every
callsite to pass through all of the transparent `CTxOut`s being spent.
Given that we need to pass it over to Rust, it makes more sense to just
have `PrecomputedTransactionData` be the vehicle for conveying this data
across.
2022-02-15 02:42:14 +00:00
therealyingtong c7346e802e SendTransaction: Introduce recipients argument. 2022-02-15 09:50:00 +08:00
Kris Nuttycombe 9702b47e2a Use libzcash::PaymentAddress instead of std::string in mergetoaddress 2022-01-07 11:49:09 -07:00
Kris Nuttycombe 20266ac911 Remove uses of KeyIO::DecodeDestination 2022-01-07 11:49:07 -07:00
Kris Nuttycombe b305ad2892 Remove the `InvalidEncoding` type from key & address variants.
The presence of this variant results in a situation where more
of the code than necessary needs to be aware of and handle
decoding failures. This change moves all handling of decoding
failures to the point of decoding.
2022-01-06 13:44:45 -07:00
Pieter Wuille ec4196d8cf Use SipHash-2-4 for CCoinsCache index
This is ~1.7x slower than the Lookup3-of-Xor-with-salt construct we were
using before, but it is a primitive designed for exactly this.

Zcash: Propagate CCoinsKeyHasher -> SaltedTxidHasher changes to where
we've used CCoinsKeyHasher outside of its original scope.
2021-02-11 11:10:42 -07:00
Jack Grigg 79ad5984b1 Remove JSDescription::h_sig
This removes the zcash/JoinSplit.hpp dependency from
primitives/transaction.cpp, and thus from libzcashconsensus.
2020-12-20 22:42:22 +00:00
Jack Grigg b1aa9365af Add JSDescriptionInfo for constructing JSDescriptions
This matches the existing transaction builder structs:
- SpendDescriptionInfo
- OutputDescriptionInfo
- TransparentInputInfo

It also removes the dependency of the transaction format on the proving
system.
2020-12-20 22:42:22 +00:00
Jack Grigg d8d0918951 scripted-diff: Migrate from boost::optional to std::optional
-BEGIN VERIFY SCRIPT-
sed -i 's/boost::none/std::nullopt/g' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ./src/*/*/*.h* ./src/*/*/*.cpp ;
sed -i 's/boost::optional/std::optional/g' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ./src/*/*/*.h* ./src/*/*/*.cpp ;
sed -i 's/std::optional<\(.*\)&>/std::optional<std::reference_wrapper<\1>>/' ./src/*/*.h ./src/*/*.cpp ;
sed -i 's/is_initialized()/has_value()/' ./src/*.cpp ./src/*/*.cpp ;
sed -i ':a;N;$!ba;s/#include <boost\/optional.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i ':a;N;$!ba;s/#include "boost\/optional.hpp"\n//' ./src/*.h ;
-END VERIFY SCRIPT-
2020-12-16 22:59:35 +00:00
Jack Grigg d9928926f3 Migrate from boost::optional::get to boost::optional::value
std::optional only has std::optional::value.
2020-12-16 22:59:34 +00:00
Jack Grigg b521cb8932 scripted-diff: Migrate from boost::variant to std::variant
-BEGIN VERIFY SCRIPT-
sed -i 's/boost::variant/std::variant/' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ;
sed -i 's/boost::get<\(.*\)>(&/std::get_if<\1>(\&/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.cpp ;
sed -i 's/boost::get</std::get</' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.cpp ;
sed -i 's/boost::apply_visitor(/std::visit(/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ;
sed -i 's/class \(.*\)\b \?: public boost::static_visitor<.*>/class \1/' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ;
sed -i ':a;N;$!ba;s/#include <boost\/variant\(\/.*\)\?.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ;
sed -i ':a;N;$!ba;s/#include "boost\/variant\/.*.hpp"\n//' ./src/*/*.cpp ;
-END VERIFY SCRIPT-
2020-12-16 22:49:53 +00:00
Jack Grigg f68c79554f Add <variant> header to files that will need it 2020-12-16 22:48:21 +00:00
Jack Grigg efb4246ad3 Replace libsodium's crypto_sign with ed25519-zebra
crypto_sign_verify_detached is still used within the consensus rules
until Canopy activation. ed25519-zebra generates signatures that are
valid under both pre- and post-Canopy rules (for our honest usage),
so we can use it to generate transaction signatures now. Then once
Canopy activates, we can remove the remaining usages of crypto_sign.
2020-08-20 19:00:47 +01:00
Jack Grigg ba1f455e5d wallet: Fix logging to satisfy constexpr requirements 2020-08-07 15:26:28 +01:00
Homu b6547929c9 Auto merge of #4593 - str4d:proofverifier-refactor, r=str4d
Refactor ProofVerifier

`ProofVerifier` was previously used to conditionally verify pre-Sapling Sprout
proofs (based on `ProofVerifier::Strict` or `ProofVerifier::Disabled` being
used), but hybrid Sprout proofs bypassed it (so were being verified multiple
times during block verification), and once `libsnark` was removed in
zcash/zcash#4060 `ProofVerifier::check` was doing nothing.

This PR refactors `ProofVerifier`, moving it out of the `libzcash` compilation
unit (so that it can depend on `primitives/transaction.h`), and moving Sprout
verification from `JSDescription::Verify` to `ProofVerifier::VerifySprout`.
Verification-skipping for Sprout proofs is re-introduced.

Additionally, the `ZCJoinSplit` global is removed from the codebase, and
`ZCJoinSplit::prove` is converted into a static function. We load the hybrid
Sprout parameters dynamically at proving time within the Rust code, and no
longer require a C++ global for any proving parameters.

As a side-effect, `libzcashconsensus.la` building with `--with-libs` is fixed,
as `primitives/transaction.cpp` no longer depends on `librustzcash.h`.
2020-08-07 12:16:59 +00:00
Kris Nuttycombe 07ff0d19a0 Make evident the relationship between chainparams and key IO. 2020-07-09 17:48:47 -06:00
Jack Grigg 042bd12a5c Move JSDescription::Verify to ProofVerifier::VerifySprout 2020-07-08 13:59:47 +12:00
Jack Grigg 35765ec9de Move ProofVerifier out of the libzcash namespace
It needs to be closer to the root of our dependency tree, so that it can
depend on the transaction format. The libzcash compilation unit is
further from the dependency tree root than the transaction format.
2020-07-08 13:59:47 +12:00
Jack Grigg 7e2558d2e2 Make ZCJoinSplit::prove static and remove ZCJoinSplit globals
We don't support making pre-Sapling JoinSplit proofs, and we load the
parameters for post-Sapling JoinSplit proofs at proving time, so there
is no need for a global ZCJoinSplit to be passed through the APIs.
2020-07-08 13:59:47 +12:00
Homu 72edd11bd9 Auto merge of #4486 - defuse:fix-undefined-behavior-in-gtest, r=daira
Fix undefined behavior in gtest tests
2020-05-27 23:47:58 +00:00
Taylor Hornby e0ab57ee36 Add univalue to updatecheck.py and update univalue, removing calls to deprecated methods 2020-05-14 12:42:19 -06:00
Taylor Hornby 39ca21845a Fix undefined behavior in gtest tests 2020-04-30 17:16:53 -06:00
Alfredo Garcia 04012a62c1 refactor experimental features 2020-03-06 07:48:33 -03:00
Dagur Valberg Johannsson fe1ff82a7d Remove option mempooltxinputlimit
This option is no longer used after Overwinter. Fixes #4209.
2019-11-19 10:35:39 +01:00
Jack Grigg fe3cb8ec93
Remove makeGrothProof argument from JoinSplit::prove 2019-09-16 13:10:54 +01:00
Homu 2528af69ff Auto merge of #4025 - bitcartel:shorter_block_target_interval_zip208, r=daira
Implement ZIP 208: Shorter Block Target Spacing

Closes #3690.
2019-08-09 02:35:30 -07:00
Homu 2300b911f8 Auto merge of #4035 - Eirik0:use-committransaction, r=str4d
Use CommitTransaction

This enables `-walletbroadcast` to correctly control transactions created with `z_*` APIs. It also addresses some TODOs in the code and consolidates some repeated logic.

Closes #4077 (because `CommitTransaction` calls `KeepKey` on the transparent change address).
2019-08-01 03:04:06 -07:00
Eirik Ogilvie-Wigley 2c6c55261d Make NetworkUpgradeAvailable a method of Params 2019-07-29 14:47:06 -06:00
Daira Hopwood bc909a7a7f Replace http with https: in links to the MIT license.
Also change MIT/X11 to just MIT, since no distinction was intended.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2019-07-18 15:26:01 +01:00
Dimitris Apostolou f57f76d789
Rename vjoinsplit to vJoinSplit 2019-06-16 19:13:49 +03:00
Eirik0 27f91abf00 Allow passing optional reserve key as a parameter to SendTransaction 2019-05-28 20:10:42 -06:00
Eirik0 d3d8fb7221 Inline sign_send_raw_transaction 2019-05-28 17:58:49 -06:00
Eirik0 23d9826ef9 Fix LogPrint statements 2019-05-10 17:25:30 -06:00
Eirik0 0e06801e12 Move reused sign and send logic 2019-05-10 12:45:14 -06:00
Eirik0 a7a52d2424 Move reused async rpc send logic to separate file 2019-05-10 12:20:52 -06:00