Skip to content

feat: merge-train/fairies-v5 - #25329

Queued
AztecBot wants to merge 4 commits into
v5-nextfrom
merge-train/fairies-v5
Queued

feat: merge-train/fairies-v5#25329
AztecBot wants to merge 4 commits into
v5-nextfrom
merge-train/fairies-v5

Conversation

@AztecBot

Copy link
Copy Markdown
Collaborator

See merge-train-readme.md.
This is a merge-train.

## Summary

The TXE bundle size guard (`enforceSizeLimits` in
`yarn-project/txe/esbuild/plugins/size_guard.mjs`) summed **every**
esbuild `metafile.outputs` entry — including the external `.map`
sourcemaps — against `totalLimitMiB`. Since `esbuild.config.mjs` sets
`sourcemap: 'external'` specifically so the runtime bundles stay small,
counting `.map` files meant the guard mostly measured sourcemap size,
not the runtime bundle.

Measured on the current bundle:

| | Size |
| -- | -- |
| Runtime JS (`.js`) | 4.74 MiB |
| Sourcemaps (`.map`) | 9.32 MiB |
| Old counted total | 14.06 MiB |

So ~66% of the guarded number was sourcemaps. This is what tipped the
guard over its limit on a sub-KB per-contract bytecode change.

## Changes

- `enforceSizeLimits` now tracks two totals: runtime JS (`.js` outputs)
and sourcemaps (`.map` outputs). The JS total is checked against
`totalLimitMiB`; the sourcemap total against a new, deliberately loose
`sourcemapLimitMiB`.
- Reset `totalLimitMiB` `15 → 6` MiB (~1.3 MiB / ~27% headroom over the
~4.74 MiB of JS today). Reverts the 14.5 stopgap.
- Added `sourcemapLimitMiB = 12` MiB (~2.7 MiB headroom over ~9.3 MiB
today) so map growth is still watched, per the issue's optional
suggestion.
- Bump log gets a 2026-07-20 entry documenting the semantic switch to
JS-only; header docstring rewritten to explain the two-total scheme.
- The build's info line now prints `X MiB JS + Y MiB sourcemaps` instead
of one combined figure.

## Verification

Guard logic exercised against metafiles mirroring real sizes:

- Current bundle → pass
- +4 KB per-contract change (the scenario that tripped the guard) → pass
- Sourcemaps grown past 12 MiB → trips *sourcemap total* only
- Real JS grown past 6 MiB → trips *runtime JS total*
- Sourcemaps never counted toward the JS total

A real end-to-end `node ./esbuild.config.mjs` run also passed without
tripping the guard.

Closes F-812.
## Summary

`BatchCall.simulate()` silently discarded `options.fee.paymentMethod`
and dropped the merged payload's `feePayer`, so batches simulated with a
sponsored/deferred fee method ran with the wallet's fallback handling
(`PREEXISTING_FEE_JUICE`) instead of the caller's method. The wallet's
account entrypoint then self-elected as fee payer and ended setup up
front — a different phase structure than the caller asked for.

Resolves F-785. Surfaced while landing #24479.

## Changes

- `batch_call.ts`: fetch
`options.fee.paymentMethod.getExecutionPayload()`, merge it ahead of the
batch (mirroring `request()`), and preserve `combinedPayload.feePayer`
when rebuilding the `ExecutionPayload`.
- The wallet-side app-call offset only counts the wallet's own fee
payment method, not one supplied via `options.fee`. So each batched
call's private/public return-value index is offset by the fee payload's
own call counts of each type; otherwise a call-contributing method (e.g.
`SponsoredFeePaymentMethod`) shifts the indices and the fee call's
return values decode as the first app call's.
- `contract_function_interaction.ts`: fixed the same latent off-by-one
under a call-contributing fee method. The single app call is the last of
its type in the payload, so its index is derived from the merged payload
(avoiding a second `getExecutionPayload()` call).
- `phase_check.parallel.test.ts`: reverted the #24479 workaround back to
the plain `batch.simulate({ from, fee })` form now that the option is
honored.

## Testing

- Added 3 `batch_call` unit tests: return-value index offset (asserting
on actual decoded values, not just absence of errors), `feePayer` from
the payment method, and `feePayer` carried by a batched payload.
Verified red/green — the offset test fails without the fix.
- All 3 `phase_check` e2e tests pass, including the reverted
late-election test.
- No behavior change for batches simulated without `fee.paymentMethod`
(offsets are 0).

@ludamad ludamad left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 Auto-approved

nventuro and others added 2 commits August 28, 2026 10:20
@nventuro
nventuro added this pull request to the merge queue Sep 1, 2026
Any commits made after this event will not be merged.
@AztecBot

AztecBot commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

🤖 Auto-merge enabled after 4 hours of inactivity. This PR will be merged automatically once all checks pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants