48
48
import net .consensys .linea .zktracer .module .limits .precompiles .Blake2fRounds ;
49
49
import net .consensys .linea .zktracer .module .limits .precompiles .EcAddEffectiveCall ;
50
50
import net .consensys .linea .zktracer .module .limits .precompiles .EcMulEffectiveCall ;
51
- import net .consensys .linea .zktracer .module .limits .precompiles .EcPairing ;
52
51
import net .consensys .linea .zktracer .module .limits .precompiles .EcPairingEffectiveCall ;
53
52
import net .consensys .linea .zktracer .module .limits .precompiles .EcPairingMillerLoop ;
54
53
import net .consensys .linea .zktracer .module .limits .precompiles .EcRecoverEffectiveCall ;
55
- import net .consensys .linea .zktracer .module .limits .precompiles .ModExp ;
56
- import net .consensys .linea .zktracer .module .limits .precompiles .ModexpEffectiveCall ;
54
+ import net .consensys .linea .zktracer .module .limits .precompiles .Modexp ;
57
55
import net .consensys .linea .zktracer .module .limits .precompiles .Rip160Blocks ;
58
- import net .consensys .linea .zktracer .module .limits .precompiles .Rip160EffectiveCall ;
59
56
import net .consensys .linea .zktracer .module .limits .precompiles .Sha256Blocks ;
60
- import net .consensys .linea .zktracer .module .limits .precompiles .Sha256EffectiveCall ;
61
57
import net .consensys .linea .zktracer .module .logData .LogData ;
62
58
import net .consensys .linea .zktracer .module .logInfo .LogInfo ;
63
59
import net .consensys .linea .zktracer .module .mmu .Mmu ;
@@ -189,19 +185,27 @@ public void addTraceSection(TraceSection section) {
189
185
private final Trm trm = new Trm ();
190
186
private final Stp stp = new Stp (this , wcp , mod );
191
187
private final L2Block l2Block = new L2Block ();
192
- private final Sha256EffectiveCall sha256NbEffectiveCall = new Sha256EffectiveCall ();
193
- private final Rip160EffectiveCall rip160NbEffectiveCall = new Rip160EffectiveCall ();
194
- private final EcPairing ecPairingNbCall = new EcPairing ();
195
- private final ModExp modExp = new ModExp ();
196
- private final ModexpEffectiveCall modexpEffectiveCall = new ModexpEffectiveCall (this , modExp );
197
188
private final HashInfo hashInfo ;
198
189
private final HashData hashData ;
199
190
191
+ // Precompiles stuff
192
+ Blake2fRounds blake2f ;
193
+ EcAddEffectiveCall ecAdd ;
194
+ EcMulEffectiveCall ecMul ;
195
+ EcPairingEffectiveCall ecPairing ;
196
+ EcRecoverEffectiveCall ecRecover ;
197
+ Modexp modexp ;
198
+ Rip160Blocks rip160 ;
199
+ Sha256Blocks sha256 ;
200
+
200
201
private final List <Module > modules ;
201
202
/* Those modules are not traced, we just compute the number of calls to those precompile to meet the prover limits */
202
203
private final List <Module > precompileLimitModules ;
203
204
204
205
public Hub () {
206
+ //
207
+ // Module
208
+ //
205
209
this .pch = new PlatformController (this );
206
210
this .mmu = new Mmu (this .callStack );
207
211
this .mxp = new Mxp (this );
@@ -213,32 +217,41 @@ public Hub() {
213
217
this .hashData = new HashData (this );
214
218
this .hashInfo = new HashInfo (this );
215
219
216
- final EcRecoverEffectiveCall ecRec = new EcRecoverEffectiveCall (this , ecRecover );
217
- final EcPairingEffectiveCall ecpairingNbEffectiveCall =
218
- new EcPairingEffectiveCall (this , ecPairingNbCall );
220
+ //
221
+ // Precompiles
222
+ //
223
+ this .blake2f = new Blake2fRounds (this );
224
+ this .ecAdd = new EcAddEffectiveCall (this );
225
+ this .ecMul = new EcMulEffectiveCall (this );
226
+ this .ecPairing = new EcPairingEffectiveCall (this );
227
+ this .ecRecover = new EcRecoverEffectiveCall (this );
228
+ this .modexp = new Modexp (this );
229
+ this .rip160 = new Rip160Blocks (this );
230
+ this .sha256 = new Sha256Blocks (this );
231
+
219
232
this .precompileLimitModules =
220
233
List .of (
221
- sha256NbCall ,
222
- sha256NbEffectiveCall ,
223
- new Sha256Blocks ( this , sha256NbCall , sha256NbEffectiveCall ) ,
224
- ecRec ,
225
- rip160NbCall ,
226
- rip160NbEffectiveCall ,
227
- new Rip160Blocks ( this , rip160NbCall , rip160NbEffectiveCall ) ,
228
- modExp ,
229
- modexpEffectiveCall ,
230
- ecAdd ,
231
- new EcAddEffectiveCall ( this , ecAdd ),
232
- ecMul ,
233
- new EcMulEffectiveCall ( this , ecMul ),
234
- ecPairingNbCall ,
235
- ecpairingNbEffectiveCall ,
236
- new EcPairingMillerLoop ( ecpairingNbEffectiveCall ) ,
237
- blake2f ,
238
- new Blake2fRounds ( this , blake2f ),
234
+ this . blake2f ,
235
+ this . blake2f . callCounter () ,
236
+ this . ecAdd ,
237
+ this . ecAdd . callCounter () ,
238
+ this . ecMul ,
239
+ this . ecMul . callCounter () ,
240
+ this . ecPairing ,
241
+ this . ecPairing . callCounter () ,
242
+ new EcPairingMillerLoop ( this . ecPairing ) ,
243
+ this . ecRecover ,
244
+ this . ecRecover . callCounter ( ),
245
+ this . modexp ,
246
+ this . modexp . callCounter ( ),
247
+ this . rip160 ,
248
+ this . rip160 . callCounter () ,
249
+ this . sha256 ,
250
+ this . sha256 . callCounter () ,
251
+
239
252
// Block level limits
240
253
this .l2Block ,
241
- new Keccak (this , ecRec , this .l2Block ),
254
+ new Keccak (this , this . ecRecover , this .l2Block ),
242
255
new L2L1Logs (this .l2Block ));
243
256
244
257
this .modules =
@@ -274,11 +287,15 @@ public Hub() {
274
287
*/
275
288
public List <Module > getModulesToTrace () {
276
289
return List .of (
290
+ //
277
291
// Reference tables
292
+ //
278
293
new BinRt (),
279
294
new InstructionDecoder (),
280
295
new ShfRt (),
296
+ //
281
297
// Modules
298
+ //
282
299
this ,
283
300
this .add ,
284
301
this .bin ,
@@ -538,7 +555,7 @@ void triggerModules(MessageFrame frame) {
538
555
// this.stp.tracePreOpcode(frame);
539
556
}
540
557
if (this .pch .signals ().exp ()) {
541
- this .modexpEffectiveCall .tracePreOpcode (frame );
558
+ this .modexp .tracePreOpcode (frame );
542
559
}
543
560
if (this .pch .signals ().trm ()) {
544
561
this .trm .tracePreOpcode (frame );
0 commit comments