Skip to content

Commit

Permalink
Merge branch 'main' into structure_change
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcere committed Jan 21, 2025
2 parents 325fdde + 4cbac41 commit 5e0297d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/parser/cfg_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def _build_spec_for_sequence(self, instructions: List[CFGInstruction], map_instr
ins_spec = map_instructions.get((ins.get_op_name().upper(), tuple(ins.get_in_args())), None)

if ins_spec is not None:
if len(ins_spec["outpt_sk"]) == 0 or ins_spec["outpt_sk"] == ins.get_out_args():
if len(ins_spec["outpt_sk"]) == 0 or ins_spec["outpt_sk"] != ins.get_out_args():
# Memory operations have an extra check: repeated keccaks or loads with the same arguments
# generate no instruction unless their output stack value is different
ins_spec = None
Expand Down
3 changes: 2 additions & 1 deletion src/parser/cfg_instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def memory_operation(self):
Memory operation: STORE operations and function calls
"""
# TODO: handle keccaks and loads better
return "STORE" in self.op or self.op not in opcodes.opcodes or "LOAD" in self.op or "KECCAK" in self.op
upper_repr = self.op.upper()
return any(op in upper_repr for op in ["STORE", "LOAD", "KECCAK"]) or self.op not in opcodes.opcodes

def set_builtin_args(self, builtin: List[str]) -> None:
self.builtin_args = builtin
Expand Down

0 comments on commit 5e0297d

Please sign in to comment.