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

Fix compilation on WASM #794

Merged
merged 2 commits into from
Feb 27, 2024
Merged

Conversation

hrxi
Copy link
Contributor

@hrxi hrxi commented Feb 27, 2024

Disable loop unrolling for Fp::into_bigint that led to WASM miscompilations with too many local variables:

Error: failed to deserialize wasm module

Caused by:
    0: failed to parse code section
    1: locals exceed maximum (at offset 16977)

Issue diagnosed by @paberr and @ii-cruz.

Fixes #615.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests -- not applicable, this is about compilation failure
  • Updated relevant documentation in the code -- not applicable
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the GitHub PR explorer

@hrxi hrxi requested review from a team as code owners February 27, 2024 14:27
@hrxi hrxi requested review from z-tech, mmagician and weikengchen and removed request for a team February 27, 2024 14:27
CHANGELOG.md Outdated Show resolved Hide resolved
Disable loop unrolling for `Fp::into_bigint` that led to WASM
miscompilations with too many local variables:

```
Error: failed to deserialize wasm module

Caused by:
    0: failed to parse code section
    1: locals exceed maximum (at offset 16977)
```

Issue diagnosed by @paberr and @ii-cruz.

Fixes arkworks-rs#615.
@hrxi hrxi force-pushed the pr_fix_wasm_compilation branch from 9b0d78e to 3e0ce6d Compare February 27, 2024 16:24
@hrxi
Copy link
Contributor Author

hrxi commented Feb 27, 2024

Squashed everything.

@Pratyush Pratyush enabled auto-merge February 27, 2024 16:25
@hrxi
Copy link
Contributor Author

hrxi commented Feb 27, 2024

Automerge won't work: CI fails on nightly unrelated to this PR:

    Checking ark-serialize v0.4.2 (/home/runner/work/algebra/algebra/serialize)
error: the item `String` is imported redundantly
 --> serialize/src/impls.rs:7:5
  |
7 |     string::String,
  |     ^^^^^^^^^^^^^^
 --> /rustc/fc3800f65777a365b5125706d60f97e4d0675efe/library/std/src/prelude/mod.rs:125:13
  |
  = note: the item `String` is already defined here
  |
  = note: `-D unused-imports` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unused_imports)]`

error: the item `Vec` is imported redundantly
 --> serialize/src/impls.rs:8:5
  |
8 |     vec::Vec,
  |     ^^^^^^^^
 --> /rustc/fc3800f65777a365b5125706d60f97e4d0675efe/library/std/src/prelude/mod.rs:125:13
  |
  = note: the item `Vec` is already defined here

error: the item `ToOwned` is imported redundantly
  --> serialize/src/impls.rs:13:77
   |
13 |     CanonicalDeserialize, CanonicalSerialize, Compress, SerializationError, ToOwned, Valid,
   |                                                                             ^^^^^^^
  --> /rustc/fc3800f65777a365b5125706d60f97e4d0675efe/library/std/src/prelude/mod.rs:125:13
   |
   = note: the item `ToOwned` is already defined here

    Checking zeroize v1.7.0
   Compiling serde_derive v1.0.197
   Compiling ark-ff-macros v0.4.2 (/home/runner/work/algebra/algebra/ff-macros)
error: could not compile `ark-serialize` (lib) due to 3 previous errors

@Pratyush Pratyush added this pull request to the merge queue Feb 27, 2024
Merged via the queue into arkworks-rs:master with commit 33d0868 Feb 27, 2024
37 checks passed
This was referenced May 22, 2024
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.

WASM compilation error due to loop unrolling
2 participants