Skip to content

Conversation

@dergoegge
Copy link
Member

This PR decouples PeerManager from our global args manager by introducing PeerManager::Options.

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 20, 2023

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

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK stickies-v, TheCharlatan
Concept ACK glozow, hebasto, theuni

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #28043 (fuzz: Test headers pre-sync through p2p interface by dergoegge)
  • #28031 (Package Relay 1/3: Introduce TxPackageTracker as Orphan Resolution Module by glozow)
  • #27385 (net, refactor: extract Network and BIP155Network logic to node/network by jonatack)
  • #26621 (refactor: Continue moving application data from CNode to Peer by dergoegge)
  • #25572 (refactor: Introduce EvictionManager and use it for the inbound eviction logic by dergoegge)
  • #25268 (refactor: Introduce EvictionManager by dergoegge)

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.

@sedited
Copy link
Contributor

sedited commented Apr 21, 2023

Concept ACK

Copy link
Contributor

@stickies-v stickies-v 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

@dergoegge dergoegge force-pushed the 2023-04-peerman-opts branch 2 times, most recently from d962c7f to 499222f Compare July 19, 2023 12:29
@dergoegge dergoegge force-pushed the 2023-04-peerman-opts branch from 499222f to 3c291dc Compare July 19, 2023 12:57
@dergoegge dergoegge force-pushed the 2023-04-peerman-opts branch from 3c291dc to f317796 Compare July 19, 2023 13:03
@dergoegge dergoegge force-pushed the 2023-04-peerman-opts branch from f317796 to e3ddc5c Compare July 19, 2023 15:08
Copy link
Contributor

@stickies-v stickies-v left a comment

Choose a reason for hiding this comment

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

ACK 064ac73d0715fb2c371e68f8d4d234fee002299b

@dergoegge dergoegge requested a review from sedited July 24, 2023 12:11
Copy link
Member

@glozow glozow 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

@hebasto
Copy link
Member

hebasto commented Jul 24, 2023

Concept ACK.

@dergoegge dergoegge force-pushed the 2023-04-peerman-opts branch from e3ddc5c to c8bc812 Compare July 24, 2023 16:33
@dergoegge dergoegge force-pushed the 2023-04-peerman-opts branch from c8bc812 to 23c7b51 Compare July 24, 2023 16:37
@dergoegge
Copy link
Member Author

Touched up all the nits, also rebased

Copy link
Contributor

@stickies-v stickies-v left a comment

Choose a reason for hiding this comment

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

re-ACK 23c7b51

Copy link
Contributor

@sedited sedited left a comment

Choose a reason for hiding this comment

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

ACK 23c7b51

Copy link
Member

@theuni theuni 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 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.

@dergoegge
Copy link
Member Author

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.

@fanquake fanquake merged commit c97270d into bitcoin:master Jul 25, 2023
}

if (auto value{argsman.GetBoolArg("-capturemessages")}) options.capture_messages = *value;
}
Copy link
Member

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

Copy link
Contributor

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.

Copy link
Member

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. Addressed in #28148.

@stickies-v
Copy link
Contributor

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.

Addressed in #28149

achow101 added a commit to bitcoin-core/gui that referenced this pull request Jul 27, 2023
…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
glozow added a commit to bitcoin-core/gui that referenced this pull request Aug 9, 2023
…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
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 9, 2023
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jul 12, 2024
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
@bitcoin bitcoin locked and limited conversation to collaborators Jul 24, 2024
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.

9 participants