GuildOfWeavers / genSTARK

A library for generating zk-STARKs.
MIT License
143 stars 18 forks source link

Use expressions to define transition function and constraints #4

Closed bobbinth closed 5 years ago

bobbinth commented 5 years ago

Currently, to create a STARK transition functions and constraints we need to use JavaScript functions. A better way would be to parse math expressions into these functions automatically.

For example, a MiMC constraint could be defined as:

N0 - (R0^3 + K0)

Instead of current:

function mimcConstraint(this: EvaluationFrame): bigint {
    const r0 = this.getValue(0);
    const k0 = this.getConst(0);
    const n0 = this.getNextValue(0);
    return this.sub(n0, this.add(this.exp(r0, 3n), k0));
}

This would also allow expressing STARK config as a plain JSON file.

bobbinth commented 5 years ago

Closed by #8