Skip to content

Commit c1aacd9

Browse files
address additional comments on #712 (#726)
* address additional comments on #712 * minor:typo * address comments: editorial * Update aggregator/README.md Co-authored-by: Haichen Shen <[email protected]> --------- Co-authored-by: Haichen Shen <[email protected]>
1 parent 106ccd5 commit c1aacd9

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

aggregator/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,22 @@ and `batch_pi_hash` matches public input.
9393
3. batch_data_hash and chunk[i].pi_hash use a same chunk[i].data_hash when chunk[i] is not padded
9494

9595
```
96-
for i in 1 ... __n__
96+
for i in 1 ... n
9797
chunk_pi_hash := keccak(chain_id || prev_state_root || post_state_root || withdraw_root || chunk_data_hash)
9898
```
9999

100100
This is done by compute the RLCs of chunk[i]'s data_hash for `i=0..k`, and then check the RLC matches the one from the keccak table.
101101

102102
4. chunks are continuous when they are not padded: they are linked via the state roots.
103103

104-
for i in 1 ... __k-1__
105104
```
106-
c_i.post_state_root == c_{i+1}.prev_state_root
105+
for i in 1 ... k-1
106+
c_i.post_state_root == c_{i+1}.prev_state_root
107107
```
108108

109109
5. All the chunks use a same chain id. __Static__.
110110
```
111-
for i in 1 ... __n__
111+
for i in 1 ... n
112112
batch.chain_id == chunk[i].chain_id
113113
```
114114

@@ -131,7 +131,7 @@ This is done via comparing the `data_rlc` of `chunk_{i-1}` and ` chunk_{i}`.
131131
![Dynamic_inputs](./figures/hash_table.jpg)
132132

133133

134-
Our keccak table uses `2^19` rows. Each keccak round takes `300` rows. When the number of round is is less than $2^19/300$, the cell manager will fill in the rest of the rows with dummy hashes.
134+
Our keccak table uses $2^{19}$ rows. Each keccak round takes `300` rows. When the number of round is is less than $2^{19}/300$, the cell manager will fill in the rest of the rows with dummy hashes.
135135

136136
The only hash that uses dynamic number of rounds is the last hash.
137137
Suppose we target for `MAX_AGG_SNARK = 10`. Then, the last hash function will take no more than `32 * 10 /136 = 3` rounds.

aggregator/figures/architecture.jpg

16.5 KB
Loading

aggregator/src/aggregation/circuit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl Circuit<Fr> for AggregationCircuit {
337337
);
338338

339339
region.constrain_equal(
340-
// in the keccak table, the input and output date have different
340+
// in the keccak table, the input and output data have different
341341
// endianess
342342
chunk_pi_hash_digests[i][j * 8 + k].cell(),
343343
snark_inputs[i * DIGEST_LEN + (3 - j) * 8 + k].cell(),

aggregator/src/aggregation/rlc/gates.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,15 @@ impl RlcConfig {
1818
region.assign_fixed(|| "const two", self.fixed, 2, || Value::known(Fr::from(2)))?;
1919
region.assign_fixed(|| "const four", self.fixed, 3, || Value::known(Fr::from(4)))?;
2020
region.assign_fixed(|| "const nine", self.fixed, 4, || Value::known(Fr::from(9)))?;
21+
region.assign_fixed(|| "const 32", self.fixed, 5, || Value::known(Fr::from(32)))?;
2122
region.assign_fixed(
22-
|| "const thirty two",
23-
self.fixed,
24-
5,
25-
|| Value::known(Fr::from(32)),
26-
)?;
27-
region.assign_fixed(
28-
|| "const one hundred and thirty six",
23+
|| "const 136",
2924
self.fixed,
3025
6,
3126
|| Value::known(Fr::from(136)),
3227
)?;
3328
region.assign_fixed(
34-
|| "const two to thirty two",
29+
|| "const 2^32",
3530
self.fixed,
3631
7,
3732
|| Value::known(Fr::from(1 << 32)),

0 commit comments

Comments
 (0)