31
31
import static net .consensys .linea .zktracer .Trace .Txndata .TYPE_1_RLP_TXN_PHASE_NUMBER_7 ;
32
32
import static net .consensys .linea .zktracer .Trace .Txndata .TYPE_2_RLP_TXN_PHASE_NUMBER_6 ;
33
33
import static net .consensys .linea .zktracer .Trace .Txndata .TYPE_2_RLP_TXN_PHASE_NUMBER_7 ;
34
- import static net .consensys .linea .zktracer .TraceLondon .Txndata .NB_ROWS_TYPE_0 ;
35
- import static net .consensys .linea .zktracer .TraceLondon .Txndata .NB_ROWS_TYPE_1 ;
36
- import static net .consensys .linea .zktracer .TraceLondon .Txndata .NB_ROWS_TYPE_2 ;
37
34
import static net .consensys .linea .zktracer .module .Util .getTxTypeAsInt ;
38
35
import static net .consensys .linea .zktracer .types .AddressUtils .highPart ;
39
36
import static net .consensys .linea .zktracer .types .AddressUtils .lowPart ;
@@ -67,21 +64,34 @@ public abstract class TxndataOperation extends ModuleOperation {
67
64
private static final Bytes EIP_2681_MAX_NONCE = bigIntegerToBytes (EIP2681_MAX_NONCE );
68
65
private static final int NB_WCP_EUC_ROWS_FRONTIER_ACCESS_LIST = 7 ;
69
66
67
+ private final int nbRowsType0 ;
68
+ private final int nbRowsType1 ;
69
+ private final int nbRowsType2 ;
70
70
private final int nbRowsTxMax ;
71
71
protected final List <TxnDataComparisonRecord > callsToEucAndWcp ;
72
72
private final ArrayList <RlptxnOutgoing > valuesToRlptxn ;
73
73
private final ArrayList <RlptxrcptOutgoing > valuesToRlpTxrcpt ;
74
74
private static final Bytes BYTES_MAX_REFUND_QUOTIENT = Bytes .of (MAX_REFUND_QUOTIENT );
75
75
76
- public TxndataOperation (Wcp wcp , Euc euc , TransactionProcessingMetadata tx , int nbRowsTxMax ) {
76
+ public TxndataOperation (
77
+ Wcp wcp ,
78
+ Euc euc ,
79
+ TransactionProcessingMetadata tx ,
80
+ int nbRowsType0 ,
81
+ int nbRowsType1 ,
82
+ int nbRowsType2 ) {
77
83
78
84
this .wcp = wcp ;
79
85
this .euc = euc ;
80
86
this .tx = tx ;
81
87
82
- // The number of rows max depends on the fork so the parameter is passed in constructor and set
83
- // to be used in setRlptxrcptValues function
84
- this .nbRowsTxMax = nbRowsTxMax ;
88
+ // The number of rows type0, type1, typ2 and thereforeTxMax depends on the fork so the
89
+ // parameters are passed in constructor and set
90
+ // to be used in setter functions
91
+ this .nbRowsType0 = nbRowsType0 ;
92
+ this .nbRowsType1 = nbRowsType1 ;
93
+ this .nbRowsType2 = nbRowsType2 ;
94
+ this .nbRowsTxMax = Math .max (Math .max (nbRowsType0 , nbRowsType1 ), nbRowsType2 );
85
95
this .callsToEucAndWcp = new ArrayList <>(nbRowsTxMax );
86
96
this .valuesToRlptxn = new ArrayList <>(nbRowsTxMax );
87
97
this .valuesToRlpTxrcpt = new ArrayList <>(nbRowsTxMax );
@@ -141,12 +151,12 @@ private void setCallsToEucAndWcp() {
141
151
142
152
switch (type ) {
143
153
case FRONTIER -> {
144
- for (int i = NB_WCP_EUC_ROWS_FRONTIER_ACCESS_LIST ; i < NB_ROWS_TYPE_0 ; i ++) {
154
+ for (int i = NB_WCP_EUC_ROWS_FRONTIER_ACCESS_LIST ; i < this . nbRowsType0 ; i ++) {
145
155
callsToEucAndWcp .add (TxnDataComparisonRecord .empty ());
146
156
}
147
157
}
148
158
case ACCESS_LIST -> {
149
- for (int i = NB_WCP_EUC_ROWS_FRONTIER_ACCESS_LIST ; i < NB_ROWS_TYPE_1 ; i ++) {
159
+ for (int i = NB_WCP_EUC_ROWS_FRONTIER_ACCESS_LIST ; i < this . nbRowsType1 ; i ++) {
150
160
callsToEucAndWcp .add (TxnDataComparisonRecord .empty ());
151
161
}
152
162
}
@@ -228,7 +238,7 @@ private void setRlptxnValues() {
228
238
(short ) TYPE_0_RLP_TXN_PHASE_NUMBER_6 ,
229
239
Bytes .EMPTY ,
230
240
Bytes .minimalBytes (tx .getEffectiveGasPrice ())));
231
- for (int i = 7 ; i < NB_ROWS_TYPE_0 + 1 ; i ++) {
241
+ for (int i = 7 ; i < this . nbRowsType0 + 1 ; i ++) {
232
242
valuesToRlptxn .add (RlptxnOutgoing .empty ());
233
243
}
234
244
}
@@ -247,7 +257,7 @@ private void setRlptxnValues() {
247
257
Bytes .ofUnsignedInt (tx .numberWarmedKey ()),
248
258
Bytes .ofUnsignedInt (tx .numberWarmedAddress ())));
249
259
250
- for (int i = 8 ; i < NB_ROWS_TYPE_1 + 1 ; i ++) {
260
+ for (int i = 8 ; i < this . nbRowsType1 + 1 ; i ++) {
251
261
valuesToRlptxn .add (RlptxnOutgoing .empty ());
252
262
}
253
263
}
@@ -268,7 +278,7 @@ private void setRlptxnValues() {
268
278
Bytes .ofUnsignedInt (tx .numberWarmedKey ()),
269
279
Bytes .ofUnsignedInt (tx .numberWarmedAddress ())));
270
280
271
- for (int i = 8 ; i < NB_ROWS_TYPE_2 + 1 ; i ++) {
281
+ for (int i = 8 ; i < this . nbRowsType2 + 1 ; i ++) {
272
282
valuesToRlptxn .add (RlptxnOutgoing .empty ());
273
283
}
274
284
}
@@ -288,7 +298,7 @@ public void setRlptxrcptValues() {
288
298
this .valuesToRlpTxrcpt .add (
289
299
RlptxrcptOutgoing .set (
290
300
(short ) RLP_RCPT_SUBPHASE_ID_CUMUL_GAS , tx .getAccumulatedGasUsedInBlock ()));
291
- // i+3 to i+MAX_NB_ROWS
301
+ // i+3 to i+nbRowsTxMax
292
302
for (int ct = 3 ; ct < this .nbRowsTxMax ; ct ++) {
293
303
this .valuesToRlpTxrcpt .add (RlptxrcptOutgoing .emptyValue ());
294
304
}
0 commit comments