Skip to content

Commit d0ee738

Browse files
fix(tests): fixed test_push.py::test_stack_overflow test by reducing contract size to below allowed max (#2002)
* fixed push stack_overflow test by reducing contract size below allowed max * use push1(0) instead of push0 * make coverage yaml more robust * chore(ci): fix coverage when modifying existing ported tests. * fix --------- Co-authored-by: spencer-tb <[email protected]>
1 parent dec75c9 commit d0ee738

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/frontier/opcodes/test_push.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from ethereum_test_forks import Fork, Frontier, Homestead
99
from ethereum_test_tools import Account, Alloc, Environment, StateTestFiller, Transaction
1010
from ethereum_test_tools import Opcodes as Op
11+
from ethereum_test_vm.bytecode import Bytecode
1112

1213

1314
def get_input_for_push_opcode(opcode: Op) -> bytes:
@@ -112,7 +113,11 @@ def test_stack_overflow(
112113
| SSTORE | | [0]: excerpt |
113114
+---------------------------------------------------+
114115
"""
115-
contract_code = push_opcode(excerpt) * stack_height + Op.SSTORE
116+
contract_code: Bytecode = Bytecode()
117+
for _ in range(stack_height - 2):
118+
contract_code += Op.PUSH1(0) # mostly push 0 to avoid contract size limit exceeded
119+
contract_code += push_opcode(excerpt) * 2 + Op.SSTORE
120+
116121
contract = pre.deploy_contract(contract_code)
117122

118123
tx = Transaction(

0 commit comments

Comments
 (0)