From e656ae0c7281144da4c0e69532f0a6412103cd27 Mon Sep 17 00:00:00 2001 From: delehef Date: Wed, 20 Dec 2023 10:21:58 +0100 Subject: [PATCH] refactor: group RLPs modules, use retro-compatible module keys (#508) --- .../java/net/consensys/linea/zktracer/module/hub/Hub.java | 6 +++--- .../consensys/linea/zktracer/module/logData/LogData.java | 4 ++-- .../consensys/linea/zktracer/module/logInfo/LogInfo.java | 4 ++-- .../zktracer/module/{rlpAddr => rlp/addr}/RlpAddr.java | 2 +- .../zktracer/module/{rlpAddr => rlp/addr}/RlpAddrChunk.java | 2 +- .../linea/zktracer/module/{rlpAddr => rlp/addr}/Trace.java | 2 +- .../linea/zktracer/module/{rlp_txn => rlp/txn}/RlpTxn.java | 4 ++-- .../zktracer/module/{rlp_txn => rlp/txn}/RlpTxnChunk.java | 2 +- .../module/{rlp_txn => rlp/txn}/RlpTxnColumnsValue.java | 2 +- .../linea/zktracer/module/{rlp_txn => rlp/txn}/Trace.java | 2 +- .../zktracer/module/{rlp_txn => rlp/txn}/TxnrlpTrace.java | 2 +- .../module/{rlp_txrcpt => rlp/txrcpt}/RlpTxrcpt.java | 2 +- .../module/{rlp_txrcpt => rlp/txrcpt}/RlpTxrcptChunk.java | 2 +- .../module/{rlp_txrcpt => rlp/txrcpt}/RlpTxrcptColumns.java | 2 +- .../module/{rlp_txrcpt => rlp/txrcpt}/RlpTxrcptTrace.java | 2 +- .../zktracer/module/{rlp_txrcpt => rlp/txrcpt}/Trace.java | 2 +- arithmetization/src/main/resources/spillings.toml | 2 +- .../consensys/linea/zktracer/module/hub/TestTwoPlusTwo.java | 5 +++++ .../linea/zktracer/module/rlp_txrcpt/RandomTxrcptTests.java | 1 + zkevm-constraints | 2 +- 20 files changed, 29 insertions(+), 23 deletions(-) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlpAddr => rlp/addr}/RlpAddr.java (99%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlpAddr => rlp/addr}/RlpAddrChunk.java (96%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlpAddr => rlp/addr}/Trace.java (99%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlp_txn => rlp/txn}/RlpTxn.java (99%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlp_txn => rlp/txn}/RlpTxnChunk.java (95%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlp_txn => rlp/txn}/RlpTxnColumnsValue.java (97%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlp_txn => rlp/txn}/Trace.java (99%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlp_txn => rlp/txn}/TxnrlpTrace.java (96%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlp_txrcpt => rlp/txrcpt}/RlpTxrcpt.java (99%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlp_txrcpt => rlp/txrcpt}/RlpTxrcptChunk.java (93%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlp_txrcpt => rlp/txrcpt}/RlpTxrcptColumns.java (97%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlp_txrcpt => rlp/txrcpt}/RlpTxrcptTrace.java (97%) rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/{rlp_txrcpt => rlp/txrcpt}/Trace.java (99%) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java index aeec9d35b0..174ae7fce1 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java @@ -58,9 +58,9 @@ import net.consensys.linea.zktracer.module.mod.Mod; import net.consensys.linea.zktracer.module.mul.Mul; import net.consensys.linea.zktracer.module.mxp.Mxp; -import net.consensys.linea.zktracer.module.rlpAddr.RlpAddr; -import net.consensys.linea.zktracer.module.rlp_txn.RlpTxn; -import net.consensys.linea.zktracer.module.rlp_txrcpt.RlpTxrcpt; +import net.consensys.linea.zktracer.module.rlp.addr.RlpAddr; +import net.consensys.linea.zktracer.module.rlp.txn.RlpTxn; +import net.consensys.linea.zktracer.module.rlp.txrcpt.RlpTxrcpt; import net.consensys.linea.zktracer.module.rom.Rom; import net.consensys.linea.zktracer.module.romLex.RomLex; import net.consensys.linea.zktracer.module.shf.Shf; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logData/LogData.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logData/LogData.java index 1208f33f7f..46d3299dae 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logData/LogData.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logData/LogData.java @@ -23,8 +23,8 @@ import net.consensys.linea.zktracer.ColumnHeader; import net.consensys.linea.zktracer.module.Module; -import net.consensys.linea.zktracer.module.rlp_txrcpt.RlpTxrcpt; -import net.consensys.linea.zktracer.module.rlp_txrcpt.RlpTxrcptChunk; +import net.consensys.linea.zktracer.module.rlp.txrcpt.RlpTxrcpt; +import net.consensys.linea.zktracer.module.rlp.txrcpt.RlpTxrcptChunk; import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.evm.log.Log; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logInfo/LogInfo.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logInfo/LogInfo.java index f693c2d640..95021bdae3 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logInfo/LogInfo.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logInfo/LogInfo.java @@ -21,8 +21,8 @@ import net.consensys.linea.zktracer.ColumnHeader; import net.consensys.linea.zktracer.module.Module; -import net.consensys.linea.zktracer.module.rlp_txrcpt.RlpTxrcpt; -import net.consensys.linea.zktracer.module.rlp_txrcpt.RlpTxrcptChunk; +import net.consensys.linea.zktracer.module.rlp.txrcpt.RlpTxrcpt; +import net.consensys.linea.zktracer.module.rlp.txrcpt.RlpTxrcptChunk; import org.apache.tuweni.bytes.Bytes32; import org.hyperledger.besu.evm.log.Log; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpAddr/RlpAddr.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/addr/RlpAddr.java similarity index 99% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpAddr/RlpAddr.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/addr/RlpAddr.java index f10205e75d..62a5547133 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpAddr/RlpAddr.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/addr/RlpAddr.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlpAddr; +package net.consensys.linea.zktracer.module.rlp.addr; import static net.consensys.linea.zktracer.module.rlputils.Pattern.byteCounting; import static net.consensys.linea.zktracer.types.AddressUtils.getCreate2Address; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpAddr/RlpAddrChunk.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/addr/RlpAddrChunk.java similarity index 96% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpAddr/RlpAddrChunk.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/addr/RlpAddrChunk.java index 6ad9839fe0..4f610afabb 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpAddr/RlpAddrChunk.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/addr/RlpAddrChunk.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlpAddr; +package net.consensys.linea.zktracer.module.rlp.addr; import java.math.BigInteger; import java.util.Optional; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpAddr/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/addr/Trace.java similarity index 99% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpAddr/Trace.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/addr/Trace.java index 3fb440101f..97f01f5116 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpAddr/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/addr/Trace.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlpAddr; +package net.consensys.linea.zktracer.module.rlp.addr; import java.nio.MappedByteBuffer; import java.util.BitSet; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/RlpTxn.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/RlpTxn.java similarity index 99% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/RlpTxn.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/RlpTxn.java index 9a24fce6ce..0801b13501 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/RlpTxn.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/RlpTxn.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlp_txn; +package net.consensys.linea.zktracer.module.rlp.txn; import static net.consensys.linea.zktracer.module.Util.getTxTypeAsInt; import static net.consensys.linea.zktracer.module.rlputils.Pattern.byteCounting; @@ -65,7 +65,7 @@ public RlpTxn(RomLex _romLex) { @Override public String moduleKey() { - return "RLP_TXN"; + return "TX_RLP"; } public static final int LLARGE = TxnrlpTrace.LLARGE.intValue(); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/RlpTxnChunk.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/RlpTxnChunk.java similarity index 95% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/RlpTxnChunk.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/RlpTxnChunk.java index 1dc5f90035..e6039b575a 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/RlpTxnChunk.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/RlpTxnChunk.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlp_txn; +package net.consensys.linea.zktracer.module.rlp.txn; import java.util.Optional; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/RlpTxnColumnsValue.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/RlpTxnColumnsValue.java similarity index 97% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/RlpTxnColumnsValue.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/RlpTxnColumnsValue.java index 2b0d1ab45b..ce1ab401ef 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/RlpTxnColumnsValue.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/RlpTxnColumnsValue.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlp_txn; +package net.consensys.linea.zktracer.module.rlp.txn; import java.math.BigInteger; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/Trace.java similarity index 99% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/Trace.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/Trace.java index dbe74ab4df..b622967633 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/Trace.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlp_txn; +package net.consensys.linea.zktracer.module.rlp.txn; import java.nio.MappedByteBuffer; import java.util.BitSet; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/TxnrlpTrace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/TxnrlpTrace.java similarity index 96% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/TxnrlpTrace.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/TxnrlpTrace.java index 68ad0fab0a..a4a9fbad1e 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txn/TxnrlpTrace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txn/TxnrlpTrace.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlp_txn; +package net.consensys.linea.zktracer.module.rlp.txn; import java.math.BigInteger; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcpt.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcpt.java similarity index 99% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcpt.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcpt.java index 0d7e00d976..a63678f90d 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcpt.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcpt.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlp_txrcpt; +package net.consensys.linea.zktracer.module.rlp.txrcpt; import static net.consensys.linea.zktracer.module.rlputils.Pattern.byteCounting; import static net.consensys.linea.zktracer.module.rlputils.Pattern.outerRlpSize; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcptChunk.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcptChunk.java similarity index 93% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcptChunk.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcptChunk.java index 091dd064de..6d657d05ac 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcptChunk.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcptChunk.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlp_txrcpt; +package net.consensys.linea.zktracer.module.rlp.txrcpt; import java.util.List; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcptColumns.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcptColumns.java similarity index 97% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcptColumns.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcptColumns.java index 9988c626da..7f2de5a8d8 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcptColumns.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcptColumns.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlp_txrcpt; +package net.consensys.linea.zktracer.module.rlp.txrcpt; import java.math.BigInteger; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcptTrace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcptTrace.java similarity index 97% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcptTrace.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcptTrace.java index 7bced5a06b..392a43158b 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RlpTxrcptTrace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/RlpTxrcptTrace.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlp_txrcpt; +package net.consensys.linea.zktracer.module.rlp.txrcpt; import com.fasterxml.jackson.annotation.JsonProperty; import net.consensys.linea.zktracer.module.ModuleTrace; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/Trace.java similarity index 99% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/Trace.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/Trace.java index 4281bd0214..7cebc91e50 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp_txrcpt/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlp/txrcpt/Trace.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.module.rlp_txrcpt; +package net.consensys.linea.zktracer.module.rlp.txrcpt; import java.nio.MappedByteBuffer; import java.util.BitSet; diff --git a/arithmetization/src/main/resources/spillings.toml b/arithmetization/src/main/resources/spillings.toml index 5d7fbb73cb..f87ddc06f6 100644 --- a/arithmetization/src/main/resources/spillings.toml +++ b/arithmetization/src/main/resources/spillings.toml @@ -14,7 +14,7 @@ MUL = 9 MXP = 4 MMU = 10 RLP_ADDR = 7 -RLP_TXN = 7 +TX_RLP = 7 RLP_TXRCPT = 7 ROM = 2 ROM_LEX = 1 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 cb3fb44fd5..82f2adb748 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 @@ -29,4 +29,9 @@ void testAdd() { BytecodeRunner.of(BytecodeCompiler.newProgram().push(32).push(27).op(OpCode.ADD).compile()) .run(); } + + @Test + void testBreakingCall() { + BytecodeRunner.of(BytecodeCompiler.newProgram().push(32).op(OpCode.CALL).compile()).run(); + } } diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RandomTxrcptTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RandomTxrcptTests.java index 518943141a..b96ca259d6 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RandomTxrcptTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlp_txrcpt/RandomTxrcptTests.java @@ -24,6 +24,7 @@ import net.consensys.linea.zktracer.module.logData.LogData; import net.consensys.linea.zktracer.module.logInfo.LogInfo; +import net.consensys.linea.zktracer.module.rlp.txrcpt.RlpTxrcpt; import net.consensys.linea.zktracer.opcode.OpCodes; import net.consensys.linea.zktracer.testing.ToyAccount; import net.consensys.linea.zktracer.testing.ToyTransaction; diff --git a/zkevm-constraints b/zkevm-constraints index 6e29227639..405afa488d 160000 --- a/zkevm-constraints +++ b/zkevm-constraints @@ -1 +1 @@ -Subproject commit 6e292276396e2309dac45e8905bdfc0fd45e8cf6 +Subproject commit 405afa488d169ec188702b2084ec5c608b415f38