vacp2p / rln-contract

RLN contract
Apache License 2.0
13 stars 6 forks source link

Update Poseidon round constants when switching to zerokit RLN #4

Closed s1fr0 closed 1 year ago

s1fr0 commented 2 years ago

Problem

Kilic's poseidon hash implementation by default generates dummy constant if none are passed. Such dummy constants are generated from blake2s with an hardcoded seed. This means that if no constants from, e.g. the reference implementation) are passed, hashes:

nwaku RLN-RELAY at the moment loads these dummy constants when compiled with Kilic's module and the smart-contract implemented in this repository uses such dummy constants.

When nwaku is compiled with zerokit RLN, instead, RLN-RELAY will use a Poseidon hash implementation that loads round constant aligned with circomlib Poseidon implementation, in turn used to build the the underlying RLN zk circuit in circom. It follows that when nwaku will switch to zerokit RLN as default, the implemented round constants implemented here need to be updated with respect to round constants implemented in circomlib.

Note that Poseidon parameters for constants hardcoded in circom are t=2, RF=8, RP=56 (in contrast to what is reported in 32/RLN), while Kilic's module uses t=3, RF=8, RP=57: it follows that also the hash logic needs to be updated in the smart-contract.

Acceptance criteria