all tests pass

This commit is contained in:
collin 2020-09-02 11:25:49 -07:00
parent e7091b18ed
commit 8cf5eb8790
5 changed files with 29 additions and 29 deletions

View File

@ -1,11 +1,11 @@
circuit PedersenHash {
parameters: u32[512]
parameters: [u32; 512]
static function new(parameters: u32[512]) -> Self {
static function new(parameters: [u32; 512]) -> Self {
return Self { parameters: parameters }
}
function hash(bits: bool[512]) -> u32 {
function hash(bits: [bool; 512]) -> u32 {
let mut digest: u32 = 0;
for i in 0..512 {
let base = if bits[i] ? self.parameters[i] : 0u32;
@ -19,7 +19,7 @@ circuit PedersenHash {
function main() {
let parameters = [0u32; 512];
let pedersen = PedersenHash::new(parameters);
let input: bool[512] = [true; 512];
let input: [bool; 512] = [true; 512];
let res = pedersen.hash(input);

View File

@ -1,4 +1,4 @@
function main(input, data: u8[32]) {
function main(input, data: [u8; 32]) {
console.assert(input.registers.value_balance == 0u64);
console.assert(input.state.leaf_index == 0u32);

View File

@ -1,6 +1,6 @@
[main]
data: u8[32] = [0u8; 32];
data: [u8; 32] = [0u8; 32];
[registers]
token_id: u8[32] = [0u8; 32];
token_id: [u8; 32] = [0u8; 32];
value_balance: u64 = 0;

View File

@ -2,23 +2,23 @@
[state]
leaf_index: u32 = 0;
root: u8[32] = [0u8; 32];
root: [u8; 32] = [0u8; 32];
[[private]]
[record]
serial_number: u8[32] = [0u8; 32];
commitment: u8[32] = [0u8; 32];
serial_number: [u8; 32] = [0u8; 32];
commitment: [u8; 32] = [0u8; 32];
owner: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
value: u64 = 5;
payload: u8[32] = [0u8; 32];
birth_program_id: u8[32] = [0u8; 32];
death_program_id: u8[32] = [0u8; 32];
serial_number_nonce: u8[32] = [0u8; 32];
commitment_randomness: u8[32] = [0u8; 32];
payload: [u8; 32] = [0u8; 32];
birth_program_id: [u8; 32] = [0u8; 32];
death_program_id: [u8; 32] = [0u8; 32];
serial_number_nonce: [u8; 32] = [0u8; 32];
commitment_randomness: [u8; 32] = [0u8; 32];
[state_leaf]
path: u8[32][2] = [ [0u8; 32], [0u8; 32] ];
memo: u8[32] = [0u8; 32];
path: [u8; (32, 2)] = [ [0u8; 32], [0u8; 32] ];
memo: [u8; 32] = [0u8; 32];
network_id: u8 = 0;
leaf_randomness: u8[32] = [0u8; 32];
leaf_randomness: [u8; 32] = [0u8; 32];

View File

@ -2,23 +2,23 @@
[state]
leaf_index: u32 = 0;
root: u8[32] = [0u8; 32];
root: [u8; 32] = [0u8; 32];
[[private]]
[record]
serial_number: u8[32] = [0u8; 32];
commitment: u8[32] = [0u8; 32];
serial_number: [u8; 32] = [0u8; 32];
commitment: [u8; 32] = [0u8; 32];
owner: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
value: u64 = 5;
payload: u8[32] = [0u8; 32];
birth_program_id: u8[32] = [0u8; 32];
death_program_id: u8[32] = [0u8; 32];
serial_number_nonce: u8[32] = [0u8; 32];
commitment_randomness: u8[32] = [0u8; 32];
payload: [u8; 32] = [0u8; 32];
birth_program_id: [u8; 32] = [0u8; 32];
death_program_id: [u8; 32] = [0u8; 32];
serial_number_nonce: [u8; 32] = [0u8; 32];
commitment_randomness: [u8; 32] = [0u8; 32];
[state_leaf]
path: u8[32][2] = [ [0u8; 32], [0u8; 32] ];
memo: u8[32] = [0u8; 32];
path: [u8; (32, 2)] = [ [0u8; 32], [0u8; 32] ];
memo: [u8; 32] = [0u8; 32];
network_id: u8 = 0;
leaf_randomness: u8[32] = [0u8; 32];
leaf_randomness: [u8; 32] = [0u8; 32];