Commit Graph

77 Commits

Author SHA1 Message Date
Eirik Ogilvie-Wigley
4fc309f0f5 Rename Merkle Trees to include sprout or sapling 2018-08-01 10:31:09 -06:00
Eirik Ogilvie-Wigley
8e8279e728 Rename sprout specific methods 2018-07-25 20:47:41 -07:00
Eirik Ogilvie-Wigley
f86ee1c252 Pass sapling merkle tree when incrementing witnesses 2018-07-25 20:47:41 -07:00
Eirik Ogilvie-Wigley
005f3ad1dd Rename note data to include sprout 2018-07-25 20:47:40 -07:00
Wladimir J. van der Laan
a9496b08b6 rpc: Register calls where they are defined
Split out methods to every module, apart from 'help' and 'stop' which
are implemented in rpcserver.cpp itself.

- This makes it easier to add or remove RPC commands - no longer everything that includes
    rpcserver.h has to be rebuilt when there's a change there.
- Cleans up `rpc/server.h` by getting rid of the huge cluttered list of function definitions.
- Removes most of the bitcoin-specific code from rpcserver.cpp and .h.

Continues #7307 for the non-wallet.
2018-07-18 11:07:18 -06:00
Daniel Cousens
4519a766b6 move rpc* to rpc/ 2018-07-18 11:07:16 -06:00
Jonas Schnelli
34aca1b03c [RPC, Wallet] Move RPC dispatch table registration to wallet/ code
Allow extending the rpc dispatch table by appending commands when server is not running.
2018-07-18 11:07:15 -06:00
Ariel Gabizon
e1a3461cc2 Improve/Fix variable names
ZCProof was too general. pubKeyHash was actually the JoinSplit pubkey
itself.
2018-06-09 20:27:35 -07:00
Sean Bowe
34f6ea95dc Adjust tests and benchmarks 2018-05-14 16:29:02 -06:00
Sean Bowe
b7a6c32178 Integrate Groth16 verification and proving. 2018-05-14 16:26:23 -06:00
Jack Grigg
e5eab182b5 Use boost::variant to represent shielded addresses and keys
libzcash::PaymentAddress has been renamed to libzcash::SproutPaymentAddress,
and a new typedef boost::variant is now libzcash::PaymentAddress. Similarly
for ViewingKey and SpendingKey.

A new class InvalidEncoding is introduced as the default boost::variant
option for each address and key type; it is used during decoding instead
of boost::optional.

All address and key storage functions in the wallet have been modified to
refer specifically to the Sprout types, as they are used very precisely.
In most other cases, the more general type is leveraged as much as possible,
and we convert to the Sprout type when necessary. This will be subsequently
wrapped in, or replaced with, context-specific functions once Sapling
types are implemented.
2018-05-11 17:14:49 -04:00
Sean Bowe
d455828fdc Specifically describe anchors as Sprout anchors. 2018-05-07 13:46:06 -06:00
Sean Bowe
28d20bdb11 Rename NullifierType to ShieldedType. 2018-05-07 13:46:06 -06:00
Jack Grigg
ddcee7e13a Benchmark the largest valid Sapling transaction in validatelargetx
11130 inputs results in a transaction between 1992301 and 2003431 bytes.
2018-05-04 11:17:30 +01: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
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
Jack Grigg
b1608eed82 Add a constant for Overwinter's transaction version 2018-04-23 20:39:04 +01:00
Jack Grigg
4553901850 Use v3 transactions with caching for validatelargetx benchmark 2018-02-20 04:22:22 +00:00
Jack Grigg
818b94f94f Make number of inputs configurable in validatelargetx test 2018-02-20 04:22:22 +00:00
Jack Grigg
be12669982 Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter
We do not need to be able to calculate multiple SignatureHash versions for a
single transaction format; instead, we use the transaction format to determine
the SigVersion.

The consensus branch ID *does* need to be passed in from the outside, as only
the caller knows the context in which the SignatureHash is being calculated
(ie. mempool acceptance vs. block validation).

JoinSplit signature verification has been moved into ContextualCheckTransaction,
where the consensus branch ID can be obtained.

The argument to the sign command for zcash-tx has been modified to take a height
in addition to the optional sigtype flags.
2018-02-20 04:22:20 +00:00
Pieter Wuille
157a5d0d9c BIP143: Signing logic 2018-02-20 04:22:19 +00:00
Pieter Wuille
2d42e1a993 Refactor script validation to observe amounts
This is a preparation for BIP143 support.

Edited for Zcash merge by Ariel Gabizon.
2018-02-20 04:22:19 +00:00
Sean Bowe
1a9543d064 Remove crusty old "loadVerifyingKey"/"loadProvingKey" APIs and associated invariants. 2017-10-21 15:42:41 +03:00
Jack Grigg
99dd50c30c Add benchmark for listunspent
Closes #2645.
2017-10-04 12:48:50 +01:00
Ariel Gabizon
2e8aefdce1 add load-wallet benchmark 2017-09-18 21:54:53 +02:00
Jack Grigg
a76174b76b Benchmark time to call sendtoaddress with many UTXOs 2017-08-31 02:15:06 +01:00
Jack Grigg
c66c731adf Add a benchmark for calling ConnectBlock on a block with many inputs
Requires placing block-107134.tar.gz (containing the block, and a fake CoinsDB
containing its inputs) into the base directory of the repository. This can be
generated using qa/zcash/create_benchmark_archive.py (see the script for usage
details).

To facilitate generation of the fake CoinsDB, an additional field 'valueZat' has
been added to 'getrawtransaction' containing the integer number of zatoshis
instead of a decimal number of ZEC.

Closes #2355.
2017-05-18 11:03:46 +12:00
Jack Grigg
2cc0a252ad Add compile flag to disable compilation of mining code 2017-01-30 21:14:46 +01:00
Jack Grigg
4082dcb10f Extend createjoinsplit to benchmark parallel JoinSplits
Closes #1940
2016-12-14 15:28:00 +13:00
zkbot
8a6c070bfa Auto merge of #1870 - str4d:1749-benchmark-rescanning, r=str4d
Add benchmarks for rescan components

Part of #1749.
2016-12-09 07:12:22 +00:00
Jack Grigg
9755eb8292 Add JS to second block to ensure witnesses are incremented 2016-12-09 16:59:40 +13:00
Jack Grigg
88b7f3c28b Generate JS for trydecryptnotes, make number of addresses a variable 2016-12-09 16:59:39 +13:00
Sean Bowe
bc59f53722 Isolate verification to a ProofVerifier context object that allows verification behavior to be tuned by the caller. 2016-12-05 12:40:06 -07:00
Jack Grigg
0bb3d40f90 Add benchmark for incrementing note witnesses 2016-11-17 22:26:46 +13:00
Jack Grigg
0fbab55b1b Add benchmark for attempting decryption of notes 2016-11-17 19:09:45 +13:00
Sean Bowe
27e3f362f0 Zcash zk-SNARK public parameters for 1.0 "Sprout". 2016-10-24 11:22:39 -06:00
Sean Bowe
74f15a73a1 Make 100KB transaction size limit a consensus rule, rather than a standard rule. 2016-10-08 00:00:23 -06:00
Sean Bowe
796c7ee52f Update to beta2 public parameters, remove regtest/testnet3 parameters
subdirectories.
2016-10-03 15:58:02 -06:00
Jack Grigg
9e52ca3205 Measure multithreaded solveequihash time per-thread 2016-09-13 16:12:07 +12:00
Simon
805344dcf4 Refactor: replace calls to GetTxid() with GetHash() 2016-09-07 15:12:09 -07:00
zkbot
cd9d373987 Auto merge of #1260 - str4d:1175-byte-array-manipulation, r=ebfull
Update Equihash implementation to match the Zcash spec

Closes #1175
2016-08-24 03:01:13 +00:00
Sean Bowe
393b2b7834 Update proving/verifying keys. 2016-08-22 15:48:43 -06:00
Jack Grigg
5be6abbf84 Store the Equihash solution in minimal representation in the block header
The genesis blocks and miner tests have been regenerated, because changing the
block header serialisation format changes the block hash, and thus validity.

The Equihash solutions have been removed from the bloom test inputs for
simplicity (block validity is not checked there; only a valid serialisation is
necessary).
2016-08-16 16:02:39 +12:00
Simon
75c2f26887 Update variable. 2016-08-08 00:51:27 -07:00
Simon
822b84b616 Fixes #1193 so that during verification benchmarking it does not
unncessarily create thousands of CTransaction objects.
2016-08-07 23:57:39 -07:00
zkbot
95277e0311 Auto merge of #1144 - bitcartel:zc.v0.11.2.z7_tx_malleability_gettxid, r=bitcartel
A fix for transaction malleability

This PR fixes transaction malleability by not including the sigscript of transaction inputs and joinsplit sigs when hashing the txid.

This PR supercedes PR #1101 which was a minimal solution based on a new serialization flag.

This PR introduces GetTxid() to distinguish between getting a transaction id and the double sha256 hash.

The key changes are:
- Adding GetTxid() method to CTransaction which makes a copy of the transaction, clearing out the sigscript and joinsplitsig fields, before hashing.
- Verifying that every call to GetHash() actually wants a txid, and replacing with GetTxid().
- Renaming GetHash() to GetSerializeHash()
  - Rationale: In future, upstream code we want to merge will use GetHash() but we don't know the intent.  We should check to see if the intent is to receive a txid (most likely) in which case we replace with GetTxid(), or if upstream actually wants a double hash of the transaction we can use GetSerializeHash().
- Updated genesis data in chainparams.cpp

Note that coinbase transactions are excluded as they need the sigscript hashed to help avoid duplicate txids per BIP34:
  - This modification is related to a question from @ebfull on PR #1101 - "Can we think of a way this change allows us to construct two transactions with the same txid which can simultaneously appear in the blockchain? My guess is it would be possible to construct a coinbase transaction of such a form... this surely breaks invariants."

This PR Passes all tests in test_bitcoin (test data was updated in bloom_tests, miner_tests and script_tests).
2016-08-05 19:31:52 +00:00
Jack Grigg
f7478de67f Add thread parameter to solveequihash benchmark
Closes #1147
2016-08-05 15:05:38 +12:00
Jack Grigg
51eb5273f5 Equihash: Pass each obtained solution to a callback for immediate checking
Closes #1143
2016-07-27 19:15:49 +12:00
Simon
10d2c57c0d Replace calls to GetHash() with GetTxid() for transaction objects.
Where the caller intends to receive a transaction id and not a double
SHA256 hash.
2016-07-26 17:13:03 -07:00