Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing underflowException in KeccakSection and same fix for blockhash module #1401

Merged
merged 5 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not usefull for BLOCKHASH as we trigger it at preOpCode ony not exceptional :
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I undid the "fix".

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.consensys.linea.zktracer.container.stacked.ModuleOperationStackedSet;
import net.consensys.linea.zktracer.module.hub.Hub;
import net.consensys.linea.zktracer.module.hub.defer.PostOpcodeDefer;
import net.consensys.linea.zktracer.module.hub.signals.Exceptions;
import net.consensys.linea.zktracer.module.wcp.Wcp;
import net.consensys.linea.zktracer.opcode.OpCode;
import org.apache.tuweni.bytes.Bytes;
Expand Down Expand Up @@ -105,6 +106,11 @@ public void tracePreOpcode(MessageFrame frame) {
@Override
public void resolvePostExecution(
Hub hub, MessageFrame frame, Operation.OperationResult operationResult) {

if (Exceptions.any(hub.pch().exceptions())) {
return;
}

final OpCode opCode = OpCode.of(frame.getCurrentOperation().getOpcode());
if (opCode == OpCode.BLOCKHASH) {
final Bytes32 result = Bytes32.leftPad(frame.getStackItem(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public KeccakSection(Hub hub) {
@Override
public void resolvePostExecution(
Hub hub, MessageFrame frame, Operation.OperationResult operationResult) {

if (Exceptions.any(hub.pch().exceptions())) {
return;
}

final Bytes32 hashResult = Bytes32.leftPad(frame.getStackItem(0));

// retroactively set HASH_INFO_FLAG and HASH_INFO_KECCAK_HI, HASH_INFO_KECCAK_LO
Expand Down
Loading