Skip to content

Prevent install-bundle from failing the RPC size limit #12193

@LuqiPan

Description

@LuqiPan

What

@agoric/bundle-source currently does its best to preserve source module structure and legibility, at the cost of larger contract bundles that RPC nodes may reject. It's a fingers-in-the-dam problem as more contracts use the growing Orchestration API.

Why

The failure is caused by strict RPC node max_body_bytes (in the [rpc] section of config.toml). CometBFT developers recommended capping this parameter at 1MB to defend against denial-of-service attacks. We know that #11821 bundle chunking will work around the RPC node limits, and instead use governable x/swingset parameters, but that feature may not be available on-chain in time.

How

In the interim (before bundle chunking is installed on-chain), we can employ minimisation techniques to help raise the contract size ceiling. Ideally, the only loss of legibility would be for contracts whose standard @endo/bundle-source artifacts cross a size threshold when built without minimisation.

As inspired by the @agoric/fast-usdc-deploy and @agoric/portfolio-deploy bundle steps, we will employ logic to retry bundleSource with esbuild --bundle --minimize-whitespace ... when the (approximate) bundle size limit is exceeded. That feature will be implemented as a Yarn patch to @endo/bundle-source in the relevant agoric-sdk workspace roots.

This way, the many import ... from '@endo/bundle-source'; sites do not need to be changed, and having a separate patch can make it clear that this is a temporary workaround until we get bundle chunking.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions