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

Remove parity-wasm dependency from contract-build crate #1594

Merged
merged 16 commits into from
Apr 18, 2024
Merged

Conversation

smiasojed
Copy link
Collaborator

@smiasojed smiasojed commented Apr 12, 2024

Summary

Closes #1141

  • y/n | Does it introduce breaking changes?
  • y/n | Is it dependent on the specific version of ink or pallet-contracts?

Replace parity-wasm usage for post processing with wasmparser and wasm-encoder

Description

Remove parity-wasm from contract-build crate
Implement the WASM post-processing logic with wasmparser and wasm-encoder crates

Checklist before requesting a review

  • My code follows the style guidelines of this project
  • I have added an entry to CHANGELOG.md
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@smiasojed smiasojed marked this pull request as ready for review April 16, 2024 10:33
@smiasojed smiasojed changed the title Remove parity-wasm deps Remove parity-wasm dependency from contract-build crate Apr 16, 2024
Copy link
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

Have you tested this against some standard contracts to check that the sizes are the same (or better!)? Would be good to run the contract size check against the integration-tests.

Also I'd like to see this wasm post-processing refactored to a separate module, this lib.rs file is big enough already!

Comment on lines 786 to 787
let mut output = Vec::new();
post_process_module(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe post_process_module could return an allocated Vec<u8> since it looks like every usage just passes a new buffer instance.

@smiasojed
Copy link
Collaborator Author

Have you tested this against some standard contracts to check that the sizes are the same (or better!)?
I tested it on some ink-examples, and the output was the same for both the old and new implementations.

@smiasojed smiasojed merged commit 7358fe0 into master Apr 18, 2024
18 checks passed
@smiasojed smiasojed deleted the sm/wasm branch April 18, 2024 12:44
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.

Replace parity-wasm usage for post processing
2 participants