diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Add.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Add.java index 25a947aa78..aa6cb50ea0 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Add.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Add.java @@ -49,8 +49,8 @@ public void tracePreOpcode(MessageFrame frame) { operations.add( new AddOperation( OpCode.of(frame.getCurrentOperation().getOpcode()), - frame.getStackItem(0), - frame.getStackItem(1))); + Bytes32.leftPad(frame.getStackItem(0)), + Bytes32.leftPad(frame.getStackItem(1)))); } @Override diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/AddOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/AddOperation.java index f4181706f1..0ceb2c48e8 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/AddOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/AddOperation.java @@ -58,10 +58,10 @@ private boolean overflowBit( return false; } - public AddOperation(OpCode opCode, Bytes arg1, Bytes arg2) { + public AddOperation(OpCode opCode, Bytes32 arg1, Bytes32 arg2) { this.opCode = opCode; - this.arg1 = Bytes32.leftPad(arg1); - this.arg2 = Bytes32.leftPad(arg2); + this.arg1 = arg1; + this.arg2 = arg2; } private int computeCtMax() { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java index 4b301caca2..e2fb9198e8 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java @@ -67,13 +67,11 @@ public class ReturnSection extends TraceSection boolean successfulMessageCallExpected; // for sanity check boolean successfulDeploymentExpected; // for sanity check - // TODO: trigger SHAKIRA - public ReturnSection(Hub hub) { super(hub, maxNumberOfRows(hub)); final CallFrame callFrame = hub.currentFrame(); - final MessageFrame messageFrame = hub.messageFrame(); + final MessageFrame messageFrame = callFrame.frame(); returnFromMessageCall = callFrame.isMessageCall(); returnFromDeployment = callFrame.isDeployment(); @@ -257,7 +255,7 @@ public void resolveAtContextReEntry(Hub hub, CallFrame frame) { // TODO: optional sanity check that may be removed if (returnFromDeployment) { - Bytes topOfTheStack = hub.messageFrame().getStackItem(0); + final Bytes topOfTheStack = hub.messageFrame().getStackItem(0); boolean deploymentWasSuccess = !topOfTheStack.isZero(); checkArgument(deploymentWasSuccess == successfulDeploymentExpected); } @@ -272,9 +270,6 @@ public void resolveAtContextReEntry(Hub hub, CallFrame frame) { DomSubStampsSubFragment.standardDomSubStamps(this.hubStamp(), 0)); if (nonemptyByteCode) { - // TODO: we require the - // - triggerHashInfo stuff on the first stack row (automatic AFAICT) - // - triggerROMLEX on the deploymentAccountFragment row (see below) deploymentAccountFragment.requiresRomlex(true); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/oob/OobOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/oob/OobOperation.java index 3bfc29c42d..6d5031e6f4 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/oob/OobOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/oob/OobOperation.java @@ -96,6 +96,7 @@ import net.consensys.linea.zktracer.types.EWord; import net.consensys.linea.zktracer.types.UnsignedByte; import org.apache.tuweni.bytes.Bytes; +import org.apache.tuweni.bytes.Bytes32; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.evm.account.Account; import org.hyperledger.besu.evm.frame.MessageFrame; @@ -480,8 +481,8 @@ private void callToADD( checkArgument(arg1Lo.bitLength() / 8 <= 16); checkArgument(arg2Hi.bitLength() / 8 <= 16); checkArgument(arg2Lo.bitLength() / 8 <= 16); - final EWord arg1 = EWord.of(arg1Hi, arg1Lo); - final EWord arg2 = EWord.of(arg2Hi, arg2Lo); + final Bytes32 arg1 = EWord.of(arg1Hi, arg1Lo); + final Bytes32 arg2 = EWord.of(arg2Hi, arg2Lo); addFlag[k] = true; modFlag[k] = false; wcpFlag[k] = false; diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/containers/StackedListTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/containers/StackedListTests.java index 2059c32f1f..3367c0aa48 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/containers/StackedListTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/containers/StackedListTests.java @@ -25,6 +25,7 @@ import net.consensys.linea.zktracer.module.add.AddOperation; import net.consensys.linea.zktracer.opcode.OpCode; import org.apache.tuweni.bytes.Bytes; +import org.apache.tuweni.bytes.Bytes32; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -32,14 +33,14 @@ public class StackedListTests { private static final AddOperation ONE_PLUS_ONE = new AddOperation( OpCode.ADD, - Bytes.wrap(BigInteger.ONE.toByteArray()), - Bytes.wrap(BigInteger.ONE.toByteArray())); + Bytes32.leftPad(Bytes.wrap(BigInteger.ONE.toByteArray())), + Bytes32.leftPad(Bytes.wrap(BigInteger.ONE.toByteArray()))); private static final AddOperation ONE_PLUS_TWO = new AddOperation( OpCode.ADD, - Bytes.wrap(BigInteger.ONE.toByteArray()), - Bytes.wrap(BigInteger.TWO.toByteArray())); + Bytes32.leftPad(Bytes.wrap(BigInteger.ONE.toByteArray())), + Bytes32.leftPad(Bytes.wrap(BigInteger.TWO.toByteArray()))); @RequiredArgsConstructor private static class IntegerModuleOperation extends ModuleOperation { diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/containers/StackedSetTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/containers/StackedSetTests.java index 6edd282f47..d9dd4873a0 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/containers/StackedSetTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/containers/StackedSetTests.java @@ -21,6 +21,7 @@ import net.consensys.linea.zktracer.module.add.AddOperation; import net.consensys.linea.zktracer.opcode.OpCode; import org.apache.tuweni.bytes.Bytes; +import org.apache.tuweni.bytes.Bytes32; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -29,14 +30,14 @@ public class StackedSetTests { private static final AddOperation ONE_PLUS_ONE = new AddOperation( OpCode.ADD, - Bytes.wrap(BigInteger.ONE.toByteArray()), - Bytes.wrap(BigInteger.ONE.toByteArray())); + Bytes32.leftPad(Bytes.wrap(BigInteger.ONE.toByteArray())), + Bytes32.leftPad(Bytes.wrap(BigInteger.ONE.toByteArray()))); private static final AddOperation ONE_PLUS_TWO = new AddOperation( OpCode.ADD, - Bytes.wrap(BigInteger.ONE.toByteArray()), - Bytes.wrap(BigInteger.TWO.toByteArray())); + Bytes32.leftPad(Bytes.wrap(BigInteger.ONE.toByteArray())), + Bytes32.leftPad(Bytes.wrap(BigInteger.TWO.toByteArray()))); @Test public void push() {