Skip to content
Open
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
3 changes: 2 additions & 1 deletion tests/hevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ def _prep_hevm_venom(venom_source_code, verbose=False):
# small class to ensure correct function traversal order and help with
# allocation
class _FunctionVisitor:
num_calldataloads = 0
visited: set
num_calldataloads: int

def __init__(self):
self.visited = set()
self.num_calldataloads = 0


def _prep_hevm_venom_ctx(ctx, verbose=False):
Expand Down
37 changes: 36 additions & 1 deletion tests/unit/hevm/test_hevm_negative.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from tests.hevm import hevm_check_venom, hevm_raises
from tests.hevm import _prep_hevm_venom, hevm_check_venom, hevm_raises

"""
Test that the hevm harness can actually detect faults,
Expand All @@ -11,6 +11,41 @@
pytestmark = pytest.mark.hevm


def test_hevm_source_limit():
# 8 symbolic sources should work (hevm limit: 256 bytes of calldata)
code8 = """
main:
%1 = source
%2 = source
%3 = source
%4 = source
%5 = source
%6 = source
%7 = source
%8 = source
sink %1
"""
result = _prep_hevm_venom(code8)
assert isinstance(result, str)

# 9 sources should fail the harness limit assertion
code9 = """
main:
%1 = source
%2 = source
%3 = source
%4 = source
%5 = source
%6 = source
%7 = source
%8 = source
%9 = source
sink %1
"""
with pytest.raises(AssertionError):
_prep_hevm_venom(code9)


def test_hevm_simple():
code1 = """
main:
Expand Down