diff --git a/arithmetization/src/main/java/net/consensys/linea/continoustracing/ContinuousTracingPlugin.java b/arithmetization/src/main/java/net/consensys/linea/continoustracing/ContinuousTracingPlugin.java index e0b22dd5..8a76acf8 100644 --- a/arithmetization/src/main/java/net/consensys/linea/continoustracing/ContinuousTracingPlugin.java +++ b/arithmetization/src/main/java/net/consensys/linea/continoustracing/ContinuousTracingPlugin.java @@ -19,7 +19,6 @@ import com.google.auto.service.AutoService; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.corset.CorsetValidator; -import net.consensys.linea.zktracer.opcode.OpCodes; import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.services.BesuEvents; @@ -97,8 +96,6 @@ public void start() { System.exit(1); } - OpCodes.load(); // must be loaded explicitly - besuEvents.addBlockAddedListener( new ContinuousTracingBlockAddedListener( new ContinuousTracer(traceService, new CorsetValidator()), diff --git a/arithmetization/src/main/java/net/consensys/linea/rpc/capture/CaptureEndpointServicePlugin.java b/arithmetization/src/main/java/net/consensys/linea/rpc/capture/CaptureEndpointServicePlugin.java index b7d7bb78..3868fb07 100644 --- a/arithmetization/src/main/java/net/consensys/linea/rpc/capture/CaptureEndpointServicePlugin.java +++ b/arithmetization/src/main/java/net/consensys/linea/rpc/capture/CaptureEndpointServicePlugin.java @@ -20,7 +20,6 @@ import com.google.auto.service.AutoService; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.AbstractLineaRequiredPlugin; -import net.consensys.linea.zktracer.opcode.OpCodes; import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.services.RpcEndpointService; @@ -66,7 +65,5 @@ private void createAndRegister( /** Start the RPC service. This method loads the OpCodes. */ @Override - public void start() { - OpCodes.load(); - } + public void start() {} } diff --git a/arithmetization/src/main/java/net/consensys/linea/rpc/counters/CountersEndpointServicePlugin.java b/arithmetization/src/main/java/net/consensys/linea/rpc/counters/CountersEndpointServicePlugin.java index 5da2b58a..8c46578d 100644 --- a/arithmetization/src/main/java/net/consensys/linea/rpc/counters/CountersEndpointServicePlugin.java +++ b/arithmetization/src/main/java/net/consensys/linea/rpc/counters/CountersEndpointServicePlugin.java @@ -17,7 +17,6 @@ import com.google.auto.service.AutoService; import net.consensys.linea.AbstractLineaSharedOptionsPlugin; -import net.consensys.linea.zktracer.opcode.OpCodes; import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.services.RpcEndpointService; @@ -72,7 +71,5 @@ private void createAndRegister( /** Start the RPC service. This method loads the OpCodes. */ @Override - public void start() { - OpCodes.load(); - } + public void start() {} } diff --git a/arithmetization/src/main/java/net/consensys/linea/rpc/tracegeneration/TracesEndpointServicePlugin.java b/arithmetization/src/main/java/net/consensys/linea/rpc/tracegeneration/TracesEndpointServicePlugin.java index e73fb70d..b4bb0384 100644 --- a/arithmetization/src/main/java/net/consensys/linea/rpc/tracegeneration/TracesEndpointServicePlugin.java +++ b/arithmetization/src/main/java/net/consensys/linea/rpc/tracegeneration/TracesEndpointServicePlugin.java @@ -18,7 +18,6 @@ import com.google.auto.service.AutoService; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.AbstractLineaSharedOptionsPlugin; -import net.consensys.linea.zktracer.opcode.OpCodes; import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.services.RpcEndpointService; @@ -74,7 +73,5 @@ private void createAndRegister( /** Start the RPC service. This method loads the OpCodes. */ @Override - public void start() { - OpCodes.load(); - } + public void start() {} } 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 747a1803..1d949f8b 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java @@ -32,10 +32,8 @@ import net.consensys.linea.config.LineaL1L2BridgeConfiguration; import net.consensys.linea.zktracer.module.Module; 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; @@ -54,8 +52,21 @@ public class ZkTracer implements ConflationAwareOperationTracer { /** The {@link GasCalculator} used in this version of the arithmetization */ public static final GasCalculator gasCalculator = new LondonGasCalculator(); + 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 Map spillings = new HashMap<>(); private Hash hashOfLastTransactionTraced = Hash.EMPTY; public ZkTracer() { @@ -64,25 +75,11 @@ 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); } } @@ -231,7 +228,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 2b293bfb..3ed4a836 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; - /** Loads all opcode metadata from src/main/resources/opcodes.yml. */ + static { + /** Loads all opcode metadata from src/main/resources/opcodes.yml. */ + init(); + } + @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 54a18464..222c91c7 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 7be7baac..92891673 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 77ee5a45..7aa06819 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 ab361a71..b7bc806b 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/ext/TestDuplicatedOperations.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/ext/TestDuplicatedOperations.java index f9a5917f..30533213 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 a61f2435..4f1ea008 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 d69e4066..080270f4 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 70d6a4ef..8008b3f8 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/mod/ModTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/mod/ModTest.java index 0e10b9ac..d36a4d26 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 d71d0031..03d30ac0 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/precTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/precompiles/precTests.java index 5fef7916..51301e3e 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/precompiles/precTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/precompiles/precTests.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 precTests {} 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 1fd17098..dd521f2d 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/rlptxn/TestRandomTxns.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlptxn/TestRandomTxns.java index 4a9c348b..3e6f5329 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlptxn/TestRandomTxns.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlptxn/TestRandomTxns.java @@ -24,7 +24,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,7 +47,6 @@ class TestRandomTxns { @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 17f23ad8..6a0e7793 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 0f5ae87b..b03a29ba 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 44e6e8e6..0515dd86 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 ac91c95a..acb8b358 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 9a098f99..ee09c235 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 dd8f5f50..00000000 --- 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 87345394..3269537c 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 a6159f46..00000000 --- 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 318b5949..3bd62bc9 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 03a58c42..b34d0f7b 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%%};