Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orchestration contract dependencies make them too large for Mainnet #9900

Closed
turadg opened this issue Aug 15, 2024 · 4 comments
Closed

Orchestration contract dependencies make them too large for Mainnet #9900

turadg opened this issue Aug 15, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@turadg
Copy link
Member

turadg commented Aug 15, 2024

What is the Problem Being Solved?

Bundles of contracts using Orchestration tend to be over 500KB, the limit for deploying to Mainnet. E.g. https://github.com/Agoric/dapp-orchestration-basics/pull/17/files#diff-1033217b1ee0740bea6f7c4bf49634318af4e0b4420a6048f55a686f3d5cfee5R56

@agoric/cosmic-proto is meant to be used in vats, UIs and contracts. Contracts have strict size limits to fit onto Mainnet and some of the codegen files in @agoric/cosmic-proto are huge.

When importing a module, the caller should only need to import (and bundle) what will be used. But right now importing the package main or helpers module will pull in abci/types.js which is over 100KB.

Description of the Design

Reduce overall weight of deps

Dupes should be prevented. Egregious export graphs should be trimmed but we shouldn't go down a rabbit hole optimizing these.

#8621 is also a factor but easily mitigated by deduping node_modules (with Yarn resolutions)

Stop export of cosmos-interchain-service from package main

Stop import of abci/types.js in helpers (by moving toRequestQueryJson into another module)

https://github.com/Agoric/dapp-orchestration-basics/tree/ta/mainnet-size has some experiments

Strip comments during bundling

Next thing to try:

Externalize deps (Import from env)

Next biggest lift:

Import between bundles

Maybe never…

Security Considerations

Scaling Considerations

Test Plan

Upgrade Considerations

@turadg turadg added the enhancement New feature or request label Aug 15, 2024
@turadg turadg self-assigned this Aug 15, 2024
@turadg turadg changed the title cosmic-proto vat-safe modules entrain too much Orchestration contract dependencies make them too large for Mainnet Aug 15, 2024
@erights
Copy link
Member

erights commented Aug 16, 2024

See also endojs/endo#2411

@kriskowal
Copy link
Member

There might be a small win in reducing compartment-mapper.json a bit more endojs/endo#2313

@kriskowal
Copy link
Member

bundle-source --elide-comments is merged endojs/endo#2420

mergify bot added a commit that referenced this issue Aug 31, 2024
refs: #9900

## Description
This uses the new `--elide-comments` option in Endo bundle-source to… elide comments. Always.

Measured with:
```
cd a3p-integration
rm -f **/b1-*.json*
yarn build:submissions
du -csh **/b1-*.json
gzip **/b1-*.json
du -csh **/b1-*.json.gz
```

Before: 26M (6.7M gz)
After: 19M (4.1M gz)


### Security Considerations
No change in runtime. Does affect code auditability. Existing bundles are base64 encoded so readers will have to find the sources anyway. Either way we will need to invest in special tooling: endojs/endo#1656

### Scaling Considerations
reduces on-chain storage

### Documentation Considerations
End users who base64 decode the on-chain bundles will no longer see comments… I don't expect anyone was doing this.

### Testing Considerations
existing coverage

### Upgrade Considerations
won't affect any existing deployments
@turadg
Copy link
Member Author

turadg commented Sep 3, 2024

multichain-testing now has the same limit as in Mainnet and it installs contracts like sendAnywhere that use withOrchestration so we have CI coverage now of orchestration contracts fitting on Mainnet.

If we hit hit up against it again we can re-open this issue and work down the list of optimizations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants