Files
darkfi/example/array.zk
y 0e9a9d5bc5 [WIP] Modify parser to support array syntax
Add support for square brackets to the parser to prepare to support
arrays.
Add a test .zk file with intended syntax for arrays. This can be used as
input to the zkas binary to check for errors while developing this
feature.
2023-10-04 10:20:23 -04:00

27 lines
567 B
Plaintext

k = 13;
field = "pallas";
constant "Array" {}
witness "Array" {
Scalar foo,
Scalar bar,
Base baz,
Base fizz,
}
# This circuit is intended to be used in testing the zkas compilation pipeline.
# When arrays are fully implemented, this code should produce no errors
circuit "Array" {
array_scalar = [foo, bar];
hash1 = poseidon_hash(foo, bar);
hash2 = poseidon_hash(array_scalar);
constrain_equal_scalar(hash1, hash2);
array_base = [baz, fizz];
hash3 = poseidon_hash(baz, fizz);
hash4 = poseidon_hash(array_base);
constrain_equal_base(hash3, hash4);
}