feat(indexer): index PoRep Market as first-class tables - #124
Conversation
Ref: #102 Pulling out just the indexer/server parts of 102, will follow-up with context with a context reorg because we currently have no space to describe this.
There was a problem hiding this comment.
🟡 Changes recommended
The new porep_sli_attestation_update table name introduces an inconsistent suffix compared to existing _updated tables, which is likely to become a long-lived API/migration footgun if merged as-is.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR extracts the indexer/server portions of the larger PoRep Market indexing work (ref #102), adding PoRep Market as a first-class indexed service with dedicated porep_* tables and updating the server-side SQL validation + MCP context size tripwires to accommodate the expanded schema metadata.
Changes:
- Add PoRep Market indexing: new
porep_*table defs, network addresses/start blocks, Ponder contract config, and event handlers to write PoRep lifecycle/registry/oracle events. - Vendor PoRep ABIs and add indexer tests to validate ABI event decoding and network registry configuration.
- Expand server SQL validator allow-list for statistical + ordered-set aggregates, and add a system-context size budget test for the table list payload.
File summaries
| File | Description |
|---|---|
| server/test/system-context.test.ts | Adds a size-budget tripwire for the formatted table list loaded into MCP sessions. |
| server/test/sql-validation.test.ts | Adds validation tests for statistical and ordered-set aggregates, including bypass guards. |
| server/src/sql-validator.ts | Allows additional safe statistical/ordered-set aggregate functions. |
| server/README.md | Updates Postgres row description to reflect growth beyond a fixed table count. |
| indexer/test/porep-events.test.ts | Adds tests ensuring PoRep ABIs decode key events into expected primitive types. |
| indexer/test/networks.test.ts | Asserts PoRep Market addresses/start blocks are preserved in network registry snapshots. |
| indexer/test/abi-events.test.ts | Registers PoRep ABIs in the shared ABI event-shape validation test. |
| indexer/src/schema-defs.ts | Defines new porep_* tables + descriptions/columns/indexes for PoRep Market. |
| indexer/src/porep.ts | Implements Ponder event handlers inserting PoRep events into porep_* tables. |
| indexer/src/networks.ts | Adds PoRep Market addresses and PoRep-specific start block to network configs. |
| indexer/ponder.schema.ts | Exposes PoRep table handles in the generated schema exports. |
| indexer/ponder.config.ts | Adds PoRep contracts to the Ponder config with PoRep deployment start blocks. |
| indexer/abis/PoRepMarket.ts | Vendored PoRepMarket V1 ABI. |
| indexer/abis/PoRepValidatorFactory.ts | Vendored ValidatorFactory V1 ABI. |
| indexer/abis/PoRepSPRegistry.ts | Vendored SPRegistry V1 ABI. |
| indexer/abis/PoRepSLIOracle.ts | Vendored SLIOracle V1 ABI. |
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Ref: #102
Pulling out just the indexer/server parts of 102, will follow-up with context with a context reorg because we currently have no space to describe this.