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

p2p: standardize outbound full/block relay connection type naming #20729

Closed

Conversation

jonatack
Copy link
Member

@jonatack jonatack commented Dec 20, 2020

We've accumulated many different ways of referring to outbound full relay and outbound block relay connection types in the codebase. In places, it is becoming less clear which type of connection is referred to. This PR proposes standardizing the naming to outbound-{full, block}-relay with a scripted diff as follows:

-BEGIN VERIFY SCRIPT-
s() { git grep -l "$1" src test/functional doc/files.md doc/reduce-*.md | xargs sed -i "s/$1/$2/g"; }

s 'ConnectionType::OUTBOUND '            'ConnectionType::OUTBOUND_FULL_RELAY '
s 'IsFullOutboundConn'                   'IsOutboundFullRelayConn'
s 'GetExtraFullOutboundCount'            'GetExtraOutboundFullRelayCount'
s 'full_outbound_peers'                  'outbound_full_relay_peers'
s 'GetTryNewOutboundPeer'                'GetTryNewOutboundFullRelayPeer'
s 'SetTryNewOutboundPeer'                'SetTryNewOutboundFullRelayPeer'
s 'm_try_another_outbound_peer'          'm_try_another_outbound_full_relay_peer'
s 'outbound (full-relay)'                'outbound-full-relay'
s 'outbound full-relay'                  'outbound-full-relay'
s 'outbound, full-relay'                 'outbound-full-relay'
s 'outbounds'                            'outbound-full-relay connections'
s 'f"outbound: '                         'f"outbound-full-relay: '
s ' full-relay'                          ' outbound-full-relay'
s 'to an extra outbound peer'            'to an extra outbound-full-relay peer'
s 'try another outbound peer'            'try another outbound-full-relay peer'
s '(tx, block, addr) outbound'           '(tx, block, addr)'
s 'we deal with extra outbound peers'    'we deal with extra outbound-full-relay peers'
s 'outbound peers we have in excess'     'outbound-full-relay peers we have in excess'
s 'some outbound connections are not'    'some outbound-full-relay connections are not'
s 'or this is a'                         'or if this is an'

s 'ConnectionType::BLOCK_RELAY'          'ConnectionType::OUTBOUND_BLOCK_RELAY'
s ' BLOCK_RELAY'                         ' OUTBOUND_BLOCK_RELAY'
s 'IsBlockOnlyConn'                      'IsOutboundBlockRelayConn'
s 'GetExtraBlockRelayCount'              'GetExtraOutboundBlockRelayCount'
s 'block_relay_peers'                    'outbound_block_relay_peers'
s 'MAX_BLOCK_RELAY_ONLY_ANCHORS'         'MAX_OUTBOUND_BLOCK_RELAY_ANCHORS'
s 'MAX_BLOCK_RELAY_ONLY_CONNECTIONS'     'MAX_OUTBOUND_BLOCK_RELAY_CONNECTIONS'
s 'EXTRA_BLOCK_RELAY_ONLY_PEER_INTERVAL' 'EXTRA_OUTBOUND_BLOCK_RELAY_PEER_INTERVAL'
s 'm_start_extra_block_relay_peers'      'm_start_extra_outbound_block_relay_peers'
s 'outgoing block-relay-only'            'outbound-block-relay'
s 'outbound block-relay-only'            'outbound-block-relay'
s 'outbound block-relay'                 'outbound-block-relay'
s 'block-relay only outbound'            'outbound-block-relay'
s 'block-relay-only outgoing'            'outbound-block-relay'
s 'block-relay only peers'               'outbound-block-relay peers'
s 'block-relay-only'                     'outbound-block-relay'

s ' a outbound'                          ' an outbound'
-END VERIFY SCRIPT-

@fanquake fanquake added the P2P label Dec 20, 2020
@practicalswift
Copy link
Contributor

Concept ACK: consistent is better than inconsistent

@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 20, 2020

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

Conflicts

Reviewers, 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.

@jonatack
Copy link
Member Author

rebased

@@ -31,7 +31,7 @@

const std::vector<std::string> CONNECTION_TYPE_DOC{
"outbound-full-relay (default automatic connections)",
"block-relay-only (does not relay transactions or addresses)",
"outbound-block-relay (does not relay transactions or addresses)",
Copy link
Member

Choose a reason for hiding this comment

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

This might be easier to confuse with peers that request blocks only (#20726)

Copy link
Member Author

@jonatack jonatack Jan 3, 2021

Choose a reason for hiding this comment

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

Yes, the script can be updated depending on what is decided there.

@luke-jr
Copy link
Member

luke-jr commented Jan 3, 2021

While doing this, I wonder if it would make sense to also standardise the prefix (eg, "outbound-feeler")

@jonatack jonatack force-pushed the outbound-connection-type-naming branch from 0d4926c to 4c8605b Compare January 3, 2021 22:14
@jonatack
Copy link
Member Author

jonatack commented Jan 3, 2021

Rebased.

While doing this, I wonder if it would make sense to also standardise the prefix (eg, "outbound-feeler")

Yes, on the user-facing side, that may be where it's heading. For instance, in #20764 the -netinfo "dir" (in/out) column is next to the "type" column, and the type is expressed as simply full/block/manual/feeler/addr prefixed by in/out of the dir column (I may propose the same for the GUI peers tab columns). But for now at least, the codebase doesn't have the same variance regarding how a feeler connection is referred to, like it does with outbound-{full, block}-relay ones (at least, I don't recall noticing it).

@DrahtBot
Copy link
Contributor

🕵️ @fanquake @harding @jonasschnelli @sipa @hebasto have been requested to review this pull request as specified in the REVIEWERS file.

@jonatack jonatack force-pushed the outbound-connection-type-naming branch from de0f38d to bb9f28e Compare January 13, 2021 11:55
@jonatack
Copy link
Member Author

jonatack commented Jan 13, 2021

Had to update the script for other changes per git range-diff e7eb3712 de0f38d bb9f28e

The script may be verified locally with test/lint/commit-script-check.sh e7eb371..bb9f28e

@jonatack
Copy link
Member Author

Rebased following the merge of #20828. The script may be verified locally with

test/lint/commit-script-check.sh 29d2aeb..2645217

@jonatack jonatack changed the title p2p: standardize on outbound-{full, block}-relay connection type naming p2p: standardize outbound full/block relay connection type naming Feb 9, 2021
-BEGIN VERIFY SCRIPT-
s() { git grep -l "$1" src test/functional doc/files.md doc/reduce-*.md | xargs sed -i "s/$1/$2/g"; }

s 'ConnectionType::OUTBOUND '            'ConnectionType::OUTBOUND_FULL_RELAY '
s 'IsFullOutboundConn'                   'IsOutboundFullRelayConn'
s 'GetExtraFullOutboundCount'            'GetExtraOutboundFullRelayCount'
s 'full_outbound_peers'                  'outbound_full_relay_peers'
s 'GetTryNewOutboundPeer'                'GetTryNewOutboundFullRelayPeer'
s 'SetTryNewOutboundPeer'                'SetTryNewOutboundFullRelayPeer'
s 'm_try_another_outbound_peer'          'm_try_another_outbound_full_relay_peer'
s 'outbound (full-relay)'                'outbound-full-relay'
s 'outbound full-relay'                  'outbound-full-relay'
s 'outbound, full-relay'                 'outbound-full-relay'
s 'outbounds'                            'outbound-full-relay connections'
s 'f"outbound: '                         'f"outbound-full-relay: '
s ' full-relay'                          ' outbound-full-relay'
s 'to an extra outbound peer'            'to an extra outbound-full-relay peer'
s 'try another outbound peer'            'try another outbound-full-relay peer'
s '(tx, block, addr) outbound'           '(tx, block, addr)'
s 'we deal with extra outbound peers'    'we deal with extra outbound-full-relay peers'
s 'outbound peers we have in excess'     'outbound-full-relay peers we have in excess'
s 'some outbound connections are not'    'some outbound-full-relay connections are not'
s 'or this is a'                         'or if this is an'

s 'ConnectionType::BLOCK_RELAY'          'ConnectionType::OUTBOUND_BLOCK_RELAY'
s ' BLOCK_RELAY'                         ' OUTBOUND_BLOCK_RELAY'
s 'IsBlockOnlyConn'                      'IsOutboundBlockRelayConn'
s 'GetExtraBlockRelayCount'              'GetExtraOutboundBlockRelayCount'
s 'block_relay_peers'                    'outbound_block_relay_peers'
s 'MAX_BLOCK_RELAY_ONLY_ANCHORS'         'MAX_OUTBOUND_BLOCK_RELAY_ANCHORS'
s 'MAX_BLOCK_RELAY_ONLY_CONNECTIONS'     'MAX_OUTBOUND_BLOCK_RELAY_CONNECTIONS'
s 'EXTRA_BLOCK_RELAY_ONLY_PEER_INTERVAL' 'EXTRA_OUTBOUND_BLOCK_RELAY_PEER_INTERVAL'
s 'm_start_extra_block_relay_peers'      'm_start_extra_outbound_block_relay_peers'
s 'outgoing block-relay-only'            'outbound-block-relay'
s 'outbound block-relay-only'            'outbound-block-relay'
s 'outbound block-relay'                 'outbound-block-relay'
s 'block-relay only outbound'            'outbound-block-relay'
s 'block-relay-only outgoing'            'outbound-block-relay'
s 'block-relay only peers'               'outbound-block-relay peers'
s 'block-relay-only'                     'outbound-block-relay'

s ' a outbound'                          ' an outbound'
-END VERIFY SCRIPT-
@jonatack jonatack force-pushed the outbound-connection-type-naming branch from 2645217 to c3e3a16 Compare February 12, 2021 17:18
@jonatack
Copy link
Member Author

6th rebase. The scripted diff may be verified locally with:

test/lint/commit-script-check.sh e9c037b..c3e3a16

ACK 0a6dae5

Thanks for normalizing connection types and +1 for Luke suggestion!

Thanks @ariard for the review! I'd be happy to do @luke-jr's suggestion in a follow-up. This patch requires frequent rebasing, so if anyone is against it or would like it to be modified (e.g. to some other naming), please LMK (I won't bite 🐕) to economize rebasing it into the void of the abyss 🌌

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".

@ariard
Copy link
Contributor

ariard commented Feb 16, 2021

Code Review ACK c3e3a16

@practicalswift
Copy link
Contributor

Lack of rebase is blocking my re-review of this PR :)

@jonatack
Copy link
Member Author

Thanks everyone for the reviews and ACKs but this commit continually needs rebasing and the issue and diff have become too large without separating this into smaller changes. Up for grabs or maybe will re-open as smaller changes but I'm not sure there is enough support to fix/clean this up.

@jonatack jonatack closed this May 11, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
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.

7 participants