diff --git a/testing/src/test/java/net/consensys/linea/testing/ExampleMultiBlockTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/ExampleMultiBlockTest.java similarity index 96% rename from testing/src/test/java/net/consensys/linea/testing/ExampleMultiBlockTest.java rename to arithmetization/src/test/java/net/consensys/linea/zktracer/ExampleMultiBlockTest.java index 0dc94328a4..8cfbfff9e9 100644 --- a/testing/src/test/java/net/consensys/linea/testing/ExampleMultiBlockTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/ExampleMultiBlockTest.java @@ -13,10 +13,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.testing; +package net.consensys.linea.zktracer; import java.util.List; +import net.consensys.linea.testing.BytecodeCompiler; +import net.consensys.linea.testing.MultiBlockExecutionEnvironment; +import net.consensys.linea.testing.ToyAccount; +import net.consensys.linea.testing.ToyTransaction; import net.consensys.linea.zktracer.opcode.OpCode; import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.crypto.KeyPair; diff --git a/testing/src/test/java/net/consensys/linea/testing/ExampleTxTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/ExampleTxTest.java similarity index 89% rename from testing/src/test/java/net/consensys/linea/testing/ExampleTxTest.java rename to arithmetization/src/test/java/net/consensys/linea/zktracer/ExampleTxTest.java index 9d67361098..3a84887d4d 100644 --- a/testing/src/test/java/net/consensys/linea/testing/ExampleTxTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/ExampleTxTest.java @@ -13,10 +13,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.testing; +package net.consensys.linea.zktracer; import java.util.List; +import net.consensys.linea.testing.BytecodeCompiler; +import net.consensys.linea.testing.ToyAccount; +import net.consensys.linea.testing.ToyExecutionEnvironmentV2; +import net.consensys.linea.testing.ToyTransaction; import net.consensys.linea.zktracer.opcode.OpCode; import org.hyperledger.besu.crypto.KeyPair; import org.hyperledger.besu.crypto.SECP256K1; diff --git a/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java b/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java index 650a3e645b..4ca8130b41 100644 --- a/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java +++ b/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java @@ -54,6 +54,7 @@ public MultiBlockExecutionEnvironmentBuilder addBlock(List transact public void run() { ReplayExecutionEnvironment.builder() + .useCoinbaseAddressFromBlockHeader(true) .build() .replay(ToyExecutionEnvironmentV2.CHAIN_ID, this.buildConflationSnapshot()); } diff --git a/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java b/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java index 6f41b64fcf..c3fdafb2ff 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java +++ b/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java @@ -85,6 +85,9 @@ public class ReplayExecutionEnvironment { */ private final boolean txResultChecking; + @Builder.Default + private final boolean useCoinbaseAddressFromBlockHeader = false; + private final ZkTracer zkTracer = new ZkTracer(); public void checkTracer(String inputFilePath) { @@ -155,18 +158,22 @@ private void executeFrom(final BigInteger chainId, final ConflationSnapshot conf tracer = ConflationAwareOperationTracer.sequence(tracer, capturer); } // Execute the conflation - executeFrom(chainId, conflation, tracer, this.txResultChecking); + executeFrom(chainId, conflation, tracer, this.txResultChecking, this.useCoinbaseAddressFromBlockHeader); // if (debugBlockCapturer) { writeCaptureToFile(conflation, capturer); } } + + private static void executeFrom( final BigInteger chainId, final ConflationSnapshot conflation, final ConflationAwareOperationTracer tracer, - final boolean txResultChecking) { + final boolean txResultChecking, + final boolean useCoinbaseAddressFromBlockHeader + ) { BlockHashOperation.BlockHashLookup blockHashLookup = conflation.toBlockHashLookup(); // Initialise world state from conflation MutableWorldState world = initWorld(conflation); @@ -194,7 +201,7 @@ private static void executeFrom( updater, header, tx, - CliqueHelpers.getProposerOfBlock(header), + useCoinbaseAddressFromBlockHeader ? header.getCoinbase() : CliqueHelpers.getProposerOfBlock(header), buildOperationTracer(tx, txs.getOutcome(), tracer, txResultChecking), blockHashLookup, false,