Commit 816852d
authored
fix(bench): handle void worker-wallet returns in inclusion sweep (#24843)
## Problem
Every point of the [Nightly Bench Inclusion
Sweep](https://github.com/AztecProtocol/aztec-packages/actions/runs/29801774127)
(1/5/10 TPS) failed identically, ~5ms into the `n_tps.test.ts` body,
during `registerSponsoredFPC` setup:
```
SyntaxError: "undefined" is not valid JSON
at JSON.parse (<anonymous>)
at WorkerWallet.call (test-wallet/worker_wallet.ts:127)
at registerSponsoredFPC (fixtures/setup.ts:821)
```
`WorkerWallet.call` unconditionally `JSON.parse`d the worker's transport
response. But void-returning methods — `registerContract`,
`registerContractClass` (both `output: z.void()` in `WalletSchema`) —
return nothing, and `jsonStringify(undefined)` yields `undefined`, which
arrives at the client as the JS value `undefined` over the
structured-clone transport. `JSON.parse(undefined)` coerces to
`JSON.parse("undefined")` and throws.
The crash is in test setup, before any transactions are sent, so it is
deterministic and independent of TPS — hence all three points failed the
same way. The deployed network and the `6.0.0-nightly.20260721` image
are not implicated.
## Fix
Pass an `undefined` response straight to the method's schema (its
`z.void()` output accepts `undefined`) instead of `JSON.parse`-ing it,
and widen `callRaw`'s return type to `string | undefined`.
## Test
Adds `worker_wallet.test.ts`, which builds a `WorkerWallet` over a stub
transport that returns `undefined` and asserts `registerContract` /
`registerContractClass` resolve. Verified red/green: against the old
code it fails with the exact CI error (`"undefined" is not valid JSON`);
with the fix it passes.2 files changed
Lines changed: 27 additions & 3 deletions
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
128 | 130 | | |
129 | 131 | | |
130 | 132 | | |
| |||
0 commit comments