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

gui: ensure inbound block relay peers have relevant services #201

Closed
wants to merge 1 commit into from

Conversation

jonatack
Copy link
Member

@jonatack jonatack commented Jan 28, 2021

Responding to #180 (comment), this ensures that inbound block relay peers have relevant services and returns all others as inbound.

src/qt/guiutil.cpp Outdated Show resolved Hide resolved
@jonatack jonatack force-pushed the inbound-block-relay branch from fd0f17d to 89c20ee Compare January 29, 2021 22:41
{
switch (conn_type) {
case ConnectionType::INBOUND: return relay_txes ? QObject::tr("Inbound Full Relay") : QObject::tr("Inbound Block Relay");
case ConnectionType::INBOUND: return !relay_txes && relevant_services ? QObject::tr("Inbound Block Relay") : QObject::tr("Inbound");
Copy link
Contributor

@maflcko maflcko Jan 30, 2021

Choose a reason for hiding this comment

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

This heuristic seems to be working fine. At least I can't find a counter example right now that can be observed on today's network (Edit: counter example: #201 (comment)). Though, it still seems fragile to assume that the type of the inbound connection can be deduced based on fuzzy logic.

If it was fine to assume so, then BIP bitcoin/bips#1052 wouldn't be needed.

Copy link
Member Author

@jonatack jonatack Jan 30, 2021

Choose a reason for hiding this comment

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

If helpful, the logic is from https://github.com/bitcoin/bitcoin/blob/16b784d953365bb2d7ae65acd2b20a79ef8ba7b6/src/net.cpp#L872 in our inbound eviction protection logic, so that's why I was interested in seeing these peers. Otherwise we could just display all of them as inbound.

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 plain "Inbound" makes most sense because it is neither possible to enumerate all inbound connection types, nor is it possible to determine them (if they were enumerable).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it seems we will need to deduce some types of connections from other properties, as currently done to obtain the inbound block relay peers for eviction protection. Take for instance this bitcoin/bitcoin#20726 (comment):

#19670 introduced a workaround to deduce inbound block-relay-only peers and protect them from eviction. After this PR, do you think we could revisit to make it more direct?

I think we would wait until this has been deployed for a while and then (potentially) change the eviction logic. Two things occur to me on this point:

  • Older software will continue to use the old way of (not) communicating their intentions, via the fRelayTxes flag. So to accommodate older software we may not want to switch to keying off this p2p message for a little while at least.
  • It seems most of the feedback has been to shy away from encoding overly broad semantics into a single p2p message; while I think that is fine it also means that from our peer's point of view, they will have to infer the connection "type" from the properties of the peer, rather than from the peer declaring its full intentions in a single message. I think for now we can treat "will never relay txes" as essentially synonymous with these block-relay connections, but perhaps in the future there will be some distinction, and all a peer can do is rely on some set of flags that it might use to preference some peers over others -- which might put us exactly back to where we are today, with us just keying off of whether fRelayTxes is false, anyway.

So while I'd like to see this type of peers easily, yes for now it may be more prudent to just use plain "Inbound" and display other properties useful for inferring the connection status, like fRelayTxes, separately.

Copy link
Contributor

Choose a reason for hiding this comment

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

Even with BIP bitcoin/bips#1052 you couldn't enumerate all possible inbound connection types. This is simply impossible.

Using properties of the connection like service bits or relay flags (and maybe later a disabletx message) or other statistics like last sent tx/block to aid eviction can be done without exactly enumerating the connection types.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't disagree, though as a user I'd like to see this information...either directly as proposed here, or indirectly by manually looking at the inbound + relaytxes + services/servicesnames getpeerinfo boolean fields. Anyway, closing for now, replaced by #203.

Copy link
Contributor

Choose a reason for hiding this comment

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

Services and inbound status should be shown in the gui. I don't recall whether version.fRelay is shown

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, inbound and services are. Proposing now to add frelaytxes and bip152 high bandwidth.

@hebasto
Copy link
Member

hebasto commented Jan 30, 2021

Sorry for being late...

It's unfortunate that it is closed for the following reasons:

  • no need to enumerate all possible inbound connection types, only block-relay-only are important to highlight as they form a subnetwork with a node graph that is untraceable for spies; other inbound connection types differ between each other only by requested resources;
  • using heuristic to detect "potential block-relay only peers" seems fine to me

Concept ACK (and ready to test if it'll be reopened).

Nevertheless, will review #203.

@jonatack
Copy link
Member Author

@hebasto Thanks--I'm happy to re-open if desired.

@jonatack jonatack reopened this Jan 30, 2021
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 89c20ee, tested on Linux Mint 20.1 (Qt 5.12.8).

{
switch (conn_type) {
case ConnectionType::INBOUND: return relay_txes ? QObject::tr("Inbound Full Relay") : QObject::tr("Inbound Block Relay");
case ConnectionType::INBOUND: return !relay_txes && relevant_services ? QObject::tr("Inbound Block Relay") : QObject::tr("Inbound");
Copy link
Member

Choose a reason for hiding this comment

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

pico-nit:

If helpful, the logic is from https://github.com/bitcoin/bitcoin/blob/16b784d953365bb2d7ae65acd2b20a79ef8ba7b6/src/net.cpp#L872 in our inbound eviction protection logic...

Maybe add a relevant comment here?

@maflcko
Copy link
Contributor

maflcko commented Feb 1, 2021

only block-relay-only are important to highlight as they form a subnetwork with a node graph that is untraceable for spies; [...] using heuristic to detect "potential block-relay only peers" seems fine to me

My point is that what is displayed in the gui is not the "untraceable subnetwork". Whether a node asked you to send txs has nothing to do of their behaviour to send you txs (or other peers they have sent a version.fRalay=false), so I think incorrectly classifying them as "block-relay-only" is confusing at best. It would be good to describe your use case, but if your use case is to determine the "untraceable subnetwork", this heuristic is neither accurate nor precise. https://en.wikipedia.org/wiki/Accuracy_and_precision

Even when ignoring all different p2p clients on the network and only considering vanilla Bitcoin Core nodes (at the commit of this pull) wont give precise results for -blocksonly peers:

Screenshot from 2021-02-01 10-11-44
Screenshot from 2021-02-01 10-12-52

@jonatack
Copy link
Member Author

jonatack commented Feb 5, 2021

Thanks for the discussions @MarcoFalke and @hebasto. I agree this can be deferred for now and have aligned -netinfo (in merged pull bitcoin/bitcoin#20764) in the same direction as #203.

@jonatack jonatack closed this Feb 5, 2021
jonasschnelli added a commit that referenced this pull request Feb 5, 2021
506e658 gui: display plain "Inbound" in peer details (Jon Atack)

Pull request description:

  Alternative version to #201.

ACKs for top commit:
  MarcoFalke:
    ACK 506e658
  jonasschnelli:
    utACK 506e658

Tree-SHA512: 88d141b14684c1dcdff47f7ba241e5a7c42c14da3d9aaa89f1649235a64fd26bc5a6055707dc07992cd9d8c05d143754f6dd51ccee69fd4309336dd07c52e61c
@bitcoin-core bitcoin-core locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants