feat: patch @endo/bundle-source to use esbuild for oversized bundles
#12227
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes: #12193
Description
Patches
@endo/bundle-sourceto automatically retry with esbuild minimization when bundles exceed 500KB, preventing RPC nodemax_body_bytesrejections until bundle chunking is available.Patch implementation (
.yarn/patches/@endo-bundle-source-npm-4.1.2-*.patch):byteLimitoption (default 500KB) andesbuildPathoptionesbuild --bundle --minify-whitespaceand re-bundles the outputpackage.jsonif needed for esbuild's module resolutionPrevent esbuild from bundling imports (~20 files):
const mod = '@pkg/name'; await import(mod)prevents esbuild from inliningKernel bundle exemption:
byteLimit: Infinityin SwingSet bundling paths (kernel bundles don't transit RPC)Test fidelity:
fakeVatAdmin.registerBundle()now generates bundleIDs containing the bundle hashendoZipBase64bundlesSecurity Considerations
Introduces esbuild as a dependency for minimization. Only activated when standard Endo bundles exceed 500KB.
Scaling Considerations
Raises effective contract size ceiling without requiring on-chain changes. Bundles under 500KB unchanged; larger bundles trade legibility for deployability.
Documentation Considerations
Transparent to consumers—no API changes required. The intermediate-variable pattern for dynamic imports is self-explanatory.
Testing Considerations
Existing tests pass. Enhanced bundleID generation improves test realism without affecting behavior.
Upgrade Considerations
Temporary workaround removable once bundle chunking ships. No migration needed—
byteLimitis optional and backward-compatible.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.