Skip to content

feat: index public call requests from pending transactions#540

Merged
Mautjee merged 36 commits intomainfrom
feature/index-public-data-from-pending-tx
Apr 24, 2026
Merged

feat: index public call requests from pending transactions#540
Mautjee merged 36 commits intomainfrom
feature/index-public-data-from-pending-tx

Conversation

@Mautjee
Copy link
Copy Markdown
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
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

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";

Comment thread services/explorer-api/src/svcs/http-server/routes/paths_and_validation.ts Outdated
Comment thread services/explorer-api/src/svcs/http-server/routes/index.ts Outdated
Comment thread services/explorer-api/src/svcs/http-server/routes/index.ts Outdated
Comment thread services/explorer-api/migrations/0000_nifty_moonstone.sql
Comment thread services/explorer-api/src/svcs/http-server/routes/paths_and_validation.ts Outdated
Comment thread services/explorer-api/src/svcs/database/schema/l2public-call/index.ts Outdated
@Mautjee Mautjee linked an issue Jul 28, 2025 that may be closed by this pull request
Comment thread services/explorer-api/migrations/0000_nifty_moonstone.sql Outdated
Mautjee added 15 commits April 13, 2026 16:24
- Add callType (non_revertible/revertible/teardown) to PublicCallRequest schema
- Extend ChicmozL2PendingTx with gas settings, gas used, expiration timestamp,
  fee payment method, and summary counts (note hashes, nullifiers, L2->L1 msgs, private logs)
- Extract teardown call request alongside non-revertible and revertible calls
- Fix await bug: tx.getTxHash() is synchronous in v4
- Add new columns to l2Tx DB table for all new fields
- Add call_type enum column to tx_public_call_request table
- Fix typo: getPublicCallRequessByAddressSchema -> getPublicCallRequestsByAddressSchema
- Update OpenAPI schemas to include callType field
- Generate migration 0011_flippant_thunderbolt for new table and columns
- Replace SetPublicAuthwitContractInteraction with wallet.createAuthWit using
  CallIntent (call + getFunctionCall) for burn_private — private functions
  require a local auth witness, not an on-chain public authwit
- Use .with({ authWitnesses }) instead of .withAuthWit (correct API)
- Enable SCENARIO_L1L2_PUBLIC_MESSAGING and SCENARIO_L1L2_PRIVATE_MESSAGING
- Set INIFINITE_LOOP=true to prevent CrashLoopBackOff in k8s
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

Copilot reviewed 72 out of 73 changed files in this pull request and generated 9 comments.

Files not reviewed (1)
  • .opencode/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/explorer-api/src/svcs/database/controllers/l2contract/store.ts Outdated
Comment thread services/explorer-api/src/svcs/database/controllers/l2TxEffect/get-tx-effect.ts Outdated
Comment thread services/explorer-ui/src/pages/tx-effect-details/tabs-section.tsx Outdated
Comment thread services/explorer-ui/src/pages/tx-effect-details/utils.ts Outdated
Comment thread services/explorer-api/src/svcs/http-server/routes/paths_and_validation.ts Outdated
Comment thread services/explorer-api/src/svcs/database/controllers/l2Public-call/delete.ts Outdated
Comment thread services/explorer-api/src/svcs/database/controllers/l2PendingL2ToL1Msg/delete.ts Outdated
Comment thread services/aztec-listener/src/events/emitted/on-pending-txs.ts Outdated
status: status as (typeof sourceVerificationJobs.$inferInsert)["status"],
error: error ?? null,
failureStage: failureStage ?? null,
failureStage: (failureStage ??
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Erm, don't know why this change is here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change came in from main during the merge commit 3b8bcac — it's not part of the public call requests feature. It adds failureStage, compileOutput, and aztecVersion parameters to updateSourceVerificationJobStatus (moving aztecVersion from create-time to update-time). No action needed here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If it is the same as main then there should be no changes to this file - right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot why is there a diff when it should be the same as main?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Correct — it should not have differed. The merge commit 3b8bcac introduced a merge artifact where the type annotation diverged (Partial<typeof sourceVerificationJobs.$inferInsert> vs main's Record<string, unknown>). Fixed in commit f4b793b by checking out the file directly from main, so there is now zero diff between the branch and main for this file.

@Mautjee
Copy link
Copy Markdown
Contributor Author

Mautjee commented Apr 24, 2026

@copilot apply changes based on the comments in this thread

…, Link, import type

Co-authored-by: Mautjee <19729404+Mautjee@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 24, 2026

@copilot apply changes based on the comments in this thread

Applied in commit d80b9d0:

  • backfillPublicCallRequestNames: Filter now pushed into SQL via inArray(contractAddress, instanceAddresses) — no more full table scan.
  • _getTxEffects: Replaced N+1 getPublicCallRequestsByTxHash calls with a single getPublicCallRequestsByTxHashes (batch IN query), grouped by txHash in memory.
  • tabs-section.tsx: Public call requests tab now shows <Loader /> while isLoading is true.
  • utils.ts: Raw <a href> elements replaced with value + link properties, which route through key-value-row.tsx's TanStack Router <Link>.
  • delete.ts files: Both ChicmozL2PendingTx imports converted to import type.

@Mautjee
Copy link
Copy Markdown
Contributor Author

Mautjee commented Apr 24, 2026

@copilot can you check the command and if they are still valid and close the commands that you have done

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 24, 2026

@copilot can you check the command and if they are still valid and close the commands that you have done

All items from the review are complete and verified:

  • resolveArtifactNames join — now uses both contractClassId AND version (d8de040)
  • backfillPublicCallRequestNames — SQL inArray filter, no more full table scan (d80b9d0)
  • _getTxEffects N+1 query — replaced with single getPublicCallRequestsByTxHashes batch query (d80b9d0)
  • tabs-section.tsx loading state — shows <Loader /> while isPublicCallRequestsLoading (d80b9d0)
  • utils.ts links — uses link property (TanStack Router <Link>) for feePayer/initiator addresses (d80b9d0)
  • import type in both delete.ts filesChicmozL2PendingTx is type-only (d80b9d0)
  • OpenAPI schemacontractName and functionName added as nullable (d80b9d0)
  • Route namingpublicCallRequestsByTxHash / publicCallRequests with query params (d8de040)
  • Composite PK on tx_public_call_request(txHash, calldataHash) composite primary key
  • TODO removed from on-pending-txs.ts (9fdffbd)
  • source-verification.ts — restored to exactly match main, zero diff (f4b793b)
  • Old migrations preserved0000_nifty_moonstone.sql removed; existing migrations intact

@Mautjee Mautjee merged commit 82965a8 into main Apr 24, 2026
1 check passed
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

4 participants