Skip to content

Use ruzstd to decompress bytecodes in Wasm #2421

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

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

jvff
Copy link
Contributor

@jvff jvff commented Aug 29, 2024

Motivation

Bytecode compression was recently introduced (#2382). However, this means that the bytecode must be decompressed after it has been loaded from storage. Currently, decompression uses the zstd crate, which uses the Zstandard library installed on the system. Unfortunately, that library is not available in Wasm.

Proposal

Use ruzstd to decompress the bytecode in Wasm. Compression is not supported by ruzstd, so bytecodes can't be published, but at least they can be decompressed so that they can executed.

Test Plan

I commented out parts of the code to make it always decompress using ruzstd, and ran the end-to-end tests manually to confirm they pass (because they publish and use bytecodes).

Release Plan

Nothing is needed, because this only affects Wasm targets, for which we haven't released anything yet.

Links

Closes #2413

@jvff jvff added the enhancement New feature or request label Aug 29, 2024
@jvff jvff added this to the Testnet #2 milestone Aug 29, 2024
@jvff jvff requested review from Twey, ma2bd and ndr-ds August 29, 2024 01:24
@jvff jvff self-assigned this Aug 29, 2024
Copy link
Contributor

@ma2bd ma2bd left a comment

Choose a reason for hiding this comment

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

Should we create a task to add a permanent test later? (using fixtures?)

@jvff
Copy link
Contributor Author

jvff commented Aug 29, 2024

Should we create a task to add a permanent test later? (using fixtures?)

I thought that we could run the end-to-end tests (or at least some of them) using the web extension. That should cover the case of decompressing the bytecodes to run them 🤔

jvff added 2 commits August 29, 2024 17:10
It was incorrectly named `CompressionError`.
Allow decompressing bytecodes when running in `wasm32-unknown-unknown`.
@jvff jvff force-pushed the enable-bytecode-decompression-for-web branch from c44f9e6 to 672c0bf Compare August 29, 2024 17:10
@jvff jvff merged commit fdeae1b into linera-io:main Aug 29, 2024
5 checks passed
@jvff jvff deleted the enable-bytecode-decompression-for-web branch August 29, 2024 18:11
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
Status: Done
Development

Successfully merging this pull request may close these issues.

Use ruzstd instead of zstd for bytecode decompression
3 participants