This repository was archived by the owner on Apr 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +24
-15
lines changed Expand file tree Collapse file tree 7 files changed +24
-15
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ fn test_e2e() {
53
53
// Proof for test circuit
54
54
let circuits = chunks
55
55
. iter ( )
56
- . map ( |& chunk| MockChunkCircuit { chunk } )
56
+ . map ( |& chunk| MockChunkCircuit { chain_id : 0 , chunk } )
57
57
. collect_vec ( ) ;
58
58
let layer_0_snarks = circuits
59
59
. iter ( )
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ mod config;
16
16
/// - data hash
17
17
/// - public input hash
18
18
pub struct MockChunkCircuit {
19
+ pub ( crate ) chain_id : u64 ,
19
20
pub ( crate ) chunk : ChunkHash ,
20
21
}
21
22
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ use super::{
16
16
impl MockChunkCircuit {
17
17
pub ( crate ) fn random < R : rand:: RngCore > ( r : & mut R ) -> Self {
18
18
Self {
19
+ chain_id : 0 ,
19
20
chunk : ChunkHash :: mock_chunk_hash ( r) ,
20
21
}
21
22
}
Original file line number Diff line number Diff line change @@ -13,15 +13,17 @@ impl CircuitExt<Fr> for MockChunkCircuit {
13
13
14
14
/// return vec![data hash | public input hash]
15
15
fn instances ( & self ) -> Vec < Vec < Fr > > {
16
- vec ! [
17
- self . chain_id. to_le_bytes( ) . iter( ) . zip(
18
-
19
- self
20
- . chunk
21
- . data_hash
22
- . as_bytes( )
16
+ vec ! [ self
17
+ . chain_id
18
+ . to_le_bytes( )
23
19
. iter( )
24
- . chain( self . chunk. public_input_hash( ) . as_bytes( ) . iter( ) ) )
20
+ . chain(
21
+ self . chunk
22
+ . data_hash
23
+ . as_bytes( )
24
+ . iter( )
25
+ . chain( self . chunk. public_input_hash( ) . as_bytes( ) . iter( ) ) ,
26
+ )
25
27
. map( |& x| Fr :: from( x as u64 ) )
26
28
. collect( ) ]
27
29
}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ use zkevm_circuits::{
14
14
15
15
use crate :: {
16
16
util:: { capacity, get_indices} ,
17
- LOG_DEGREE ,
17
+ CHAIN_ID_LEN , LOG_DEGREE ,
18
18
} ;
19
19
20
20
/// Config for MockChunkCircuit
@@ -152,9 +152,9 @@ impl MockChunkCircuitConfig {
152
152
// chunk's data hash
153
153
for i in 0 ..32 {
154
154
layouter. constrain_instance (
155
- hash_input_cells[ i + 100 ] . cell ( ) ,
155
+ hash_input_cells[ i + 96 + CHAIN_ID_LEN ] . cell ( ) ,
156
156
self . hash_digest_column ,
157
- i,
157
+ i + CHAIN_ID_LEN ,
158
158
) ?;
159
159
}
160
160
// chunk's public_input_hash
@@ -164,10 +164,15 @@ impl MockChunkCircuitConfig {
164
164
layouter. constrain_instance (
165
165
hash_output_cells[ ( 3 - i) * 8 + j] . cell ( ) ,
166
166
self . hash_digest_column ,
167
- i * 8 + j + 32 ,
167
+ i * 8 + j + 32 + CHAIN_ID_LEN ,
168
168
) ?;
169
169
}
170
170
}
171
+ // chain id
172
+ for i in 0 ..CHAIN_ID_LEN {
173
+ layouter. constrain_instance ( hash_input_cells[ i] . cell ( ) , self . hash_digest_column , i) ?;
174
+ }
175
+
171
176
Ok ( hash_output_cells)
172
177
}
173
178
}
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ fn test_aggregation_circuit() {
43
43
// Proof for test circuit
44
44
let circuits = chunks
45
45
. iter ( )
46
- . map ( |& chunk| MockChunkCircuit { chunk } )
46
+ . map ( |& chunk| MockChunkCircuit { chain_id : 0 , chunk } )
47
47
. collect_vec ( ) ;
48
48
let layer_0_snarks = circuits
49
49
. iter ( )
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ RUST_LOG=trace MODE=greeter cargo test --release --features=print-trace test_moc
4
4
5
5
6
6
# the following 3 tests takes super long time
7
- # RUST_LOG=trace MODE=greeter cargo test --release --features=print-trace test_mock_chunk_prover -- --nocapture 2>&1 | tee mock_chunk.log
7
+ # RUST_LOG=trace MODE=greeter cargo test --release --features=print-trace test_proof_compression -- --nocapture 2>&1 | tee mock_chunk.log
8
8
# RUST_LOG=trace MODE=greeter cargo test --release --features=print-trace test_two_layer_proof_compression -- --ignored --nocapture 2>&1 | tee compression2.log
9
9
# RUST_LOG=trace MODE=greeter cargo test --release --features=print-trace test_aggregation_circuit -- --ignored --nocapture 2>&1 | tee aggregation.log
10
10
# RUST_LOG=trace MODE=greeter cargo test --release --features=print-trace test_e2e -- --ignored --nocapture 2>&1 | tee aggregation.log
You can’t perform that action at this time.
0 commit comments