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

feat[venom]: implement mem2var and sccp passes #3941

Merged
merged 563 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
563 commits
Select commit Hold shift + click to select a range
aff18ad
added comment
harkal Mar 20, 2024
560e4a9
remove debugging leftover
harkal Mar 20, 2024
b942c03
rename members
harkal Mar 20, 2024
0c066f6
lint
harkal Mar 20, 2024
54feec4
assert there is a producing instruction
harkal Mar 20, 2024
0b5e764
remove unnecessary check
harkal Mar 21, 2024
20536bf
variable name elaboration
harkal Mar 21, 2024
2a404cc
add documentation
harkal Mar 21, 2024
6259962
update dominator users
harkal Mar 21, 2024
3c88c50
lint
charles-cooper Mar 21, 2024
50146d1
depth first
harkal Mar 21, 2024
06d216f
lint
harkal Mar 21, 2024
d72a41f
add volatile instruction
harkal Mar 21, 2024
46fe757
fix dominator test
harkal Mar 21, 2024
1325d48
revert
harkal Mar 21, 2024
ef78ccf
before cleanup
harkal Mar 22, 2024
86acccb
improvements to OrderedSet performance
charles-cooper Mar 22, 2024
fbe4e28
index basic blocks
charles-cooper Mar 22, 2024
6ebf977
add comment
charles-cooper Mar 22, 2024
bcfa42d
OrderedSet hide dict implementation better
charles-cooper Mar 22, 2024
3e4de66
cleanupo
harkal Mar 22, 2024
84a02d7
mark test
harkal Mar 22, 2024
afa5173
some more small optimizations
charles-cooper Mar 22, 2024
58e1a33
fix a couple tests
charles-cooper Mar 22, 2024
0e59adb
Merge pull request #5 from charles-cooper/perf/venom
harkal Mar 22, 2024
8bc466f
fix workflow
harkal Mar 22, 2024
6f9923e
lint
harkal Mar 22, 2024
66977b4
remove some xfails
charles-cooper Mar 22, 2024
fb5d87d
Merge branch 'master' into feature/venom_updates
charles-cooper Mar 23, 2024
91ea9bd
lint
harkal Mar 23, 2024
544c90c
add some comments, sanity check
charles-cooper Mar 23, 2024
c05bcff
add some review comments
charles-cooper Mar 23, 2024
91a9401
fix cursed __repr__ function
charles-cooper Mar 24, 2024
0a0d592
Merge branch 'master' into feature/venom_updates
harkal Mar 24, 2024
15573c4
Merge branch 'feature/venom_updates' of github.com:harkal/vyper into …
harkal Mar 24, 2024
10d3c82
lint
harkal Mar 24, 2024
affdb09
change mstore evaluation order
harkal Mar 24, 2024
9909513
protect b from double evaluation
harkal Mar 24, 2024
c3b4dc7
revert mstore evaluation order
harkal Mar 24, 2024
193f275
Merge branch 'feature/venom_updates' into feature/sccp
harkal Mar 26, 2024
64c107d
update dominator tree usage
harkal Mar 26, 2024
cedd518
Merge branch 'master' into feature/venom_updates
harkal Mar 26, 2024
b1ba5cb
add review
charles-cooper Mar 26, 2024
ebf776e
refactor dominator tree constructor
harkal Mar 26, 2024
8400481
rename variables, refactor code
harkal Mar 26, 2024
52c6f61
commenting
harkal Mar 26, 2024
a5a1844
add DominatorTree.build_dominator_tree()
harkal Mar 26, 2024
3e53d7f
Merge branch 'master' into feature/venom_updates
harkal Mar 26, 2024
fec8b84
ensure revaluation order for select
harkal Mar 27, 2024
85bbd8c
Merge branch 'master' into feature/venom_updates
harkal Mar 28, 2024
50cb1b4
lint
harkal Mar 28, 2024
4a8a472
Update vyper/codegen/stmt.py
harkal Mar 28, 2024
4beaaa4
unlint
harkal Mar 28, 2024
f57a9d1
verify phi placement
harkal Mar 28, 2024
6099dae
Merge branch 'feature/venom_updates' of github.com:harkal/vyper into …
harkal Mar 28, 2024
fece7b1
remove stray alloca
harkal Mar 28, 2024
7ac26d8
Merge branch 'feature/venom_updates' into feature/sccp
harkal Apr 2, 2024
34eba09
missplaced comment
harkal Apr 2, 2024
9206f81
Merge branch 'feature/venom_updates' into feature/sccp
harkal Apr 2, 2024
14f00b3
handle unused
harkal Apr 2, 2024
664cd8f
Add arithmetic optimization to SCCP pass
harkal Apr 2, 2024
bf0b217
Add constant propagation method to SCCP pass
harkal Apr 2, 2024
1c6d6f0
make settings into a global object
charles-cooper Mar 21, 2024
319be84
do not perform deallocation in venom pipeline
charles-cooper Mar 21, 2024
a047691
wip -- change new_variable to return IRnode with alloca metadata instead
charles-cooper Mar 21, 2024
b79403a
pass thru alloca in gep
charles-cooper Mar 21, 2024
685164c
fix a fixture scope
charles-cooper Mar 21, 2024
73a68f1
use more add_ofst / fix instances where IRnodes are not expected
charles-cooper Mar 21, 2024
21eefb3
fix some more instances
charles-cooper Mar 21, 2024
5518af3
fix a comment
charles-cooper Mar 21, 2024
4a3bd4b
fix bad evm_version fixture
charles-cooper Mar 23, 2024
b37d4d9
fix some fixtures
charles-cooper Mar 23, 2024
a5dd7bb
small fix
charles-cooper Mar 23, 2024
597d00a
fix another builtin bug
charles-cooper Mar 23, 2024
75169cc
fix typo
charles-cooper Mar 23, 2024
aa19207
fix a bad from_list
charles-cooper Mar 23, 2024
ab9d60f
last fixes
charles-cooper Mar 23, 2024
0f75973
simplify alloca, lint
charles-cooper Mar 23, 2024
3221c1c
update alloca check
charles-cooper Mar 23, 2024
5adc7d4
fix with variable shadowing
charles-cooper Mar 23, 2024
42289dd
update alloca generation
charles-cooper Mar 24, 2024
593d2ee
remove memory elision code
charles-cooper Mar 24, 2024
b22ab61
remove mload and mstore handling in ir_node_to_venom
charles-cooper Mar 24, 2024
77427f6
lint
charles-cooper Mar 24, 2024
607502d
fix buf in revert with reason
charles-cooper Mar 24, 2024
24d7eac
fix a variable lookup
charles-cooper Mar 24, 2024
df3b5b8
Merge branch 'master' into venom-alloca
charles-cooper Apr 2, 2024
f7d9432
fix order of arguments
charles-cooper Apr 2, 2024
e41e6d6
fix bad variable
charles-cooper Apr 2, 2024
00bc095
fix another variable
charles-cooper Apr 2, 2024
5c3231b
remove mstore from passthru instructions, add argument names
charles-cooper Apr 2, 2024
7569a34
another variable rename
charles-cooper Apr 2, 2024
ca4a817
Add Mem2Stack pass to optimize memory usage
harkal Apr 2, 2024
55b852e
Refactor IRPass class to use instance methods instead of class methods
harkal Apr 3, 2024
345f9f5
Update code to use pass instances
harkal Apr 3, 2024
6fb76e2
Update tests to use pass instances
harkal Apr 3, 2024
53587b9
Merge branch 'fix/use_pass_instances' into mem2stack
harkal Apr 3, 2024
d529b4b
Merge branch 'fix/use_pass_instances' into feature/sccp
harkal Apr 3, 2024
6fcea4d
remove parameters
harkal Apr 3, 2024
f8d88d2
remove test
harkal Apr 3, 2024
37a8985
Remove unnecessary __eq__ method from IRVariable class
harkal Apr 3, 2024
4a6fd78
revert symbols change
charles-cooper Apr 3, 2024
b0e918e
fix operand order
charles-cooper Apr 3, 2024
1a27693
fix a defaults test
charles-cooper Apr 3, 2024
b908cae
Merge branch 'venom-alloca' into mem2stack
harkal Apr 3, 2024
ebf38d9
Refactor Mem2Stack pass to use DFG outputs
harkal Apr 3, 2024
731da63
Refactor Mem2Stack pass and MakeSSA pass
harkal Apr 3, 2024
4dd5384
Merge branch 'mem2stack' into feature/sccp
harkal Apr 3, 2024
53d1711
Merge branch 'master' into feature/sccp
harkal Apr 3, 2024
d372ad9
wip -- different kind of alloca for internal function params
charles-cooper Apr 3, 2024
5c18284
temp
harkal Apr 4, 2024
b28ac5a
Merge branch 'venom-alloca' into feature/sccp
harkal Apr 4, 2024
6799b97
param alloca
harkal Apr 4, 2024
b193c70
Add global symbol tracking in ir_node_to_venom.py
harkal Apr 5, 2024
a60fa6c
temp commit
harkal Apr 5, 2024
8d6699a
Refactor memory allocation to use stack
harkal Apr 5, 2024
69e3ec1
Refactor if-else block in ir_node_to_venom.py
harkal Apr 5, 2024
ce9f447
add global symbol saving/restoring for repeat body
harkal Apr 5, 2024
3c48258
enable sccp
harkal Apr 5, 2024
1a424c5
run sccp on all functions
harkal Apr 5, 2024
9dcd136
Merge branch 'master' into feature/sccp
harkal Apr 5, 2024
a8e8576
remove unused parameter
harkal Apr 5, 2024
07ba210
fix merge accident
harkal Apr 5, 2024
f8b5a04
cleanup
harkal Apr 5, 2024
8036078
refactor
harkal Apr 5, 2024
b09cddf
lint
harkal Apr 5, 2024
432b830
fix
harkal Apr 5, 2024
efd533a
fixes
harkal Apr 6, 2024
2298a27
refactor class hierarchy
harkal Apr 6, 2024
63a6d84
use new class structure and `is_` functions
harkal Apr 6, 2024
29ae288
refactor IROperand as base
harkal Apr 6, 2024
0fbd68a
lint
harkal Apr 6, 2024
ea34e4d
remove unused member
harkal Apr 6, 2024
b1a8c37
Merge branch 'refactor/venom_classes' into feature/sccp
harkal Apr 6, 2024
ae53c2d
refactors
harkal Apr 6, 2024
fae87ba
Refactor IROperand checks to use isinstance() instead of custom funct…
harkal Apr 6, 2024
273f814
Merge branch 'master' into refactor/venom_classes
harkal Apr 6, 2024
cbd6a13
Merge branch 'refactor/venom_classes' into feature/sccp
harkal Apr 6, 2024
213b205
use isinstance
harkal Apr 6, 2024
f3be009
Merge branch 'master' into feature/sccp
harkal Apr 7, 2024
0e44392
constant jump optimization
harkal Apr 8, 2024
b04e08c
lint
harkal Apr 8, 2024
200f816
`nop` instruction
harkal Apr 8, 2024
313881a
temp
harkal Apr 8, 2024
2b69335
Fix SCCP algorithm and add conditional jump optimization
harkal Apr 8, 2024
dde71b9
Fix SCCP propagation bug
harkal Apr 8, 2024
78efcf7
Remove phi operand method
harkal Apr 8, 2024
1647e3e
Updated unreachable block elimination with new phi
harkal Apr 8, 2024
9a04a28
Fix phi operand bug in SCCP pass
harkal Apr 8, 2024
50fbdd8
Refactor SCCP pass to propagate variables for cleaner code for humans
harkal Apr 8, 2024
9055dca
reverse condition order
harkal Apr 8, 2024
dcea498
Refactor SCCP pass files and evaluation functions
harkal Apr 9, 2024
2c30b7c
Add CEILING_UINT256 constant to SizeLimits class
harkal Apr 9, 2024
0f92f1e
clean sccp
harkal Apr 9, 2024
dcaaefd
Refactor arithmetic operations in SCCP evaluation
harkal Apr 9, 2024
cda1348
Update arithmetic operations in SCCP
harkal Apr 9, 2024
6e3d7fc
fix phi issue
harkal Apr 9, 2024
c75c89c
fixes
harkal Apr 9, 2024
ddb5795
Merge branch 'master' into feature/sccp
harkal Apr 9, 2024
05194e3
Merge branch 'master' into feature/sccp
harkal Apr 10, 2024
d116cc1
Fix operand order in binary operations and add new EVM instructions
harkal Apr 10, 2024
ee833ed
block optimization and remove unreachable blocks
harkal Apr 10, 2024
b12717a
Commented out SCCP pass and rearranged code
harkal Apr 10, 2024
779ce77
Fix operand order in EVM shift operations
harkal Apr 10, 2024
5ae8ede
Refactor Mem2Stack pass and add variable propagation
harkal Apr 10, 2024
1e93650
enable for internals
harkal Apr 11, 2024
53fcc75
Add _evm_not function to handle bitwise NOT operation
harkal Apr 11, 2024
85e6ad8
update test cases in test_sccp
harkal Apr 11, 2024
536af1e
fix branch selection logic to actually use _meet()
harkal Apr 11, 2024
ca97135
disable variable propagation
harkal Apr 11, 2024
b29975d
fixes
harkal Apr 11, 2024
dd481fc
fix exp evaluation
harkal Apr 11, 2024
f4b2fdc
lint
harkal Apr 11, 2024
d2d053d
Refactor exp in SCCP evaluation
harkal Apr 11, 2024
7c232b0
fix successor phis
harkal Apr 12, 2024
36da602
Fix incorrect lattice values in test_sccp.py
harkal Apr 12, 2024
153844a
Fix signed integer operations in SCCP evaluation
harkal Apr 12, 2024
184f371
add `abort` venom instruction
harkal Apr 12, 2024
393b290
Swap order of operands in _evm_signextend function
harkal Apr 12, 2024
234b208
Remove xfail markers from test functions
harkal Apr 12, 2024
c5ac59a
bugfix DFT
harkal Apr 12, 2024
2354c8a
Remove unused code and add new instruction "abort"
harkal Apr 12, 2024
63e2300
cleanup
harkal Apr 12, 2024
6016d1b
Merge branch 'master' into feature/sccp
harkal Apr 12, 2024
a76341a
Add type hinting for ARITHMETIC_OPS dictionary
harkal Apr 13, 2024
8c728b0
lint
harkal Apr 13, 2024
4a8def3
Remove unused imports
harkal Apr 13, 2024
96abd9f
lint
harkal Apr 13, 2024
2a5e22b
raise CompilerPanic for unimplemented djmp with literal
harkal Apr 13, 2024
9f9f1da
lint
harkal Apr 13, 2024
cbd5a58
Remove unused imports and optimize imports in venom/__init__.py
harkal Apr 13, 2024
8a7024f
refactor sccp code
harkal Apr 14, 2024
ca40950
Enable liveness display in IRInstruction class
harkal Apr 14, 2024
1b227f7
return iterators when posible
harkal Apr 14, 2024
adcbda7
Remove commented code in ir_node_to_venom.py
harkal Apr 14, 2024
8047ce1
Remove unused function
harkal Apr 14, 2024
073ddd2
Refactor `self.uses` handling to simplify code
harkal Apr 14, 2024
4e41719
comments and a small optimization
harkal Apr 14, 2024
5506b40
comments and cleanup
harkal Apr 14, 2024
cbec0a5
Remove unused code
harkal Apr 15, 2024
ac841ec
add comment
harkal Apr 15, 2024
b5548eb
lint
harkal Apr 15, 2024
c2a17ed
Remove `abort` opcode, make false assertions into compile error
harkal Apr 15, 2024
34593bf
assertion failure and add get_ast_source method
harkal Apr 15, 2024
2a77c88
fix signextend
harkal Apr 15, 2024
225c593
lint
harkal Apr 15, 2024
975d4eb
`ast_source` made into `IRnode`
harkal Apr 15, 2024
1238c96
formatting
harkal Apr 15, 2024
b184206
update tests for venom compile time asserts
harkal Apr 15, 2024
9545e36
formatting
harkal Apr 15, 2024
b105a01
update test for venom compile type assert
harkal Apr 15, 2024
e602265
remove unsused local
harkal Apr 15, 2024
19c6a77
Merge branch 'master' into feature/sccp
harkal Apr 15, 2024
d234400
use `pytest.raises()'
harkal Apr 15, 2024
02bcf8b
snakecasefy
harkal Apr 15, 2024
e684bd4
rename functions
harkal Apr 15, 2024
8bda3f9
bound iterations
harkal Apr 15, 2024
298504f
lint
harkal Apr 15, 2024
913124f
right right shift
harkal Apr 15, 2024
75a0bcb
Panic for too many iterations in SimplifyCFGPass
harkal Apr 15, 2024
238d28e
refactor
harkal Apr 15, 2024
09cb6ce
make use of vyper signed/unsigned conversion utility functions
harkal Apr 16, 2024
eba81af
Refactor EVM evaluation functions
harkal Apr 16, 2024
c778fbb
refactor _evm_iszero function
harkal Apr 16, 2024
b01b9af
Add input value bounds checks in SCCP evaluation functions
harkal Apr 16, 2024
6bd1822
remove masking
harkal Apr 16, 2024
93ae7ed
Merge branch 'master' into feature/sccp
harkal Apr 16, 2024
5cd9c3e
Rename Mem2Stack to Mem2Var
harkal Apr 17, 2024
1d0ae1c
generalize `mstore` insertion before `return`
harkal Apr 17, 2024
c83940a
remove fast paths
harkal Apr 17, 2024
13d7cc2
use snake_case naming convention
harkal Apr 17, 2024
40ad200
remove basic_block from SSAWorkItem
harkal Apr 17, 2024
251181d
rename `vars` to `in_vars`
harkal Apr 17, 2024
bc95d0c
Move `cfg_in_exec` to `SCCP`
harkal Apr 17, 2024
a318522
remove fast return
harkal Apr 17, 2024
1c8df40
nbytes
harkal Apr 17, 2024
cf478ed
Raise invalid work item type handling in SCCP
harkal Apr 17, 2024
34354a0
Merge branch 'master' into feature/sccp
harkal Apr 22, 2024
3c3072c
Reform type assertion in IRInstruction class
harkal Apr 22, 2024
be86cbf
refactor
harkal Apr 22, 2024
ea0b57f
remove unused self.dom
harkal Apr 22, 2024
5e2be93
add back check
harkal Apr 22, 2024
3769faa
remove unused import
harkal Apr 22, 2024
a8a6951
oob tests for compile/run time
harkal Apr 22, 2024
4bb67fb
lint
harkal Apr 22, 2024
e3b40d1
Merge branch 'master' into feature/sccp
charles-cooper Apr 24, 2024
3dca106
Fix typo in simplify_cfg.py
harkal Apr 26, 2024
4c3b252
compile/runtime tests
harkal Apr 26, 2024
2bee449
Fix typo
harkal Apr 26, 2024
8bd05a9
reference wegman+zadeck
charles-cooper Apr 26, 2024
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
4 changes: 1 addition & 3 deletions tests/functional/builtins/codegen/test_abi_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from eth.codecs import abi

from tests.utils import decimal_to_int
from vyper.exceptions import ArgumentException, StackTooDeep, StructureException
from vyper.exceptions import ArgumentException, StructureException

TEST_ADDR = "0x" + b"".join(chr(i).encode("utf-8") for i in range(20)).hex()

Expand Down Expand Up @@ -201,7 +201,6 @@ def abi_decode(x: Bytes[{len}]) -> DynArray[DynArray[uint256, 3], 3]:

@pytest.mark.parametrize("args", nested_3d_array_args)
@pytest.mark.parametrize("unwrap_tuple", (True, False))
@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_abi_decode_nested_dynarray2(get_contract, args, unwrap_tuple):
if unwrap_tuple is True:
encoded = abi.encode("(uint256[][][])", (args,))
Expand Down Expand Up @@ -279,7 +278,6 @@ def foo(bs: Bytes[160]) -> (uint256, DynArray[uint256, 3]):
assert c.foo(encoded) == [2**256 - 1, bs]


@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_abi_decode_private_nested_dynarray(get_contract):
code = """
bytez: DynArray[DynArray[DynArray[uint256, 3], 3], 3]
Expand Down
3 changes: 0 additions & 3 deletions tests/functional/builtins/codegen/test_abi_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from eth.codecs import abi

from tests.utils import decimal_to_int
from vyper.exceptions import StackTooDeep


# @pytest.mark.parametrize("string", ["a", "abc", "abcde", "potato"])
Expand Down Expand Up @@ -227,7 +226,6 @@ def abi_encode(


@pytest.mark.parametrize("args", nested_3d_array_args)
@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_abi_encode_nested_dynarray_2(get_contract, args):
code = """
@external
Expand Down Expand Up @@ -332,7 +330,6 @@ def foo(bs: DynArray[uint256, 3]) -> (uint256, Bytes[160]):
assert c.foo(bs) == [2**256 - 1, abi.encode("(uint256[])", (bs,))]


@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_abi_encode_private_nested_dynarray(get_contract):
code = """
bytez: Bytes[1696]
Expand Down
55 changes: 49 additions & 6 deletions tests/functional/codegen/features/iteration/test_for_range.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import pytest

from vyper.exceptions import StaticAssertionException
from vyper.utils import SizeLimits


def test_basic_repeater(get_contract_with_gas_estimation):
basic_repeater = """
Expand Down Expand Up @@ -271,17 +274,38 @@ def test():


@pytest.mark.parametrize("typ", ["uint8", "int128", "uint256"])
def test_for_range_oob_check(get_contract, tx_failed, typ):
def test_for_range_oob_compile_time_check(get_contract, tx_failed, typ, experimental_codegen):
code = f"""
@external
def test():
x: {typ} = max_value({typ})
for i: {typ} in range(x, x + 2, bound=2):
pass
"""
if not experimental_codegen:
return
with pytest.raises(StaticAssertionException):
get_contract(code)


@pytest.mark.parametrize(
"typ, max_value",
[
("uint8", SizeLimits.MAX_UINT8),
("int128", SizeLimits.MAX_INT128),
("uint256", SizeLimits.MAX_UINT256),
],
)
def test_for_range_oob_runtime_check(get_contract, tx_failed, typ, max_value):
code = f"""
@external
def test(x: {typ}):
for i: {typ} in range(x, x + 2, bound=2):
pass
"""
c = get_contract(code)
with tx_failed():
c.test()
c.test(max_value)


@pytest.mark.parametrize("typ", ["int128", "uint256"])
Expand Down Expand Up @@ -416,7 +440,25 @@ def foo(a: {typ}) -> {typ}:
assert c.foo(0) == 31337


def test_for_range_signed_int_overflow(get_contract, tx_failed):
def test_for_range_signed_int_overflow_runtime_check(get_contract, tx_failed, experimental_codegen):
code = """
@external
def foo(_min:int256, _max: int256) -> DynArray[int256, 10]:
res: DynArray[int256, 10] = empty(DynArray[int256, 10])
x:int256 = _max
y:int256 = _min+2
for i:int256 in range(x,y , bound=10):
res.append(i)
return res
"""
c = get_contract(code)
with tx_failed():
c.foo(SizeLimits.MIN_INT256, SizeLimits.MAX_INT256)


def test_for_range_signed_int_overflow_compile_time_check(
get_contract, tx_failed, experimental_codegen
):
code = """
@external
def foo() -> DynArray[int256, 10]:
Expand All @@ -427,6 +469,7 @@ def foo() -> DynArray[int256, 10]:
res.append(i)
return res
"""
c = get_contract(code)
with tx_failed():
c.foo()
if not experimental_codegen:
return
with pytest.raises(StaticAssertionException):
get_contract(code)
4 changes: 0 additions & 4 deletions tests/functional/codegen/features/test_constructor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import pytest
from web3.exceptions import ValidationError

from vyper.exceptions import StackTooDeep


def test_init_argument_test(get_contract_with_gas_estimation):
init_argument_test = """
Expand Down Expand Up @@ -165,7 +163,6 @@ def get_foo() -> uint256:
assert c.get_foo() == 39


@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_nested_dynamic_array_constructor_arg_2(w3, get_contract_with_gas_estimation):
code = """
foo: int128
Expand Down Expand Up @@ -211,7 +208,6 @@ def get_foo() -> DynArray[DynArray[uint256, 3], 3]:
assert c.get_foo() == [[37, 41, 73], [37041, 41073, 73037], [146, 123, 148]]


@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_initialise_nested_dynamic_array_2(w3, get_contract_with_gas_estimation):
code = """
foo: DynArray[DynArray[DynArray[int128, 3], 3], 3]
Expand Down
2 changes: 0 additions & 2 deletions tests/functional/codegen/features/test_immutable.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest

from vyper.compiler.settings import OptimizationLevel
from vyper.exceptions import StackTooDeep


@pytest.mark.parametrize(
Expand Down Expand Up @@ -199,7 +198,6 @@ def get_idx_two() -> uint256:
assert c.get_idx_two() == expected_values[2][2]


@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_nested_dynarray_immutable(get_contract):
code = """
my_list: immutable(DynArray[DynArray[DynArray[int128, 3], 3], 3])
Expand Down
26 changes: 22 additions & 4 deletions tests/functional/codegen/types/numbers/test_signed_ints.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from vyper.exceptions import (
InvalidOperation,
OverflowException,
StaticAssertionException,
TypeMismatch,
ZeroDivisionException,
)
Expand Down Expand Up @@ -73,18 +74,35 @@ def foo(x: int256) -> int256:

# TODO: make this test pass
@pytest.mark.parametrize("base", (0, 1))
def test_exponent_negative_power(get_contract, tx_failed, base):
def test_exponent_negative_power_runtime_check(get_contract, tx_failed, base, experimental_codegen):
# #2985
code = f"""
@external
def bar() -> int16:
x: int16 = -2
def bar(negative:int16) -> int16:
x: int16 = negative
return {base} ** x
"""
c = get_contract(code)
# known bug: 2985
with tx_failed():
c.bar()
c.bar(-2)


@pytest.mark.parametrize("base", (0, 1))
def test_exponent_negative_power_compile_time_check(
get_contract, tx_failed, base, experimental_codegen
):
# #2985
code = f"""
@external
def bar() -> int16:
x: int16 = -2
return {base} ** x
"""
if not experimental_codegen:
return
with pytest.raises(StaticAssertionException):
get_contract(code)
charles-cooper marked this conversation as resolved.
Show resolved Hide resolved


def test_exponent_min_int16(get_contract):
Expand Down
7 changes: 1 addition & 6 deletions tests/functional/codegen/types/test_dynamic_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def loo(x: DynArray[DynArray[int128, 2], 2]) -> int128:
print("Passed list tests")


@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_string_list(get_contract):
code = """
@external
Expand Down Expand Up @@ -1491,7 +1490,6 @@ def foo(x: int128) -> int128:
assert c.foo(7) == 392


@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_struct_of_lists(get_contract):
code = """
struct Foo:
Expand Down Expand Up @@ -1580,7 +1578,6 @@ def bar(x: int128) -> DynArray[int128, 3]:
assert c.bar(7) == [7, 14]


@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_nested_struct_of_lists(get_contract, assert_compile_failed, optimize):
code = """
struct nestedFoo:
Expand Down Expand Up @@ -1710,9 +1707,7 @@ def __init__():
("DynArray[DynArray[DynArray[uint256, 5], 5], 5]", [[[], []], []]),
],
)
def test_empty_nested_dynarray(get_contract, typ, val, venom_xfail):
if val == [[[], []], []]:
venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_empty_nested_dynarray(get_contract, typ, val):
code = f"""
@external
def foo() -> {typ}:
Expand Down
Loading
Loading