diff --git a/tests/parser/functions/test_raw_call.py b/tests/parser/functions/test_raw_call.py index c8e0aa8bad..aaf190ac27 100644 --- a/tests/parser/functions/test_raw_call.py +++ b/tests/parser/functions/test_raw_call.py @@ -1,6 +1,7 @@ import pytest from hexbytes import HexBytes +from vyper import compile_code from vyper.builtins.functions import eip1167_bytecode from vyper.exceptions import ArgumentException, InvalidType, StateAccessViolation @@ -261,36 +262,28 @@ def __default__(): # check max_outsize=0 does same thing as not setting max_outsize +# compile to bytecode and compare bytecode directly. def test_max_outsize_0(get_contract): - mock1_code = """ + code1 = """ @external -def foo(): - return - """ - mock2_code = """ -@external -def foo(): - raise +def test_raw_call(_target: address) -> bool: + # compile raw_call both ways, with revert_on_failure + a: bool = raw_call(_target, method_id("foo()"), revert_on_failure=False) + # and without revert_on_failure + raw_call(_target, method_id("foo()")) + return a """ - code = """ + # write same code, but with max_outsize=0 + code2 = """ @external -def test_raw_call(_target: address) -> (bool, bool): - # compiles - a: bool = raw_call(_target, method_id("foo()"), revert_on_failure=False) - # should have same behavior - b: bool = raw_call(_target, method_id("foo()"), max_outsize=0, revert_on_failure=False) - return a, b +def test_raw_call(_target: address) -> bool: + a: bool = raw_call(_target, method_id("foo()"), max_outsize=0, revert_on_failure=False) + raw_call(_target, method_id("foo()"), max_outsize=0) + return a """ - - c = get_contract(code) - - mock1 = get_contract(mock1_code) - a, b = c.test_raw_call(mock1.address) - assert a == b and a is True - - mock2 = get_contract(mock2_code) - a, b = c.test_raw_call(mock2.address) - assert a == b and a is False + output1 = compile_code(code1, ["bytecode", "bytecode_runtime"]) + output2 = compile_code(code2, ["bytecode", "bytecode_runtime"]) + assert output1 == output2 def test_static_call_fails_nonpayable(get_contract, assert_tx_failed):