Commit Graph

11500 Commits

Author SHA1 Message Date
Homu c6ab62191a Auto merge of #3205 - str4d:3173-missing-return, r=str4d
Return result of boost::apply_visitor

Not returning a value at the end of a non-void function is undefined behaviour.
Given that this managed to pass our full test suite, I guess that GCC looks for
un-returned values at the end of a function and uses them as the return value,
if the keyword is missing. Clang OTOH complains, which is how we spotted this:
https://ci.z.cash/#/builders/16/builds/282
2018-04-25 13:50:53 -07:00
Simon b230fe6836 Refactoring: Rename class libzcash::Note to libzcash::SproutNote. 2018-04-25 11:33:24 -07:00
Simon bef33bbc73 Refactoring: libzcash::Note is now a subclass of libzcash::BaseNote. 2018-04-25 11:33:16 -07:00
Eirik Ogilvie-Wigley 9669920f75 Rename nullifier caches and maps to indicate sprout nullifiers 2018-04-25 11:26:38 -06:00
Eirik Ogilvie-Wigley cab341e1a8 Add sapling nullifiers to db and mempool 2018-04-24 17:16:43 -06:00
Jack Grigg bf605b2644
Return result of boost::apply_visitor
Not returning a value at the end of a non-void function is undefined behaviour.
Given that this managed to pass our full test suite, I guess that GCC looks for
un-returned values at the end of a function and uses them as the return value,
if the keyword is missing. Clang OTOH complains, which is how we spotted this:
https://ci.z.cash/#/builders/16/builds/282
2018-04-24 23:04:09 +01:00
Homu f961e5c3c0 Auto merge of #3195 - str4d:3180-clang-warnings, r=str4d
Remove now-unshadowed serialization lines that do nothing

Previously we had both nVersion as a class parameter *and* a serialization
argument, and in several inherited serializers the latter was set to the former,
in order to pass the serialized object's version into underlying parsers. #3180
pulled in the upstream changes to clean this up, and in doing so these lines
became no-ops - setting the class parameter to itself. Clang throws warnings on
this, which turn into errors on the MacOS builder.

We can just remove these, because upstream already had done so in earlier PRs,
indicating that they were not being relied on by underlying parsers.
2018-04-24 14:03:57 -07:00
Eirik Ogilvie-Wigley 708c87f16d Add enum for nullifier type 2018-04-24 09:57:14 -06:00
Eirik Ogilvie-Wigley 685e936c31 Add sapling nullifier set 2018-04-24 09:57:14 -06:00
Homu 68cf6f3c2d Auto merge of #3074 - arcalinea:2983_tx_expiry_test_dependent, r=str4d
Add test for dependent txs to mempool_tx_expiry.py

Closes #2983

Also replaced absolute blockheight check with a relative height check.
2018-04-23 15:50:16 -07:00
Eirik Ogilvie-Wigley df960a9ba7 Clarify help text of dumpprivkey 2018-04-23 15:14:56 -06:00
Jeremy Rubin 1b34996b21
Fix subscript[0] in base58.cpp 2018-04-23 22:12:53 +01:00
MarcoFalke b37b4b2fa3
[rpcwallet] Don't use floating point 2018-04-23 22:12:53 +01:00
Pedro Branco 181c511cd0
Prevent multiple calls to ExtractDestination 2018-04-23 22:12:53 +01:00
Kaz Wesley 63822fbc84
CBase58Data::SetString: cleanse the full vector
SetString seems to be passing the length of the wrong variable to
memory_cleanse, resulting in the last byte of the temporary buffer not being
securely erased.
2018-04-23 22:12:45 +01:00
Homu df1dc9dd91 Auto merge of #3197 - str4d:2907-sapling-v4-tx-innards, r=str4d
Sapling v4 transaction format

Builds on #3173.
2018-04-23 13:35:07 -07:00
Jack Grigg b1608eed82
Add a constant for Overwinter's transaction version 2018-04-23 20:39:04 +01:00
Jack Grigg b4f7174a88
Implement SpendDescription and OutputDescription datastructures
Co-authored-by: George Tankersley <george@z.cash>
2018-04-23 20:39:00 +01:00
Homu 0e65c245f7 Auto merge of #3181 - bitcartel:least_authority_issue_c, r=daira
Closes #1249 - Least Authority Issue C

Backports the first commit from https://github.com/bitcoin/bitcoin/pull/9512 to avoid unaligned access in crypto i/o.
2018-04-21 05:19:05 -07:00
Homu 77889933e7 Auto merge of #3173 - str4d:2907-sapling-v4-tx-shell, r=str4d
Initial support for Sapling v4 transactions

Part of #2907.
2018-04-20 12:35:47 -07:00
Jack Grigg 22ffe8ce44
Remove now-unshadowed serialization lines that do nothing
Previously we had both nVersion as a class parameter *and* a serialization
argument, and in several inherited serializers the latter was set to the former,
in order to pass the serialized object's version into underlying parsers. #3180
pulled in the upstream changes to clean this up, and in doing so these lines
became no-ops - setting the class parameter to itself. Clang throws warnings on
this, which turn into errors on the MacOS builder.

We can just remove these, because upstream already had done so in earlier PRs,
indicating that they were not being relied on by underlying parsers.
2018-04-20 09:48:33 +01:00
Homu 5821bb0a4d Auto merge of #3185 - ebfull:sapling-testnet-params, r=str4d
Load Sapling testnet parameters into memory

This PR depends on https://github.com/zcash/librustzcash/pull/4.

The parameters are not loaded into memory if `zcashd` is configured as a mainnet node -- this is something we can change in the weeks before `2.0.0`.
2018-04-20 01:28:13 -07:00
Jack Grigg 2d922b66b0
Pass transaction header into correct SignatureHash serialization level
We need to indicate whether PHGR or Groth proofs are expected to vjoinsplit,
which is serialized in an inner hash, not the outer hash.
2018-04-19 20:35:33 +01:00
Sean Bowe 62ba80e766 Update librustzcash hash 2018-04-19 13:00:28 -06:00
Cory Fields d207b81d28
prevector: assert successful allocation 2018-04-19 16:49:12 +01:00
Cory Fields c10b69eb64
don't throw std::bad_alloc when out of memory. Instead, terminate immediately 2018-04-19 16:49:02 +01:00
Jack Grigg 72540cee4a
Add Sapling v4 transactions to IsStandard 2018-04-19 16:25:04 +01:00
Pieter Wuille 1878f3a759 Fix some empty vector references
streams.h has some methods that can be tricked into dereferencing
null pointers or end() iterators. Fix this.
2018-04-18 21:31:14 -07:00
Jack Grigg b7e75b17af
Implement basic Sapling v4 transaction parser
Details of Sapling datatypes will be filled in later; for now, they are treated
as binary blobs.

Includes code cherry-picked from upstream commit:
    7030d9eb47254499bba14f1c00abc6bf493efd91
    BIP144: Serialization, hashes, relay (sender side)
2018-04-19 05:01:47 +01:00
Jack Grigg 987b8ee60e
Adjust consensus rules to require v4 transactions from Sapling activation 2018-04-19 05:01:47 +01:00
Homu 0753a0e8a9 Auto merge of #3180 - str4d:transaction-serialization, r=ebfull
Upstream serialization improvements

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#5264
- bitcoin/bitcoin#6914
- bitcoin/bitcoin#6215
- bitcoin/bitcoin#8068
  - Only the `COMPACTSIZE` wrapper commit
- bitcoin/bitcoin#8658
- bitcoin/bitcoin#8708
  - Only the serializer variadics commit
- bitcoin/bitcoin#9039
- bitcoin/bitcoin#9125
  - Only the first two commits (the last two block on other upstream PRs)

Part of #2074.
2018-04-18 19:08:34 -07:00
Homu b3f2da18ef Auto merge of #3184 - str4d:b6820-univalue-subdir, r=str4d
build: univalue subdir build fixups

Backported from bitcoin/bitcoin#6820.
2018-04-18 08:22:59 -07:00
Jay Graber 7dc0f84788 Add test for dependent txs to mempool_tx_expiry.py 2018-04-18 06:34:09 -07:00
Cory Fields da96e3b71a
build: univalue subdir build fixups
- Force a rebuild if the headers change
- Only build the lib target
- Clean univalue on 'make clean'
2018-04-18 00:36:49 +01:00
Sean Bowe acfcdb94b9 Load Sapling testnet parameters into memory. 2018-04-17 15:04:46 -06:00
Pieter Wuille 0b6594f444 Avoid unaligned access in crypto i/o 2018-04-17 09:15:55 -07:00
Pieter Wuille c7d71985c9
Add deserializing constructors to CTransaction and CMutableTransaction 2018-04-17 13:29:51 +01:00
Pieter Wuille 40cc9aa7dd
Add serialization for unique_ptr and shared_ptr 2018-04-17 13:09:48 +01:00
Pieter Wuille 87a5975ca0
Use fixed preallocation instead of costly GetSerializeSize
Dbwrapper used GetSerializeSize() to compute the size of the buffer
to preallocate. For some cases (specifically: CCoins) this requires
a costly compression call. Avoid this by just using fixed size
preallocations instead.
2018-04-17 13:09:48 +01:00
Pieter Wuille 098917052d
Add optimized CSizeComputer serializers
To get the advantages of faster GetSerializeSize() implementations
back that were removed in "Make GetSerializeSize a wrapper on top of
CSizeComputer", reintroduce them in the few places in the form of a
specialized Serialize() implementation. This actually gets us in a
better state than before, as these even get used when they're invoked
indirectly in the serialization of another object.
2018-04-17 13:09:48 +01:00
Pieter Wuille 93aaf4fc94
Make CSerAction's ForRead() constexpr
The CSerAction's ForRead() method does not depend on any runtime
data, so guarantee that requests to it can be optimized out by
making it constexpr.

Suggested by Cory Fields.
2018-04-17 13:09:48 +01:00
Pieter Wuille 9b228f0391
Avoid -Wshadow errors
Suggested by Pavel Janik.
2018-04-17 13:09:48 +01:00
Jack Grigg 68a1a592ca
Remove nType and nVersion from Zcash-specific code 2018-04-17 13:09:47 +01:00
Pieter Wuille 242f1421db
Get rid of nType and nVersion
Remove the nType and nVersion as parameters to all serialization methods
and functions. There is only one place where it's read and has an impact
(in CAddress), and even there it does not impact any of the recursively
invoked serializers.

Instead, the few places that need nType or nVersion are changed to read
it directly from the stream object, through GetType() and GetVersion()
methods which are added to all stream classes.
2018-04-17 13:09:28 +01:00
Homu ec6021950d Auto merge of #3176 - daira:use-https-for-bdb, r=daira
Use https: for BDB backup download URL.
2018-04-17 02:13:10 -07:00
Homu 0066c317b4 Auto merge of #3160 - bitcartel:3134_least_authority_issue_e, r=daira
Closes #3134 - Least Authority Issue E

CTxMemPool::check() does nothing when turned on, due to overflow.
2018-04-16 11:25:43 -07:00
Homu 012344249b Auto merge of #3175 - ca333:patch-4, r=daira
[fix] proton download path

resolves #3174
2018-04-16 09:47:39 -07:00
Jack Grigg a8e5ae92ba
GetSerializeSize changes in Zcash-specific code 2018-04-16 07:38:38 -06:00
Pieter Wuille b8a6579366
Make GetSerializeSize a wrapper on top of CSizeComputer
Given that in default GetSerializeSize implementations created by
ADD_SERIALIZE_METHODS we're already using CSizeComputer(), get rid
of the specialized GetSerializeSize methods everywhere, and just use
CSizeComputer. This removes a lot of code which isn't actually used
anywhere.

For CCompactSize and CVarInt this actually removes a more efficient
size computing algorithm, which is brought back in a later commit.
2018-04-16 07:38:38 -06:00
Pieter Wuille 7f4acac433
Make nType and nVersion private and sometimes const
Make the various stream implementations' nType and nVersion private
and const (except in CDataStream where we really need a setter).
2018-04-16 07:38:37 -06:00