str4d
5675a4eed4
Fix typo in method documentation
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-07-19 12:44:05 +01:00
Homu
5802be3427
Auto merge of #5254 - zcash:ci-lints, r=str4d
...
CI: Add workflow that runs lints
2021-07-16 21:29:23 +00:00
Jack Grigg
4026386cac
CI: Add Rust lints
2021-07-14 23:11:02 +01:00
Jack Grigg
b54b416d68
CI: Check scripted diffs
2021-07-14 22:58:05 +01:00
Jack Grigg
29280b9821
CI: Add workflow that runs general lints
2021-07-14 22:19:40 +01:00
Jack Grigg
612f250814
Pass network type through to UA address handling logic
2021-07-13 13:40:13 +01:00
Jack Grigg
776e9c5a4b
Add support for decoding and encoding Unified Addresses
2021-07-13 03:22:47 +01:00
Jack Grigg
990bc46b2b
Use a visitor for handling -mineraddress config option
...
This makes it easier to add UA support.
2021-07-13 03:21:54 +01:00
Jack Grigg
22ffee8da6
Use `libzcash::RawAddress` in `CWallet::GetFilteredNotes`
...
`getBalanceZaddr` is modified to take an optional `RawAddress` instead of
a string. This limits it to showing the balance of a single protocol
address, which is fine: `z_getbalance` is the only user of this function,
and we are deprecating that RPC method (replacing it with RPC methods that
can show more detailed information for UAs).
`CWallet::GetNullifiersForAddresses` and `CWallet::IsNote*Change` now use
`RawAddress` because they are generally fed the same addresses as
`GetFilteredNotes`, and in the context of specific notes we need to work
with protocol addresses.
2021-07-13 03:21:54 +01:00
Jack Grigg
6f1a54cd16
Introduce libzcash::RawAddress type
...
Currently, `libzcash::PaymentAddress` serves two purposes: it represents
the result of parsing a string encoding provided by a user, and it holds
the possible shielded protocol addresses that can be used in transaction
outputs. In order to add support for Unified Addresses, we split these
purposes across two separate types.
We also add two new visitors to enable converting between these types:
- `RecipientForPaymentAddress` returns the "preferred protocol address"
that should be used in transaction outputs, or `std::nullopt` if the
payment address encoding was invalid.
- `GetRawAddresses` returns all protocol addresses contained within the
given payment address, or an empty set if the payment address encoding
was invalid.
For the existing address encodings, the implementations of these are
trivial.
2021-07-13 03:21:54 +01:00
Homu
15041a34fa
Auto merge of #5246 - nuttycom:consensus/total_orchard_merklecrh, r=nuttycom
...
Update Orchard commitment tree hashes to use total MerkleCRH^Orchard.
See zcash/zips#530
2021-07-09 16:49:07 +00:00
Kris Nuttycombe
a4847132fa
Apply suggestions from code review
2021-07-09 10:44:59 -06:00
Kris Nuttycombe
e588d1d790
Update Orchard commitment tree hashes to use total MerkleCRH^Orchard.
2021-07-09 10:40:49 -06:00
Kris Nuttycombe
dcbbf43d8b
Ensure that the Orchard note commitment tree does not exceed its maximum size.
2021-07-06 10:57:30 -06:00
Kris Nuttycombe
76aafa0f5f
Add check for consistency between nActionsOrchard and Orchard flags.
...
Fixes #5245
2021-07-06 10:40:47 -06: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
Jack Grigg
e18da34468
miner: Set coinbase expiry height to block height from NU5 activation
2021-07-01 13:34:56 +01:00
Jack Grigg
0a78f4c6ec
test: Fix OverwinterExpiryHeight test after ZIP 203 contextual changes
2021-07-01 13:17:08 +01:00
Jack Grigg
9a5951aab1
test: Check for updated empty-tx reject messages in transaction tests
2021-07-01 13:05:26 +01:00
Kris Nuttycombe
7a2be88768
ZIP 213: Add checks to support Orchard shielded coinbase outputs.
2021-07-01 12:42:37 +01:00
Jack Grigg
6bbe0906a8
ZIP 203: Enforce coinbase nExpiryHeight consensus rule from NU5
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
b0b797b4e9
Add check that v5 transactions have empty Sprout joinsplits.
2021-07-01 12:41:25 +01:00
Kris Nuttycombe
d882c68274
Retract partial Orchard test support.
...
Testing for Orchard transaction construction will be introduced
separately.
2021-07-01 12:41:25 +01:00
Kris Nuttycombe
1f7aaf2368
Account for Orchard balance in GetValueOut and GetShieldedValueIn.
...
Also adds Orchard information to CTransaction::ToString.
2021-07-01 12:41:25 +01:00
Kris Nuttycombe
22854f7998
Add Orchard value balance checks.
2021-07-01 12:41:25 +01:00
Kris Nuttycombe
5bfdbb4c74
Make valueBalanceSapling a private non-const member of CTransaction.
2021-07-01 12:41:25 +01:00
Kris Nuttycombe
fd91f099f4
Rename tx.valueBalance -> tx.valueBalanceSapling
2021-07-01 12:41:25 +01:00
Kris Nuttycombe
feef0e03f6
Check consensus branch ID for V5 transactions.
2021-07-01 12:41:25 +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
Kris Nuttycombe
53828a38ba
Make CTransaction::nConsensusBranchId a std::optional
2021-07-01 12:41:25 +01:00
Kris Nuttycombe
52568f58a8
Ensure Sapling versions are valid after NU5
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
Homu
c3fe01200b
Auto merge of #5235 - str4d:tx-dynamic-usage, r=str4d
...
Include Orchard bundle in transaction dynamic usage
This was missed in #5202 .
2021-06-29 14:07:06 +00:00
Jack Grigg
8ad7371800
Include Orchard bundle in transaction dynamic usage
2021-06-29 15:05:46 +01:00
Homu
52e3a74a75
Auto merge of #5233 - nuttycom:feature/orchard_merkle, r=str4d
...
Implement Orchard commitment tree logic.
2021-06-29 12:18:18 +00:00
Jack Grigg
d72f722915
test: Update CCoinsViewTest with changes to CCoinsView interface
...
I just LOVE how C++ didn't complain that the changes to the virtual
method APIs didn't cause any compilation errors for the tests...
2021-06-29 03:34:08 +01:00
Kris Nuttycombe
3251f0c935
Apply suggestions from code review
...
Co-authored-by: str4d <jack@electriccoin.co>
2021-06-28 17:56:57 -06:00
Kris Nuttycombe
0d40ea8494
Add Orchard nullifiers to nullifiers cache.
2021-06-28 17:43:23 -06:00
Kris Nuttycombe
f9d823726c
Add consensus check for duplicate Orchard nullifiers within a single transaction.
2021-06-28 17:37:32 -06:00
Kris Nuttycombe
572719fca6
Apply suggestions from code review
...
Use const pointers wherever possible.
Co-authored-by: str4d <jack@electriccoin.co>
2021-06-28 17:37:32 -06:00
Kris Nuttycombe
8fbc84842b
Document source of Orchard merkle tree test data.
2021-06-28 16:40:11 -06:00
Kris Nuttycombe
5550dbe1b8
Fix implmentation of OrchardMerkleTree.DynamicMemoryUsage
2021-06-28 16:33:40 -06:00
Kris Nuttycombe
8ee8c9f6ab
Consistently panic on null commitment tree pointers.
...
Orchard commitment tree pointers should never be null.
2021-06-28 15:27:21 -06:00
Kris Nuttycombe
d46dbd9ea4
Apply style suggestions.
2021-06-28 14:49:39 -06:00
Kris Nuttycombe
d533d3ccbf
Fix header guards for incremental_sinsemilla_tree.h
2021-06-28 13:54:15 -06:00
Kris Nuttycombe
60f58890ec
Fix Orchard incremental Merkle tree empty root.
2021-06-28 13:54:15 -06:00
Kris Nuttycombe
4b36b6fc20
Apply suggestions from code review
...
Co-authored-by: str4d <jack@electriccoin.co>
2021-06-28 13:54:15 -06:00
Kris Nuttycombe
a3214285c2
Apply suggestions from code review
...
Co-authored-by: str4d <jack@electriccoin.co>
2021-06-28 13:54:15 -06:00
Kris Nuttycombe
34f192b8f0
Update to released version of incrementalmerkletree
2021-06-28 09:56:05 -06:00