Skip to content

Commit

Permalink
Adjust keccak size (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
LogvinovLeon authored Feb 1, 2024
1 parent a7f3645 commit 497dde2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 28 deletions.
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ Or regenerate profiling info:

| Package | Tool | Action | Elapsed Time | User Time | System Time | CPU Usage | Max Memory |
| --------- | ------- | ------ | ------------ | --------- | ----------- | --------- | ---------- |
| poseidon | nargo | prove | 0:00.67 | 1.16 | 0.17 | 198% | 149.46MB |
| | | verify | 0:00.64 | 0.89 | 0.12 | 159% | 143.59MB |
| | noir_js | prove | 0:01.62 | 3.67 | 0.66 | 266% | 2.18GB |
| | | verify | 0:01.28 | 3.30 | 0.55 | 299% | 2.13GB |
| rlp | nargo | prove | 0:01.28 | 3.74 | 0.25 | 310% | 313.48MB |
| | | verify | 0:01.27 | 3.70 | 0.15 | 303% | 244.93MB |
| | noir_js | prove | 0:02.61 | 9.90 | 0.72 | 406% | 2.24GB |
| | | verify | 0:02.48 | 9.25 | 0.59 | 396% | 2.36GB |
| keccak | nargo | prove | 0:07.41 | 40.26 | 0.96 | 555% | 2.29GB |
| | | verify | 0:06.62 | 39.98 | 0.62 | 613% | 1.79GB |
| | noir_js | prove | 0:21.50 | 107.59 | 2.00 | 509% | 4.07GB |
| | | verify | 0:18.11 | 95.84 | 1.04 | 534% | 3.65GB |
| keccak_2x | nargo | prove | 0:14.52 | 79.77 | 1.83 | 561% | 4.31GB |
| | | verify | 0:12.44 | 76.64 | 1.24 | 626% | 3.57GB |
| | noir_js | prove | 0:42.05 | 213.33 | 3.54 | 515% | 6.06GB |
| | | verify | 0:32.77 | 184.67 | 1.52 | 568% | 5.11GB |
| poseidon | nargo | prove | 0:00.65 | 1.13 | 0.19 | 201% | 148.89MB |
| | | verify | 0:00.59 | 0.85 | 0.14 | 167% | 143.26MB |
| | noir_js | prove | 0:01.40 | 3.61 | 0.67 | 304% | 2.14GB |
| | | verify | 0:01.30 | 3.37 | 0.59 | 303% | 2.04GB |
| rlp | nargo | prove | 0:01.28 | 3.65 | 0.28 | 307% | 308.08MB |
| | | verify | 0:01.17 | 3.56 | 0.16 | 317% | 245.10MB |
| | noir_js | prove | 0:02.51 | 9.74 | 0.76 | 417% | 2.37GB |
| | | verify | 0:02.28 | 9.09 | 0.62 | 426% | 2.20GB |
| keccak | nargo | prove | 0:04.11 | 20.72 | 0.66 | 519% | 1.18GB |
| | | verify | 0:04.36 | 21.54 | 0.50 | 505% | 983.63MB |
| | noir_js | prove | 0:11.49 | 55.73 | 1.33 | 496% | 3.04GB |
| | | verify | 0:09.69 | 51.34 | 0.80 | 537% | 2.74GB |
| keccak_2x | nargo | prove | 0:07.84 | 40.64 | 1.05 | 531% | 2.21GB |
| | | verify | 0:06.79 | 40.07 | 0.75 | 601% | 1.82GB |
| | noir_js | prove | 0:21.25 | 106.92 | 1.92 | 512% | 4.03GB |
| | | verify | 0:17.76 | 95.39 | 1.07 | 543% | 3.71GB |

### Recursive proofs (WASM, local M1 Max)

Expand Down Expand Up @@ -72,9 +72,9 @@ recursive2x.bb.verifyFinalProof: 14.451s
+--------------+----------------------+--------------+----------------------+
| rlp | Bounded { width: 3 } | 4188 | 11704 |
+--------------+----------------------+--------------+----------------------+
| keccak | Bounded { width: 3 } | 4 | 155014 |
| keccak | Bounded { width: 3 } | 4 | 97766 |
+--------------+----------------------+--------------+----------------------+
| keccak_2x | Bounded { width: 3 } | 7 | 300406 |
| keccak_2x | Bounded { width: 3 } | 7 | 154910 |
+--------------+----------------------+--------------+----------------------+
| recursive | Bounded { width: 3 } | 1 | 247869 |
+--------------+----------------------+--------------+----------------------+
Expand Down
6 changes: 3 additions & 3 deletions circuits/keccak/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use dep::std;

fn main(x: pub u8) {
let array: [u8; 1000] = [x; 1000];
let hash = std::hash::keccak256(array, 1000);
assert(hash[0] == 174);
let array: [u8; 532] = [x; 532];
let hash = std::hash::keccak256(array, 532);
assert(hash[0] == 148);
}
10 changes: 5 additions & 5 deletions circuits/keccak_2x/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use dep::std;

fn main(x: pub u8) {
let array: [u8; 1000] = [x; 1000];
let hash = std::hash::keccak256(array, 1000);
let hash2 = std::hash::keccak256(array, 999);
assert(hash[0] == 174);
assert(hash2[0] == 10);
let array: [u8; 532] = [x; 532];
let hash = std::hash::keccak256(array, 532);
let hash2 = std::hash::keccak256(array, 531);
assert(hash[0] == 148);
assert(hash2[0] == 135);
}
3 changes: 1 addition & 2 deletions src/recursive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { initCircuit, readInputMap } from "./utils.js";
import { InputMap } from "@noir-lang/noir_js";
import { Field } from "@noir-lang/noirc_abi";
import { Field, type InputMap } from "@noir-lang/noirc_abi";
import assert from "assert";
import { prepareIntermediateProofArtefacts } from "./recursive_utils.js";

Expand Down

0 comments on commit 497dde2

Please sign in to comment.