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[ir]: add make_ssa pass to venom pipeline #3825

Merged
merged 354 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
354 commits
Select commit Hold shift + click to select a range
85ab7c1
trascription magic
harkal Feb 7, 2024
af5f16b
add blockhash instruction
charles-cooper Feb 7, 2024
77a633a
Refactor variable handling in _convert_ir_bb function
harkal Feb 8, 2024
b886630
fix if-else block handling
harkal Feb 8, 2024
a3ba760
get_variable_op
harkal Feb 12, 2024
0c99b01
Revert "get_variable_op"
harkal Feb 12, 2024
a6533df
refactor
harkal Feb 13, 2024
863a78a
simplify
harkal Feb 13, 2024
e6f58c9
fix
harkal Feb 13, 2024
aa32d41
bug fix then symbols
harkal Feb 14, 2024
5a44a83
remove debuging
harkal Feb 14, 2024
0c0a3cb
debuging
harkal Feb 14, 2024
245cb27
clear out vars on reseting liveness
harkal Feb 14, 2024
7f1e938
make ssa test
harkal Feb 14, 2024
4b1b9b8
move to orderedset
harkal Feb 14, 2024
c5047e5
add intersection method to OrderedSet
harkal Feb 14, 2024
2057bf3
update test
harkal Feb 14, 2024
287c0dd
cleanup
harkal Feb 14, 2024
b4cdfa7
fix internal invocation
harkal Feb 14, 2024
4e28eca
enable experimental
harkal Feb 15, 2024
882116e
fix constructor exit issue
harkal Feb 15, 2024
484df7f
stuff
harkal Feb 15, 2024
d4ed07d
creates
harkal Feb 16, 2024
60362da
offset try
harkal Feb 16, 2024
d19bf39
istore iload
harkal Feb 16, 2024
38c550f
extcodecopy
harkal Feb 16, 2024
c6572bc
facepalm
harkal Feb 16, 2024
ef43103
addmod mulmod
harkal Feb 16, 2024
5a6a260
revert
harkal Feb 16, 2024
9d18a54
fix push literals
harkal Feb 16, 2024
eefb3eb
in_vars property
harkal Feb 16, 2024
d325ca1
bugfix if
harkal Feb 16, 2024
277a282
fix parameter passing case
harkal Feb 17, 2024
b9927f9
array returns
harkal Feb 17, 2024
e17ddec
return buffer hacks
harkal Feb 17, 2024
f754ff0
add instructions
harkal Feb 17, 2024
850f7af
fix const array passing
harkal Feb 17, 2024
2acf154
remove unused function
harkal Feb 17, 2024
85d8ec5
fix
harkal Feb 17, 2024
af88463
more instructions
harkal Feb 18, 2024
d04ea93
external call logic simplifications
harkal Feb 18, 2024
c44ef81
raise, unreachable, etc
harkal Feb 18, 2024
c53afb8
more fixes
harkal Feb 18, 2024
231d1d7
fix and optimization
harkal Feb 19, 2024
4d4727a
implement loop bounds
harkal Feb 19, 2024
154fca3
finalize repeat
harkal Feb 19, 2024
f6da335
Merge branch 'master' into feature/venom_updates
harkal Feb 22, 2024
48b7c6c
fix isqrt
harkal Feb 22, 2024
e1d5f73
include postamble
harkal Feb 22, 2024
ddf41bc
remove unused function
harkal Feb 22, 2024
7fdf4a5
cleanup calldatacopy
harkal Feb 22, 2024
ef408e9
remove unused function
harkal Feb 22, 2024
dba4ca2
Merge branch 'master' into feature/venom_updates
harkal Feb 23, 2024
20bdc08
dynarray fixes
harkal Feb 23, 2024
5e6edd1
more dynarray fixes
harkal Feb 23, 2024
935a2a9
fix mload handling
harkal Feb 23, 2024
dbe9202
handle unused return values of volatile call and staticcall
harkal Feb 24, 2024
412a8b1
for internals called from ctor
harkal Feb 24, 2024
813ab10
handle mstore arguments in order the old code expects
harkal Feb 24, 2024
855e726
more acrobatics for new cconv
harkal Feb 25, 2024
b94eeea
fix
harkal Feb 25, 2024
a91ac18
fix
harkal Feb 25, 2024
76dc7eb
Merge branch 'master' into feature/venom_updates
harkal Feb 25, 2024
5dcdfe6
call conv
harkal Feb 28, 2024
5505b9b
old call conv
harkal Feb 28, 2024
4f8dbec
more fixes
harkal Feb 29, 2024
a9ceb5a
fix test
harkal Feb 29, 2024
f6bcb25
add difficulty instruction
harkal Feb 29, 2024
3a3174b
func_t cleanup
harkal Feb 29, 2024
63aa60b
more func_t cleanup
harkal Feb 29, 2024
b0fecda
get rid of passthrough_metadata
harkal Feb 29, 2024
a50fd13
Merge remote-tracking branch 'origin/master' into feature/venom_updates
harkal Feb 29, 2024
4ca5bcb
remove get_variable
harkal Feb 29, 2024
a1d2110
remove variables
harkal Feb 29, 2024
776a33e
remove allocated_variables
harkal Feb 29, 2024
1e182f7
transient storage
harkal Feb 29, 2024
0fd4f57
mcopy
harkal Feb 29, 2024
a9fefa6
fix reordering of stack with duplicated
harkal Mar 1, 2024
c1b4965
exit_to acrobatics
harkal Mar 1, 2024
48ea429
exit_to with no parameters
harkal Mar 1, 2024
f54da86
ret_ofst ret_size undefined case
harkal Mar 1, 2024
96f7c3b
multi phi get_depth
harkal Mar 1, 2024
a055a83
small cleanup / refactor
harkal Mar 1, 2024
18dd18d
cleanup
harkal Mar 1, 2024
b3b9663
clean up phase 2
harkal Mar 1, 2024
760c424
fix
harkal Mar 1, 2024
4595b1d
returndatacopy in reversed ops
harkal Mar 1, 2024
6ed922f
lint
harkal Mar 1, 2024
116bc7f
fix lint
charles-cooper Mar 1, 2024
d1fa295
update some tests
charles-cooper Mar 1, 2024
ad619b7
add --use-venom test option, venom_xfail fixture
charles-cooper Mar 1, 2024
d0ae1de
fix a setting
charles-cooper Mar 1, 2024
28c10a6
add test pipeline for venom
charles-cooper Mar 1, 2024
60f0b6b
mark more xfails
charles-cooper Mar 1, 2024
a805303
fix lint
charles-cooper Mar 1, 2024
619ab3d
update workflow file
charles-cooper Mar 1, 2024
b0785f8
some more xfails
charles-cooper Mar 1, 2024
d7b39b6
add `#pragma experimental-codegen`
charles-cooper Mar 2, 2024
9f595ca
cleanup make_ssa test
harkal Mar 4, 2024
51075a8
Merge branch 'feature/venom_updates' of github.com:harkal/vyper into …
harkal Mar 4, 2024
7f969b9
Merge branch 'master' into feature/venom_updates
harkal Mar 5, 2024
04260ac
fix case where cfg_in empty on non entry nodes
harkal Mar 5, 2024
a0ff828
force strict=True for venom_xfail
charles-cooper Mar 5, 2024
5aa6c89
Merge branch 'master' into feature/venom_updates
harkal Mar 5, 2024
43a11c2
cleanup
harkal Mar 7, 2024
6b74b20
var list
harkal Mar 7, 2024
9d7336d
more fixes
harkal Mar 7, 2024
bbb25fa
temp
harkal Mar 7, 2024
94e7328
fix lib issues
harkal Mar 8, 2024
7a650df
cleanup
harkal Mar 8, 2024
b828a86
fix
harkal Mar 8, 2024
ef4e8a2
Merge branch 'master' into feature/venom_updates
harkal Mar 8, 2024
338dc09
remove unused imports
harkal Mar 8, 2024
1445096
codesize dispatcher
harkal Mar 8, 2024
b01c730
Update dense selector to emit the target constrained djump instruction
harkal Mar 8, 2024
e8c8ba0
handle raw data
harkal Mar 8, 2024
b62701e
Merge branch 'master' into feature/venom_updates
harkal Mar 8, 2024
862bcd8
fix test_assert_reason_revert_length
harkal Mar 8, 2024
3ebd99e
pass down source pos
harkal Mar 9, 2024
afdb086
Merge branch 'master' into feature/venom_updates
harkal Mar 9, 2024
c017371
update test for venom
harkal Mar 9, 2024
2bf47c7
lint
harkal Mar 9, 2024
7bc1b13
revert force experimental flag
harkal Mar 9, 2024
a87076e
lint
harkal Mar 9, 2024
ea83674
update to new external call syntax
harkal Mar 9, 2024
7994423
fix test for venom
harkal Mar 9, 2024
f455b66
fix tests for venom
harkal Mar 9, 2024
c0b7de0
simplify cfg
harkal Mar 10, 2024
86ea74f
fix
harkal Mar 10, 2024
75fc035
raise on dup out of stack
harkal Mar 11, 2024
f1465da
simplify cfg refactor and optimization
harkal Mar 11, 2024
f2e3871
update cfg on remove unreachable blocks
harkal Mar 11, 2024
926eeb3
simplify jumps
harkal Mar 11, 2024
5e496ef
remove unsused imports
harkal Mar 11, 2024
7e9ee92
exit venom instruction
harkal Mar 11, 2024
e2b51ab
mark tests xfail for venom
harkal Mar 11, 2024
7e9b878
use exit instruction
harkal Mar 11, 2024
47dfd05
mark xfail
harkal Mar 11, 2024
743b15d
mark xfail venom
harkal Mar 12, 2024
4059e88
Add cfg and cfg_runtime output types
harkal Mar 12, 2024
41cf781
Merge branch 'master' into feature/venom_updates
harkal Mar 12, 2024
5a22d49
Merge branch 'master' into feature/venom_updates
harkal Mar 13, 2024
7fc72a2
change source_pos to ast_source
harkal Mar 13, 2024
651a076
optimization
harkal Mar 13, 2024
d513bb4
cleanup, optimization
harkal Mar 13, 2024
4d70077
no operation instructions for translator
harkal Mar 13, 2024
559a80b
update test
harkal Mar 14, 2024
5477ec1
graphviz output for DFG
harkal Mar 14, 2024
dfc9b86
fix
harkal Mar 14, 2024
31e6c8e
small stack optimization
harkal Mar 14, 2024
46f5f8c
stack reorder pass scaffold
harkal Mar 14, 2024
dab020d
dfg testing
harkal Mar 15, 2024
24730ad
optimize double swaps
harkal Mar 18, 2024
1cd994c
cleanup
harkal Mar 19, 2024
25fa225
cleanup
harkal Mar 19, 2024
84f1b69
docs
harkal Mar 19, 2024
2330f83
Merge branch 'master' into feature/venom_updates
charles-cooper Mar 19, 2024
d7ef9ef
rename venom_pipeline to experimental-codegen
charles-cooper Mar 19, 2024
540b71a
Merge branch 'feature/venom_updates' of github.com:harkal/vyper into …
charles-cooper Mar 19, 2024
71882ed
add passthrough_data
harkal Mar 19, 2024
9c63c3e
fix typo
harkal Mar 19, 2024
ea07632
remove print
harkal Mar 19, 2024
e37e54a
fixes from bad merge
charles-cooper Mar 19, 2024
34316f3
move an optimization to assembly
charles-cooper Mar 19, 2024
477643e
Merge branch 'feature/venom_updates' of github.com:harkal/vyper into …
harkal Mar 19, 2024
41474df
rename a variable
charles-cooper Mar 19, 2024
5f4f548
Merge branch 'feature/venom_updates' of github.com:harkal/vyper into …
harkal Mar 19, 2024
c3e0ac9
simplify ir_node_to_venom
charles-cooper Mar 19, 2024
2a7cb0b
add a couple comments
charles-cooper Mar 19, 2024
5ec9e60
count iterations, not changes for exception
charles-cooper Mar 19, 2024
6de6e7d
wip - alloca
charles-cooper Mar 19, 2024
5c58549
fixes
harkal Mar 20, 2024
5e7f93c
equalities
harkal Mar 20, 2024
752b685
remove unnecessary assert
harkal Mar 20, 2024
e5d2c45
compile with experimental
harkal Mar 20, 2024
5c453f3
bound check int literal
harkal Mar 20, 2024
c420116
variable rename
harkal Mar 20, 2024
43185a0
style change
harkal Mar 20, 2024
a866575
style
harkal Mar 20, 2024
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
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
34eba09
missplaced comment
harkal Apr 2, 2024
9d81918
Merge remote-tracking branch 'origin/master' into feature/venom_updates
harkal Apr 2, 2024
7d6547e
remove merge leftover
harkal Apr 2, 2024
3f85aae
remove test
harkal Apr 2, 2024
5fc8ea4
Update python-version to 3.12 and 312
harkal Apr 2, 2024
958d743
fix IRLiteral.__eq__()
charles-cooper Apr 2, 2024
679543b
Remove unused code in test_dominator_tree.py
harkal Apr 2, 2024
ae50cdf
Merge branch 'feature/venom_updates' of github.com:harkal/vyper into …
harkal Apr 2, 2024
c724265
fix some more `__eq__()` instances
charles-cooper Apr 2, 2024
8df8573
assert in experimental case
harkal Apr 2, 2024
1becca7
add a comment
charles-cooper Apr 2, 2024
9474fb8
Merge branch 'feature/venom_updates' of github.com:harkal/vyper into …
harkal Apr 2, 2024
cd5f3d7
Remove mem_type and mem_addr
harkal Apr 2, 2024
e0dd344
remove MemType datatype
charles-cooper Apr 2, 2024
7efa006
fix a test
charles-cooper Apr 2, 2024
ba29b24
fix lint
charles-cooper Apr 2, 2024
2227386
Merge branch 'master' into feature/venom_updates
charles-cooper Apr 2, 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
19 changes: 15 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ jobs:
matrix:
python-version: [["3.11", "311"]]
opt-mode: ["gas", "none", "codesize"]
evm-version: [shanghai]
debug: [true, false]
evm-version: [shanghai]
experimental-codegen: [false]
memorymock: [false]

# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
Expand All @@ -94,6 +95,14 @@ jobs:
opt-mode: gas
evm-version: cancun

# test experimental pipeline
- python-version: ["3.11", "311"]
opt-mode: gas
debug: false
evm-version: shanghai
experimental-codegen: true
# TODO: test experimental_codegen + -Ocodesize

# run with `--memorymock`, but only need to do it one configuration
# TODO: consider removing the memorymock tests
- python-version: ["3.11", "311"]
Expand All @@ -108,12 +117,14 @@ jobs:
opt-mode: gas
debug: false
evm-version: shanghai

- python-version: ["3.12", "312"]
opt-mode: gas
debug: false
evm-version: shanghai

name: py${{ matrix.python-version[1] }}-opt-${{ matrix.opt-mode }}${{ matrix.debug && '-debug' || '' }}${{ matrix.memorymock && '-memorymock' || '' }}-${{ matrix.evm-version }}

name: py${{ matrix.python-version[1] }}-opt-${{ matrix.opt-mode }}${{ matrix.debug && '-debug' || '' }}${{ matrix.memorymock && '-memorymock' || '' }}${{ matrix.experimental-codegen && '-experimental' || '' }}-${{ matrix.evm-version }}

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -141,6 +152,7 @@ jobs:
--evm-version ${{ matrix.evm-version }} \
${{ matrix.debug && '--enable-compiler-debug-mode' || '' }} \
${{ matrix.memorymock && '--memorymock' || '' }} \
${{ matrix.experimental-codegen && '--experimental-codegen' || '' }} \
--cov-branch \
--cov-report xml:coverage.xml \
--cov=vyper \
Expand Down Expand Up @@ -193,8 +205,7 @@ jobs:
# NOTE: if the tests get poorly distributed, run this and commit the resulting `.test_durations` file to the `vyper-test-durations` repo.
# `pytest -m "fuzzing" --store-durations -r aR tests/`
- name: Fetch test-durations
run: |
curl --location "https://raw.githubusercontent.com/vyperlang/vyper-test-durations/master/test_durations" -o .test_durations
run: curl --location "https://raw.githubusercontent.com/vyperlang/vyper-test-durations/master/test_durations" -o .test_durations

- name: Run tests
run: |
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ testpaths = tests
xfail_strict = true
markers =
fuzzing: Run Hypothesis fuzz test suite (deselect with '-m "not fuzzing"')
venom_xfail: mark a test case as a regression (expected to fail) under the venom pipeline
77 changes: 66 additions & 11 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def pytest_addoption(parser):
help="change optimization mode",
)
parser.addoption("--enable-compiler-debug-mode", action="store_true")
parser.addoption("--experimental-codegen", action="store_true")

parser.addoption(
"--evm-version",
Expand All @@ -73,6 +74,8 @@ def output_formats():
output_formats = compiler.OUTPUT_FORMATS.copy()
del output_formats["bb"]
del output_formats["bb_runtime"]
del output_formats["cfg"]
del output_formats["cfg_runtime"]
return output_formats


Expand All @@ -89,6 +92,36 @@ def debug(pytestconfig):
_set_debug_mode(debug)


@pytest.fixture(scope="session")
def experimental_codegen(pytestconfig):
ret = pytestconfig.getoption("experimental_codegen")
assert isinstance(ret, bool)
return ret


@pytest.fixture(autouse=True)
def check_venom_xfail(request, experimental_codegen):
if not experimental_codegen:
return

marker = request.node.get_closest_marker("venom_xfail")
if marker is None:
return

# https://github.com/okken/pytest-runtime-xfail?tab=readme-ov-file#alternatives
request.node.add_marker(pytest.mark.xfail(strict=True, **marker.kwargs))


@pytest.fixture
def venom_xfail(request, experimental_codegen):
def _xfail(*args, **kwargs):
if not experimental_codegen:
return
request.node.add_marker(pytest.mark.xfail(*args, strict=True, **kwargs))

return _xfail


@pytest.fixture(scope="session", autouse=True)
def evm_version(pytestconfig):
# note: we configure the evm version that we emit code for,
Expand All @@ -108,6 +141,7 @@ def chdir_tmp_path(tmp_path):
yield


# CMC 2024-03-01 this doesn't need to be a fixture
@pytest.fixture
def keccak():
return Web3.keccak
Expand Down Expand Up @@ -321,6 +355,7 @@ def _get_contract(
w3,
source_code,
optimize,
experimental_codegen,
output_formats,
*args,
override_opt_level=None,
Expand All @@ -329,6 +364,7 @@ def _get_contract(
):
settings = Settings()
settings.optimize = override_opt_level or optimize
settings.experimental_codegen = experimental_codegen
out = compiler.compile_code(
source_code,
# test that all output formats can get generated
Expand All @@ -352,17 +388,21 @@ def _get_contract(


@pytest.fixture(scope="module")
def get_contract(w3, optimize, output_formats):
def get_contract(w3, optimize, experimental_codegen, output_formats):
def fn(source_code, *args, **kwargs):
return _get_contract(w3, source_code, optimize, output_formats, *args, **kwargs)
return _get_contract(
w3, source_code, optimize, experimental_codegen, output_formats, *args, **kwargs
)

return fn


@pytest.fixture
def get_contract_with_gas_estimation(tester, w3, optimize, output_formats):
def get_contract_with_gas_estimation(tester, w3, optimize, experimental_codegen, output_formats):
def get_contract_with_gas_estimation(source_code, *args, **kwargs):
contract = _get_contract(w3, source_code, optimize, output_formats, *args, **kwargs)
contract = _get_contract(
w3, source_code, optimize, experimental_codegen, output_formats, *args, **kwargs
)
for abi_ in contract._classic_contract.functions.abi:
if abi_["type"] == "function":
set_decorator_to_contract_function(w3, tester, contract, source_code, abi_["name"])
Expand All @@ -372,15 +412,19 @@ def get_contract_with_gas_estimation(source_code, *args, **kwargs):


@pytest.fixture
def get_contract_with_gas_estimation_for_constants(w3, optimize, output_formats):
def get_contract_with_gas_estimation_for_constants(
w3, optimize, experimental_codegen, output_formats
):
def get_contract_with_gas_estimation_for_constants(source_code, *args, **kwargs):
return _get_contract(w3, source_code, optimize, output_formats, *args, **kwargs)
return _get_contract(
w3, source_code, optimize, experimental_codegen, output_formats, *args, **kwargs
)

return get_contract_with_gas_estimation_for_constants


@pytest.fixture(scope="module")
def get_contract_module(optimize, output_formats):
def get_contract_module(optimize, experimental_codegen, output_formats):
"""
This fixture is used for Hypothesis tests to ensure that
the same contract is called over multiple runs of the test.
Expand All @@ -393,16 +437,25 @@ def get_contract_module(optimize, output_formats):
w3.eth.set_gas_price_strategy(zero_gas_price_strategy)

def get_contract_module(source_code, *args, **kwargs):
return _get_contract(w3, source_code, optimize, output_formats, *args, **kwargs)
return _get_contract(
w3, source_code, optimize, experimental_codegen, output_formats, *args, **kwargs
)

return get_contract_module


def _deploy_blueprint_for(
w3, source_code, optimize, output_formats, initcode_prefix=ERC5202_PREFIX, **kwargs
w3,
source_code,
optimize,
experimental_codegen,
output_formats,
initcode_prefix=ERC5202_PREFIX,
**kwargs,
):
settings = Settings()
settings.optimize = optimize
settings.experimental_codegen = experimental_codegen
out = compiler.compile_code(
source_code,
output_formats=output_formats,
Expand Down Expand Up @@ -438,9 +491,11 @@ def factory(address):


@pytest.fixture(scope="module")
def deploy_blueprint_for(w3, optimize, output_formats):
def deploy_blueprint_for(w3, optimize, experimental_codegen, output_formats):
def deploy_blueprint_for(source_code, *args, **kwargs):
return _deploy_blueprint_for(w3, source_code, optimize, output_formats, *args, **kwargs)
return _deploy_blueprint_for(
w3, source_code, optimize, experimental_codegen, output_formats, *args, **kwargs
)

return deploy_blueprint_for

Expand Down
4 changes: 3 additions & 1 deletion tests/functional/builtins/codegen/test_abi_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from eth.codecs import abi

from vyper.exceptions import ArgumentException, StructureException
from vyper.exceptions import ArgumentException, StackTooDeep, StructureException

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

Expand Down Expand Up @@ -196,6 +196,7 @@ 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 @@ -273,6 +274,7 @@ 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
4 changes: 4 additions & 0 deletions tests/functional/builtins/codegen/test_abi_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import pytest
from eth.codecs import abi

from vyper.exceptions import StackTooDeep


# @pytest.mark.parametrize("string", ["a", "abc", "abcde", "potato"])
def test_abi_encode(get_contract):
Expand Down Expand Up @@ -226,6 +228,7 @@ 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 @@ -330,6 +333,7 @@ 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
2 changes: 2 additions & 0 deletions tests/functional/codegen/features/test_clampers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from eth.codecs import abi
from eth_utils import keccak

from vyper.exceptions import StackTooDeep
from vyper.utils import int_bounds


Expand Down Expand Up @@ -506,6 +507,7 @@ def foo(b: DynArray[int128, 10]) -> DynArray[int128, 10]:


@pytest.mark.parametrize("value", [0, 1, -1, 2**127 - 1, -(2**127)])
@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_multidimension_dynarray_clamper_passing(w3, get_contract, value):
code = """
@external
Expand Down
4 changes: 4 additions & 0 deletions tests/functional/codegen/features/test_constructor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
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 @@ -163,6 +165,7 @@ 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 @@ -208,6 +211,7 @@ 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: 2 additions & 0 deletions tests/functional/codegen/features/test_immutable.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

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


@pytest.mark.parametrize(
Expand Down Expand Up @@ -198,6 +199,7 @@ 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
9 changes: 8 additions & 1 deletion tests/functional/codegen/types/test_dynamic_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ArrayIndexException,
ImmutableViolation,
OverflowException,
StackTooDeep,
StateAccessViolation,
TypeMismatch,
)
Expand Down Expand Up @@ -60,6 +61,7 @@ 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 @@ -732,6 +734,7 @@ def test_array_decimal_return3() -> DynArray[DynArray[decimal, 2], 2]:
assert c.test_array_decimal_return3() == [[1.0, 2.0], [3.0]]


@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_mult_list(get_contract_with_gas_estimation):
code = """
nest3: DynArray[DynArray[DynArray[uint256, 2], 2], 2]
Expand Down Expand Up @@ -1478,6 +1481,7 @@ 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 @@ -1566,6 +1570,7 @@ 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 @@ -1695,7 +1700,9 @@ def __init__():
("DynArray[DynArray[DynArray[uint256, 5], 5], 5]", [[[], []], []]),
],
)
def test_empty_nested_dynarray(get_contract, typ, val):
def test_empty_nested_dynarray(get_contract, typ, val, venom_xfail):
if val == [[[], []], []]:
venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
code = f"""
@external
def foo() -> {typ}:
Expand Down
Loading
Loading