matter-labs / bellman

Bellman zkSNARK library for community with Ethereum's BN256 support
https://matter-labs.io
Other
159 stars 79 forks source link

Make logging a compile option in order to support ewasm compatibility #15

Closed AlexandreBelling closed 4 years ago

AlexandreBelling commented 4 years ago

Hey Matter-Labs team,

We are currently using bellman on an execution environment, and running it with scout. It runs great, the only thing we needed to change is to remove the logging capability. This PR adds the feature nolog which deactivate the logging capability.

In order to use bellman in an Eth2.0 EE, one would need to import it with:

features = ["wasm", "nolog"], default-features = false

I did it with a minimal amount of changes. For instance, I choosed to prefix all the stopwatch variable with an underscore (which, I agree, is not the cleaniest the way to deal with unused variable) instead of compiling out every occurence of stopwatch when nolog is enabled because that would be less maintainable.

Also, I made sure that this compile with:

Please let me know, if you think anything should be changed

shamatar commented 4 years ago

@AlexandreBelling does num_cpu crate work in Eth2.0 EE by the way? I'd need to resolve this with a previous PR

AlexandreBelling commented 4 years ago

So the check with num_cpus, yield posive results. As expected, num_cpus::get() returns 1 in the Eth2.0 EE context.

I did the check with the latest version, ie : 1.11.1

AlexandreBelling commented 4 years ago

Just updated the PR to include the latest changes of futures

shamatar commented 4 years ago

@AlexandreBelling can you check for a new futures PR in WASM plus if you still need an adhoc multiexponentiation fix for MNT4/6 with 753 bits field?

AlexandreBelling commented 4 years ago

@shamatar

Just made the update. The migration to future completely solved the problem with MNT4/6-753 and the eWasm compatibility is still functional