1
0
Fork 0
mirror of synced 2025-09-23 04:08:33 +00:00
Commit graph

373 commits

Author SHA1 Message Date
Thibaut Schaeffer
10ebd604f3
Merge pull request #1289 from Zokrates/backend-opt
Optimize backend integrations
2023-04-11 22:58:55 +02:00
dark64
2e9c66a5c1 fix integration test, update book 2023-04-04 18:46:08 +02:00
Ahmed Castro
48885d64a4
Update sudoku_checker.zok 2023-03-24 16:37:58 -06:00
Ahmed Castro
30c9d8b8b1
Update sudoku_checker.zok 2023-03-24 16:36:49 -06:00
Ahmed Castro
2e551b3d16
Update sudoku_checker.zok 2023-03-21 11:53:10 -06:00
Ahmed Castro
f84faaae83
Sudoku example fix
**Problem**

the logic behind `countDuplicates` is invalid because it's doing this:
(incorrect)
```
if(duplicates + e11 == e21)
  duplicates = 1;
else
  duplicates = 0;
```

Instead of this:
(correct)
```
if(e11 == e21)
  duplicates = duplicates + 1;
else
  duplicates = duplicates;
```

**Solution**

I'm using an auxiliary variable to fix this

**Alternative solution**

We can also fix it with an array and a loop. But I went for the auxiliary variable for no particular reason.

```
def countDuplicates(field e11, field e12, field e21, field e22) -> u32 {
    u32[6] mut duplicates = [0,0,0,0,0,0];
    duplicates[0] = e11 == e12 ? 1 : 0;
    duplicates[1] = e11 == e21 ? 1 : 0;
    duplicates[2] = e11 == e22 ? 1 : 0;
    duplicates[3] = e12 == e21 ? 1 : 0;
    duplicates[4] = e12 == e22 ? 1 : 0;
    duplicates[5] = e21 == e22 ? 1 : 0;

    u32 mut count = 0;
    for u32 i in 0..5 {
        count = count + duplicates[i];
    }

    return count;
}
```

And btw, I also added an assert to make sure we check for this validation. I've tested this on the playground and on chain on goerli and with this changes it works correctly.
2023-03-18 20:09:28 -06:00
Ahmed Castro
60ee62d309
Fixed small typo
Found a small typo while testing this.
Cheers!
2023-03-16 19:01:46 -06:00
dark64
d273bb5958 update book, merge develop and merge conflicts 2023-01-30 15:27:17 +01:00
Dimitris Apostolou
28ac40923c
Fix typos 2023-01-11 03:14:28 +02:00
dark64
8d9e8899c1 merge develop, fix conflicts 2023-01-02 14:26:22 +01:00
dark64
0cdcedd9de allow user-provided randomness in setup 2022-12-12 16:28:16 +01:00
dark64
e95cef8e90 validate expressions, add more tests 2022-12-01 21:07:42 +01:00
dark64
fbfc20c4e6 improvements 2 2022-11-28 20:25:05 +01:00
dark64
8d7e5804df improvements 2022-11-25 17:54:21 +01:00
dark64
fd361d68f3 more tests 2022-11-22 20:32:49 +01:00
dark64
e48afb678c add test for public, update changelog 2022-09-21 14:54:37 +02:00
dark64
4d09fe1c19 disallow the use of the private keyword on non-entry point functions 2022-09-06 12:55:40 +02:00
Thibaut Schaeffer
f86172f6a6
Merge pull request #1206 from Zokrates/dead-code-elimination
Introduce dead code elimination
2022-09-01 15:59:38 +02:00
schaeff
40f6fe277f merge dev 2022-08-30 18:07:13 +02:00
dark64
dd61b2f0c3 Merge branch 'develop' into optional-return 2022-08-30 14:03:45 +02:00
dark64
1da27bc55b update docs 2022-08-30 14:01:01 +02:00
dark64
bc25bc4816 apply suggestions 2022-08-29 16:25:01 +02:00
dark64
ea98c92879 make return statement optional 2022-08-29 15:17:15 +02:00
schaeff
66bb9f12ca Merge branch 'develop' of github.com:Zokrates/ZoKrates into shadowing 2022-08-22 22:00:02 +02:00
dark64
1448742642 add changelog 2022-08-22 13:56:07 +02:00
dark64
6ab602e88c fail if log call contains an int expression 2022-08-22 13:01:59 +02:00
schaeff
4cde35ec80 revert example change, fmt tweaks 2022-08-19 17:23:49 +02:00
schaeff
b9dc1bd65e introduce conditional expression, fix flattening to avoid quadratic term 2022-08-17 16:07:51 +02:00
schaeff
3fbf63d335 extract panics just before flattening, simplify zir, remove redundant checks in code generation 2022-08-16 18:53:21 +02:00
schaeff
8caa6b4720 wip 2022-08-05 16:23:18 +02:00
schaeff
fdebdd86e1 clean, update docs 2022-07-26 14:18:08 +01:00
schaeff
b2cf1012e8 implement shadowing only at the semantic phase 2022-07-21 17:52:54 +02:00
schaeff
950ac08b0e apply suggestions 2022-07-05 13:40:43 +02:00
schaeff
3b07c156ad use function syntax for log, reserve log, add test 2022-07-04 17:19:07 +02:00
schaeff
81d670e531 merge split 2022-07-04 17:02:48 +02:00
Thibaut Schaeffer
588943567f
Merge pull request #1174 from Zokrates/fix-docs
Fix inconsistencies in docs
2022-06-29 10:37:01 +02:00
dark64
e75552b0eb merge staging 2022-06-28 19:23:45 +02:00
dark64
9e1f3ae7e3 fix inconsistencies in docs 2022-06-28 13:19:13 +02:00
dark64
94a3ce511d add failing test 2022-06-28 11:23:57 +02:00
dark64
0736c4b976 fix tests 2022-06-27 14:24:09 +02:00
Thibaut Schaeffer
aa9dc9740f
Merge pull request #1170 from Zokrates/deprecate-multi-returns
Remove multi returns
2022-06-23 17:52:12 +02:00
Thibaut Schaeffer
b852907248
Merge pull request #1121 from Zokrates/syntax-revamp
Use curly braces and semi colons
2022-06-23 11:46:46 +02:00
dark64
253ff1f8f6 fix tests 2022-06-22 18:33:14 +02:00
schaeff
5239d5eb0b Merge branch 'develop' of github.com:Zokrates/ZoKrates into log-statement 2022-06-22 18:18:24 +02:00
schaeff
e2b69c5403 docs, changelog 2022-06-22 17:54:26 +02:00
dark64
63c1e22978 merge syntax-revamp 2022-06-21 15:10:33 +02:00
dark64
b7e787dfd1 deprecate multi returns 2022-06-21 15:03:53 +02:00
schaeff
15dcee9978 changelog, docs 2022-06-15 16:14:13 +02:00
schaeff
241447a09c implement and update zok files 2022-06-13 20:17:40 +02:00
dark64
9283aceeaf fix mpc integration test 2022-06-13 15:42:49 +02:00