Skip to content

Update API endpoints to return a merge of l1 validator and sentinel data#578

Open
WietzeSlagman wants to merge 16 commits intofeat/validator-metrics-updatefrom
feat/validator-metrics-api-update
Open

Update API endpoints to return a merge of l1 validator and sentinel data#578
WietzeSlagman wants to merge 16 commits intofeat/validator-metrics-updatefrom
feat/validator-metrics-api-update

Conversation

@WietzeSlagman
Copy link
Copy Markdown
Collaborator

This PR updates the database retrieve queries in explorer-api to merge the data from l2-validators and sentinel and returns that data.

What changed:

  • API endpoints changed in terms of queries and params
  • Database get functions changed in explorer-api
  • Update to l2-validator table to make it even more simplified

@FilipHarald FilipHarald requested a review from Copilot October 17, 2025 13:29
Copy link
Copy Markdown
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.

Pull Request Overview

This PR refactors the validator data model to simplify the database schema and merge L1 validator data with Sentinel statistics. The changes consolidate historical tracking tables into a single validator table with direct fields, and introduce new API endpoints that return combined validator and sentinel data.

Key Changes:

  • Simplified the l1_l2_validator table by adding a stake field directly, eliminating the separate l1_l2_validator_stake history table
  • Created new database query functions that merge validator data from multiple sources (L1, L2, and Sentinel schemas)
  • Updated API endpoints to return merged validator and sentinel data with new query parameters for filtering and pagination

Reviewed Changes

Copilot reviewed 33 out of 34 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
services/validator-metrics/src/svcs/database/index.ts Updated database service to import and merge L1, L2, and Sentinel schemas
services/validator-metrics/src/svcs/database/controllers/l1/l2-validator/store.ts Removed stake history table insertions, now storing stake directly in validator table
services/validator-metrics/src/svcs/database/controllers/l1/l2-validator/get-single.ts Removed stake history subquery, now reading stake directly from validator table
services/validator-metrics/src/svcs/database/controllers/l1/l2-validator/get-multiple.ts Removed stake history subquery for multiple validators
services/explorer-api/src/svcs/database/controllers/l1/l2-validator/get.ts New file implementing merged validator and sentinel data queries
services/explorer-api/src/svcs/http-server/routes/controllers/validators.ts Updated API endpoints to use new merged data functions
packages/database-registry/src/schemas/l1/l2-validator.ts Removed stake history table schema, added stake field to main validator table
packages/types/src/aztec/sentinel.ts Added new schema for merged validator with sentinel data
services/explorer-api/migrations/*.sql Database migration files for schema changes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread services/explorer-api/src/svcs/database/controllers/l1/l2-validator/get.ts Outdated
Comment thread k8s/local/validator-metrics/remote_devnet/deployment.yaml Outdated
Comment thread k8s/local/validator-metrics/sandbox/deployment.yaml Outdated
Comment thread k8s/local/validator-metrics/testnet/deployment.yaml
Comment thread packages/database-registry/src/schemas/l1/l2-validator.ts
Comment thread packages/database-registry/src/schemas/l1/l2-validator.ts
Comment thread packages/types/src/ethereum/index.ts
Comment thread services/explorer-api/migrations/0000_daffy_skin.sql Outdated
Comment thread services/explorer-api/migrations/0009_greedy_thunderbolts.sql Outdated
Comment thread services/explorer-api/src/svcs/database/controllers/l1/l2-validator/get.ts Outdated
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.

3 participants