diff --git a/aggregator/README.md b/aggregator/README.md index 40bc5aeae2..c201ac5b2b 100644 --- a/aggregator/README.md +++ b/aggregator/README.md @@ -93,7 +93,7 @@ and `batch_pi_hash` matches public input. 3. batch_data_hash and chunk[i].pi_hash use a same chunk[i].data_hash when chunk[i] is not padded ``` -for i in 1 ... __n__ +for i in 1 ... n chunk_pi_hash := keccak(chain_id || prev_state_root || post_state_root || withdraw_root || chunk_data_hash) ``` @@ -101,14 +101,14 @@ This is done by compute the RLCs of chunk[i]'s data_hash for `i=0..k`, and then 4. chunks are continuous when they are not padded: they are linked via the state roots. -for i in 1 ... __k-1__ ``` -c_i.post_state_root == c_{i+1}.prev_state_root +for i in 1 ... k-1 + c_i.post_state_root == c_{i+1}.prev_state_root ``` 5. All the chunks use a same chain id. __Static__. ``` -for i in 1 ... __n__ +for i in 1 ... n batch.chain_id == chunk[i].chain_id ``` @@ -131,7 +131,7 @@ This is done via comparing the `data_rlc` of `chunk_{i-1}` and ` chunk_{i}`. ![Dynamic_inputs](./figures/hash_table.jpg) -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. +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. The only hash that uses dynamic number of rounds is the last hash. Suppose we target for `MAX_AGG_SNARK = 10`. Then, the last hash function will take no more than `32 * 10 /136 = 3` rounds. diff --git a/aggregator/figures/architecture.jpg b/aggregator/figures/architecture.jpg index e359607143..ca6d5cf879 100644 Binary files a/aggregator/figures/architecture.jpg and b/aggregator/figures/architecture.jpg differ diff --git a/aggregator/src/aggregation/circuit.rs b/aggregator/src/aggregation/circuit.rs index 85892f933e..791e530d8d 100644 --- a/aggregator/src/aggregation/circuit.rs +++ b/aggregator/src/aggregation/circuit.rs @@ -337,7 +337,7 @@ impl Circuit for AggregationCircuit { ); region.constrain_equal( - // in the keccak table, the input and output date have different + // in the keccak table, the input and output data have different // endianess chunk_pi_hash_digests[i][j * 8 + k].cell(), snark_inputs[i * DIGEST_LEN + (3 - j) * 8 + k].cell(), diff --git a/aggregator/src/aggregation/rlc/gates.rs b/aggregator/src/aggregation/rlc/gates.rs index 3dc359195e..b62610c144 100644 --- a/aggregator/src/aggregation/rlc/gates.rs +++ b/aggregator/src/aggregation/rlc/gates.rs @@ -18,20 +18,15 @@ impl RlcConfig { region.assign_fixed(|| "const two", self.fixed, 2, || Value::known(Fr::from(2)))?; region.assign_fixed(|| "const four", self.fixed, 3, || Value::known(Fr::from(4)))?; region.assign_fixed(|| "const nine", self.fixed, 4, || Value::known(Fr::from(9)))?; + region.assign_fixed(|| "const 32", self.fixed, 5, || Value::known(Fr::from(32)))?; region.assign_fixed( - || "const thirty two", - self.fixed, - 5, - || Value::known(Fr::from(32)), - )?; - region.assign_fixed( - || "const one hundred and thirty six", + || "const 136", self.fixed, 6, || Value::known(Fr::from(136)), )?; region.assign_fixed( - || "const two to thirty two", + || "const 2^32", self.fixed, 7, || Value::known(Fr::from(1 << 32)),