Zokrates / ZoKrates

A toolbox for zkSNARKs on Ethereum
https://zokrates.github.io
GNU Lesser General Public License v3.0
1.81k stars 361 forks source link

MiMC can't be instantiated with bls12_377 #1308

Open mkobelt opened 1 year ago

mkobelt commented 1 year ago

Description

Compiling a program using MiMC and bls12_377 as the curve choice fails with

$ZOKRATES_STDLIB/hashes/mimc7/mimc7.zok:1:1
    Expression `20888961410941983456478427210666206549300505294776164667214940546594746570981` of type `{integer}` cannot be assigned to constant `C` of type `field[91]`

because the integer can't be represented in the curve's scalar field.

Environment

Steps to Reproduce

from "hashes/mimc7/mimc7" import main as mimc;

def main(private field preImage) -> field {
    return mimc::<10>(preImage, 0);
}