Skip to content

[CRE] Add confidential relay gateway handler#21356

Open
nadahalli wants to merge 3 commits intodevelopfrom
tejaswi/remote-c-gateway-handler
Open

[CRE] Add confidential relay gateway handler#21356
nadahalli wants to merge 3 commits intodevelopfrom
tejaswi/remote-c-gateway-handler

Conversation

@nadahalli
Copy link
Contributor

@nadahalli nadahalli commented Mar 2, 2026

Confidential CRE Workflows (implementation plan | reviewer's guide | relay DON design)

Summary

  • Gateway-side handler for confidential compute relay, implementing handlers.Handler
  • Receives JSON-RPC requests from the enclave, fans out to relay DON nodes, aggregates 2F+1 quorum responses
  • Registered as confidential-compute-relay handler type in handler_factory.go
  • Simplified vs vault handler: no authorization, no caching, no OCR3 signatures, no owner-prefixed request IDs

Pairs with #265 (node-side relay handler in confidential-compute).

Changes

  • core/services/gateway/handlers/confidentialrelay/handler.go: Handler interface implementation. Fan-out to relay DON nodes, response aggregation, timeout cleanup. Single code path for all methods.
  • core/services/gateway/handlers/confidentialrelay/aggregator.go: 2F+1 quorum by response digest. No signature validation tier (relay responses have no OCR3 signatures).
  • core/services/gateway/handlers/confidentialrelay/handler_test.go: 13 tests covering quorum success (mock + real aggregator), divergent responses, quorum unobtainable, timeout, duplicate request IDs, rate limiting, late responses, fan-out failure, legacy message rejection, and both JSON-RPC methods.
  • core/services/gateway/handler_factory.go: New ConfidentialRelayHandlerType constant and switch case.

Key simplifications vs vault handler

Vault Relay
Owner-prefixed request IDs Plain request IDs
Request authorization No authorization (attestation validated by relay DON nodes)
Public key caching + refresh ticker No caching
OCR3 signature validation (F+1) then quorum fallback Quorum only (2F+1 matching digests)
capabilitiesRegistry dependency No registry dependency
writeMethodsEnabled gate limiter No write method gating
Method-specific handle* functions Single fan-out path for all methods

Note: shared handler infrastructure

~400 of the ~430 lines here are generic fan-out/aggregate boilerplate copied from the vault handler (activeRequest lifecycle, HandleNodeMessage, fanOutToNodes, removeExpiredRequests, sendResponse, errorResponse, metrics). The actual method-specific logic is ~5 lines in HandleJSONRPCUserMessage.

The same pattern is independently re-implemented in at least three handlers:

Handler Fan-out Aggregation Extras
Vault activeRequest + fanOutToVaultNodes Signature validation, quorum fallback Auth, caching, owner-prefix, method routing
Confidential relay (this PR) Copy-paste from vault 2F+1 digest only Nothing
v2 HTTP trigger Own httpTriggerHandler IdenticalNodeResponseAggregator (same 2F+1 idea) Response cache, sub-handler routing

A generic base handler in handlers/common/ could extract the shared ~400 lines. Relay would shrink to ~50 lines. Vault would wrap the base with its auth/caching/routing layer. Didn't do this here because it's a refactor of existing gateway handler internals that should be its own PR.

Copilot AI review requested due to automatic review settings March 2, 2026 20:52
@nadahalli nadahalli requested review from a team as code owners March 2, 2026 20:52
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

👋 nadahalli, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

✅ No conflicts with other open PRs targeting develop

@nadahalli nadahalli changed the title Add confidential relay gateway handler (Remote-C) [CRE] Add confidential relay gateway handler (Remote-C) Mar 2, 2026
@nadahalli nadahalli changed the title [CRE] Add confidential relay gateway handler (Remote-C) [CRE] Add confidential relay gateway handler Mar 2, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Gateway-side handler that receives JSON-RPC requests from the enclave,
fans them out to relay DON nodes, and aggregates 2F+1 quorum responses.
Follows the vault handler pattern but simplified: no authorization, no
caching, no OCR3 signatures, no owner-prefixed request IDs.
@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
24.6% Duplication on New Code (required ≤ 10%)

See analysis details on SonarQube

@trunk-io
Copy link

trunk-io bot commented Mar 3, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

Failed Test Failure Summary Logs
TestDocsTOMLComplete The test failed due to a missing required field in the configuration, causing an error during TOML validation. Logs ↗︎

View Full Report ↗︎Docs

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.

2 participants