1616package net .consensys .linea .testing ;
1717
1818import static net .consensys .linea .reporting .TracerTestBase .chainConfig ;
19- import static net .consensys .linea .reporting .TracerTestBase .fork ;
2019import static net .consensys .linea .testing .ToyExecutionEnvironmentV2 .DEFAULT_BLOCK_NUMBER ;
21- import static net .consensys .linea .zktracer .ChainConfig .MAINNET_TESTCONFIG ;
2220import static net .consensys .linea .zktracer .Trace .LINEA_BLOCK_GAS_LIMIT ;
2321
2422import java .math .BigInteger ;
@@ -55,6 +53,7 @@ public class MultiBlockExecutionEnvironment {
5553 @ Builder .Default private final long startingBlockNumber = DEFAULT_BLOCK_NUMBER ;
5654 @ Builder .Default private final boolean systemContractDeployedPriorToConflation = true ;
5755 @ Builder .Default private final Boolean runWithBesuNode = false ;
56+
5857 /**
5958 * A transaction validator of each transaction; by default, it asserts that the transaction was
6059 * successfully processed.
@@ -120,20 +119,11 @@ public MultiBlockExecutionEnvironmentBuilder addBlock(
120119 }
121120
122121 public void run () {
123- <<<<<<< HEAD
124- if (System .getenv ().containsKey ("RUN_WITH_BESU_NODE" )) {
125- List <Transaction > transactionsIncludingNullTransactionsForEmptyBlocks = new ArrayList <>();
126- for (BlockSnapshot block : blocks ) {
127- if (block .txs ().isEmpty ()) {
128- // Add a null transaction to represent an empty block
129- transactionsIncludingNullTransactionsForEmptyBlocks .add (null );
130- } else {
131- for (TransactionSnapshot txSnapshot : block .txs ()) {
132- transactionsIncludingNullTransactionsForEmptyBlocks .add (txSnapshot .toTransaction ());
133- }
134- }
135- =======
136122 if (runWithBesuNode || System .getenv ().containsKey ("RUN_WITH_BESU_NODE" )) {
123+ // When runnning with a Besu node, the list of transactions present in blocks is not followed
124+ // as set originally.
125+ // With the below, it collects all the transactions in all blocks, and dispatches them one per
126+ // block
137127 List <Transaction > transactionsIncludingNullTransactionsForEmptyBlocks = new ArrayList <>();
138128 for (BlockSnapshot block : blocks ) {
139129 if (block .txs ().isEmpty ()) {
@@ -142,34 +132,9 @@ public void run() {
142132 } else {
143133 for (TransactionSnapshot txSnapshot : block .txs ()) {
144134 transactionsIncludingNullTransactionsForEmptyBlocks .add (txSnapshot .toTransaction ());
145- >>>>>>> c2c824704 (feat : add runWithBesu field to MultiBlockExecutionEnvironement )
146135 }
147- BesuExecutionTools besuExecTools =
148- new BesuExecutionTools (
149- Optional .of (testInfo ),
150- MAINNET_TESTCONFIG (CANCUN ), // TODO: make configurable ?
151- ToyExecutionEnvironmentV2 .DEFAULT_COINBASE_ADDRESS ,
152- accounts ,
153- transactionsIncludingNullTransactionsForEmptyBlocks ,
154- true ,
155- null );
156- besuExecTools .executeTest ();
157- } else {
158- final ConflationSnapshot conflationSnapshot = buildConflationSnapshot ();
159- final Map <Long , Hash > historicalBlockhashes = conflationSnapshot .historicalBlockHashes ();
160- // Remove the last block number as it's not part of the historical blockhashes
161- historicalBlockhashes .remove (conflationSnapshot .lastBlockNumber ());
162- tracer = new ZkTracer (chainConfig , historicalBlockhashes );
163- ReplayExecutionEnvironment .builder ()
164- .zkTracer (tracer )
165- .useCoinbaseAddressFromBlockHeader (true )
166- .transactionProcessingResultValidator (transactionProcessingResultValidator )
167- .systemContractDeployedPriorToConflation (systemContractDeployedPriorToConflation )
168- .build ()
169- .replay (testsChain , testInfo , conflationSnapshot );
136+ }
170137 }
171- <<<<<<< HEAD
172- =======
173138 BesuExecutionTools besuExecTools =
174139 new BesuExecutionTools (
175140 Optional .of (testInfo ),
@@ -180,21 +145,20 @@ >>>>>>> c2c824704 (feat: add runWithBesu field to MultiBlockExecutionEnvironemen
180145 true ,
181146 null );
182147 besuExecTools .executeTest ();
183- return ;
148+ } else {
149+ final ConflationSnapshot conflationSnapshot = buildConflationSnapshot ();
150+ final Map <Long , Hash > historicalBlockhashes = conflationSnapshot .historicalBlockHashes ();
151+ // Remove the last block number as it's not part of the historical blockhashes
152+ historicalBlockhashes .remove (conflationSnapshot .lastBlockNumber ());
153+ tracer = new ZkTracer (chainConfig , historicalBlockhashes );
154+ ReplayExecutionEnvironment .builder ()
155+ .zkTracer (tracer )
156+ .useCoinbaseAddressFromBlockHeader (true )
157+ .transactionProcessingResultValidator (transactionProcessingResultValidator )
158+ .systemContractDeployedPriorToConflation (systemContractDeployedPriorToConflation )
159+ .build ()
160+ .replay (testsChain , testInfo , conflationSnapshot );
184161 }
185- final ConflationSnapshot conflationSnapshot = buildConflationSnapshot ();
186- final Map <Long , Hash > historicalBlockhashes = conflationSnapshot .historicalBlockHashes ();
187- // Remove the last block number as it's not part of the historical blockhashes
188- historicalBlockhashes .remove (conflationSnapshot .lastBlockNumber ());
189- tracer = new ZkTracer (chainConfig , historicalBlockhashes );
190- ReplayExecutionEnvironment .builder ()
191- .zkTracer (tracer )
192- .useCoinbaseAddressFromBlockHeader (true )
193- .transactionProcessingResultValidator (transactionProcessingResultValidator )
194- .systemContractDeployedPriorToConflation (systemContractDeployedPriorToConflation )
195- .build ()
196- .replay (testsChain , testInfo , conflationSnapshot );
197- >>>>>>> 68 a7a6f97 (feat : configurable fork )
198162 }
199163
200164 public Hub getHub () {
0 commit comments