mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 06:14:08 -05:00
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.
27 lines
567 B
Plaintext
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);
|
|
}
|
|
|