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
Open
Update API endpoints to return a merge of l1 validator and sentinel data#578WietzeSlagman wants to merge 16 commits intofeat/validator-metrics-updatefrom
WietzeSlagman wants to merge 16 commits intofeat/validator-metrics-updatefrom
Conversation
Contributor
There was a problem hiding this comment.
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_validatortable by adding astakefield directly, eliminating the separatel1_l2_validator_stakehistory 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.
FilipHarald
requested changes
Oct 17, 2025
FilipHarald
approved these changes
Oct 21, 2025
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.
This PR updates the database retrieve queries in
explorer-apito merge the data from l2-validators and sentinel and returns that data.What changed:
explorer-apil2-validatortable to make it even more simplified