Skip to content

refactor: rename remaining BIP14 subversion identifiers to user agent - #34444

Closed
l0rinc wants to merge 2 commits into
bitcoin:masterfrom
l0rinc:l0rinc/rename-user-agent
Closed

l0rinc wants to merge 2 commits into
bitcoin:masterfrom
l0rinc:l0rinc/rename-user-agent

Conversation

@l0rinc

@l0rinc l0rinc commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

Problem

BIP14 defines the sub_version_num field in version messages as a user-agent string, but there are still internal and user-facing references to "subver/subversion" (as noted in #34389 (comment)).

Fix

The first commit performs the bulk of the mechanical work via a scripted-diff that (with a leading preflight check to make sure the target names don't collide), renaming internal identifiers from *SubVersion*/subver* to *UserAgent*/user_agent. I have verified the mechanical renames via to produce the same binary (except for the test_FormatSubVersion unit test name).

The second commit follows up with the remaining non-mechanical cleanup, adjusting user-facing descriptions, comments, and local variable names to use "user agent" and explicitly referencing BIP14 as justification.

For compatibility, the RPC keys (subver, subversion) are intentionally left unchanged.

BIP14 specifies that the `sub_version_num` field is a user agent string.
A few values can safely be renamed automatically.

-BEGIN VERIFY SCRIPT-
git grep -qE 'FormatUserAgent|formatUserAgent|strUserAgent|MAX_USER_AGENT_LENGTH|cleanUserAgent|m_user_agent_mutex|USER_AGENT_COLUMN_WIDTH|P2P_USER_AGENT' -- src test/functional && echo "Error: Target identifiers already exist in src/ or test/functional" && exit 1

git grep -lE 'FormatSubVersion|formatSubVersion|strSubVersion|MAX_SUBVERSION_LENGTH|cleanSubVer|m_subver_mutex|SUBVERSION_COLUMN_WIDTH|P2P_SUBVERSION|strSubVer|Subversion' -- src test/functional | \
  xargs sed --in-place \
    -e 's/FormatSubVersion/FormatUserAgent/g' \
    -e 's/formatSubVersion/formatUserAgent/g' \
    -e 's/strSubVersion/strUserAgent/g' \
    -e 's/MAX_SUBVERSION_LENGTH/MAX_USER_AGENT_LENGTH/g' \
    -e 's/cleanSubVer/cleanUserAgent/g' \
    -e 's/m_subver_mutex/m_user_agent_mutex/g' \
    -e 's/SUBVERSION_COLUMN_WIDTH/USER_AGENT_COLUMN_WIDTH/g' \
    -e 's/P2P_SUBVERSION/P2P_USER_AGENT/g' \
    -e 's/strSubVer/user_agent/g' \
    -e 's/Subversion/UserAgent/g'
-END VERIFY SCRIPT-
BIP14 specifies that the `sub_version_num` field is a user agent string.
Update user-facing text, comments, and local variable names accordingly, while keeping RPC keys ("subver", "subversion") unchanged for compatibility.
@DrahtBot

DrahtBot commented Jan 29, 2026 •

Copy link
Copy Markdown
Contributor

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
Concept NACK ajtowns
Concept ACK naiyoma

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #34389 (net/log: standardize peer+addr log formatting via LogPeer by l0rinc)
  • #34293 (Bugfix: net_processing: Restore missing comma between peer and peeraddr in "receive version message" and "New ___ peer connected" by luke-jr)
  • #34181 (refactor: [p2p] Make ProcessMessage private again, Use references when non-null by maflcko)

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.

LLM Linter (✨ experimental)

Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

  • check_bytesrecv(peer, msg_type, min_bytes_recv) in test/functional/test_framework/test_framework.py

2026-01-29 13:25:27

@l0rinc l0rinc changed the title refactor/BIP14: rename remaining subversion identifiers to user agent refactor: rename remaining BIP14 subversion identifiers to user agent Jan 29, 2026

@naiyoma naiyoma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Concept ACK

Changes align with proposal:-> https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki#proposal

"The currently unused sub_version_num field in "version" packets will become the new user-agent string."

I grepped twice to check on the remaining instance
git grep -i "subver" -- src test/functional
git grep -i "subver" -- ':!src' ':!test/functional

Other than the RPC keys. These changes also do not touch the release notes and doc/bips.md, which should be left as-is.

@ajtowns

ajtowns commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Concept NACK. This touches 28 files for a purely cosmetic rename — the merge conflict cost (already 3 conflicting PRs) and git blame churn outweigh the naming consistency benefit IMO.

The internal terminology has been "subversion" for 15 years and is well-understood by anyone working on this code. BIP 14 defined how we format the string, and introduced the separation between protocol and client version, but I don't think it obligates us to match its naming internally. (Personally, I think "subversion" is a nice string to have peppered through our codebase anyway)

If the concern is that bips.md's description feels inaccurate, note that the entry already has a bug: it cites #669 (multisig/OP_EVAL) but the actual BIP 14 implementation was #707.

(** Using AI to edit my NACKs to make them less mean)

@l0rinc

l0rinc commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback.

@l0rinc l0rinc closed this Feb 6, 2026
@l0rinc
l0rinc deleted the l0rinc/rename-user-agent branch February 27, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants