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 C++17 build to Travis #18591

Merged
merged 4 commits into from
Apr 30, 2020
Merged

Add C++17 build to Travis #18591

merged 4 commits into from
Apr 30, 2020

Conversation

sipa
Copy link
Member

@sipa sipa commented Apr 11, 2020

This adds a --enable-c++17 option to the configure script, fixes the only C++17 incompatibility (with a commit taken from #18468), and adds a Travis test for it.

This is all off by default, and release builds remain C++11.

It implements the first step of the plan in #16684.

configure.ac Outdated Show resolved Hide resolved
@fanquake
Copy link
Member

Is this just to ensure continued C++17 compatibility of the codebase going forward?

@sipa
Copy link
Member Author

sipa commented Apr 11, 2020

@fanquake No, just the first step. See the plan in #16684.

@fanquake
Copy link
Member

No, just the first step. See the plan in #16684.

I mean, is the point of the CI addition just to ensure that after the last C++17 incompatibility is fixed (10b4f25), that there are no trivial regressions? I understand that this can't do much else.

@sipa
Copy link
Member Author

sipa commented Apr 11, 2020

Yeah, to demonstrate that it works, and to start introducing support in our build system.

@maflcko maflcko added this to the 0.21.0 milestone Apr 11, 2020
Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

.travis.yml Outdated Show resolved Hide resolved
@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@hebasto
Copy link
Member

hebasto commented Apr 11, 2020

Concept ACK.

@elichai
Copy link
Contributor

elichai commented Apr 13, 2020

Concept ACK

For ease review this is the same implicit conversion impl that libc++ has: https://github.com/llvm-mirror/libcxx/blob/b857e811b34ae637ce49bbca19ae5bae26a9c4e8/include/span#L229

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK c31cbe7, tested on Linux Mint 19.3 both C++11 and C++17 modes. Compiled and passed tests locally.

Verified, that build fails in C++17 mode without "Support conversion between Spans of compatible types" commit (0fbde48).

@practicalswift
Copy link
Contributor

Concept ACK

Asserting that we compile and pass tests also with a C++17 mode build is valuable.

@laanwj
Copy link
Member

laanwj commented Apr 16, 2020

Concept ACK, thanks for adding.

@elichai
Copy link
Contributor

elichai commented Apr 23, 2020

tACK c31cbe7

Checked that with and without --enable-c++17 it compiles(including Qt and everything) and tests pass.
Checked with make -n that without the flag it still passes -std=c++11 and with it it passes -std=c++17.
Checked that with the span changes reverted it still works on c++11 but fails on c++17 with:

test/util_tests.cpp: In member function ‘void util_tests::test_spanparsing::test_method()’:                                                                                                                                                                                                                                                                                                  
test/util_tests.cpp:1832:24: error: no match for ‘operator=’ (operand types are ‘Span<const char>’ and ‘Span<char>’)                                                                                                                                                                                                                                                                         
 1832 |     sp = MakeSpan(input);                                                                                                                                                                                                                                                                                                                                                            
      |                        ^                                                                                                                                                                                                                                                                                                                                                             
In file included from ./serialize.h:25,                                                                                                                                                                                                                                                                                                                                                      
                 from ./hash.h:13,                                                                                                                                                                                                                                                                                                                                                           
                 from test/util_tests.cpp:8:                                                                                                                                                                                                                                                                                                                                                 
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)’                                                                                                                                                                                                                                                                           
   18 | class Span                                                                                                                                                                                                                                                                                                                                                                           
      |       ^~~~                                                                                                                                                                                                                                                                                                                                                                           
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘const Span<const char>&’                                                                                                                                                                                                                                                                                     
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)’                                                                                                                                                                                                                                                                                
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘Span<const char>&&’                                                                                                                                                                                                                                                                                          
test/util_tests.cpp:1857:24: error: no match for ‘operator=’ (operand types are ‘Span<const char>’ and ‘Span<char>’)                                                                                                                                                                                                                                                                         
 1857 |     sp = MakeSpan(input);                                                                                                                                                                                                                                                                                                                                                            
      |                        ^                                                                                                                                                                                                                                                                                                                                                             
In file included from ./serialize.h:25,                                                                                                                                                                                                                                                                                                                                                      
                 from ./hash.h:13,                                                                                                                                                                                                                                                                                                                                                           
                 from test/util_tests.cpp:8:                                                                                                                                                                                                                                                                                                                                                 
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)’                                                                                                                                                                                                                                                                           
   18 | class Span                                                                                                                                                                                                                                                                                                                                                                           
      |       ^~~~                                                                                                                                                                                                                                                                                                                                                                           
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘const Span<const char>&’
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)’
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘Span<const char>&&’
test/util_tests.cpp:1880:24: error: no match for ‘operator=’ (operand types are ‘Span<const char>’ and ‘Span<char>’)
 1880 |     sp = MakeSpan(input);
      |                        ^
In file included from ./serialize.h:25,
                 from ./hash.h:13,
                 from test/util_tests.cpp:8:
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)’
   18 | class Span
      |       ^~~~
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘const Span<const char>&’
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)’
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘Span<const char>&&’
test/util_tests.cpp:1886:24: error: no match for ‘operator=’ (operand types are ‘Span<const char>’ and ‘Span<char>’)
 1886 |     sp = MakeSpan(input);
      |                        ^
In file included from ./serialize.h:25,
                 from ./hash.h:13,
                 from test/util_tests.cpp:8:
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)’
   18 | class Span
      |       ^~~~
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘const Span<const char>&’
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)’
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘Span<const char>&&’
test/util_tests.cpp:1892:24: error: no match for ‘operator=’ (operand types are ‘Span<const char>’ and ‘Span<char>’)
 1892 |     sp = MakeSpan(input);
      |                        ^
In file included from ./serialize.h:25,
                 from ./hash.h:13,
                 from test/util_tests.cpp:8:
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)’
   18 | class Span
      |       ^~~~
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘const Span<const char>&’
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)’
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘Span<const char>&&’
test/util_tests.cpp:1898:24: error: no match for ‘operator=’ (operand types are ‘Span<const char>’ and ‘Span<char>’)
 1898 |     sp = MakeSpan(input);
      |                        ^
In file included from ./serialize.h:25,
                 from ./hash.h:13,
                 from test/util_tests.cpp:8:
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)’
   18 | class Span
      |       ^~~~
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘const Span<const char>&’
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)’
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘Span<const char>&&’
test/util_tests.cpp:1904:24: error: no match for ‘operator=’ (operand types are ‘Span<const char>’ and ‘Span<char>’)
 1904 |     sp = MakeSpan(input);
      |                        ^
In file included from ./serialize.h:25,
                 from ./hash.h:13,
                 from test/util_tests.cpp:8:
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)’
   18 | class Span
      |       ^~~~
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘const Span<const char>&’
./span.h:18:7: note: candidate: ‘constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)’
./span.h:18:7: note:   no known conversion for argument 1 from ‘Span<char>’ to ‘Span<const char>&&’
test/util_tests.cpp:1913:29: error: invalid initialization of reference of type ‘const Span<const char>&’ from expression of type ‘Span<char>’
 1913 |     results = Split(MakeSpan(input), 'x');
      |                     ~~~~~~~~^~~~~~~
In file included from test/util_tests.cpp:20:
./util/spanparsing.h:46:61: note: in passing argument 1 of ‘std::vector<Span<const char> > spanparsing::Split(const Span<const char>&, char)’
   46 | std::vector<Span<const char>> Split(const Span<const char>& sp, char sep);
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~^~
test/util_tests.cpp:1921:29: error: invalid initialization of reference of type ‘const Span<const char>&’ from expression of type ‘Span<char>’
 1921 |     results = Split(MakeSpan(input), '-');
      |                     ~~~~~~~~^~~~~~~
In file included from test/util_tests.cpp:20:
./util/spanparsing.h:46:61: note: in passing argument 1 of ‘std::vector<Span<const char> > spanparsing::Split(const Span<const char>&, char)’
   46 | std::vector<Span<const char>> Split(const Span<const char>& sp, char sep);
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~^~
test/util_tests.cpp:1926:29: error: invalid initialization of reference of type ‘const Span<const char>&’ from expression of type ‘Span<char>’
 1926 |     results = Split(MakeSpan(input), '#');
      |                     ~~~~~~~~^~~~~~~
In file included from test/util_tests.cpp:20:
./util/spanparsing.h:46:61: note: in passing argument 1 of ‘std::vector<Span<const char> > spanparsing::Split(const Span<const char>&, char)’
   46 | std::vector<Span<const char>> Split(const Span<const char>& sp, char sep);
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~^~
test/util_tests.cpp:1933:29: error: invalid initialization of reference of type ‘const Span<const char>&’ from expression of type ‘Span<char>’
 1933 |     results = Split(MakeSpan(input), '*');
      |                     ~~~~~~~~^~~~~~~
In file included from test/util_tests.cpp:20:
./util/spanparsing.h:46:61: note: in passing argument 1 of ‘std::vector<Span<const char> > spanparsing::Split(const Span<const char>&, char)’
   46 | std::vector<Span<const char>> Split(const Span<const char>& sp, char sep);

@practicalswift
Copy link
Contributor

Tested ACK c31cbe7

@laanwj laanwj merged commit 35ef3c1 into bitcoin:master Apr 30, 2020
@sipa sipa mentioned this pull request May 1, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 2, 2020
c31cbe7 Add C++17 test to Travis (Pieter Wuille)
7829685 Add configure option for c++17 (Pieter Wuille)
0fbde48 Support conversion between Spans of compatible types (Pieter Wuille)
7cbfebb Update ax_cxx_compile_stdcxx.m4 (Pieter Wuille)

Pull request description:

  This adds a `--enable-c++17` option to the configure script, fixes the only C++17 incompatibility (with a commit taken from bitcoin#18468), and adds a Travis test for it.

  This is all off by default, and release builds remain C++11.

  It implements the first step of the plan in bitcoin#16684.

ACKs for top commit:
  elichai:
    tACK c31cbe7
  practicalswift:
    Tested ACK c31cbe7
  hebasto:
    ACK c31cbe7, tested on Linux Mint 19.3 both C++11 and C++17 modes. Compiled and passed tests locally.

Tree-SHA512: a4b00776dbceef9c12abbb404c6bcd48f7916ce24c8c7a14116355f64e817578b7fcddbedd5ce435322319d1e4de43429b68553f4d96d970c308fe3e3e59b9d1
laanwj added a commit that referenced this pull request Jun 18, 2020
26acc8d Add sanity check asserts to span when -DDEBUG (Pieter Wuille)
2676aea Simplify usage of Span in several places (Pieter Wuille)
ab303a1 Add Span constructors for arrays and vectors (Pieter Wuille)
bb3d38f Make pointer-based Span construction safer (Pieter Wuille)
1f790a1 Make Span size type unsigned (Pieter Wuille)

Pull request description:

  This improves our Span class by making it closer to the C++20 `std::span` one:
  * ~~Support conversion between compatible Spans (e.g. `Span<char>` to `Span<const char>`).~~ (done in #18591)
  * Make the size type `std::size_t` rather than `std::ptrdiff_t` (the C++20 one underwent the same change).
  * Support construction of Spans directly from arrays, `std::string`s, `std::array`s, `std::vector`s, `prevector`s, ... (for all but arrays, this only works for const containers to prevent surprises).

  And then make use of those improvements in various call sites.

  I realize the template magic used looks scary, but it's only needed to make overload resultion make the right choices. Note that the operations done on values are all extremely simple: no casts, explicit conversions, or warning-silencing constructions. That should hopefully make it simpler to review.

ACKs for top commit:
  laanwj:
    Code review ACK 26acc8d
  promag:
    Code review ACK 26acc8d.

Tree-SHA512: 5a5bd346a140edf782b5b3b3f04d9160c7b9e9def35159814a07780ab1dd352545b88d3cc491e0f80d161f829c49ebfb952fddc9180f1a56f1257aa51f38788a
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 7, 2020
26acc8d Add sanity check asserts to span when -DDEBUG (Pieter Wuille)
2676aea Simplify usage of Span in several places (Pieter Wuille)
ab303a1 Add Span constructors for arrays and vectors (Pieter Wuille)
bb3d38f Make pointer-based Span construction safer (Pieter Wuille)
1f790a1 Make Span size type unsigned (Pieter Wuille)

Pull request description:

  This improves our Span class by making it closer to the C++20 `std::span` one:
  * ~~Support conversion between compatible Spans (e.g. `Span<char>` to `Span<const char>`).~~ (done in bitcoin#18591)
  * Make the size type `std::size_t` rather than `std::ptrdiff_t` (the C++20 one underwent the same change).
  * Support construction of Spans directly from arrays, `std::string`s, `std::array`s, `std::vector`s, `prevector`s, ... (for all but arrays, this only works for const containers to prevent surprises).

  And then make use of those improvements in various call sites.

  I realize the template magic used looks scary, but it's only needed to make overload resultion make the right choices. Note that the operations done on values are all extremely simple: no casts, explicit conversions, or warning-silencing constructions. That should hopefully make it simpler to review.

ACKs for top commit:
  laanwj:
    Code review ACK 26acc8d
  promag:
    Code review ACK 26acc8d.

Tree-SHA512: 5a5bd346a140edf782b5b3b3f04d9160c7b9e9def35159814a07780ab1dd352545b88d3cc491e0f80d161f829c49ebfb952fddc9180f1a56f1257aa51f38788a
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 23, 2020
Summary:
Debian buster ships with gcc 7/8 which is all green according to:
https://gcc.gnu.org/projects/cxx-status.html

Depends on D8492 and D8495

edit: backported some changes from Core [[bitcoin/bitcoin#18591 | PR18591]] regarding implicit conversion between Span types

Test Plan:
  ninja all check
  test_runner.py --extended

Reviewers: #bitcoin_abc, Fabien, deadalnix

Reviewed By: #bitcoin_abc, Fabien, deadalnix

Subscribers: deadalnix, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8493
MarkLTZ added a commit to litecoinz-core/litecoinz that referenced this pull request Feb 16, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Mar 10, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Mar 10, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Mar 10, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Mar 23, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Mar 23, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Mar 23, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Mar 23, 2021
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Apr 14, 2021
Summary
---

Partial backport from Core: bitcoin/bitcoin#18591
And also ABC: https://reviews.bitcoinabc.org/D8493

Note that I also backported the `span.h` fixes from Pieter Wiulle in the
core#18591 backport, but I did not like way that class looked. It had
some unsafe behavior and was using `std::ptrdiff_t` instead of
`std::size_t`, among other problems.  I went ahead and spruced it up to
be more idiomatic and less insane.

    Commit message from Fabien:

    Debian buster ships with gcc 7/8 which is all green according to:
    https://gcc.gnu.org/projects/cxx-status.html

Test Plan
---

1. Build eveyrthing with cmake. Be sure to `rm -fr` your build directory
   and do a full build, run tests `ninja all check-all`
2. Build everything with the deprecated build system, again, using a
   fresh build dir: `./autogen.sh && ./configure --deprecated-build-system ...`
3. Run gitian build to make sure they are sane too.
UdjinM6 added a commit to dashpay/dash that referenced this pull request Apr 27, 2021
partial merge bitcoin#13697, bitcoin#18591, bitcoin#19387, bitcoin#18468: update constructors to match c++20 draft spec
cculianu added a commit to cculianu/Bitcoin-Static that referenced this pull request May 7, 2021
Summary
---

Partial backport from Core: bitcoin/bitcoin#18591
And also ABC: https://reviews.bitcoinabc.org/D8493

Note that I also backported the `span.h` fixes from Pieter Wiulle in the
core#18591 backport, but I did not like way that class looked. It had
some unsafe behavior and was using `std::ptrdiff_t` instead of
`std::size_t`, among other problems.  I went ahead and spruced it up to
be more idiomatic and less insane.

    Commit message from Fabien:

    Debian buster ships with gcc 7/8 which is all green according to:
    https://gcc.gnu.org/projects/cxx-status.html

Test Plan
---

1. Build eveyrthing with cmake. Be sure to `rm -fr` your build directory
   and do a full build, run tests `ninja all check-all`
2. Build everything with the deprecated build system, again, using a
   fresh build dir: `./autogen.sh && ./configure --deprecated-build-system ...`
3. Run gitian build to make sure they are sane too.
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Jul 21, 2021
a1f3aed util: make EncodeBase64 consume Spans (furszy)
c36754f Add MakeUCharSpan, to help constructing Span<[const] unsigned char> (Pieter Wuille)
1f18199 Make uint256 Span-convertible by adding ::data() (Pieter Wuille)
0067590 Add lifetimebound to attributes for general-purpose usage (Cory Fields)
26eb256 span: add lifetimebound attribute (Cory Fields)
696e91f span: (almost) match std::span's constructor behavior (Cory Fields)
da207d4 doc: Mention Span in developer-notes.md (Pieter Wuille)
138053d doc: Document Span pitfalls (Pieter Wuille)
e2216d7 Add sanity check asserts to span when -DDEBUG (Pieter Wuille)
ebcc978 Add Span constructors for arrays and vectors (Pieter Wuille)
38f105b Make pointer-based Span construction safer (Pieter Wuille)
33d5297 Make Span size type unsigned (Pieter Wuille)
17118e1 Support conversion between Spans of compatible types (Pieter Wuille)
f36042f Span front() and back() methods and SpanPopBack function backport (furszy)
1b2e7c8 Add more methods to Span class (Pieter Wuille)

Pull request description:

  Another decouple from #2411.
  Purely focused on updating the Span sources to be up-to-date with current upstream.

  Following PRs/commits were back ported:

  * bitcoin#13697 (only 29943a9)
  * 2b0fcff (only span changes).
  * bitcoin#18591 (only 0fbde48).
  * bitcoin#18468 (without 2676aea).
  * bitcoin#19367.
  * bitcoin#19387.
  * bitcoin#19326 (only 5678250 and e63dcc3 here).
  * bitcoin#19687 (only e2aa1a5 here, 2bc2071 is inside #2411 and require net related commits that are introduced down the commits line there).

  Extra side note:
  Some of the current serialization compiler warnings in master will be fixed with this, other ones are coming down 2411 commits line as they need other previous PRs.

ACKs for top commit:
  random-zebra:
    Tested ACK a1f3aed

Tree-SHA512: 256bc2064724ea6d4f6fac722fafb4ed3e2b4590cdad61bf1e4a5be25e0632bafcff39235ea6ed7badbef4f79dbb4f866356372a1b3c201af23873884baedfea
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Aug 11, 2021
ecde04a [Consensus] Bump Active Protocol version to 70923 for v5.3 (random-zebra)
b63e4f5 Consensus: Add v5.3 enforcement height for testnet. (furszy)
f44be94 Only relay IPv4, IPv6, Tor addresses (Pieter Wuille)
015298c fix: tor: Call event_base_loopbreak from the event's callback (furszy)
34ff7a8 Consensus: Add mnb ADDRv2 guard. (furszy)
b4515dc GUI: Present v3 onion addresses properly in MNs list. (furszy)
337d43d tests: don't export in6addr_loopback (Vasil Dimov)
2cde8e0 GUI: Do not show the tor v3 onion address in the topbar. (furszy)
0b5f406 Doc: update tor.md with latest upstream information. (furszy)
89df7f2 addrman: ensure old versions don't parse peers.dat (Vasil Dimov)
bb90c5c test: add getnetworkinfo network name regression tests (Jon Atack)
d8e01b5 rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
57fc7b0 net: update GetNetworkName() with all enum Network cases (Jon Atack)
647d60b tests: Modify rpc_bind to conform to bitcoin#14532 behaviour. (Carl Dong)
d4d6729 Allow running rpc_bind.py --nonloopback test without IPv6 (Kristaps Kaupe)
4a034d8 test: Add rpc_bind test to default-run tests (Wladimir J. van der Laan)
61a08af [tests] bind functional test nodes to 127.0.0.1  Prevents OSX firewall (Sjors Provoost)
6a4f1e0 test: Add basic addr relay test (furszy)
78aa61c net: Make addr relay mockable (furszy)
ba954ca Send and require SENDADDRV2 before VERACK (Pieter Wuille)
61c2ed4 Bump net protocol version + don't send 'sendaddrv2' to pre-70923 software (furszy)
ccd508a tor: make a TORv3 hidden service instead of TORv2 (Vasil Dimov)
6da9a14 net: advertise support for ADDRv2 via new message (furszy)
e58d5d0 Migrate to test_large_inv() to Misbehaving logging. (furszy)
d496b64 [QA] fix mininode CAddress ser/deser (Jonas Schnelli)
cec9567 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). (furszy)
b8c1dda streams update: get rid of nType and nVersion. (furszy)
3eaa273 Support bypassing range check in ReadCompactSize (Pieter Wuille)
a237ba4 net: recognize TORv3/I2P/CJDNS networks (Vasil Dimov)
8e50853 util: make EncodeBase32 consume Spans (Sebastian Falbesoner)
1f67e30 net: CNetAddr: add support to (un)serialize as ADDRv2 (Vasil Dimov)
2455420 test: move HasReason so it can be reused (furszy)
d41adb4 util: move HasPrefix() so it can be reused (Vasil Dimov)
f6f86af Unroll Keccak-f implementation (Pieter Wuille)
45222e6 Implement keccak-f[1600] and SHA3-256 (Pieter Wuille)
08ad06d net: change CNetAddr::ip to have flexible size (furszy)
3337219 net: improve encapsulation of CNetAddr. (furszy)
910d5c4 test: Do not instantiate CAddrDB for static call (Hennadii Stepanov)
6b607ef Drop IsLimited in favor of IsReachable (Ben Woosley)
a40711b IsReachable is the inverse of IsLimited (DRY). Includes unit tests (marcaiaf)
8839828 net: don't accept non-left-contiguous netmasks (Vasil Dimov)
5d7f864 rpcbind: Warn about exposing RPC to untrusted networks (Luke Dashjr)
2a6abd8 CNetAddr: Add IsBindAny method to check for INADDR_ANY (Luke Dashjr)
4fdfa45 net: Always default rpcbind to localhost, never "all interfaces" (Luke Dashjr)
31064a8 net: Minor accumulated cleanups (furszy)
9f9c871 tests: Avoid using C-style NUL-terminated strings as arguments (practicalswift)
f6c52a3 tests: Add tests to make sure lookup methods fail on std::string parameters with embedded NUL characters (practicalswift)
a751b9b net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface (furszy)
f30869d test: add IsRFC2544 tests (Mark Tyneway)
ed5abe1 Net: Proper CService deserialization + GetIn6Addr return false if addr isn't an IPv6 addr (furszy)
86d73fb net: save the network type explicitly in CNetAddr (Vasil Dimov)
ad57dfc net: document `enum Network` (Vasil Dimov)
cb160de netaddress: Update CNetAddr for ORCHIDv2 (Carl Dong)
c3c04e4 net: Better misbehaving logging (furszy)
3660487 net: Use C++11 member initialization in protocol (Marco)
082baa3 refactor: Drop unused CBufferedFile::Seek() (Hennadii Stepanov)
e2d776a util: CBufferedFile fixes (Larry Ruane)
6921f42 streams: backport OverrideStream class (furszy)

Pull request description:

  Conjunction of a large number of back ports, updates and refactorings that made with the final goal of implementing v3 Onion addresses support (BIP155 https://github.com/bitcoin/bips/blob/master/bip-0155.mediawiki) before the tor v2 addresses EOL, scheduled, by the Tor project, for (1) July 15th: v2 addr support removal from the code base, and (2) October 15th: v2 addr network disable, where **every peer in our network running under Tor will loose the connection and drop the network**.

  As BIP155 describes, this is introducing a new P2P message to gossip longer node addresses over the P2P network. This is required to support new-generation Onion addresses, I2P, and potentially other networks that have longer endpoint addresses than fit in the 128 bits of the current addr message.

  In order to achieve the end goal, had to:
  1.  Create Span class and push it up to latest Bitcoin implementation.
  2.  Update the whole serialization framework and every object using it up to latest Bitcoin implementation (3-4 years ahead of what we currently are in master).
  3.  Update the address manager implementing ASN-based bucketing of the network nodes.
  4.  Update and refactor the netAddress and address manager tests to latest Bitcoin implementation (4 years ahead of what we currently are in master).
  5.  Several util string, vector, encodings, parsing, hashing backports and more..

  Important note:
  This PR it is not meant to be merged as a standalone PR, will decouple smaller ones moving on. Adding on each sub-PR its own description isolated from this big monster.

  Second note:
  This is still a **work-in-progress**, not ready for testing yet. I'm probably missing to mention few PRs that have already adapted to our sources. Just making it public so can decouple the changes, we can start merging them and i can continue working a bit more confortable (rebase a +170 commits separate branch is not fun..).

  ### List of back ported and adapted PRs:

  Span and Serialization:
  ----------------
  *  bitcoin#12886.
  *  bitcoin#12916.
  *  bitcoin#13558.
  *  bitcoin#13697. (Only Span's commit 29943a9)
  *  bitcoin#17850.
  *  bitcoin#17896.
  *  bitcoin#12752.
  *  bitcoin#16577.
  *  bitcoin#16670. (without faebf62)
  *  bitcoin#17957.
  *  bitcoin#18021.
  *  bitcoin#18087.
  *  bitcoin#18112 (only from 353f376 that we don't support).
  *  bitcoin#18167.
  *  bitcoin#18317.
  *  bitcoin#18591 (only Span's commit 0fbde48)
  *  bitcoin#18468.
  *  bitcoin#19020.
  *  bitcoin#19032.
  *  bitcoin#19367.
  *  bitcoin#19387.

  Net, NetAddress and AddrMan:
  ----------------

  *  bitcoin#7932.
  *  bitcoin#10756.
  *  bitcoin#10765.
  *  bitcoin#12218.
  *  bitcoin#12855.
  *  bitcoin#13532.
  *  bitcoin#13575.
  *  bitcoin#13815.
  *  bitcoin#14532.
  *  bitcoin#15051.
  *  bitcoin#15138.
  *  bitcoin#15689.
  *  bitcoin#16702.
  *  bitcoin#17243.
  *  bitcoin#17345.
  *  bitcoin#17754.
  *  bitcoin#17758.
  *  bitcoin#17812.
  *  bitcoin#18023.
  *  bitcoin#18454.
  *  bitcoin#18512.
  *  bitcoin#19314.
  *  bitcoin#19687

  Keys and Addresses encoding:
  ----------------
  * bitcoin#11372.
  * bitcoin#17511.
  * bitcoin#17721.

  Util:
  ----------------
  * bitcoin#9140.
  * bitcoin#16577.
  * bitcoin#16889.
  * bitcoin#19593.

  Bench:
  ----------------
  * bitcoin#16299.

  BIP155:
  ----------------
  *  bitcoin#19351.
  *  bitcoin#19360.
  *  bitcoin#19534.
  *  bitcoin#19628.
  *  bitcoin#19841.
  *  bitcoin#19845.
  *  bitcoin#19954.
  *  bitcoin#19991 (pending).
  *  bitcoin#19845.
  *  bitcoin#20000 (pending).
  *  bitcoin#20120.
  *  bitcoin#20284.
  *  bitcoin#20564.
  *  bitcoin#21157 (pending).
  *  bitcoin#21564 (pending).
  *  Fully removed v2 onion addr support.
  *  Add hardcoded seeds.
  *  Add release-notes, changes to files.md and every needed documentation.

  I'm currently working on the PRs marked as "pending", this isn't over, but I'm pretty pretty close :). What a long road..

ACKs for top commit:
  random-zebra:
    utACK ecde04a
  Fuzzbawls:
    ACK ecde04a

Tree-SHA512: 82c95fbda76fce63f96d8a9af7fa9a89cb1e1b302b7891e27118a6103af0be23606bf202c7332fa61908205e6b6351764e2ec23d753f1e2484028f57c2e8b51a
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants