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

add explicit message when we find a library placeholder #158

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions src/halmos/sevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
hexify,
)
from .cheatcodes import halmos_cheat_code, hevm_cheat_code, console, Prank
from .warnings import warn, UNSUPPORTED_OPCODE
from .warnings import warn, UNSUPPORTED_OPCODE, LIBRARY_PLACEHOLDER

Word = Any # z3 expression (including constants)
Byte = Any # z3 expression (including constants)
Expand Down Expand Up @@ -501,7 +501,13 @@ def from_hexcode(hexcode: str):
if hexcode.startswith("0x"):
hexcode = hexcode[2:]

return Contract(bytes.fromhex(hexcode))
if "__" in hexcode:
warn(LIBRARY_PLACEHOLDER, f"contract hexcode contains library placeholder")

try:
return Contract(bytes.fromhex(hexcode))
except ValueError as e:
raise ValueError(f"{e} (hexcode={hexcode})")

def decode_instruction(self, pc: int) -> Instruction:
opcode = int_of(self[pc])
Expand Down
1 change: 1 addition & 0 deletions src/halmos/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def url(self) -> str:
COUNTEREXAMPLE_UNKNOWN = ErrorCode("counterexample-unknown")
INTERNAL_ERROR = ErrorCode("internal-error")
UNSUPPORTED_OPCODE = ErrorCode("unsupported-opcode")
LIBRARY_PLACEHOLDER = ErrorCode("library-placeholder")

LOOP_BOUND = ErrorCode("loop-bound")

Expand Down
Loading