#I noticed that SelfProof now takes 2 type arguments. What should be the type of public output?

1 messages · Page 1 of 1 (latest)

obtuse ivy
#

Is it safe to just use the type of public input for the type of public output? What's the difference?

smoky lintel
#

Afaiu this is now a feature coming with the new input-output syntax. So basically you can now create part of your public input by returning data from the zkprogram method. I find i really useful when creating this from-to state-transition pattern

#

But you can just leave it undefined, then it will behave pretty much like before

obtuse ivy
#

Can you share an example of how it's useful? I'm not sure how to think about it coming from publicInput1 -> transition -> publicInput2. Now it's publicInput -> transition -> publicOutput? But that output can have a different type than the input?

north hill
#

It now feels more like a real program, that also returns your result! Previously, you had to do some mind bending tricks when you wanted to prove state transitions, now you just call a function that returns your result, with the benefit of a tiny proof attached to it

obtuse ivy
patent canopy
#

the new return feature is an optional addition. to stay in the old world:

  • leave publicOutput undefined in the ZkProgram declaration. That is, change nothing
  • use Proof<PublicInput, undefined> as your type
#

You wouldn't use the same type for input and output, but rather you'd leave one of them undefined