-
Notifications
You must be signed in to change notification settings - Fork 38.7k
init, test: improve network reachability test coverage and safety #24205
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
init, test: improve network reachability test coverage and safety #24205
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, 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. |
vasild
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK d1d04469a96d15b4d0a30881cbe6760d916e0762
|
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. |
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.
d1d0446 to
2dc734f
Compare
|
Rebased following the merge of #22834 and added further test coverage and doc follow-ups to that pull. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach ACK
2dc734f to
58a1479
Compare
vasild
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 58a1479
…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
…/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
brunoerg
left a comment
There was a problem hiding this 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:
Line 1333 in 91d1234
| return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg)); |
Line 1352 in 91d1234
| return InitError(strprintf(_("Invalid -onion address or hostname: '%s'"), onionArg)); |
Line 1363 in 91d1234
| _("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.
|
I think this has been ready for a few weeks now, if anyone would like to do a final review or merge. |
dongcarl
left a comment
There was a problem hiding this 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.
|
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. |
…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
Adds missing network reachability test coverage and an assertion during init, noticed while reviewing #22834:
LimitedAndReachable_Networkunit tests-proxyraises expected init error-onionraises expected init error-onlynet=onionwithout-proxyand-onionraises expected init error-onlynet=onionwith-onion=0and with-noonionraises expected init error