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

Remove wrong imm value set to None if Relocatable #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
8 changes: 4 additions & 4 deletions src/starkware/cairo/lang/vm/vm_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RunContext(RunContextBase):
fp: MaybeRelocatable
prime: int

def get_instruction_encoding(self) -> Tuple[int, Optional[int]]:
def get_instruction_encoding(self) -> Tuple[int, Optional[MaybeRelocatable]]:
"""
Returns the encoded instruction (the value at pc) and the immediate value (the value at
pc + 1, if it exists in the memory).
Expand All @@ -52,8 +52,6 @@ def get_instruction_encoding(self) -> Tuple[int, Optional[int]]:

imm_addr = (self.pc + 1) % self.prime
optional_imm = self.memory.get(imm_addr)
if not isinstance(optional_imm, int):
optional_imm = None
return instruction_encoding, optional_imm

def compute_dst_addr(self, instruction: Instruction):
Expand Down Expand Up @@ -276,7 +274,9 @@ def compute_res(
else:
raise NotImplementedError("Invalid res value")

def compute_operands(self, instruction: Instruction) -> Tuple[Operands, List[int]]:
def compute_operands(
self, instruction: Instruction
) -> Tuple[Operands, List[MaybeRelocatable]]:
"""
Computes the values of the operands. Deduces dst if needed.
Returns:
Expand Down