Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zkas improvements #226

Open
parazyd opened this issue Sep 23, 2023 · 1 comment
Open

zkas improvements #226

parazyd opened this issue Sep 23, 2023 · 1 comment
Assignees

Comments

@parazyd
Copy link
Member

parazyd commented Sep 23, 2023

Improvements that should be made to the language.

Witnessing arrays

The witness section should be able to take BaseArray:

witness "MyProof" {
    BaseArray some_array,
}

Arrays in the circuit, part 1

In the circuit section, we should be able to construct BaseArray and ScalarArray with the syntax:

foo = [bar, baz];

foo should automatically be typed based on bar and baz (resulting in either BaseArray or ScalarArray)

Arrays in the circuit, part 2

When we have a BaseArray, we should be able to use it in a way that the array explodes.

Example 1

# This should result in constraining both `bar` and `baz` as public inputs
foo = [bar, baz];
constrain_instance(foo);

Example 2

# These two poseidon_hash calls should be equivalent
one = witness_base(1);
foo = [bar, baz];
hash1 = poseidon_hash(one, foo);
hash2 = poseidon_hash(one, bar, baz);
constrain_equal_base(hash1, hash2);
@ggreptile
Copy link
Contributor

ggreptile commented Oct 2, 2023

subtasks

array verification

Another property to keep in mind: there should be error-handling if the .zk file tries to initialize an array that contains both a Scalar and a Base. (i.e. an array's elements must all have the same type).

This might already be handled somewhere in the zkas code but I'm writing it here so we can remember to verify this.

opcode "overloading"

Does example 2 entail that we support many different ways to call opcodes like poseidon_hash? For example, it looks like poseidon_hash can take any number of Bases, Scalars, BaseArrays, and ScalarArrays in any order.
Let's discuss in irc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants