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

test(fast-usdc): bundle size under 1MB RPC limit #10902

Closed
wants to merge 1 commit into from

Conversation

dckc
Copy link
Member

@dckc dckc commented Jan 27, 2025

refs: #10895

Description / Testing / Scaling Considerations

To avoid "request body too large" (a la #6454), we test that the bundle size (doubled for hex encoding) is < 1MB. Note the use of elideComments and gzip.

Security / Documentation / Upgrade Considerations

n/a

@dckc dckc requested a review from turadg January 27, 2025 21:52
@dckc dckc requested a review from a team as a code owner January 27, 2025 21:52
Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

Without merging, this PR serves to show the bundle is small enough. In order to merge please create a test macro we can use repeatedly which has documentation on why this is the limit.

originallySize: `${(JSON.stringify(bundle).length / MB).toFixed(3)} MB`,
});
// JSON RPC hex encoding doubles the size
t.assert(sizeInMb * 2 < 1, 'Compressed bundle is less than 0.5MB');
Copy link
Member

Choose a reason for hiding this comment

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

let's take this opportunity to create a more general solution that can be used in other packages, even off repo.

e.g. an Ava macro,

import test from 'ava';
import { bundleSizeLimit } from '@agoric/boot';

const bundleName = 'fast-usdc';
const entryModule = nodeRequire.resolve('../src/fast-usdc.contract.js');

test(bundleSizeLimit, entryModule);

Copy link
Member

Choose a reason for hiding this comment

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

Since the test call is so small at that point it could go in the existing test/fast-usdc.contract.test.ts.

@dckc
Copy link
Member Author

dckc commented Jan 30, 2025

maybe later.

@dckc dckc closed this Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants