Remove legacy forwarded message v1/v2 receive handling - #8426
Open
Amaury Chamayou (achamayou) wants to merge 2 commits into
Open
Amaury Chamayou (achamayou) wants to merge 2 commits into
Amaury Chamayou (achamayou) wants to merge 2 commits into
Conversation
ForwardedMsg v3 (session consistency info) has been emitted since 4.0 (#4595); the compatibility policy only supports mixed-version operation with the previous LTS (6.x), which always emits v3. The v1/v2 receive paths in Forwarder::recv_message were therefore unreachable dead code, accounting for about 64 of the missed lines in src/node/rpc/forwarder.h's coverage report. Drop the recv_forwarded_command<ForwardedHeader_v1/_v2> command paths and the v1/v2 branches of the response fall-through, leaving only the v3 handling. Legacy message types now hit an explicit case that logs and drops the message. The ForwardedMsg enum values and the ForwardedHeader_v1/_v2 structs are kept unchanged, since the wire values must remain stable and ForwardedCommandHeader_v3 / ForwardedResponseHeader_v3 still inherit from them; frontend_test.cpp still exercises those headers directly via the templated recv_forwarded_command helper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Amaury Chamayou (achamayou)
September 22, 2026 22:38
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add the requested regression test and pull request reference.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Removes receive-side handling for legacy forwarded-message v1/v2 formats while retaining v3 compatibility.
Changes:
- Drops and logs legacy v1/v2 messages.
- Simplifies forwarding response handling to v3.
- Documents the compatibility change and updates the changelog.
| File | Summary | Findings |
|---|---|---|
src/node/rpc/forwarder.h |
Removes legacy dispatch and retains v3 handling. | Moderate (2 votes): Add regression coverage through recv_message for dropped legacy messages. |
src/node/node_types.h |
Documents v1/v2 receive incompatibility. | None. |
CHANGELOG.md |
Records the legacy handling removal. | Nit (3 votes): Append (#8426) to the entry. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Removed the unused ringbuffer writer from the public research interface and deprecated support for legacy RPC formats. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Motivation
Coverage run (main @ 854b655) shows
src/node/rpc/forwarder.hat 65.8% line coverage. About 64 of its missed lines are the receive paths for the legacy forwarded-message wire formats v1 and v2, which no supported peer can send. v3 (session consistency info) has been emitted since 4.0 (#4595), and the compatibility policy only supports mixed-version operation with the previous LTS (6.x), which always emits v3. The v1/v2 receive paths inForwarder::recv_messageare therefore unreachable and untestable dead code.Implementation summary
forwarded_cmd_v1andforwarded_cmd_v2command-handling blocks fromForwarder::recv_message(src/node/rpc/forwarder.h).forwarded_response_v3case: cancel the pending timeout task, callrecv_forwarded_response<ForwardedResponseHeader_v3>, and reply as before. Removed the v1/v2/v3 if/else header-selection chain and the previous fall-through between response cases.ForwardedMsgvalues (forwarded_cmd_v1,forwarded_response_v1,forwarded_cmd_v2,forwarded_response_v2) that logs atLOG_FAIL_FMTthat the format is no longer supported and drops the message, rather than falling through to the genericdefault:"unknown type" case.ForwardedMsgenum insrc/node/node_types.hto note that v1/v2 are no longer accepted on receive.ForwardedMsgenum values and theForwardedHeader_v1/ForwardedHeader_v2structs unchanged, sinceForwardedCommandHeader_v3/ForwardedResponseHeader_v3inherit from them andsrc/node/rpc/test/frontend_test.cppstill exercises those headers directly via the templatedrecv_forwarded_commandhelper (not throughrecv_message), so no test changes were needed.CHANGELOG.mdentry under the existing### Removedheading for the unreleased[7.0.17]section.Safety and compatibility
ForwardedMsgwire enum values are unchanged (v1=0, response_v1=1, v2=2, response_v2=3, v3=4, response_v3=5), so on-wire framing is unaffected; only the receive-side handling for v1/v2 is removed.ctest -L unit, includingfrontend_test/node_frontend_test) and thee2e_loggingend-to-end test, which exercises real backup-to-primary request forwarding over the v3 path, all pass.