Skip to content

Commit

Permalink
move test earlier in file
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Sep 1, 2023
1 parent bdcfaf2 commit 0336745
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions tests/parser/functions/test_raw_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,28 @@ def test_raw_call(_target: address) -> bool:
assert output1 == output2


# test functionality of max_outsize=0
def test_max_outsize_0_call(get_contract):
target_source = """
@external
@payable
def bar() -> uint256:
return 123
"""

caller_source = """
@external
@payable
def foo(_addr: address) -> bool:
success: bool = raw_call(_addr, method_id("bar()"), max_outsize=0, revert_on_failure=False)
return success
"""

target = get_contract(target_source)
caller = get_contract(caller_source)
assert caller.foo(target.address) is True


def test_static_call_fails_nonpayable(get_contract, assert_tx_failed):
target_source = """
baz: int128
Expand Down Expand Up @@ -404,32 +426,6 @@ def baz(_addr: address, should_raise: bool) -> uint256:
assert caller.baz(target.address, False) == 3


def test_max_outsize_zero(get_contract, w3, keccak):
target_source = """
@external
@payable
def foo() -> uint256:
return 123
"""

caller_source = """
@external
@payable
def foo(_addr: address) -> bool:
success: bool = raw_call(
_addr,
method_id("foo()"),
max_outsize=0,
revert_on_failure=False,
)
return success
"""

target = get_contract(target_source)
caller = get_contract(caller_source)
assert caller.foo(target.address) is True


uncompilable_code = [
(
"""
Expand Down

0 comments on commit 0336745

Please sign in to comment.