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

Pack resolc.js and resolc.wasm into single file #173

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

smiasojed
Copy link
Collaborator

Pack resolc.js and resolc.wasm into single file
Format JS files
Fix issue with Module overwriting in preloaded js.

@athei
Copy link
Member

athei commented Jan 23, 2025

This way of packing it works better in Firefox than the way we tried before?

@smiasojed
Copy link
Collaborator Author

smiasojed commented Jan 23, 2025

This way of packing it works better in Firefox than the way we tried before?

No is does not, I am doing still experiments
The most important point is that I have exposed the wasm data outside the code generated by emscripten, so for example I can experiment with wasm data compression.
For example the Wasm data bundled in soljson is compressed with lz4
To main issue is for me that we need to instantiate wasm two times as we need call revive twice in one compilation run.

Added lz4 compression, but there is still issue with compilation large contracts in firefox

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@@ -0,0 +1,118 @@
function uncompress(source, uncompressedSize) {
/*
Source https://github.com/ethereum/solidity/blob/develop/scripts/ci/mini-lz4.js
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@xermicus This file is taken from Solidity. Is the licensing compliant for use?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think so as ethereum/solidity appears to be GPL licensed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, so I will rewrite this small part, and we will simply base it on the original mini-lz4. Does that work for you?

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, however I have a bunch of higher level questions related to this:

  1. Why is this needed?
  2. Why do they use a custom compression implementation (or is it also a custom algorithm)?
  3. Why not just use a library?

Copy link
Collaborator Author

@smiasojed smiasojed Jan 27, 2025

Choose a reason for hiding this comment

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

  1. It is used for resolc.wasm compression to limit its size
  2. it standard lz4 compression, but needs to be embedded it in the resolc.js to decompress wasm on the fly
  3. What do you mean? Do you want to embed npm lz4 package to resolc.js?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alternative solution: #176

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.

3 participants