Skip to content

feat(api)!: make getTxReceipt the single tx-lookup API#23660

Merged
PhilWindle merged 13 commits into
merge-train/spartanfrom
spl/new-get-tx-receipt
Jun 1, 2026
Merged

feat(api)!: make getTxReceipt the single tx-lookup API#23660
PhilWindle merged 13 commits into
merge-train/spartanfrom
spl/new-get-tx-receipt

Conversation

@spalladino

@spalladino spalladino commented May 29, 2026

Copy link
Copy Markdown
Contributor

Motivation

The node exposed two overlapping transaction-lookup methods — getTxReceipt (lifecycle/status) and getTxEffect (mined side effects) — forcing callers to stitch results together and duplicating fields (txHash, fee, block hash/number, execution result) for mined txs. This resolves the standing REFACTOR note on TxReceipt by making getTxReceipt the single lookup API.

Breaking change to the public node RPC, with no wire back-compat.

Approach

TxReceipt becomes a discriminated union over the lifecycle — PendingTxReceipt | DroppedTxReceipt | MinedTxReceipt over an abstract TxReceiptBase — with isMined()/isPending()/isDropped() guards for narrowing while bare field reads keep compiling. getTxReceipt gains GetTxReceiptOptions to opt into attaching the full TxEffect, the pending Tx, and its proof. Receipt assembly moves from the block store to the node (deriving mined status from the cached getL2Tips), getSettledTxReceipt is removed from the archiver/L2BlockSource, and the public getTxEffect is deprecated.

Breaking change adds the slotNumber to the indexed tx effect, changing the db format.

Changes

  • stdlib: TxReceipt variant classes + union + TxReceiptSchema, GetTxReceiptOptions, Tx.withoutProof; new getTxReceipt interface/RPC signature; removed getSettledTxReceipt from L2BlockSource/archiver; l2_to_l1_membership collapsed to a single call.
  • aztec-node: node assembles MinedTxReceipt from getTxEffect + getL2Tips (+ epoch); deprecated the public getTxEffect.
  • archiver: removed getSettledTxReceipt impl/wrapper/mock; the block store returns raw IndexedTxEffects.
  • pxe / cli / cli-wallet / wallet-sdk / bot: migrated callers off the deprecated getTxEffect to getTxReceipt(h, { includeTxEffect: true }); the PXE oracle and message-context paths reconstruct an IndexedTxEffect so downstream note/event services are unchanged.
  • p2p: tx_archive reuses Tx.withoutProof.
  • tests: per-variant construction + union round-trip coverage, node-level status-derivation tests across the tip boundaries, and updated RPC round-trip tests.
  • docs: migration-notes entry for the breaking change + how-to-send-transaction guide update.

Note: the auto-generated typescript-api and node-api-reference docs are intentionally not regenerated here — the former is bulk-regenerated by release tooling (regenerating now would sweep in unrelated drift since the v4.3.0 snapshot) and the latter's generator is currently incompatible with the repo's Zod 4 schemas (a pre-existing issue affecting all methods).

@spalladino spalladino added the ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure label May 29, 2026
@spalladino spalladino changed the title refactor: make getTxReceipt the single tx-lookup API feat(api)!: make getTxReceipt the single tx-lookup API May 29, 2026
@spalladino spalladino force-pushed the spl/new-get-tx-receipt branch 2 times, most recently from 977dd06 to 050ed28 Compare May 29, 2026 20:03
spalladino added 13 commits May 29, 2026 17:52
Phase 1 of the getTxReceipt redesign. Replaces the single TxReceipt class
with an abstract TxReceiptBase and Pending/Dropped/Mined variant subclasses
(union type + z.union schema), plus GetTxReceiptOptions. Adds Tx.withoutProof
and refactors tx_archive to use it.
Adds GetTxReceiptOptions to the getTxReceipt interface + RPC schema, returns
the TxReceipt union, deprecates the public AztecNode.getTxEffect, and removes
getSettledTxReceipt from the L2BlockSource/archiver. The node now assembles
the MinedTxReceipt itself from getTxEffect + getL2Tips (+ epoch), replacing
the block-store's receipt computation.
Moves the PXE oracle/message-context, cli, cli-wallet, wallet-sdk, bot, and
l2_to_l1 membership callers to getTxReceipt(h, { includeTxEffect: true }).
The oracle and message-context paths reconstruct an IndexedTxEffect from the
receipt so downstream note/event services are unchanged.
Rewrites tx_receipt tests for the variant classes (per-variant round-trip,
union routing, stripped-proof pending tx), updates the aztec-node/archiver
RPC tests for the union + removed getSettledTxReceipt, and adds aztec-node
getTxReceipt coverage of status derivation from getL2Tips at each tip
boundary plus the pending/dropped branches. Exports TxReceiptBase for
instanceof checks.
Adds a migration-notes entry for the getTxReceipt lifecycle union and
GetTxReceiptOptions, the getTxEffect deprecation, and the
TxReceipt.empty()/schema -> DroppedTxReceipt.empty()/TxReceiptSchema moves,
and updates the how-to-send-transaction guide for the union shape.
Resolves an import/no-duplicates lint violation by combining the two
@aztec/stdlib/tx imports into a single statement with inline type markers.
Migrates the message-context, oracle, and base-wallet unit tests off the
removed getTxEffect mock path (they now mock getTxReceipt returning receipt
variants), and drops the unnecessary includeTxEffect from
computeL2ToL1MembershipWitness, which only needs txIndexInBlock/blockNumber/
epochNumber off the mined receipt.
TxReceipt is now a type-only union, not a runtime class. Switch the
playground imports to type-only and replace the timeout-path
new TxReceipt(txHash, PENDING, ...) with new PendingTxReceipt(txHash).
The getTxReceipt redesign moved receipt assembly into the node, which now
calls blockSource.getL1Constants() to derive the epoch when building a mined
receipt. The TXE archiver stubbed that method to throw, breaking every TXE
contract test that fetches a mined receipt (counter_contract, default_scaffold).
Return EmptyL1RollupConstants, matching the TXE's mock_epoch_cache.
Add slotNumber to IndexedTxEffect and MinedTxReceipt so the node derives the
epoch from the block's slot in getTxReceipt instead of an extra getBlockData
lookup, with finalization status read from the cached L2 tips. Bump the
archiver DB version for the new tx-effect serialization. Reorder the
MinedTxReceipt constructor (txEffect before debugLogs) and stop exporting
TxReceiptBase, updating all call sites.
Drop dead imports left by the rebase: get_logs_response.ts was removed by the
log-retrieval redesign (its schemas are replaced by LogResultSchema, already
imported), and TxReceipt is no longer referenced in archiver.ts. Point
log_result.ts at the renamed PickIfFlag, and restore the missing MinedTxStatus
and TxEffect imports in the sender-sync test.
…eader skip

The partial IndexedTxEffect reader in getNoteHashesAndNullifiers skipped a
fixed-length header that did not include the newly added slotNumber field,
leaving every effect read 4 bytes misaligned and producing over-modulus Fr
values. This broke the archiver log-by-tags effect path used by PXE contract
sync, failing all e2e tests. Skip the slotNumber bytes too (109-byte header).
@spalladino spalladino force-pushed the spl/new-get-tx-receipt branch from 862e6e8 to abd8208 Compare May 29, 2026 20:59
@PhilWindle PhilWindle merged commit 0162c2a into merge-train/spartan Jun 1, 2026
17 checks passed
@PhilWindle PhilWindle deleted the spl/new-get-tx-receipt branch June 1, 2026 15:14
spalladino added a commit that referenced this pull request Jun 1, 2026
Upstream #23660 removed getSettledTxReceipt in favor of getTxReceipt as the
single tx-lookup API. The outbox resolver no longer has getSettledTxReceipt to
read epoch/block/txIndex from, so it now derives them from getTxEffect and
getEpochAtSlot — mirroring how the node assembles a mined receipt.
danielntmd pushed a commit to danielntmd/aztec-packages that referenced this pull request Jun 4, 2026
…or (AztecProtocol#23798)

## Motivation

The Node JSON-RPC API reference generator
(`docs/scripts/node_api_reference_generation/generate_node_api_reference.ts`)
does not instantiate Zod at runtime — it string-parses the schema source
(`AztecNodeApiSchema = { ... }`) via the TypeScript compiler API.
`parseZodFunctionExpr` only recognized the **Zod 3** DSL:

```ts
z.function().args(BlockParameterSchema, schemas.Fr).returns(schemas.Fr)
```

After the repo-wide Zod 3 → 4 migration, every schema moved to the Zod 4
form:

```ts
getPublicStorageAt: z.function({
  input: z.tuple([BlockParameterSchema, schemas.AztecAddress, schemas.Fr]),
  output: schemas.Fr,
}),
```

There is no `.args(` / `.returns(` left, so `argsStart`/`returnsStart`
are `-1` and **every** method is emitted with `Parameters: None` and
`Returns: void`. It does not throw — it silently produces a useless
reference. This is the breakage referenced in AztecProtocol#23660 ("the
node-api-reference generator is currently incompatible with the repo's
Zod 4 schemas — a pre-existing issue affecting all methods"); it
predates that PR and stems from the Zod 4 migration (the generator last
regenerated cleanly in AztecProtocol#22934, when schemas were still Zod 3).

## Approach

Rewrote `parseZodFunctionExpr` to read the Zod 4 `z.function({ input:
z.tuple([...]), output: <expr> })` object: it extracts the `input` tuple
elements as the parameter list and the `output` expression as the return
type, reusing the existing `simplifyZodType` mapping. The legacy
`.args().returns()` path is kept as a fallback so older versioned-docs
schemas still regenerate. Added small helpers `findMatchingBracket`,
`findTopLevelColon`, and `parseInputArgs`.

## Verification

The only changed logic is the pure expression parser, so I unit-tested
the actual functions (loaded from this file) against real schema strings
copied verbatim from `aztec-node.ts`, plus a legacy Zod 3 string:

```
PASS  getPublicStorageAt (multi-arg tuple)            -> [BlockHash|number|"latest", AztecAddress, Fr] / Fr
PASS  getWorldStateSyncStatus (empty tuple)           -> [] / WorldStateSyncStatus
PASS  getTxReceipt (class.schema)                     -> [TxHash] / TxReceipt
PASS  getPendingTxs (optionals + array output)        -> [number|undefined, TxHash|undefined] / Tx[]
PASS  getBlockNumber (optional ref + branded return)  -> [ChainTip|undefined] / number
PASS  registerContractFunctionSignatures (nested arr) -> [string[]] / void
PASS  LEGACY Zod 3 .args().returns()                  -> [number, boolean|undefined] / void
7/7 passed
```

Red→green: pre-fix, the same parser returns `{ paramTypes: [],
returnType: "void" }` for every Zod 4 string.

**Not done in this PR (needs the built monorepo):** I did not run the
full generator end-to-end (`yarn generate:node-api-reference` requires
`yarn-project/node_modules`) or commit a regenerated
`node-api-reference.md`. A maintainer/CI should run the generator and
commit the refreshed reference as a follow-up.

## Out of scope (follow-ups)

The generator's static tables have also drifted from the current RPC
surface and will produce misplaced/ungrouped output even after this
parser fix — kept separate to keep this change focused:

- `METHOD_GROUPS` lists removed methods (`getPublicLogs`,
`getContractClassLogs`, `getPublicLogsByTagsFromContract`) and omits
current ones (`getPrivateLogsByTags`, `getPublicLogsByTags`,
`getCheckpointNumber`, `getCheckpointsData`, `getValidatorStats`, …).
- `simplifyZodType` still maps deleted schemas (`LogFilterSchema`,
`GetPublicLogsResponseSchema`, `GetContractClassLogsResponseSchema`) and
lacks `LogResultSchema` / `PrivateLogsQuerySchema` /
`PublicLogsQuerySchema` / `TxReceiptSchema`.

The separate TypeScript API reference generator
(`typescript_api_generation/`) is unrelated to this bug.

---
*Created by
[claudebox](https://claudebox.work/v2/sessions/46be71fd1d38fe81) ·
group: `slackbot`*
danielntmd pushed a commit to danielntmd/aztec-packages that referenced this pull request Jun 4, 2026
BEGIN_COMMIT_OVERRIDE
chore: deploy next-net and reuse contracts (AztecProtocol#23761)
chore: turn on autoscaling (AztecProtocol#23706)
chore: rename staging-public to staging (AztecProtocol#23767)
chore(p2p): use sync hash for tx validation hashing (AztecProtocol#23768)
test(e2e): wait warmup slots in slashing tests (AztecProtocol#23719)
feat(api)!: make getTxReceipt the single tx-lookup API (AztecProtocol#23660)
fix: cap cloned n_tps fees within sponsored FPC balance (AztecProtocol#23770)
fix: protect HA validator Postgres from cluster scale-down (AztecProtocol#23772)
refactor: remove non-pipelining sequencer code path (AztecProtocol#23665)
feat(archiver): add getL2ToL1MembershipWitness node RPC (AztecProtocol#23646)
fix(p2p)!: revamp BLOCK_TXS validations (AztecProtocol#23778)
chore: name the bots (AztecProtocol#23795)
fix(e2e): ensure BBSync init (AztecProtocol#23793)
fix(p2p)!: fix BLOCK_TXS response under proposer equivocation (AztecProtocol#23786)
fix: reconnect L1 port-forward after epoch-boundary sleep in n_tps_prove
(AztecProtocol#23800)
chore: add empty vscode settings for yarn-project (AztecProtocol#23808)
fix(sequencer): only warn about missing proposed checkpoint once overdue
(AztecProtocol#23807)
fix: refresh n_tps fee quotes during sustained benchmark (AztecProtocol#23797)
fix(sequencer): enforce build-frame deadlines and align
attestation/publish windows (AztecProtocol#23776)
END_COMMIT_OVERRIDE
spalladino added a commit that referenced this pull request Jun 4, 2026
## Motivation

`v5-next` was cut from `next` at cbc99df (Jun 1), so PRs merged to
`merge-train/spartan` after the cut never flowed into it. This backports
all of them (authored by @spalladino and @fcarreiro) to keep v5-next
current with the spartan train.

## Approach

Each PR is cherry-picked from its squashed merge commit on
`merge-train/spartan`, in merge order, preserving the original commit
message and PR number — one commit per backported PR. All 11 applied
cleanly with no conflicts; patches are identical to the originals
(verified via `git patch-id`), and `bootstrap.sh build yarn-project`
passes on the result. Labeled `ci-no-squash` to preserve the per-PR
commits.

## Backported PRs

- #23768 — chore(p2p): use sync hash for tx validation hashing
- #23719 — test(e2e): wait warmup slots in slashing tests
- #23660 — feat(api)!: make getTxReceipt the single tx-lookup API
- #23665 — refactor: remove non-pipelining sequencer code path
- #23646 — feat(archiver): add getL2ToL1MembershipWitness node RPC
- #23778 — fix(p2p)!: revamp BLOCK_TXS validations
- #23786 — fix(p2p)!: fix BLOCK_TXS response under proposer equivocation
- #23808 — chore: add empty vscode settings for yarn-project
- #23807 — fix(sequencer): only warn about missing proposed checkpoint
once overdue
- #23776 — fix(sequencer): enforce build-frame deadlines and align
attestation/publish windows
- #23818 — chore(p2p): BlockTxsRequest comment

Note #23660, #23778, and #23786 are breaking changes (node RPC +
tx-effect db format, and p2p wire format respectively), as they were on
`next`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants