zksecurity / noname

Noname: a programming language to write zkapps
https://zksecurity.github.io/noname/
161 stars 35 forks source link

Array as public output #130

Closed dmpierre closed 1 month ago

dmpierre commented 1 month ago

Hi! I would like to be able to output an array of public values when writing a noname circuit. An example would be:

fn main(pub public_input: [Field; 2], other_private_input: Field) -> [Field; 2] {
        let x = private_input * public_input[0];
        let y = private_input * public_input[1];
       return [x, y]
};

Is this something that could be done? I'm targeting the R1CS backend.

mimoo commented 1 month ago

My recommendation would be to add this as a minimal test and make it compile! (Which it won't at first because of https://github.com/zksecurity/noname/blob/56abd181ff1aa1dc255c5441765cd11669c3c4b9/src/circuit_writer/mod.rs#L167)