Commit Graph

17235 Commits

Author SHA1 Message Date
Kris Nuttycombe 71e80c8656 Postpone dependency updates for v5.4.2 hotfix. 2023-02-20 19:54:51 -07:00
Kris Nuttycombe 10ba5f12ff Merge commit '1478dc1e7f1ccd89bac76fc738650877fbfd1422' into hotfix-5.4.2 2023-02-20 19:52:21 -07:00
Kris Nuttycombe 1478dc1e7f Update release notes for v5.3.3 hotfix 2023-02-20 19:37:38 -07:00
Kris Nuttycombe 2c85dd9598 Merge remote-tracking branch '22387-backport' into hotfix-5.3.3 2023-02-20 19:33:18 -07:00
Kris Nuttycombe 169e890f1e Merge remote-tracking branch 'trim-cnode' into hotfix-5.3.3 2023-02-20 19:30:48 -07:00
Kris Nuttycombe f30c3c97b7 Merge remote-tracking branch 'remove-mapRequest' into hotfix-5.3.3 2023-02-20 19:30:25 -07:00
Daira Hopwood 074e633798 Improve the encapsulation of `CNode::filterInventoryKnown`.
Co-authored-by: Jack Grigg <jack@z.cash>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2023-02-20 23:39:20 +00:00
Daira Hopwood c5b8807ce7 Ensure that CNode::{addrKnown, filterInventoryKnown} immediately take
little memory when we disconnect the node.

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Co-authored-by: Jack Grigg <str4d@z.cash>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2023-02-20 20:14:55 +00:00
Daira Hopwood 0a39cc6727 Enable a CRollingBloomFilter to be reset to a state where it takes little memory.
Co-authored-by: Jack Grigg <jack@z.cash>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2023-02-20 18:32:46 +00:00
Jon Atack 9555b5e8a4 p2p, rpc, test: address rate-limiting follow-ups
(cherry picked from commit bitcoin/bitcoin@d930c7f5b0)
2023-02-17 17:54:39 -07:00
Pieter Wuille 1dddc1337c Add logging and addr rate limiting statistics
Includes logging improvements by Vasil Dimov and John Newbery.

(cherry picked from commit bitcoin/bitcoin@f424d601e1)
2023-02-17 16:47:47 -07:00
Pieter Wuille c8cdfcffd0 Randomize the order of addr processing
(cherry picked from commit bitcoin/bitcoin@5648138f59)
2023-02-17 16:47:37 -07:00
Greg Pfeil 2c48eddfa5
Remove `ResetRequestCount`
There is no longer any `mapRequestCount` to reset.

This also removes the `BlockFound` signal, as its only purpose was to call
`ResetRequestCount`.
2023-02-17 15:45:29 -07:00
Pieter Wuille 7c739e2b20 Rate limit the processing of incoming addr messages
While limitations on the influence of attackers on addrman already
exist (affected buckets are restricted to a subset based on incoming
IP / network group), there is no reason to permit them to let them
feed us addresses at more than a multiple of the normal network
rate.

This commit introduces a "token bucket" rate limiter for the
processing of addresses in incoming ADDR and ADDRV2 messages.
Every connection gets an associated token bucket. Processing an
address in an ADDR or ADDRV2 message from non-whitelisted peers
consumes a token from the bucket. If the bucket is empty, the
address is ignored (it is not forwarded or processed). The token
counter increases at a rate of 0.1 tokens per second, and will
accrue up to a maximum of 1000 tokens (the maximum we accept in a
single ADDR or ADDRV2). When a GETADDR is sent to a peer, it
immediately gets 1000 additional tokens, as we actively desire many
addresses from such peers (this may temporarily cause the token
count to exceed 1000).

The rate limit of 0.1 addr/s was chosen based on observation of
honest nodes on the network. Activity in general from most nodes
is either 0, or up to a maximum around 0.025 addr/s for recent
Bitcoin Core nodes. A few (self-identified, through subver) crawler
nodes occasionally exceed 0.1 addr/s.

(cherry-picked from commit bitcoin/bitcoin@0d64b8f709)
2023-02-17 14:36:25 -07:00
Matt Corallo aa88e23f6b
Remove useless mapRequest tracking that just effects Qt display.
I thought we had removed this a long time ago, TBH, its really
confusing feedback to users that we display whether a tx was
broadcast to immediate neighbor nodes, given that has little
indication of whether the tx propagated very far.
2023-02-17 14:04:37 -07:00
Jack Grigg bb172416d5 Fix typo in v5.4.1 release notes 2023-02-13 18:24:05 +00:00
Jack Grigg 56626bcb29 make-release.py: Updated release notes and changelog for 5.4.1. 2023-02-13 18:10:07 +00:00
Jack Grigg 1d7e797436 make-release.py: Updated manpages for 5.4.1. 2023-02-13 18:10:07 +00:00
Jack Grigg fc6ddfa605 make-release.py: Versioning changes for 5.4.1. 2023-02-13 18:06:28 +00:00
Jack Grigg 7628ec7dfa Postpone dependency updates for v5.4.1 2023-02-13 18:05:35 +00:00
Jack Grigg f5288d44d7 Write release notes for v5.4.1 2023-02-13 18:01:55 +00:00
Kris Nuttycombe 97aa2b9442
Merge pull request #6423 from str4d/6420-allowdeprecated-in-config-file
Load `-allowdeprecated` settings after reading the config file
2023-02-10 17:53:20 -07:00
Jack Grigg 1ceb4c19cc qa: Extend `wallet_deprecation` to test `allowdeprecated` in config file
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-02-10 23:57:05 +00:00
Jack Grigg 8dd3e6135d qa: Refactor `wallet_deprecation` test to extract common logic
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-02-10 23:57:05 +00:00
Kris Nuttycombe 8707a8e9f5
Merge pull request #6424 from str4d/sideport-reindex-lock-contention-fix-5.4.1
Sleep for 200µs before each `ActivateBestChainStep` call
2023-02-10 15:40:51 -07:00
Jack Grigg b814336aec Load `-allowdeprecated` settings after reading the config file
We need to load these early so that it's possible for other
initialization steps to respect them. However, we were loading them
slightly too early, before the config file had been read, which meant
that only CLI arguments were being used.

We now load the `-allowdeprecated` settings just after the config file
is parsed and the chain parameters are prepared; neither of these are
features we would ever consider deprecating (at least while `zcashd`
exists in its Bitcoin Core-derived form).

Closes zcash/zcash#6420.
2023-02-10 22:14:10 +00:00
Jack Grigg 774f2d8eda Document known issues in v5.4.0 release notes 2023-02-08 17:50:06 +00:00
Jack Grigg 0e277800bb make-release.py: Updated release notes and changelog for 5.4.0. 2023-02-08 17:21:10 +00:00
Jack Grigg 3ca7d806fa make-release.py: Updated manpages for 5.4.0. 2023-02-08 17:21:09 +00:00
Jack Grigg 4cb8973c22 make-release.py: Versioning changes for 5.4.0. 2023-02-08 17:07:58 +00:00
str4d 048af2d7a3
Adjust documentation of 200µs sleep
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-02-07 19:08:59 +00:00
Jack Grigg e2cd1b761f Sleep for 200us before each ActivateBestChainStep call
This should lower the main thread's likelihood to immediately reacquire
cs_main after dropping it, which should help ThreadNotifyWallets and the
RPC methods to acquire cs_main more quickly.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2023-02-03 23:12:28 +00:00
Kris Nuttycombe bd2cabf6fd
Merge pull request #6391 from nuttycom/release-v5.4.0-rc4
Release v5.4.0-rc4
2023-02-01 19:51:10 -07:00
Kris Nuttycombe 7b28054e8b make-release.py: Updated release notes and changelog for 5.4.0-rc4. 2023-02-01 17:37:55 -07:00
Kris Nuttycombe 6abe21ba45 make-release.py: Updated manpages for 5.4.0-rc4. 2023-02-01 17:37:54 -07:00
Kris Nuttycombe 6ae749d4d9 make-release.py: Versioning changes for 5.4.0-rc4. 2023-02-01 17:35:05 -07:00
Kris Nuttycombe 582dc52b67 Add #6387 fix to v5.4.0 release notes. 2023-02-01 17:34:35 -07:00
Kris Nuttycombe 5fb4385c5a Postpone rustcxx and native_cxxbridge versions 1.0.89 2023-02-01 17:28:38 -07:00
Charlie O'Keefe e8ae3d97a1
Merge pull request #6394 from nuttycom/zmq_check_snprintf_return
Patch zeromq to check the return value of snprintf where necessary.
2023-02-01 17:19:45 -07:00
Kris Nuttycombe 7024b7f5c0 Patch zeromq to check the return value of snprintf where necessary.
@daira identified an error in https://github.com/zeromq/libzmq/pull/4494
that we reproduced in zcash/zcash#6393. This adds @daira's patch from
https://github.com/zeromq/libzmq/pull/4507 to ensure we handle this
potential case of undefined behavior.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-02-01 12:31:13 -07:00
Kris Nuttycombe 0fab09d46e
Merge pull request #6393 from nuttycom/fix/zeromq_macos_build
Patch uses of `sprintf` in `zeromq` that break the build on macOS
2023-01-31 21:26:33 -07:00
Kris Nuttycombe 9751b18207 Patch uses of `sprintf` in `zeromq` that break the build on macOS
Fixes #6006, #6296
2023-01-31 15:55:33 -07:00
Kris Nuttycombe 26dbee2c5f
Merge pull request #6387 from str4d/6004-orchard-reindex
Reset Orchard wallet state in `CWallet::ClearNoteWitnessCache`
2023-01-31 13:36:33 -07:00
Jack Grigg 204950191c Reset Orchard wallet state in `CWallet::ClearNoteWitnessCache`
The general invariant in the wallet is that `CWallet::ChainTip` is only
called with sequential (either connecting or disconnecting) blocks. The
one exception to this is when starting `zcashd` with `-reindex`, which
creates a discontinuity: the node jumps back to the genesis block, and
`ThreadNotifyWallets` will similarly start notifying the wallet of the
entire chain again.

In Bitcoin Core, this behaviour was fine: there was no persistent cached
state that couldn't just be overwritten during the re-notification. For
Zcash however, wallets need to additionally maintain witnesses for notes
that are spendable, and these witnesses can generally only be amended by
sequential blocks.

For Sprout and Sapling, the discontinuity was handled by checking if a
reindex was occurring during `CWallet::InitLoadWallet`, and clearing the
witness caches in `CWallet::ClearNoteWitnessCache` if so. The witnesses
would then be rebuilt as the reindexed chain was re-connected during
`ActivateBestChain`.

The Orchard wallet stores its witnesses in a different structure on the
Rust side, so it wasn't being cleared at the same time. This meant that
when a full reindex was performed in one go, the sequentiality invariant
would be broken once `ThreadNotifyWallets` reached NU5 activation, and
the node would crash with a failed assertion (the issue at hand).

However, reindexing Zcash takes a long time, and has been historically
buggy for various reasons (e.g. crashing due to OOM). And due to a quirk
of how the `-rescan` behaviour is implemented, if a reindexing node is
restarted during its `ActivateBestChain` phase, on restart the node will
almost always trigger a rescan due to the wallet chain locator not
containing any hashes that match the on-start chain tip. And the first
thing that the rescan logic does is check whether the start of the
rescan is before NU5 activation, and reset the Orchard wallet if so.

We now reset the Orchard wallet unconditionally at the same time as we
clear the Sprout and Sapling witness caches. This additionally clears
spentness information that the Orchard wallet is storing, but that is
rebuilt during the reindex.

Closes zcash/zcash#5736.
Closes zcash/zcash#6004.
2023-01-31 00:28:30 +00:00
Jack Grigg 0d1e1ad438 Fix return type of `orchard_wallet_reset`
Part of zcash/zcash#6386.
2023-01-31 00:28:30 +00:00
Jack Grigg 51d62c652d qa: Add RPC test reproducing the Orchard reindex issue
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2023-01-31 00:28:30 +00:00
Kris Nuttycombe abda46722b
Merge pull request #6382 from nuttycom/defer_zbalance_deprecation
Defer z_getbalance and z_gettotalbalance disablement.
2023-01-30 16:57:07 -07:00
Kris Nuttycombe c9d6230e88 Defer z_getbalance and z_gettotalbalance disablement.
These disable-by-default changes need to be deferred until we
have a better replacement that provides a single source for
summary balance information.
2023-01-30 11:00:09 -07:00
Kris Nuttycombe f3b93f87f3
Merge pull request #6380 from zcash/release-v5.4.0-rc3
Release v5.4.0-rc3
2023-01-27 16:11:27 -07:00
Kris Nuttycombe d9a60c9d1e make-release.py: Updated release notes and changelog for 5.4.0-rc3. 2023-01-27 15:07:19 -07:00