Jack Grigg
19fed267e3
Use `cxx` bridge for all Orchard bundle inspection and validation
...
zcash/zcash#5987 added a bridge to `orchard::Bundle<Authorized, Amount>`
for `getrawtransaction`. This commit expands it to also cover the
consensus rules, by migrating over missing functionality from the
hand-written FFI methods, and exposing the Orchard `BatchValidator` type
directly (as with Sapling) instead of via the C++ `AuthValidator`
intermediary.
Part of zcash/zcash#6397 .
2023-04-07 12:16:28 +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
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
therealyingtong
acd45224bf
Use orchard_bundle ffi in getrawtransaction.
...
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2022-07-01 08:50:34 -04:00
Jack Grigg
d46e18f955
Batch-validate Orchard proofs as well as Orchard signatures
2022-07-01 01:24:15 +00: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
83c1938af3
Fix inconsistent caplitalization in copyright notices.
2022-05-11 16:40:25 -06:00
Kris Nuttycombe
6587b2ed86
Add Rust backend for Orchard components of the wallet.
...
Co-authored-by: str4d <thestr4d@gmail.com>
2022-02-17 17:50:17 -07: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
Kris Nuttycombe
f49f4c73d8
Rename OrchardMerkleTree -> OrchardMerkleFrontier
...
Remove IncrementalSinsemillaTree; this will be replaced by
a more full-featured OrchardWallet type which embeds the
incremental merkle tree used in wallet operations.
2021-11-23 07:27:34 -07:00
Homu
c34162d6dd
Auto merge of #5225 - LarryRuane:2021-06-v5-transaction, r=str4d
...
Implement v5 transaction consensus rules
Part of zcash/zcash#5196 .
2021-07-01 12:37:17 +00:00
Kris Nuttycombe
7a2be88768
ZIP 213: Add checks to support Orchard shielded coinbase outputs.
2021-07-01 12:42:37 +01:00
Kris Nuttycombe
6145cb8ae1
Prevent undefined behaviour in `CTransaction::GetValueOut()`
...
If `valueBalanceSapling` were `INT64_MIN`, the negation would be undefined
behaviour. Also, if `valueBalanceSapling` were a large-magnitude value
then `nValueOut += -valueBalanceSapling;` could overflow, which would be
undefined behaviour.
In practice neither of these cases can happen because `GetValueOut()` is
only called on non-contextually valid transactions, for which
`valueBalanceSapling` will have been checked to be in range.
`GetShieldedValueIn()` is similarly cleaned up for consistency.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-07-01 12:42:37 +01:00
Kris Nuttycombe
3aae84cc49
Add NU5 upper bound check on nSpendsSapling, nOutputsSapling, nActionsOrchard
...
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-07-01 12:41:25 +01:00
Larry Ruane
66de454a20
ZIP 225: v5 transaction check rules
2021-07-01 12:41:25 +01:00
Jack Grigg
8ad7371800
Include Orchard bundle in transaction dynamic usage
2021-06-29 15:05:46 +01:00
Kris Nuttycombe
fd34ecc64d
Return std::optional for GetAnchor
2021-06-23 16:06:30 -06:00
Kris Nuttycombe
437b8c488a
Orchard changes to coins & consensus.
2021-06-23 16:06:30 -06:00
Jack Grigg
1072cd4e3e
Check Orchard bundle-specific consensus rules, i.e. proofs
...
We are already checking the other bundle-specific consensus rules:
- Encodings are checked during transaction parsing.
- Signatures are batch-validated.
Closes zcash/zcash#5195 .
2021-06-21 18:33:57 +01:00
Jack Grigg
509e7c7d79
Implement Orchard pool value tracking
...
The ZIP 209 rules preventing the Sprout and Sapling pool values from
going negative, are extended to the Orchard pool.
2021-06-21 01:40:49 +01:00
Jack Grigg
16317bc6af
Use V2 history trees from NU5 onward
2021-06-18 12:35:53 +01:00
Kris Nuttycombe
2a2d87bac4
Move OrchardBundle to its own header file.
...
This is a prerequisite to the incremental merkle tree
work that otherwise would need to introduce a cyclic
dependency.
2021-06-17 12:37:04 -06:00