celo-org / celo-bls-snark-rs

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

Add unpredictable chain of values to epoch message #194

Closed mstraka100 closed 3 years ago

mstraka100 commented 3 years ago

Description

Identical to https://github.com/celo-org/celo-bls-snark-rs/pull/183 merged with master and with relevant circuit code added. This PR makes epoch entropy values, derived from the epoch block header hash, available to the constraint system. It adds constraints to check that the entropy values form a chain. Entropy values are optional to support different versions of Celo. These constraints are designed to be trivially satisfied if the first epoch does not contain entropy. The entropy of the first and last epochs are hashed as part of the public input.

Tested

The multiple epochs tests were refactored, with additional cases added covering the uses of entropy in epoch blocks.

Related issues

https://github.com/celo-org/celo-bls-snark-rs/issues/185