Commit 7661977
authored
fix(bench): handle void worker-wallet returns in inclusion sweep [backport to merge-train/spartan-v5] (#24961)
## Backport
Backports the WorkerWallet fix from `next`
([#24843](#24843),
commit `fc2d7444fc2`) onto `merge-train/spartan-v5`. Cherry-pick applied
cleanly; the void-return fix hunks are byte-identical to the original,
and the branch's own `registerAccount(signingKey)` signature was
preserved untouched.
## Problem
`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 arrive at the client as the JS value `undefined`.
`JSON.parse(undefined)` coerces to `JSON.parse("undefined")` and throws
`SyntaxError: "undefined" is not valid JSON`.
This crashed `registerSponsoredFPC` during `n_tps.test.ts` setup and
failed every nightly bench inclusion-sweep point (1/5/10 TPS)
deterministically, ~5ms into the test body.
## 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`. Adds a
`worker_wallet.test.ts` unit test covering the void-return path.
Refs
[#24843](#24843).
---
*Created by
[claudebox](https://claudebox.work/v2/sessions/29aeafd6e697c027/jobs/1)
· group: `slackbot` · requested by Phil Windle · [Slack
thread](https://aztecprotocol.slack.com/archives/C0AU8BULZHC/p1784891623684979?thread_ts=1784891623.684979&cid=C0AU8BULZHC)*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