stellar / slingshot

A new blockchain architecture under active development, with a strong focus on scalability, privacy and safety
Apache License 2.0
415 stars 61 forks source link

zkvm: rename variable and constant operations #482

Closed oleganza closed 4 years ago

oleganza commented 4 years ago

Problem

Current operation names const, var and alloc do not quite reflect what they are doing.

Proposal

One way to make these better, although I'm still looking for a better naming:

const -> scalar because it creates an expression with a clear-text scalar.

var -> const because it creates a r1cs "variable" out of a Pedersen commitment, which makes it a constant value in a sense.

alloc -> var because it create a true "variable" since the user can choose its value freely w/o being tied to any pre-existing commitments.

Why these are not good enough?

scalar name is close to perfect because it's what it literally does. But in the ZkVM spec it clashes with the section on the Scalar type, so we should probably rename it to "Scalar type" from simply "Scalar".

var/const is not quite the correct distinction since in the r1cs most "low level variables", although secret, often assigned very specific values to satisfy constrains and do not dynamically change as the execution or verification happens, like regular variables/registers in an actual computer.

oleganza commented 4 years ago

Another idea: