Move node endpoint handlers out of NodeEndpoints::init_handlers - #8504
Merged
Merged
Conversation
Extract existing node endpoint implementations into private handlers while retaining their registration and policies in init_handlers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Amaury Chamayou (achamayou)
October 5, 2026 12:56
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The extraction preserves handler semantics and endpoint registration behavior, with relevant validation reported.
Review effort: Balanced
Findings: None
What changed in this PR
Refactors node endpoint handlers into private member functions, reducing init_handlers() complexity without changing behavior.
Changes:
- Extracts 33 handler bodies.
- Retains lightweight registration lambdas and endpoint configuration.
Custom instructions used
.github/copilot-instructions.md.github/instructions/reviewing.instructions.md.github/skills/testing/SKILL.md
| File | Description |
|---|---|
src/node/rpc/node_frontend.h |
Separates handler implementations from endpoint registration. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Replace unnecessary handler templates and generic forwarding parameters with the exact endpoint context types, preserving handler behavior and registration policies. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Max (maxtropets)
approved these changes
Oct 5, 2026
Qualify pointer-returning auto declarations (readability-qualified-auto) and use dynamic_cast for the CommittableTx downcast (cppcoreguidelines-pro-type-static-cast-downcast), consistent with node_state.h and open_service.h. These were previously hidden from clang-tidy because the generic lambdas made the expressions type-dependent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Reduce the cognitive complexity of
NodeEndpoints::init_handlers()by separating handler implementations from endpoint registration. Split from #8489 at reviewer request so the node frontend refactor can be reviewed and merged independently againstmain.Related to #7358; this is partial complexity-reduction work, not a resolution of that issue.
Implementation summary
Move the existing handlers into private member functions, with static functions for handlers that do not need node state. Use concrete
EndpointContext,ReadOnlyEndpointContextorCommandEndpointContexttypes in both handlers and forwarding lambdas, rather than unnecessary templates. Keep lightweight forwarding lambdas and all endpoint registration ininit_handlers().Only
src/node/rpc/node_frontend.hchanges. This is the node frontend refactor only, without the redundant handler-extraction comment or any programmability sample or consensus changes.Safety and compatibility
No intentional behaviour, public API, authorization, transaction-boundary, wire-format or ledger-format changes. All 33 extracted handler bodies retain their semantics, and all 34 endpoint registration chains preserve authentication, forwarding, adapters, schemas and registration order. No special mixed-version or recovery considerations.
Local validation passed with Clang 21 and
RelWithDebInfo: builtnode_frontend_testandloggingwith parallelism 2, passednode_frontend_testand the completenodes_teste2e runner (2/2), and passed all 15scripts/ci-checks.shchecks without autofix. The header is ASCII-only.