Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add un ser unittests #10

Open
wants to merge 154 commits into
base: master
Choose a base branch
from
Open

Add un ser unittests #10

wants to merge 154 commits into from

Commits on Oct 28, 2021

  1. Combine common error strings for different options so translations ca…

    …n be shared and reused
    
    (cherry picked from commit 5e10922)
    luke-jr authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    c1201dc View commit details
    Browse the repository at this point in the history
  2. net: require lookup functions to specify all arguments

    To make it clear where DNS resolves are happening
    
    (cherry picked from commit e9fc71e)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    7cca797 View commit details
    Browse the repository at this point in the history
  3. net: manually resolve dns seed sources

    Note: Some seeds aren't actually returning an IP for their name entries, so
    they're being added to addrman with a source of [::].
    
    This commit shouldn't change that behavior, for better or worse.
    
    (cherry picked from commit a98cd1f)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    f7e7659 View commit details
    Browse the repository at this point in the history
  4. net: resolve outside of storage structures

    Rather than allowing CNetAddr/CService/CSubNet to launch DNS queries, require
    that addresses are already resolved.
    
    This greatly simplifies async resolve logic, and makes it harder to
    accidentally leak DNS queries.
    
    (cherry picked from commit 3675699)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    15c30d7 View commit details
    Browse the repository at this point in the history
  5. net: disable resolving from storage structures

    CNetAddr/CService/CSubnet can no longer resolve DNS.
    
    (cherry picked from commit d39f5b4)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    0cee429 View commit details
    Browse the repository at this point in the history
  6. Introduce enum ServiceFlags for service flags

    (cherry picked from commit ee06e04)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    55708f5 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    6c1454b View commit details
    Browse the repository at this point in the history
  8. remove SetServices

    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    8cf62ae View commit details
    Browse the repository at this point in the history
  9. Revert changes from CserviceFlags cherry-pick to prefer zcash logic a…

    …round use of nServices
    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    ba1d17d View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    6e1a9c6 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    bb8a1af View commit details
    Browse the repository at this point in the history
  12. Removed extranious lines

    AloeareV authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    16774a6 View commit details
    Browse the repository at this point in the history
  13. net: Split resolving out of CNetAddr

    (cherry picked from commit 31d6b1d)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    b6649b2 View commit details
    Browse the repository at this point in the history
  14. net: Split resolving out of CService

    (cherry picked from commit f96c7c4)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    634738e View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    b7c6cba View commit details
    Browse the repository at this point in the history
  16. net: Split resolving out of CSubNet

    (cherry picked from commit b6c3ff3)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    0bfe4c5 View commit details
    Browse the repository at this point in the history
  17. net: Add direct tests for new CSubNet constructors

    (cherry picked from commit 1017b8a)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    7095826 View commit details
    Browse the repository at this point in the history
  18. net: move CNetAddr/CService/CSubNet out of netbase

    (cherry picked from commit 21e5b96)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    82064de View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    0b021bc View commit details
    Browse the repository at this point in the history
  20. net: narrow include scope after moving to netaddress

    Net functionality is no longer needed for CAddress/CAddrman/etc. now that
    CNetAddr/CService/CSubNet are dumb storage classes.
    
    (cherry picked from commit 21ba407)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    4ffb715 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    46625fb View commit details
    Browse the repository at this point in the history
  22. net: Have LookupNumeric return a CService directly

    Also fix up a few small issues:
    - Lookup with "badip:port" now sets the port to 0
    - Don't allow assert to have side-effects
    
    (cherry picked from commit 8945384)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    8cdc833 View commit details
    Browse the repository at this point in the history
  23. net: fixup nits

    (cherry picked from commit 9e9d644)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    68e39cd View commit details
    Browse the repository at this point in the history
  24. test: add two edge case tests for CSubNet

    (cherry picked from commit ccef5d7)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    aefb74a View commit details
    Browse the repository at this point in the history
  25. scripted-diff: Replace NET_TOR with NET_ONION

    -BEGIN VERIFY SCRIPT-
    
    sed --in-place'' --expression='s/NET_TOR/NET_ONION/g' $(git grep -I --files-with-matches 'NET_TOR')
    
    -END VERIFY SCRIPT-
    
    The --in-place'' hack is required for sed on macOS to edit files in-place without passing a backup extension.
    
    (cherry picked from commit 07c493f)
    wodry authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    8d1f697 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    b8a1835 View commit details
    Browse the repository at this point in the history
  27. net: improve encapsulation of CNetAddr

    Do not access `CNetAddr::ip` directly from `CService` methods.
    
    This improvement will help later when we change the type of
    `CNetAddr::ip` (in the BIP155 implementation).
    
    Co-authored-by: Carl Dong <[email protected]>
    (cherry picked from commit bc74a40)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    a824fbc View commit details
    Browse the repository at this point in the history
  28. net: document enum Network

    (cherry picked from commit 100c64a)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    498ef00 View commit details
    Browse the repository at this point in the history
  29. net: add an internal subnet for representing unresolved hostnames

    We currently do two resolves for dns seeds: one for the results, and one to
    serve in addrman as the source for those addresses.
    
    There's no requirement that the source hostname resolves to the stored
    identifier, only that the mapping is unique. So rather than incurring the
    second lookup, combine a private subnet with a hash of the hostname.
    
    The resulting v6 ip is guaranteed not to be publicy routable, and has only a
    negligible chance of colliding with a user's internal network (which would be
    of no consequence anyway).
    
    (cherry picked from commit 7f31762)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    13b1b17 View commit details
    Browse the repository at this point in the history
  30. net: document enum Network

    (cherry picked from commit 100c64a)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    69d417a View commit details
    Browse the repository at this point in the history
  31. Add Slice: a (pointer, size) array view that acts like a container

    (cherry picked from commit 833bc08)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    f216563 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    9dd3e05 View commit details
    Browse the repository at this point in the history
  33. netaddress: Update CNetAddr for ORCHIDv2

    The original ORCHID prefix was deprecated as of 2014-03, the new
    ORCHIDv2 prefix was allocated by RFC7343 as of 2014-07. We did not
    consider the original ORCHID prefix routable, and I don't see any reason
    to consider the new one to be either.
    
    (cherry picked from commit 8be3f30)
    dongcarl authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    d9a8e1a View commit details
    Browse the repository at this point in the history
  34. net: extract conditional to bool CNetAddr::IsHeNet

    and remove redundant public declaration
    
    (cherry picked from commit c90b9a2)
    jonatack authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    59dce12 View commit details
    Browse the repository at this point in the history
  35. CNetAddr: Add IsBindAny method to check for INADDR_ANY

    (cherry picked from commit d6a1287)
    luke-jr authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    483f5c1 View commit details
    Browse the repository at this point in the history
  36. Introduce new serialization macros without casts

    This new approach uses a static method which takes the object as
    a argument. This has the advantage that its constness can be a
    template parameter, allowing a single implementation that sees the
    object as const for serialization and non-const for deserialization,
    without casts.
    
    More boilerplate is included in the new macro as well.
    
    (cherry picked from commit ca33451)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    7d8534c View commit details
    Browse the repository at this point in the history
  37. Avoid dereference-of-casted-pointer

    (cherry picked from commit 0aadc11)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    96fa4e2 View commit details
    Browse the repository at this point in the history
  38. Support serialization as another type without casting

    This adds a READWRITEAS(type, obj) macro which serializes obj as if it
    were casted to (const type&) when const, and to (type&) when non-const.
    
    This makes it usable in serialization code that uses a single
    implementation for both serialization and deserializing, which doesn't
    know the constness of the object involved.
    
    (cherry picked from commit 818dc74)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    39a1933 View commit details
    Browse the repository at this point in the history
  39. Convert addrdb/addrman to new serialization

    (cherry picked from commit 9250a08)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    e8f0189 View commit details
    Browse the repository at this point in the history
  40. Fixed outdated use of READWRITEMANY

    AloeareV authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    78eda4c View commit details
    Browse the repository at this point in the history
  41. Introduce CHashVerifier to hash read data

    This is necessary later, when we drop the nVersion field from the undo
    data. At that point deserializing and reserializing the data won't
    roundtrip anymore, and thus that approach can't be used to verify
    checksums anymore.
    
    With this CHashVerifier approach, we can deserialize while hashing the
    exact serialized form that was used. This is both more efficient and
    more correct in that case.
    
    (cherry picked from commit e484652)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    d6ed0b0 View commit details
    Browse the repository at this point in the history
  42. Deduplicate addrdb.cpp and use CHashWriter/Verifier

    (cherry picked from commit cf68a48)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    f30969b View commit details
    Browse the repository at this point in the history
  43. Support deserializing into temporaries

    Currently, the READWRITE macro cannot be passed any non-const temporaries, as
    the SerReadWrite function only accepts lvalue references.
    
    Deserializing into a temporary is very common, however. See for example
    things like 's >> VARINT(n)'. The VARINT macro produces a temporary wrapper
    that holds a reference to n.
    
    Fix this by accepting non-const rvalue references instead of lvalue references.
    We don't propagate the rvalue-ness down, as there are no useful optimizations
    that only apply to temporaries.
    
    Then use this new functionality to get rid of many (but not all) uses of the
    'REF' macro (which casts away constness).
    
    (cherry picked from commit 172f5fa)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    4616f46 View commit details
    Browse the repository at this point in the history
  44. Add static_assert to prevent VARINT(<signed value>)

    Using VARINT with signed types is dangerous because negative values will appear
    to serialize correctly, but then deserialize as positive values mod 128.
    
    This commit changes the VARINT macro to trigger an error by default if called
    with an signed value, and updates broken uses of VARINT to pass a special flag
    that lets them keep working with no change in behavior.
    
    (cherry picked from commit 499d95e)
    ryanofsky authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    18b4026 View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    13fd76b View commit details
    Browse the repository at this point in the history
  46. Add a generic approach for (de)serialization of objects using code in…

    … other classes
    
    This adds the (internal) Wrapper class, and the Using function that uses it. Given
    a class F that implements Ser(stream, const object&) and Unser(stream, object&)
    functions, this permits writing e.g. READWRITE(Using<F>(object)).
    
    (cherry picked from commit ca62563)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    45f015e View commit details
    Browse the repository at this point in the history
  47. Convert VARINT to the formatter/Using approach

    ( cherry-picked _MANUALLY_ from 2f1b2f4 )
    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    3b32b98 View commit details
    Browse the repository at this point in the history
  48. Get rid of VARINT default argument

    This removes the need for the GNU C++ extension of variadic macros.
    
    (cherry picked from commit 0e0fa27)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    b6cd764 View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    cd95f41 View commit details
    Browse the repository at this point in the history
  50. prevector: add C++11-like data() method

    This returns a pointer to the beginning of the vector's data.
    
    (cherry picked from commit 47314e6)
    laanwj authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    c638d20 View commit details
    Browse the repository at this point in the history
  51. serialize: Deprecate begin_ptr / end_ptr

    Implement `begin_ptr` and `end_ptr` in terms of C++11 code,
    and add a comment that they are deprecated.
    
    Follow-up to developer notes update in 654a211.
    
    (cherry picked from commit f00705a)
    laanwj authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    bb73863 View commit details
    Browse the repository at this point in the history
  52. Refactor: Removed begin/end_ptr functions.

    (cherry picked from commit 8c1dbc5)
    kallewoof authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    c37db9b View commit details
    Browse the repository at this point in the history
  53. Add native support for serializing char arrays without FLATDATA

    Support is added to serialize arrays of type char or unsigned char directly,
    without any wrappers. All invocations of the FLATDATA wrappers that are
    obsoleted by this are removed.
    
    This includes a patch by Russell Yanofsky to make char casting type safe.
    
    The serialization of CSubNet is changed to serialize a bool directly rather
    than though FLATDATA. This makes the serialization independent of the size
    of the bool type (and will use 1 byte everywhere).
    
    (cherry picked from commit a7c45bc)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    f90041a View commit details
    Browse the repository at this point in the history
  54. Support serializing Span<unsigned char> and use that instead of FLATDATA

    (cherry picked from commit 9272d70)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    fa3af89 View commit details
    Browse the repository at this point in the history
  55. Add FORMATTER_METHODS, similar to SERIALIZE_METHODS, but for formatters

    (cherry picked from commit ca34c5c)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    4160900 View commit details
    Browse the repository at this point in the history
  56. Add a constant for the maximum vector allocation (5 Mbyte)

    (cherry picked from commit 37d800b)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    3e57340 View commit details
    Browse the repository at this point in the history
  57. Add custom vector-element formatter

    This allows a very compact notation for serialization of vectors whose
    elements are not serialized using their default encoding.
    
    (cherry picked from commit abf8624)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    abd5134 View commit details
    Browse the repository at this point in the history
  58. Make std::vector and prevector reuse the VectorFormatter logic

    (cherry picked from commit 3cd8ab9)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    4757d5b View commit details
    Browse the repository at this point in the history
  59. Convert CCompactSize to proper formatter

    (cherry picked from commit 3ca574c)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    19b6329 View commit details
    Browse the repository at this point in the history
  60. Make VectorFormatter support stateful formatters

    (cherry picked from commit 56dd9f0)
    ryanofsky authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    a8b7e36 View commit details
    Browse the repository at this point in the history
  61. Add CustomUintFormatter

    (cherry picked from commit e574fff)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    f0b100e View commit details
    Browse the repository at this point in the history
  62. Merge BigEndian functionality into CustomUintFormatter

    (cherry picked from commit 769ee5f)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    703cfad View commit details
    Browse the repository at this point in the history
  63. Extend CustomUintFormatter to support enums

    Extracted by Pieter Wuille from a comment by Russ Yanofsky, see
    bitcoin/bitcoin#18317 (comment).
    
    (cherry picked from commit 6f9a1e5)
    ryanofsky authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    0c3735b View commit details
    Browse the repository at this point in the history
  64. Add SER_READ and SER_WRITE for read/write-dependent statements

    Extracted and extended by Pieter Wuille from a comment by Russ
    Yanofsky (see
    bitcoin/bitcoin#18317 (comment)).
    
    (cherry picked from commit d06fedd)
    ryanofsky authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    c11c6c0 View commit details
    Browse the repository at this point in the history
  65. Convert everything except wallet/qt to new serialization

    (only picked changes to tests and netaddress.h, other changes are
    outside the scope of this cherry-pick)
    
    (cherry picked from commit 4eb5643)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    b5ae2ee View commit details
    Browse the repository at this point in the history
  66. Do not shadow variables in networking code

    (cherry picked from commit b7c349d)
    paveljanik authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    7826ea3 View commit details
    Browse the repository at this point in the history
  67. net: save the network type explicitly in CNetAddr

    Before this change, we would analyze the contents of `CNetAddr::ip[16]`
    in order to tell which type is an address. Change this by introducing a
    new member `CNetAddr::m_net` that explicitly tells the type of the
    address.
    
    This is necessary because in BIP155 we will not be able to tell the
    address type by just looking at its raw representation (e.g. both TORv3
    and I2P are "seemingly random" 32 bytes).
    
    As a side effect of this change we no longer need to store IPv4
    addresses encoded as IPv6 addresses - we can store them in proper 4
    bytes (will be done in a separate commit). Also the code gets
    somewhat simplified - instead of
    `memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0` we can use
    `m_net == NET_IPV4`.
    
    Co-authored-by: Carl Dong <[email protected]>
    (cherry picked from commit bcfebb6)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    5bd20ee View commit details
    Browse the repository at this point in the history
  68. net: don't accept non-left-contiguous netmasks

    A netmask that contains 1-bits after 0-bits (the 1-bits are not
    contiguous on the left side) is invalid [1] [2].
    
    The code before this PR used to parse and accept such
    non-left-contiguous netmasks. However, a coming change that will alter
    `CNetAddr::ip` to have flexible size would make juggling with such
    netmasks more difficult, thus drop support for those.
    
    [1] https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#Subnet_masks
    [2] https://tools.ietf.org/html/rfc4632#section-5.1
    
    (cherry picked from commit 1ea57ad)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    d0fee54 View commit details
    Browse the repository at this point in the history
  69. net: improve encapsulation of CNetAddr

    Do not access `CNetAddr::ip` directly from `CService` methods.
    
    This improvement will help later when we change the type of
    `CNetAddr::ip` (in the BIP155 implementation).
    
    Co-authored-by: Carl Dong <[email protected]>
    (cherry picked from commit bc74a40)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    fa45937 View commit details
    Browse the repository at this point in the history
  70. net: Minor accumulated cleanups

    (cherry picked from commit 2c084a6)
    tjps authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    071e2a7 View commit details
    Browse the repository at this point in the history
  71. fix uninitialized read when stringifying an addrLocal

    Reachable from either place where SetIP is used when our best-guess
    addrLocal for a peer is IPv4, but the peer tells us it's reaching us at
    an IPv6 address.
    
    In that case, SetIP turns an IPv4 address into an IPv6 address without
    setting the scopeId, which is subsequently read in GetSockAddr during
    CNetAddr::ToStringIP and passed to getnameinfo. Fix by ensuring every
    constructor initializes the scopeId field with something.
    
    (cherry picked from commit b7b36de)
    kazcw authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    f61ba91 View commit details
    Browse the repository at this point in the history
  72. Do not increment nAttempts by more than one for every Good connection.

    This slows the increase of the nAttempts in addrman while partitioned,
     even if the node hasn't yet noticed the partitioning.
    
    (cherry picked from commit 6182d10)
    gmaxwell authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    c91d7b6 View commit details
    Browse the repository at this point in the history
  73. Add more methods to Span class

    This introduces a rudimentary begin(), end(), operator[], and subspan to Span.
    
    (cherry picked from commit 29943a9)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    c9fd358 View commit details
    Browse the repository at this point in the history
  74. Make VerifyWitnessProgram use a Span stack

    This allows for very cheap transformations on the range of elements that
    are to be passed to ExecuteWitnessScript.
    
    (cherry picked from commit 2b0fcff)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    61e7475 View commit details
    Browse the repository at this point in the history
  75. Support conversion between Spans of compatible types

    (cherry picked from commit 0fbde48)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    18a7388 View commit details
    Browse the repository at this point in the history
  76. Make Span size type unsigned

    This matches a change in the C++20 std::span proposal.
    
    (cherry picked from commit 1f790a1)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    047b65c View commit details
    Browse the repository at this point in the history
  77. Make pointer-based Span construction safer

    This prevents constructing a Span<A> given two pointers into an array
    of B (where B is a subclass of A), at least without explicit cast to
    pointers to A.
    
    (cherry picked from commit bb3d38f)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    4ebecbf View commit details
    Browse the repository at this point in the history
  78. Add Span constructors for arrays and vectors

    (cherry picked from commit ab303a1)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    45a240b View commit details
    Browse the repository at this point in the history
  79. Add sanity check asserts to span when -DDEBUG

    (cherry picked from commit 26acc8d)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    eb786c2 View commit details
    Browse the repository at this point in the history
  80. Add MakeUCharSpan, to help constructing Span<[const] unsigned char>

    Based on a suggestion by Russell Yanofsky.
    
    (cherry picked from commit e63dcc3)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    98a7759 View commit details
    Browse the repository at this point in the history
  81. doc: Document Span pitfalls

    (cherry picked from commit 3502a60)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    e9c33bc View commit details
    Browse the repository at this point in the history
  82. span: Add Span::empty() and use it in script/descriptor

    (cherry picked from commit fa2ae0a)
    MarcoFalke authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    1c41916 View commit details
    Browse the repository at this point in the history
  83. gitignore *configure~*

    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    421dbf1 View commit details
    Browse the repository at this point in the history
  84. cherry-pick GetNetClass definition and invocation

    Return mapped AS in RPC call getpeerinfo
    
    If ASN bucketing is used, return a corresponding AS
    used in bucketing for a given peer.
    
    (cherry picked from commit e4658aa)
    naumenkogs authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    706a742 View commit details
    Browse the repository at this point in the history
  85. add dropped close bracket

    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    a27acdd View commit details
    Browse the repository at this point in the history
  86. Use ASNs for mapped IPv4 addresses correctly

    (cherry picked from commit 38c2395)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    27f5b56 View commit details
    Browse the repository at this point in the history
  87. net: change CNetAddr::ip to have flexible size

    Before this change `CNetAddr::ip` was a fixed-size array of 16 bytes,
    not being able to store larger addresses (e.g. TORv3) and encoded
    smaller ones as 16-byte IPv6 addresses.
    
    Change its type to `prevector`, so that it can hold larger addresses and
    do not disguise non-IPv6 addresses as IPv6. So the IPv4 address
    `1.2.3.4` is now encoded as `01020304` instead of
    `00000000000000000000FFFF01020304`.
    
    Rename `CNetAddr::ip` to `CNetAddr::m_addr` because it is not an "IP" or
    "IP address" (TOR addresses are not IP addresses).
    
    In order to preserve backward compatibility with serialization (where
    e.g. `1.2.3.4` is serialized as `00000000000000000000FFFF01020304`)
    introduce `CNetAddr` dedicated legacy serialize/unserialize methods.
    
    Adjust `CSubNet` accordingly. Still use `CSubNet::netmask[]` of fixed 16
    bytes, but use the first 4 for IPv4 (not the last 4). Only allow
    subnetting for IPv4 and IPv6.
    
    Co-authored-by: Carl Dong <[email protected]>
    (cherry picked from commit 102867c)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    a975a25 View commit details
    Browse the repository at this point in the history
  88. Configuration menu
    Copy the full SHA
    23fb43f View commit details
    Browse the repository at this point in the history
  89. util: Add ParseUInt32

    Add error and range-checking parsers for unsigned 32 bit numbers.
    The 32-bit variant is required for parsing sequence numbers from the
    command line in `bitcoin-tx` (see #8164 for discussion).
    
    Also adds tests, and updates `developer-notes.md`.
    
    (cherry picked from commit e012f3c)
    laanwj authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    f683243 View commit details
    Browse the repository at this point in the history
  90. Configuration menu
    Copy the full SHA
    31fa6c6 View commit details
    Browse the repository at this point in the history
  91. Configuration menu
    Copy the full SHA
    4c918c9 View commit details
    Browse the repository at this point in the history
  92. Configuration menu
    Copy the full SHA
    3887a05 View commit details
    Browse the repository at this point in the history
  93. Configuration menu
    Copy the full SHA
    0e3111e View commit details
    Browse the repository at this point in the history
  94. Configuration menu
    Copy the full SHA
    ea2238c View commit details
    Browse the repository at this point in the history
  95. Configuration menu
    Copy the full SHA
    510dae5 View commit details
    Browse the repository at this point in the history
  96. fix typo

    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    cc71b96 View commit details
    Browse the repository at this point in the history
  97. Drop IsLimited in favor of IsReachable

    These two methods have had the same meaning, but inverted, since
    110b62f. Having one name for a single
    concept simplifies the code.
    
    (cherry picked from commit d6b076c)
    Empact authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    baa7c1c View commit details
    Browse the repository at this point in the history
  98. Configuration menu
    Copy the full SHA
    360709f View commit details
    Browse the repository at this point in the history
  99. revert c_str()

    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    eb476a7 View commit details
    Browse the repository at this point in the history
  100. util: Don't allow base58-decoding of std::string:s containing non-bas…

    …e58 characters
    
    (cherry picked from commit d945c6f)
    practicalswift authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    5816f7c View commit details
    Browse the repository at this point in the history
  101. use correct base58 invocation

    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    460ef32 View commit details
    Browse the repository at this point in the history
  102. adjust names

    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    13dab44 View commit details
    Browse the repository at this point in the history
  103. net: Avoid using C-style NUL-terminated strings as arguments in the n…

    …etbase interface
    
    (cherry picked from commit 9574de8)
    practicalswift authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    4ed412f View commit details
    Browse the repository at this point in the history
  104. revert ConnectThroughProxy

    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    9f3ae14 View commit details
    Browse the repository at this point in the history
  105. Configuration menu
    Copy the full SHA
    811c033 View commit details
    Browse the repository at this point in the history
  106. util: move HasPrefix() so it can be reused

    Move the function `HasPrefix()` from `netaddress.cpp` to `util/string.h`
    so it can be reused by `CNetAddr` methods (and possibly others).
    
    (cherry picked from commit d2bb681)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    ab33377 View commit details
    Browse the repository at this point in the history
  107. test: move HasReason so it can be reused

    This file was previously removed, and..  perhaps will be again.
    
    src/test/util/setup_common.h
    
    Move the class `HasReason` from `miner_tests.cpp` to
    `setup_common.h` so that it can be reused by other tests.
    
    (cherry picked from commit fe42411)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    9ab383e View commit details
    Browse the repository at this point in the history
  108. net: CNetAddr: add support to (un)serialize as ADDRv2

    Co-authored-by: Carl Dong <[email protected]>
    (cherry picked from commit e0d7357)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    5c9d3b3 View commit details
    Browse the repository at this point in the history
  109. comment out third test

    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    8f74822 View commit details
    Browse the repository at this point in the history
  110. net: recognize TORv3/I2P/CJDNS networks

    Recognizing addresses from those networks allows us to accept and gossip
    them, even though we don't know how to connect to them (yet).
    
    Co-authored-by: eriknylund <[email protected]>
    (cherry picked from commit 7be6ff6)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    881eadd View commit details
    Browse the repository at this point in the history
  111. Configuration menu
    Copy the full SHA
    c84d6de View commit details
    Browse the repository at this point in the history
  112. Implement keccak-f[1600] and SHA3-256

    (cherry picked from commit 2ac8bf9)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    d98b755 View commit details
    Browse the repository at this point in the history
  113. Configuration menu
    Copy the full SHA
    03407f2 View commit details
    Browse the repository at this point in the history
  114. Add FastRandomContext::rand256() and ::randbytes()

    FastRandomContext now provides all functionality that the real Rand* functions
    provide.
    
    (cherry picked from commit 37e864e)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    6e4ed7d View commit details
    Browse the repository at this point in the history
  115. use insecure_randbits as name

    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    c9bc6fe View commit details
    Browse the repository at this point in the history
  116. Configuration menu
    Copy the full SHA
    44d8aec View commit details
    Browse the repository at this point in the history
  117. Make CHash256 and CHash160 consume Spans

    Note this doesn't build, missing identifier: SHA256D64
    (cherry picked from commit e549bf8)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    03f6a28 View commit details
    Browse the repository at this point in the history
  118. Configuration menu
    Copy the full SHA
    73e18ec View commit details
    Browse the repository at this point in the history
  119. Configuration menu
    Copy the full SHA
    3cb026f View commit details
    Browse the repository at this point in the history
  120. Configuration menu
    Copy the full SHA
    b9ee309 View commit details
    Browse the repository at this point in the history
  121. Support bypassing range check in ReadCompactSize

    This is needed when we want to encode an arbitrary number as CompactSize
    like node service flags, which is a bitmask and could be bigger than the
    usual size of an object.
    
    (cherry picked from commit 1d3ec2a)
    (cherry picked from commit e86ce4e)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    8b9f55c View commit details
    Browse the repository at this point in the history
  122. Convert LimitedString to formatter

    (cherry picked from commit 92beff1)
    sipa authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    df8f19b View commit details
    Browse the repository at this point in the history
  123. adapted from 201a459

    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    c510def View commit details
    Browse the repository at this point in the history
  124. net: CAddress & CAddrMan: (un)serialize as ADDRv2

    Change the serialization of `CAddrMan` to serialize its addresses
    in ADDRv2/BIP155 format by default. Introduce a new `CAddrMan` format
    version (3).
    
    Add support for ADDRv2 format in `CAddress` (un)serialization.
    
    Co-authored-by: Carl Dong <[email protected]>
    (cherry picked from commit 201a459)
    (cherry picked from commit bd2c485)
    vasild authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    65fd791 View commit details
    Browse the repository at this point in the history
  125. Configuration menu
    Copy the full SHA
    8d97eed View commit details
    Browse the repository at this point in the history
  126. HACK in Format::V1_BIP155

    (cherry picked from commit 857baca)
    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    0325124 View commit details
    Browse the repository at this point in the history
  127. Configuration menu
    Copy the full SHA
    ca67de1 View commit details
    Browse the repository at this point in the history
  128. Configuration menu
    Copy the full SHA
    7473b8f View commit details
    Browse the repository at this point in the history
  129. remove unsupported service types from tests

    (cherry picked from commit 27d53eb)
    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    b2ea131 View commit details
    Browse the repository at this point in the history
  130. correct test vector counts

    (cherry picked from commit 5c34bff)
    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    726029a View commit details
    Browse the repository at this point in the history
  131. net: add CVectorWriter and CNetMsgMaker

    CVectorWriter is useful for overwriting or appending an existing byte vector.
    
    CNetMsgMaker is a shortcut for creating messages on-the-fly which are suitable
    for pushing to CConnman.
    
    (cherry picked from commit 2ec935d)
    (cherry picked from commit 878e63c)
    theuni authored and zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    842e727 View commit details
    Browse the repository at this point in the history
  132. minimal changes to net.h and net_processing.cpp

    minimally change net_processing by adding "addrv2" as a strCommand
    minimally change net.h with addition of m_wants_addrv2
    
    (cherry picked from commit 353a3fd)
    (cherry picked from commit d2d5557)
    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    6a97885 View commit details
    Browse the repository at this point in the history
  133. minimal changes to net.h and netaddress.{h,cpp}

     (cherry picked from commit 353a3fd)
    
    (cherry picked from commit 19ee7cf)
    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    ef9322e View commit details
    Browse the repository at this point in the history
  134. update torcontrol.cpp

      (cherry picked from commit dcf0cb4)
    
    (cherry picked from commit 796c30a)
    zancas committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    22a18dd View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2021

  1. remove unused include

    zancas committed Nov 9, 2021
    Configuration menu
    Copy the full SHA
    b97dfd7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b5f4da8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9ee66e4 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f37e6e9 View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2021

  1. net: advertise support for ADDRv2 via new message

    Introduce a new message `sendaddrv2` to signal support for ADDRv2.
    Send the new message immediately after sending the `VERACK` message.
    
    Add support for receiving and parsing ADDRv2 messages.
    
    Send ADDRv2 messages (instead of ADDR) to a peer if he has
    advertised support for it.
    
    Co-authored-by: Carl Dong <[email protected]>
    (cherry picked from commit 353a3fd)
    vasild authored and zancas committed Nov 17, 2021
    Configuration menu
    Copy the full SHA
    46fb77e View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2021

  1. Configuration menu
    Copy the full SHA
    5a49fd8 View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2021

  1. Configuration menu
    Copy the full SHA
    6535c8e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    48bb561 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5653867 View commit details
    Browse the repository at this point in the history
  4. hack on serialization test

    zancas committed Nov 19, 2021
    Configuration menu
    Copy the full SHA
    6ef2d0f View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2021

  1. Configuration menu
    Copy the full SHA
    7670fb2 View commit details
    Browse the repository at this point in the history

Commits on Nov 29, 2021

  1. Configuration menu
    Copy the full SHA
    df94812 View commit details
    Browse the repository at this point in the history
  2. add read_from_protocol_v1

    zancas committed Nov 29, 2021
    Configuration menu
    Copy the full SHA
    a6bdfec View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2021

  1. Configuration menu
    Copy the full SHA
    20f2d87 View commit details
    Browse the repository at this point in the history
  2. remove default

    zancas committed Dec 1, 2021
    Configuration menu
    Copy the full SHA
    e593e36 View commit details
    Browse the repository at this point in the history

Commits on Dec 3, 2021

  1. Configuration menu
    Copy the full SHA
    5fb7f2b View commit details
    Browse the repository at this point in the history

Commits on Dec 6, 2021

  1. remove debug statements

    zancas committed Dec 6, 2021
    Configuration menu
    Copy the full SHA
    8c70dc8 View commit details
    Browse the repository at this point in the history
  2. remove debug from net.cpp

    zancas committed Dec 6, 2021
    Configuration menu
    Copy the full SHA
    7380394 View commit details
    Browse the repository at this point in the history

Commits on Dec 8, 2021

  1. Configuration menu
    Copy the full SHA
    8b1bf1c View commit details
    Browse the repository at this point in the history

Commits on Dec 9, 2021

  1. Configuration menu
    Copy the full SHA
    b23ffdc View commit details
    Browse the repository at this point in the history