When aggregating audits, their criteria need to match exactly. The
description for `license-reviewed` previously made specific references
to aspects of this repository that do not apply to `zcash/librustzcash`
or other repos we want to aggregate from.
This should make occurrences of NodeId wrapping essentially impossible for
real-world usage.
Backport of https://github.com/bitcoin/bitcoin/pull/10176
[zcashd] I have checked that zcashd has no current uses of NodeId that
depend on it being an `int`. All accesses to the global `nLastNodeId`
are under lock. `NodeId` *is* required to be a signed integral type,
because `-1` is used as a sentinel value. It is also formatted using
the `%d` tinyformat specifier, but unlike the C format specifier it is
inspired by, this correctly handles integral types of arbitrary width.
There are `NodeId` fields in `CNodeStats`, `NodeEvictionCandidate`, and
(test-only) `COrphanTx`, but those types are not serializable, and there
is no other ad-hoc serialization of `NodeId` values apart from its use
in the "id" field of the output from the `getpeerinfo` RPC. `UniValue` has
an override of `pushKV` for `int64_t`, and so that use will correctly
handle values up to the [maximum safe JSON/JavaScript integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER),
i.e. $2^{53} - 1$. As upstream did, we argue that it is not feasible to
cause that value to be exceeded.
Co-authored-by: Cory Fields <cory-nospam-@coryfields.com>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
* fields were deserialized into variables of platform-dependent length;
* pfrom->nVersion was set even if it does not meet the minimum version
requirements;
* make sure that pfrom->nTimeOffset is set before
pfrom->fSuccessfullyConnected.
At this point it is still possible for parsing to fail due to a
`std::ios_base::failure`, which will not cause a disconnect.
Co-authored-by: Andrea Lanfranchi <andrea.lanfranchi@gmail.com>
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
Added are:
* Vector(arg1,arg2,arg3,...) constructs a vector with the specified
arguments as elements. The vector's type is derived from the
arguments. If some of the arguments are rvalue references, they
will be moved into place rather than copied (which can't be achieved
using list initialization).
* Cat(vector1,vector2) returns a concatenation of the two vectors,
efficiently moving elements when relevant.
Vector generalizes (and replaces) the Singleton function in
src/descriptor.cpp, and Cat replaces the Cat function in bech32.cpp
(cherry picked from commit bitcoin/bitcoin@e65e61c812)