celo-org / celo-bls-snark-rs

Implements SNARK-friendly BLS signatures
https://celo.org
Apache License 2.0
84 stars 21 forks source link

use integer based ceil() method, instead of float arithmetic #209

Open mkaczanowski opened 3 years ago

mkaczanowski commented 3 years ago

Description

I am working on Celo Light Client (rust) that utilizes this library to validate the BLS signature. The LC compiles to WASM format and then it's executed on the Cosmos Chain.

The issue I have is that WASM/CosmWASM doesn't work with floating-point arithmetic, therefore I had to change hash_length function to float-free implementation.

The ceil can be achieved via ~trick: ceilVal = (a+b-1) / b

Tested

All tests are passing after the PR is applied (run via cargo test)

Other changes

none

Related issues

none