Skip to content

Move node endpoint handlers out of NodeEndpoints::init_handlers - #8504

Merged
Amaury Chamayou (achamayou) merged 4 commits into
mainfrom
achamayou-bookish-fiesta
Oct 5, 2026
Merged

Amaury Chamayou (achamayou) merged 4 commits into
mainfrom
achamayou-bookish-fiesta

Conversation

@achamayou

@achamayou Amaury Chamayou (achamayou) commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

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 against main.

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, ReadOnlyEndpointContext or CommandEndpointContext types in both handlers and forwarding lambdas, rather than unnecessary templates. Keep lightweight forwarding lambdas and all endpoint registration in init_handlers().

Only src/node/rpc/node_frontend.h changes. 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: built node_frontend_test and logging with parallelism 2, passed node_frontend_test and the complete nodes_test e2e runner (2/2), and passed all 15 scripts/ci-checks.sh checks without autofix. The header is ASCII-only.

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 AI 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.

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.

Comment thread src/node/rpc/node_frontend.h Outdated
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>
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>
@achamayou
Amaury Chamayou (achamayou) merged commit a5d0497 into main Oct 5, 2026
12 checks passed
@achamayou
Amaury Chamayou (achamayou) deleted the achamayou-bookish-fiesta branch October 5, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants