core/validatorapi: serve ptc duties - #4669
Conversation
|
There was a problem hiding this comment.
Pull request overview
Adds first-class support in Charon’s validator API for serving Payload Timeliness Committee (PTC) duties via POST /eth/v1/validator/duties/ptc/{epoch}. This removes reliance on reverse-proxying for that endpoint and ensures validator clients receive duties keyed by their local public shares (so they can recognize/schedule duties), while preserving Beacon API metadata fields (dependent_root, execution_optimistic) in the HTTP response.
Changes:
- Implement
Component.PTCDutiesto fetch PTC duties from the beacon node and replace DV root pubkeys with local pubshares. - Register the new
/eth/v1/validator/duties/ptc/{epoch}POST route and shape its response to includedependent_rootandexecution_optimistic. - Extend mocks and add unit/router tests covering pubshare mapping and response metadata behavior.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| core/validatorapi/validatorapi.go | Adds PTCDuties component method that maps duty pubkeys from DV root keys to local pubshares. |
| core/validatorapi/validatorapi_test.go | Adds a component-level test ensuring PTC duty pubkeys are rewritten to pubshares. |
| core/validatorapi/router.go | Adds the ptc_duties route and handler, returning Beacon API-style metadata and non-null data. |
| core/validatorapi/router_internal_test.go | Adds router-level test validating the PTC duties endpoint wiring and metadata passthrough. |
| core/validatorapi/mocks/handler.go | Updates the generated handler mock to include PTCDuties. |
| core/validatorapi/eth2types.go | Adds ptcDutiesResponse response struct for JSON encoding with dependent root + execution optimistic metadata. |
Files not reviewed (1)
- core/validatorapi/mocks/handler.go: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## gloas #4669 +/- ##
========================================
Coverage ? 58.78%
========================================
Files ? 246
Lines ? 34697
Branches ? 0
========================================
Hits ? 20398
Misses ? 11761
Partials ? 2538 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



Serve
POST /eth/v1/validator/duties/ptc/{epoch}from the validator API instead of reverse-proxying it, replacing the DV root public keys with the local public shares so validator clients recognise their keys and schedule the duty. Mirrors theattesterDutieshandler includingdependent_root/execution_optimisticmetadata.category: feature
ticket: #4324