Skip to content

Conversation

@jonatack
Copy link
Member

@jonatack jonatack commented Jan 30, 2022

Adds missing network reachability test coverage and an assertion during init, noticed while reviewing #22834:

  • assert during init that each network reachability is true by default
  • add CJDNS to the LimitedAndReachable_Network unit tests
  • hoist proxy out of two network loops in feature_proxy.py
  • test that passing invalid -proxy raises expected init error
  • test that passing invalid -onion raises expected init error
  • test that passing -onlynet=onion without -proxy and -onion raises expected init error
  • test that passing -onlynet=onion with -onion=0 and with -noonion raises expected init error

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 31, 2022

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #23531 (Add Yggdrasil support by prusnak)

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.

Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

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

ACK d1d04469a96d15b4d0a30881cbe6760d916e0762

@jonatack
Copy link
Member Author

Note, this pull has a trivial one-line test conflict with #22834 that IMO should be reviewed/merged first so this pull doesn't invalidate the review there.

jonatack added 3 commits March 1, 2022 21:03
The default network reachability values are implicitly set
by this line in net.cpp:

static bool vfLimited[NET_MAX] GUARDED_BY(g_maplocalhost_mutex) = {};

This commit asserts that each network is reachable during
the first loop through them during bitcoind init.
@jonatack jonatack force-pushed the network-reachability-assertion-and-testing branch from d1d0446 to 2dc734f Compare March 1, 2022 22:01
@jonatack
Copy link
Member Author

jonatack commented Mar 1, 2022

Rebased following the merge of #22834 and added further test coverage and doc follow-ups to that pull.

Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

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

Approach ACK

@jonatack jonatack force-pushed the network-reachability-assertion-and-testing branch from 2dc734f to 58a1479 Compare March 3, 2022 14:34
Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

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

ACK 58a1479

laanwj added a commit to bitcoin-core/gui that referenced this pull request Mar 7, 2022
…ated tor/i2p documentation

a1db99a init, doc: improve -onlynet help and tor/i2p documentation (Jon Atack)

Pull request description:

  including review feedback from bitcoin/bitcoin#22834 (comment) and bitcoin/bitcoin#24205 (comment) concerning `src/init.cpp`, `doc/tor.md` and `doc/i2p.md`

  - s/outgoing/automatic outbound/
  - s/Incoming/Inbound and manual/ (are not affected by this option.)
  - s/only through network/only to network/
  - s/this option. This option/this option. It/
  - s/network types/networks/

  and pick up a few nits in `doc/p2p-bad-ports.md` from bitcoin/bitcoin#23542 (review).

ACKs for top commit:
  laanwj:
    ACK a1db99a
  w0xlt:
    ACK a1db99a
  theStack:
    ACK a1db99a

Tree-SHA512: dd727904b9b3dadb16053e2b0350e6c0814ef68fb0cca7d34880b883123cfe3aa03b15813b40a863f6367d596d17ee4517eab55281cfe35cd00767b8a39593ca
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 7, 2022
…/i2p documentation

a1db99a init, doc: improve -onlynet help and tor/i2p documentation (Jon Atack)

Pull request description:

  including review feedback from bitcoin#22834 (comment) and bitcoin#24205 (comment) concerning `src/init.cpp`, `doc/tor.md` and `doc/i2p.md`

  - s/outgoing/automatic outbound/
  - s/Incoming/Inbound and manual/ (are not affected by this option.)
  - s/only through network/only to network/
  - s/this option. This option/this option. It/
  - s/network types/networks/

  and pick up a few nits in `doc/p2p-bad-ports.md` from bitcoin#23542 (review).

ACKs for top commit:
  laanwj:
    ACK a1db99a
  w0xlt:
    ACK a1db99a
  theStack:
    ACK a1db99a

Tree-SHA512: dd727904b9b3dadb16053e2b0350e6c0814ef68fb0cca7d34880b883123cfe3aa03b15813b40a863f6367d596d17ee4517eab55281cfe35cd00767b8a39593ca
@jonatack jonatack changed the title net, init, test: network reachability testing and safety improvements init, test: improve network reachability test coverage and safety Mar 17, 2022
Copy link
Contributor

@brunoerg brunoerg left a comment

Choose a reason for hiding this comment

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

ACK 58a1479

Checked the following init errors are now covered in functional tests:

return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg));

return InitError(strprintf(_("Invalid -onion address or hostname: '%s'"), onionArg));

_("Outbound connections restricted to Tor (-onlynet=onion) but the proxy for "

Code looks great for both tests. Just ran them several times and got no error.

@jonatack
Copy link
Member Author

jonatack commented Mar 24, 2022

I think this has been ready for a few weeks now, if anyone would like to do a final review or merge.

Copy link
Contributor

@dongcarl dongcarl left a comment

Choose a reason for hiding this comment

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

Code Review ACK 58a1479

Change seems straightforward. Had to convince myself of the assert in src/init.cpp, but it seems right that we don't want users to specify -onlynet=foo and foo be somehow default disabled, and now bitcoind is silently operating without foo.

@maflcko maflcko merged commit f0c9ba2 into bitcoin:master Mar 24, 2022
@michaelfolkson
Copy link

Post-merge ACK 58a1479

Built on MacOS Big Sur, reviewed code changes and checked the functional test was covering the errors in the PR description.

@jonatack jonatack deleted the network-reachability-assertion-and-testing branch March 26, 2022 13:36
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 2, 2022
…verage and safety

58a1479 test: passing -onlynet=onion with -onion=0/-noonion raises expected init error (Jon Atack)
7000f66 test: passing -onlynet=onion without -proxy/-onion raises expected init error (Jon Atack)
8332e6e test: passing invalid -onion raises expected init error (Jon Atack)
d5edb08 test: passing invalid -proxy raises expected init error (Jon Atack)
bd57dcb test: hoist proxy out of 2 network loops in feature_proxy.py (Jon Atack)
afdf2de test: add CJDNS to LimitedAndReachable_Network unit tests (Jon Atack)
2b7a818 net, init: assert each network reachability is true by default (Jon Atack)

Pull request description:

  Adds missing network reachability test coverage and an assertion during init, noticed while reviewing bitcoin#22834:

  - assert during init that each network reachability is  true by default
  - add CJDNS to the `LimitedAndReachable_Network` unit tests
  - hoist proxy out of two network loops in feature_proxy.py
  - test that passing invalid `-proxy` raises expected init error
  - test that passing invalid `-onion` raises expected init error
  - test that passing `-onlynet=onion` without `-proxy` and `-onion` raises expected init error
  - test that passing `-onlynet=onion` with `-onion=0` and with `-noonion` raises expected init error

ACKs for top commit:
  vasild:
    ACK 58a1479
  brunoerg:
    ACK 58a1479
  dongcarl:
    Code Review ACK 58a1479

Tree-SHA512: bdee6dd0c12bb63591ce7c9321fe77b509ab1265123054e774adc38a187746dddafe1627cbe89e990bcc78b45e194bfef8dc782710d5b217e2e2106ab0158827
@bitcoin bitcoin locked and limited conversation to collaborators Mar 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants