-
Notifications
You must be signed in to change notification settings - Fork 38.6k
net processing, refactor: Decouple PeerManager from gArgs #27499
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
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. 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. |
c3a0d5f to
e044437
Compare
|
Concept ACK |
05dbe25 to
f5d1a76
Compare
f5d1a76 to
f221a16
Compare
f221a16 to
4a31d4c
Compare
stickies-v
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.
Concept ACK
d962c7f to
499222f
Compare
499222f to
3c291dc
Compare
3c291dc to
f317796
Compare
f317796 to
e3ddc5c
Compare
stickies-v
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 064ac73d0715fb2c371e68f8d4d234fee002299b
glozow
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.
concept ACK
|
Concept ACK. |
e3ddc5c to
c8bc812
Compare
c8bc812 to
23c7b51
Compare
|
Touched up all the nits, also rebased |
stickies-v
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.
re-ACK 23c7b51
sedited
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 23c7b51
theuni
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.
Concept ACK and quick review ACK.
My only nit is that size_t max_extra_txs is platform dependent and says nothing about its upper bound. Similarly, from a quick glance, I think max_orphan_txs could wrap from the command line?
(I realize these aren't new problems, they're just highlighted here)
Maybe as a followup we could add some pedantic checks in init to make sure they're sane values that fit into 32bits and make max_orphan_txs a uint32_t. Please ignore if those checks exist and I'm not seeing them.
Thanks for pointing this out. I agree that some sane limits/checks would make sense for these settings as users could shoot themselves in the foot otherwise. I will leave this for a follow-up though as this isn't a new problem. |
| } | ||
|
|
||
| if (auto value{argsman.GetBoolArg("-capturemessages")}) options.capture_messages = *value; | ||
| } |
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.
You forgot to read -blocksonly in this function
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.
I think this is on purpose since we use ignore_incoming_txs for multiple purposes, see also my suggested diff in #27499 (comment) (although I now see it can be simplified even further by not passing ignores_incoming_txs to the Options constructor at all). So, I don't think it's forgotten, but room for improvement in follow-up? Happy to open a pull for this if you think it's an improvement.
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.
Yeah, I don't see what is wrong with your diff (apart from it not compiling).
I just don't get the point of adding the ApplyArgsManOptions helper when it is not used consistently. Might as well not add it in the first place?
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.
Agreed. Addressed in #28148.
Addressed in #28149 |
…ptions for PeerManager::Options 8a31597 refactor: deduplicate ignores_incoming_txs (stickies-v) 5f41afc refactor: set ignore_incoming_txs in ApplyArgsManOptions (stickies-v) Pull request description: Consistently use `ApplyArgsManOptions` for `PeerManager::Options`, and initialize `PeerManager::Options` early to avoid reading `"-blocksonly"` twice. Suggested in bitcoin/bitcoin#27499 (comment) and also requested in bitcoin/bitcoin#27499 (comment). No behaviour change, but the [`TestingSetup`](https://github.com/bitcoin/bitcoin/blob/e35fb7bc48d360585b80d0c7f89ac5087c1d405e/src/test/util/setup_common.cpp#L255-L256) is now also able to access `"-blocksonly"`. ACKs for top commit: MarcoFalke: lgtm ACK 8a31597 achow101: ACK 8a31597 TheCharlatan: ACK 8a31597 dergoegge: utACK 8a31597 Tree-SHA512: 6cb489d79ac2a87e8faedb76c96973ab3fc597426f274a90a3ffd0bc5fe3f2b25db9c7ec2e55a0c806c2bcbc0fdded6e228adb43d2cd81f14fd6552863847698
…ns user input 547fa52 net processing: clamp -blockreconstructionextratxn to uint32_t bounds (stickies-v) e451d1e net processing: clamp -maxorphantx to uint32_t bounds (stickies-v) aa89e04 doc: document PeerManager::Options members (stickies-v) Pull request description: Avoid out-of-bounds user input for `PeerManager::Options` by safely clamping `-maxorphantx` and `-blockreconstructionextratxn`, and avoid platform-specific behaviour by changing `PeerManager::Options::max_extra_txs` from `size_t` to a `uint32_t`. Addresses bitcoin/bitcoin#27499 (review). Also documents all `PeerManager::Options` members, addressing bitcoin/bitcoin#27499 (comment). ACKs for top commit: dergoegge: Code review ACK 547fa52 glozow: reACK 547fa52 Tree-SHA512: 042d47b35bb8a7b29ef3dadd4c0c5d26f13a8f174f33687855d603c19f8de0fcbbda94418453331e149885412d4edd5f402d640d938f6d94b4dcf54e2fdbbcc9
Summary: [net processing] Introduce PeerManager options bitcoin/bitcoin@8b87725 ----- [net processing] Use ignore_incoming_txs from m_opts bitcoin/bitcoin@4cfb7b9 ----- [net processing] Move -maxorphantx to PeerManager::Options bitcoin/bitcoin@567c4e0 ----- [net processing] Move -blockreconstructionextratxn to PeerManager::Options bitcoin/bitcoin@bd59bda ----- [net processing] Move -capturemessages to PeerManager::Options bitcoin/bitcoin@23c7b51 Note that we cannot yet remove `include <common/args.h>` The remaining calls to gArgs in net_processing.cpp are mostly related to avalanche options, which I will move in a separate diff. ----- refactor: set ignore_incoming_txs in ApplyArgsManOptions Refactor to consistently use ApplyArgsManOptions to set all PeerManager::Options, including ignore_incoming_txs. bitcoin/bitcoin@8a31597 Note we don't have the duplicated reading of -blocksonly, this is used by core for initializing some fee estimation machinery. ----- [net_processing] move -maxaddrtosend to PeerManager::Options Note that this option was added by us in D10823 ----- This is a backport of [[bitcoin/bitcoin#27499 | core#27499]] and [[bitcoin/bitcoin#28148 | core#28148]] It it missing the -txreconciliation related commit which is part of a feature that we have not yet backported. Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D16455
This PR decouples
PeerManagerfrom our global args manager by introducingPeerManager::Options.