Commit Graph

12214 Commits

Author SHA1 Message Date
Dimitris Apostolou 7420711d9e
Electric Coin Company 2019-03-20 09:04:32 +02:00
Homu 6158f0a4fa Auto merge of #3897 - ebfull:wallet-sprout-check-commitment, r=ebfull
Check consistency of note commitment and ciphertext in wallet

Fixes #3896.
2019-03-19 21:21:54 -07:00
Homu 6391741d1f Auto merge of #3890 - zebambam:add_dns_rebinding_warnings_security_3841, r=mdr0id
Added documentation warnings about DNS rebinding attacks, issue #3841

For AMQP and ZMQP.
2019-03-19 15:50:34 -07:00
Sean Bowe c1009374b1 (wallet) Check that the commitment matches the note plaintext provided by the sender. 2019-03-19 13:12:26 -06:00
Homu 008705d7c1 Auto merge of #3885 - ebfull:turnstile, r=bitcartel
Reject blocks that violate turnstile

This is an implementation of a consensus rule which marks blocks as invalid if they would lead to a turnstile violation in the Sprout or Shielded value pools. The motivations and deployment details can be found in the [accompanying ZIP draft](https://github.com/zcash/zips/pull/210).

**This PR only introduces the rule for testnet at the moment.**

We achieve the institution of this rule in three ways:

1. Nodes prior to #2795 did not record the "delta" in the Sprout value pool balance as part of the on-disk block index. This was a long time ago, though, and all nodes that are consensus-compatible with the network today have been recording this value for newer blocks. However, the value is absent from older block indexes unless the node has reindexed or synchronized from scratch in the time since. We shouldn't need to require nodes to reindex in order to enforce this consensus rule. We avoid this problem by falling back on a hardcoded Sprout shielded value pool balance in a very recent block.
2. If during `ConnectBlock` we observe that the resulting shielded value pool balance of Sprout or Sapling is negative, we reject the block.
3. During the miner's block assembly process the miner will skip over transactions if adding them to the assembled block might violate the turnstile, since the resulting block would be invalid. This means that theoretical transactions violating the turnstile would still be relayed in the network (and made available in users' memory pools) and so a turnstile violation would have some visibility outside of block relay.

## Smoke Testing

It's really tricky to test the behavior that automatically falls back to hardcoded shielded value pool balances in our architecture because it's very testnet-specific and node-version-specific. However, we can do some smoke tests to see that everything is working.

I modified the serialization of `CDiskBlockIndex` to serialize `boost::none` for `nSproutValue`

```
if ((s.GetType() & SER_DISK) && (nVersion >= SPROUT_VALUE_VERSION)) {
    boost::optional<CAmount> nSproutValueFake = boost::none;
    READWRITE(nSproutValueFake);
}
```

and then began a reindex of my node which I interruped around height 130k on testnet. I then restored the original serialization and resumed the reindex; I have thus _roughly_ simulated a older node "upgrading" to a newer node that records the deltas when processing new blocks. My node showed pool monitoring was disabled, as expected, for Sprout. I confirmed that some blocks following the reindex had nonzero Sprout `valueDelta` from `getblock`, as expected. I finished the reindex, restarted the node, and confirmed that the serialization worked for newer blocks but not older blocks by querying `getblock`, simply as a reassurance.

Finally, I introduced the code in this PR and reloaded the node. The desired behavior (that the chain began to be "monitored" again) worked, and the values were consistent with the hardcoded constant. I then made a payment to a Sprout z-addr from the transparent pool and the pool value increased as expected, as reported by `getblockchaininfo`. I reindexed the node again to exercise the remaining logic and check for turnstile violations throughout the history of testnet; there were none.
2019-03-19 12:10:17 -07:00
Sean Bowe 8d0e2befe7 (minor) Remove added newline. 2019-03-19 12:45:21 -06:00
Sean Bowe 4e3dca978b Do not enable ZIP209 on regtest right now. 2019-03-19 12:44:53 -06:00
Homu 5a8a1b450e Auto merge of #3839 - sandakersmann:master, r=bitcartel
Update of copyright year to 2019

Update of copyright year to 2019
2019-03-18 23:04:26 -07:00
Homu 8eb6101ef8 Auto merge of #3846 - garethtdavies:updated-logo, r=bitcartel
Correcting logo on README

As a follow up to https://github.com/zcash/zcash/pull/3509 which I closed due to the updated branding. The logo [still has the wrong aspect ratio]. This corrects it with the logo taken from https://z.cash/press/ while preserving the original image dimensions and aspect ratio. I added it at 2x for retina displays.
2019-03-18 21:19:22 -07:00
Homu aa0d1f3b94 Auto merge of #3892 - zebambam:add_responsible_disclosure_statement_security_3869, r=bitcartel
Added responsible disclosure statement for issue #3869
2019-03-18 18:29:43 -07:00
Homu 1078c7f9a6 Auto merge of #3887 - bitcartel:2.0.4_pre_release, r=bitcartel
Update chain work and checkpoint for 2.0.4

Closes #3886
2019-03-18 14:53:09 -07:00
Sean Bowe 30a5d6f520 Only enforce Sapling turnstile if balance values have been populated. 2019-03-18 14:09:32 -06:00
Sean Bowe b5c7e63bcd Change SproutValuePoolCheckpointEnabled to ZIP209Activated 2019-03-18 11:32:26 -06:00
zebambam 1da8882d88 Added responsible disclosure statement for issue #3869 2019-03-15 16:08:57 -07:00
zebambam daf97cb441 Added documentation warnings about DNS rebinding attacks, issue #3841 2019-03-15 16:00:27 -07:00
Sean Bowe 6482b661ab Check blockhash of fallback block for Sprout value pool balance 2019-03-14 15:39:11 -06:00
Sean Bowe ebe2edce9a Add newlines to turntile log messages for miner 2019-03-14 15:25:31 -06:00
Sean Bowe 831725a671 Use existing chainparams variable 2019-03-14 15:25:10 -06:00
Sean Bowe 2b1252af80 Consolidate logic to enable turnstile auditing for testnet/regtest/mainnet. 2019-03-14 14:29:04 -06:00
Sean Bowe cb6df4b0cc Fix tallying for Sprout/Sapling value pools. 2019-03-14 14:08:12 -06:00
Simon ea5f00aa5d Add checkpoint for block 497000. 2019-03-13 17:31:49 -07:00
Simon 16385486b8 Update nMinimumChainWork using block 497000. 2019-03-13 17:24:43 -07:00
Sean Bowe bf4de896e7 (testnet/regtest) Avoid mining transactions that would violate the turnstile. 2019-03-13 01:38:34 -06:00
Sean Bowe 8a990a7d64 (testnet) Reject blocks that result in turnstile violations 2019-03-13 00:54:29 -06:00
Sean Bowe 24db3297df (testnet) Fall back to hardcoded shielded pool balance to avoid reorgs. 2019-03-13 00:43:54 -06:00
Homu 1cbe5075d6 Auto merge of #3762 - str4d:2074-detach-wallet-from-miner, r=Eirik0
Detach wallet from miner

Cherry-picked from upstream PR bitcoin/bitcoin#5994.

Part of #2074.
2019-03-12 13:01:31 -07:00
Jack Grigg 1fee15028f
Move payment disclosure code and tests into wallet
The code was already compiled as part of the wallet, but the tests were
not, meaning that the tests would fail to compile when the wallet was
disabled.
2019-03-06 10:04:23 +13:00
Jack Grigg c7fc78987a
Move utiltest.cpp from wallet to common
This ensures it is accessible by the test suite when the wallet is
disabled.
2019-03-06 09:41:39 +13:00
Jack Grigg c233f6fd31
Add comments 2019-03-06 09:03:55 +13:00
Jack Grigg 3cb20f26a1
test: Make expected_utxos optional in get_coinbase_address() 2019-03-06 09:03:55 +13:00
Jack Grigg b0f1d643aa
test: Fetch coinbase address from coinbase UTXOs
After upstream PR bitcoin/bitcoin#5994, the first call to getnewaddress after
startup does not return the address being used by the miner.
2019-03-06 09:03:51 +13:00
Jonas Schnelli 648d6bee65
miner: rename UpdateRequestCount signal to ResetRequestCount 2019-03-06 09:02:50 +13:00
Jonas Schnelli f4055fe158
add CReserveScript to allow modular script keeping/returning
- use one CReserveScript per mining thread
2019-03-06 09:02:50 +13:00
Jonas Schnelli 38da0d16b1
fix GetScriptForMining() CReserveKey::keepKey() issue 2019-03-06 09:02:50 +13:00
Jonas Schnelli b2993bc5d4
detach wallet from miner 2019-03-06 09:02:50 +13:00
Homu 92cd76fcba Auto merge of #3859 - LarryRuane:3708-patched-explorer, r=mdr0id
Simplify DisconnectBlock arguments/return value

DisconnectBlock currently has a complicated interface:

  Situation       Return value
                  pfClean != nullptr   pfClean == nullptr

  All good:       true                 true
  Failure:        false                false
  Unclean rewind: true                 false
                  with *pfClean=false

Change this to return a tristate enum instead. As an added bonus,
remove the ValidationState& argument which was unused.
2019-02-26 10:50:59 -08:00
Pieter Wuille ec555a8e9b Simplify DisconnectBlock arguments/return value
DisconnectBlock currently has a complicated interface:

  Situation       Return value
                  pfClean != nullptr   pfClean == nullptr

  All good:       true                 true
  Failure:        false                false
  Unclean rewind: true                 false
                  with *pfClean=false

Change this to return a tristate enum instead. As an added bonus,
remove the ValidationState& argument which was unused.
2019-02-26 11:10:20 -07:00
Homu 52fbc1ce66 Auto merge of #3657 - Eirik0:3395-sapling-benchmarks, r=str4d
Update zcbenchmarks to include sapling data

Closes #3395

This PR adds a benchmark named `trydecryptsaplingnotes` which is intended to be similar to `trydecryptnotes`. It also adds a benchmark `incnotewitnessessapling` which is similar to `incnotewitnesses`.

As a side note, while looking for examples to follow I ran in to a fair amount of setup, which I wanted to be able to reuse, repeated across several tests. I pulled some of that logic in to a utility functions and refactored the existing tests using that setup.
2019-02-26 09:05:35 -08:00
Gareth Davies 89606bcbf6 Correcting logo on README 2019-02-25 21:00:08 -08:00
Homu ff07644b21 Auto merge of #3819 - ioptio:rm-source-docs, r=Eirik0
redirect and update source docs

also, update Zcash logo source.

User guide related documentation in the `/doc` folder should really live in RTDs. I've left policy and process related docs as is for now.

This **should not** be merged until https://gitlab.com/zcash-docs/zcash-docs/merge_requests/90 is for associated redirect links to work.
2019-02-25 13:31:45 -08:00
Homu 48b7dea5a8 Auto merge of #3639 - leto:size_on_disk, r=bitcartel
Port getblockchaininfo.size_on_disk from BTC master

Closes #3630.
2019-02-25 10:08:44 -08:00
Homu 1ad0b3482b Auto merge of #3850 - Eirik0:update-author-aliases, r=Eirik0
Add missing author aliases

This adds some missing author aliases to release-notes.py.
2019-02-21 09:56:13 -08:00
Eirik Ogilvie-Wigley 3620d5709d Add missing author aliases 2019-02-20 12:52:41 -07:00
Homu e45154f559 Auto merge of #3817 - Eirik0:3646-better-error-msgs, r=mdr0id
Improve some error messages when building a transaction fails

Follow up from #3646
2019-02-19 10:09:43 -08:00
Homu 87171d35b1 Auto merge of #3843 - str4d:sapling-bench-runner, r=mdr0id
Add Sapling benchmarks to benchmark runner

Follow-up to #3611. Once this is merged, we can add the Sapling benchmarks to CI.
2019-02-18 15:12:54 -08:00
Jack Grigg ecde950bac
Add Sapling benchmarks to benchmark runner 2019-02-16 18:44:16 +00:00
Homu 6a20252282 Auto merge of #3809 - defuse:dependency-updates, r=str4d
Dependency Updates

This updates:

- Boost from 1.66.0 to 1.69.0
- OpenSSL From 1.1.0h to 1.1.1a
- Proton from 0.17.0 to 0.26.0
- Rust from 1.28.0 to 1.32.0
2019-02-14 17:30:04 -08:00
sandakersmann 2ad41e00ce
Update of copyright year to 2019 2019-02-14 15:00:00 +01:00
Homu 647c155dc7 Auto merge of #3833 - mdr0id:release-v2.0.3, r=mdr0id
Release v2.0.3
2019-02-11 10:34:20 -08:00
mdr0id f4fe8542c7 make-release.py: Updated release notes and changelog for 2.0.3. 2019-02-11 09:16:09 -08:00