diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java index f8b822d31d..018268180f 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java @@ -38,10 +38,8 @@ import net.consensys.linea.zktracer.module.Module; import net.consensys.linea.zktracer.module.Pin55; import net.consensys.linea.zktracer.module.hub.Hub; -import net.consensys.linea.zktracer.opcode.OpCodes; +import net.consensys.linea.zktracer.types.Utils; import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.toml.Toml; -import org.apache.tuweni.toml.TomlTable; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.PendingTransaction; import org.hyperledger.besu.datatypes.Transaction; @@ -62,10 +60,22 @@ public class ZkTracer implements ConflationAwareOperationTracer { public static final GasCalculator gasCalculator = new LondonGasCalculator(); public static final FeeMarket feeMarket = FeeMarket.london(-1); + private static final Map spillings; + + static { + try { + // Load spillings configured in src/main/resources/spillings.toml. + spillings = Utils.computeSpillings(); + } catch (final Exception e) { + final String errorMsg = + "A problem happened during spillings initialization, cause " + e.getCause(); + log.error(errorMsg); + throw new RuntimeException(e); + } + } @Getter private final Hub hub; private final Optional pin55; - private final Map spillings = new HashMap<>(); private Hash hashOfLastTransactionTraced = Hash.EMPTY; /** Accumulate all the exceptions that happened at tracing time. */ @Getter private final List tracingExceptions = new FiniteList<>(50); @@ -76,27 +86,12 @@ public ZkTracer() { public ZkTracer(final LineaL1L2BridgeConfiguration bridgeConfiguration) { this.hub = new Hub(bridgeConfiguration.contract(), bridgeConfiguration.topic()); - - // Load opcodes configured in src/main/resources/opcodes.yml. - OpCodes.load(); - - // Load spillings configured in src/main/resources/spillings.toml. - try { - final TomlTable table = - Toml.parse(getClass().getClassLoader().getResourceAsStream("spillings.toml")) - .getTable("spillings"); - table.toMap().keySet().forEach(k -> spillings.put(k, Math.toIntExact(table.getLong(k)))); - - for (Module m : this.hub.getModulesToCount()) { - if (!this.spillings.containsKey(m.moduleKey())) { - throw new IllegalStateException( - "Spilling for module " + m.moduleKey() + " not defined in spillings.toml"); - } + for (Module m : this.hub.getModulesToCount()) { + if (!spillings.containsKey(m.moduleKey())) { + throw new IllegalStateException( + "Spilling for module " + m.moduleKey() + " not defined in spillings.toml"); } - } catch (final Exception e) { - throw new RuntimeException(e); } - // >>>> CHANGE ME >>>> // >>>> CHANGE ME >>>> // >>>> CHANGE ME >>>> @@ -326,7 +321,7 @@ public Map getModulesLineCount() { modulesLineCount.put( m.moduleKey(), m.lineCount() - + Optional.ofNullable(this.spillings.get(m.moduleKey())) + + Optional.ofNullable(spillings.get(m.moduleKey())) .orElseThrow( () -> new IllegalStateException( diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/OpCodes.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/OpCodes.java index 2b293bfb6f..7880b98c58 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/OpCodes.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/OpCodes.java @@ -35,9 +35,13 @@ public class OpCodes { private static Map valueToOpCodeDataMap; private static Map opCodeToOpCodeDataMap; + static { + init(); + } + /** Loads all opcode metadata from src/main/resources/opcodes.yml. */ @SneakyThrows(IOException.class) - public static void load() { + private static void init() { JsonNode rootNode = YAML_CONVERTER .getObjectMapper() diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/types/Utils.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/types/Utils.java index 54a184640c..222c91c71b 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/types/Utils.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/types/Utils.java @@ -15,10 +15,15 @@ package net.consensys.linea.zktracer.types; +import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; import com.google.common.base.Preconditions; import org.apache.tuweni.bytes.Bytes; +import org.apache.tuweni.toml.Toml; +import org.apache.tuweni.toml.TomlTable; public class Utils { @@ -83,4 +88,15 @@ public static BitDecOutput bitDecomposition(int input, int nbStep) { } return output; } + + public static Map computeSpillings() throws IOException { + final Map spillings = new HashMap<>(); + + final TomlTable table = + Toml.parse(Utils.class.getClassLoader().getResourceAsStream("spillings.toml")) + .getTable("spillings"); + table.toMap().keySet().forEach(k -> spillings.put(k, Math.toIntExact(table.getLong(k)))); + + return spillings; + } } diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/EcDataTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/EcDataTest.java index 7be7baaca0..9289167340 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/EcDataTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/EcDataTest.java @@ -16,12 +16,9 @@ package net.consensys.linea.zktracer.module; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.apache.tuweni.bytes.Bytes; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) public class EcDataTest { @Test void testEcData() { diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/add/AddTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/add/AddTest.java index 76b624c93e..aca8ef628c 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/add/AddTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/add/AddTest.java @@ -18,12 +18,9 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.apache.tuweni.bytes.Bytes; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) public class AddTest { @Test void testSmallZeroAdd() { diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/bin/BinTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/bin/BinTest.java index ab361a7195..b7bc806b79 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/bin/BinTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/bin/BinTest.java @@ -18,12 +18,9 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.apache.tuweni.units.bigints.UInt256; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) public class BinTest { @Test public void edgeCase() { diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockhash/BlockhashTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockhash/BlockhashTest.java index 4b1e8c2585..1327774769 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockhash/BlockhashTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockhash/BlockhashTest.java @@ -20,12 +20,9 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.apache.tuweni.bytes.Bytes; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) public class BlockhashTest { // @Disabled("in our framework, BLOCKNUMBER is 0 thus breaking the wcp_lower_bound lookup") diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/exp/ExpTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/exp/ExpTest.java index 3b24e9c6e4..22df078a71 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/exp/ExpTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/exp/ExpTest.java @@ -25,14 +25,11 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.apache.tuweni.bytes.Bytes; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; @Slf4j -@ExtendWith(EvmExtension.class) public class ExpTest { // Generates 128, 64, 2, 1 as LD private static final int[] LD_INDICES = new int[] {1, 2, 7, 8}; diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/ext/TestDuplicatedOperations.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/ext/TestDuplicatedOperations.java index f9a5917f95..3053321356 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/ext/TestDuplicatedOperations.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/ext/TestDuplicatedOperations.java @@ -20,12 +20,9 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.apache.tuweni.bytes.Bytes; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) public class TestDuplicatedOperations { @Test void testDuplicate() { diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/CallEmptyNoStopTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/CallEmptyNoStopTest.java index 620fa645aa..d19665cb31 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/CallEmptyNoStopTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/CallEmptyNoStopTest.java @@ -21,7 +21,6 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; -import net.consensys.linea.zktracer.testing.EvmExtension; import net.consensys.linea.zktracer.testing.ToyAccount; import net.consensys.linea.zktracer.testing.ToyExecutionEnvironment; import net.consensys.linea.zktracer.testing.ToyTransaction; @@ -34,10 +33,8 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.Transaction; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; /** Ensure that calling a contract with empty code does not generate a virtual STOP trace */ -@ExtendWith(EvmExtension.class) public class CallEmptyNoStopTest { @Test void test() { diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/OtherTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/OtherTests.java index d69e4066f1..080270f421 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/OtherTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/OtherTests.java @@ -18,11 +18,8 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) public class OtherTests { @Test public void testMul() { diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TestTwoPlusTwo.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TestTwoPlusTwo.java index df16290a90..c9b0dae20d 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TestTwoPlusTwo.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TestTwoPlusTwo.java @@ -18,11 +18,8 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) public class TestTwoPlusTwo { @Test void testAdd() { diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mmu/MemoryTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mmu/MemoryTests.java index 736c475299..99a8bbf0a4 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mmu/MemoryTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mmu/MemoryTests.java @@ -20,12 +20,9 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.apache.tuweni.bytes.Bytes; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) class MemoryTests { private final Random rnd = new Random(666); diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mod/ModTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mod/ModTest.java index 9d819f8de5..817993c5da 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mod/ModTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mod/ModTest.java @@ -18,12 +18,9 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.apache.tuweni.units.bigints.UInt256; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) public class ModTest { @Test void testSignedSmod() { diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mxp/MxpTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mxp/MxpTest.java index 634ddf33a1..a44995b0e9 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mxp/MxpTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mxp/MxpTest.java @@ -27,7 +27,6 @@ import net.consensys.linea.zktracer.opcode.gas.MxpType; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import net.consensys.linea.zktracer.testing.ToyAccount; import net.consensys.linea.zktracer.testing.ToyExecutionEnvironment; import net.consensys.linea.zktracer.testing.ToyTransaction; @@ -42,11 +41,9 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.Transaction; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; // https://github.com/Consensys/linea-besu-plugin/issues/197 -@ExtendWith(EvmExtension.class) public class MxpTest { private static final Random RAND = new Random(123456789123456L); public static final EWord TWO_POW_128 = EWord.of(EWord.ONE.shiftLeft(128)); diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/precompiles/PrecompileTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/precompiles/PrecompileTests.java index a68a3f6c38..95d07f6001 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/precompiles/PrecompileTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/precompiles/PrecompileTests.java @@ -14,8 +14,4 @@ */ package net.consensys.linea.zktracer.module.precompiles; -import net.consensys.linea.zktracer.testing.EvmExtension; -import org.junit.jupiter.api.extension.ExtendWith; - -@ExtendWith(EvmExtension.class) public class PrecompileTests {} diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlpaddr/TestRlpAddress.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlpaddr/TestRlpAddress.java index 69e6d87ba1..6e89f40401 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlpaddr/TestRlpAddress.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlpaddr/TestRlpAddress.java @@ -26,7 +26,6 @@ import java.util.Random; import net.consensys.linea.zktracer.opcode.OpCode; -import net.consensys.linea.zktracer.opcode.OpCodes; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.ToyAccount; import net.consensys.linea.zktracer.testing.ToyExecutionEnvironment; @@ -48,8 +47,6 @@ public class TestRlpAddress { @Test void test() { - OpCodes.load(); - ToyWorld.ToyWorldBuilder world = ToyWorld.builder(); List txList = new ArrayList<>(); diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/shf/ShfRtTracerTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/shf/ShfRtTracerTest.java index 17f23ad874..6a0e779375 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/shf/ShfRtTracerTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/shf/ShfRtTracerTest.java @@ -22,18 +22,15 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; import org.junit.jupiter.api.Named; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @Slf4j -@ExtendWith(EvmExtension.class) class ShfRtTracerTest { private static final Random RAND = new Random(); private static final int TEST_REPETITIONS = 4; diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/stp/StpTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/stp/StpTest.java index 52a9e13cd6..965798d688 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/stp/StpTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/stp/StpTest.java @@ -25,9 +25,7 @@ import java.util.Random; import net.consensys.linea.zktracer.opcode.OpCode; -import net.consensys.linea.zktracer.opcode.OpCodes; import net.consensys.linea.zktracer.testing.BytecodeCompiler; -import net.consensys.linea.zktracer.testing.EvmExtension; import net.consensys.linea.zktracer.testing.ToyAccount; import net.consensys.linea.zktracer.testing.ToyExecutionEnvironment; import net.consensys.linea.zktracer.testing.ToyTransaction; @@ -42,9 +40,7 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.Transaction; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) public class StpTest { private static final Random RAND = new Random(666L); final int NB_CALL = 200; @@ -52,7 +48,6 @@ public class StpTest { @Test void testCall() { - OpCodes.load(); ToyWorld.ToyWorldBuilder world = ToyWorld.builder(); List txList = new ArrayList<>(); @@ -78,7 +73,6 @@ void testCall() { @Test void testCreate() { - OpCodes.load(); ToyWorld.ToyWorldBuilder world = ToyWorld.builder(); List txList = new ArrayList<>(); diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/trm/TrmTracerTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/trm/TrmTracerTest.java index 44e6e8e68b..0515dd860f 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/trm/TrmTracerTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/trm/TrmTracerTest.java @@ -18,13 +18,10 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) public class TrmTracerTest { private final Bytes32 RANDOM_STRING_FROM_THE_INTERNET = Bytes32.fromHexString( diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/wcp/WcpEdgeCaseTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/wcp/WcpEdgeCaseTest.java index 85b9dc097a..2ec181875f 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/wcp/WcpEdgeCaseTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/wcp/WcpEdgeCaseTest.java @@ -18,12 +18,9 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.testing.BytecodeCompiler; import net.consensys.linea.zktracer.testing.BytecodeRunner; -import net.consensys.linea.zktracer.testing.EvmExtension; import org.apache.tuweni.bytes.Bytes; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) public class WcpEdgeCaseTest { @Test void testZeroAndHugeArgs() { diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/DynamicTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/DynamicTests.java index 9a098f9935..ee09c2353c 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/DynamicTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/DynamicTests.java @@ -31,7 +31,6 @@ import net.consensys.linea.zktracer.module.shf.Shf; import net.consensys.linea.zktracer.module.wcp.Wcp; import net.consensys.linea.zktracer.opcode.OpCode; -import net.consensys.linea.zktracer.opcode.OpCodes; import org.apache.tuweni.bytes.Bytes32; import org.junit.jupiter.api.DynamicTest; @@ -48,7 +47,6 @@ public class DynamicTests { private final Module module; private DynamicTests(Module module) { - OpCodes.load(); this.module = module; this.testCaseRegistry = new LinkedList<>(); } diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/EvmExtension.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/EvmExtension.java deleted file mode 100644 index dd8f5f50ab..0000000000 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/EvmExtension.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright Consensys Software Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.testing; - -import net.consensys.linea.zktracer.opcode.OpCodes; -import org.junit.jupiter.api.extension.BeforeAllCallback; -import org.junit.jupiter.api.extension.ExtensionContext; - -/** - * A JUnit {@link org.junit.jupiter.api.extension.Extension} handling the test lifecycle for EVM - * tests. - */ -public class EvmExtension implements BeforeAllCallback { - @Override - public void beforeAll(ExtensionContext context) { - OpCodes.load(); - } -} diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ExampleTxTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ExampleTxTest.java index 8734539412..3269537c0c 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ExampleTxTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/testing/ExampleTxTest.java @@ -25,9 +25,7 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.Transaction; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -@ExtendWith(EvmExtension.class) class ExampleTxTest { @Test diff --git a/reference-tests/src/test/java/net/consensys/linea/EvmExtension.java b/reference-tests/src/test/java/net/consensys/linea/EvmExtension.java deleted file mode 100644 index a6159f46fe..0000000000 --- a/reference-tests/src/test/java/net/consensys/linea/EvmExtension.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright Consensys Software Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea; - -import net.consensys.linea.zktracer.opcode.OpCodes; -import org.junit.jupiter.api.extension.BeforeAllCallback; -import org.junit.jupiter.api.extension.ExtensionContext; - -/** - * A JUnit {@link org.junit.jupiter.api.extension.Extension} handling the test lifecycle for EVM - * tests. - */ -public class EvmExtension implements BeforeAllCallback { - @Override - public void beforeAll(ExtensionContext context) { - OpCodes.load(); - } -} diff --git a/reference-tests/src/test/resources/templates/BlockchainReferenceTest.java.template b/reference-tests/src/test/resources/templates/BlockchainReferenceTest.java.template index 318b5949dc..3bd62bc910 100644 --- a/reference-tests/src/test/resources/templates/BlockchainReferenceTest.java.template +++ b/reference-tests/src/test/resources/templates/BlockchainReferenceTest.java.template @@ -20,8 +20,6 @@ import static net.consensys.linea.BlockchainReferenceTestTools.generateTestParam import java.util.stream.Stream; -import net.consensys.linea.EvmExtension; - import org.hyperledger.besu.ethereum.referencetests.BlockchainReferenceTestCaseSpec; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.extension.ExtendWith; @@ -33,7 +31,6 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue; /** The blockchain test operation testing framework entry point. */ @Tag("BlockchainReferenceTest") -@ExtendWith(EvmExtension.class) public class %%TESTS_NAME%% { private static final String[] TEST_CONFIG_FILE_DIR_PATH = new String[] {%%TESTS_FILE%%}; diff --git a/reference-tests/src/test/resources/templates/GeneralStateReferenceTest.java.template b/reference-tests/src/test/resources/templates/GeneralStateReferenceTest.java.template index 03a58c424a..b34d0f7b4d 100644 --- a/reference-tests/src/test/resources/templates/GeneralStateReferenceTest.java.template +++ b/reference-tests/src/test/resources/templates/GeneralStateReferenceTest.java.template @@ -19,8 +19,6 @@ import static net.consensys.linea.GeneralStateReferenceTestTools.executeTest; import static net.consensys.linea.GeneralStateReferenceTestTools.generateTestParametersForConfig; import static org.junit.jupiter.api.Assumptions.assumeTrue; -import net.consensys.linea.EvmExtension; - import java.util.stream.Stream; import org.hyperledger.besu.ethereum.referencetests.GeneralStateTestCaseEipSpec; @@ -32,7 +30,6 @@ import org.junit.jupiter.params.provider.MethodSource; /** The general state test operation testing framework entry point. */ @Tag("GeneralStateReferenceTest") -@ExtendWith(EvmExtension.class) public class %%TESTS_NAME%% { private static final String[] TEST_CONFIG_FILE_DIR_PATH = new String[] {%%TESTS_FILE%%};