Skip to content

feat: index public call requests from pending transactions#540

Open
Mautjee wants to merge 7 commits intomainfrom
feature/index-public-data-from-pending-tx
Open

feat: index public call requests from pending transactions#540
Mautjee wants to merge 7 commits intomainfrom
feature/index-public-data-from-pending-tx

Conversation

@Mautjee
Copy link
Contributor

@Mautjee Mautjee commented Jul 8, 2025

Add support for extracting and storing public call requests from pending transactions with new API endpoints

@FilipHarald FilipHarald requested a review from Copilot July 8, 2025 20:27
Copy link

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

Adds support for extracting, storing, and indexing public call requests from pending L2 transactions via new API endpoints.

  • Introduces three new GET endpoints to fetch public call requests by transaction hash, contract address, or sender address.
  • Defines a new tx_public_call_request table in the database schema with controllers to store, retrieve, and delete entries.
  • Integrates public call request handling into transaction storage and dropped‐transaction cleanup logic.

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
services/explorer-api/src/svcs/http-server/routes/paths_and_validation.ts Added new path constants and Zod schema for public call requests
services/explorer-api/src/svcs/http-server/routes/index.ts Registered new routes for public call request endpoints
services/explorer-api/src/svcs/http-server/routes/controllers/public-call.ts Implemented controllers and OpenAPI specs for public call requests
services/explorer-api/src/svcs/http-server/routes/controllers/index.ts Exported the new public-call controller
services/explorer-api/src/svcs/database/schema/l2tx/index.ts Extended l2Tx relations to include many public call requests
services/explorer-api/src/svcs/database/schema/l2public-call/index.ts Defined the tx_public_call_request table and relations
services/explorer-api/src/svcs/database/controllers/l2Tx/store.ts Hooked into transaction storage to persist public call requests
services/explorer-api/src/svcs/database/controllers/l2Tx/get-tx.ts Augmented transaction fetch to include stored public call requests
services/explorer-api/src/svcs/database/controllers/l2Public-call/store.ts Created store logic to upsert public call requests
services/explorer-api/src/svcs/database/controllers/l2Public-call/get.ts Added retrieval functions for public call requests
services/explorer-api/src/svcs/database/controllers/l2Public-call/delete.ts Added deletion logic for public call requests
services/explorer-api/src/svcs/database/controllers/index.ts Exported the new l2PublicCall controller namespace
services/explorer-api/src/events/received/on-dropped-txs.ts Cleaned up public call requests when a transaction is dropped
services/explorer-api/migrations/meta/_journal.json Updated journal metadata (note: no new migration script present)
Comments suppressed due to low confidence (1)

services/explorer-api/src/svcs/database/schema/l2public-call/index.ts:1

  • New table tx_public_call_request is defined but no corresponding migration script was added; ensure a migration is created to persist this schema in the database.
import { generateAztecAddressColumn } from "@chicmoz-pkg/backend-utils";

}),
});

export const getPublicCallRequessByAddressSchema = z.object({
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

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

Typo in schema name: 'Requess' should be 'Requests' for consistency and clarity.

Suggested change
export const getPublicCallRequessByAddressSchema = z.object({
export const getPublicCallRequestsByAddressSchema = z.object({

Copilot uses AI. Check for mistakes.
);
router.get(
paths.publicDataSender,
controller.GET_PUBLIC_CALL_REQUESTS_BY_CONTRACT_ADDRESS,
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

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

The handler for the 'sender' endpoint is using the contract-address controller; swap so publicDataSender uses GET_PUBLIC_CALL_REQUESTS_BY_SENDER_ADDRESS.

Suggested change
controller.GET_PUBLIC_CALL_REQUESTS_BY_CONTRACT_ADDRESS,
controller.GET_PUBLIC_CALL_REQUESTS_BY_SENDER_ADDRESS,

Copilot uses AI. Check for mistakes.
);
router.get(
paths.publicDataContract,
controller.GET_PUBLIC_CALL_REQUESTS_BY_SENDER_ADDRESS,
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

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

The handler for the 'contract' endpoint is using the sender-address controller; use GET_PUBLIC_CALL_REQUESTS_BY_CONTRACT_ADDRESS instead.

Suggested change
controller.GET_PUBLIC_CALL_REQUESTS_BY_SENDER_ADDRESS,
controller.GET_PUBLIC_CALL_REQUESTS_BY_CONTRACT_ADDRESS,

Copilot uses AI. Check for mistakes.
@@ -14,9 +14,16 @@ CREATE TABLE IF NOT EXISTS "aztec-chain-connection" (
"protocol_contract_addresses" jsonb NOT NULL
Copy link
Contributor

Choose a reason for hiding this comment

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

I can see that you have deleted all the older migrations. We can't do that any longer since we need to persist the DB

Copy link
Contributor

Choose a reason for hiding this comment

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

txs: "/l2/txs",
txByHash: `/l2/txs/:${txEffectHash}`,

publicDataTx: `/l2/public-call-requests/tx/:${txEffectHash}`,
Copy link
Contributor

@FilipHarald FilipHarald Jul 9, 2025

Choose a reason for hiding this comment

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

Since public-call-requests is only one DB-table. We should also only have one (or two) endpoints.

publicCallRequestsByTxHash: /l2/public-call-requests/:${txEffectHash}
publicCallRequests: /l2/public-call-requests // this one can have query-params to search for contractAddress or senderAddress

Copy link
Contributor

Choose a reason for hiding this comment

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

is this file needed?

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.

index public data from pending transactions to later show on txEffects

3 participants