Skip to content

fix(tests): fixed test_push.py::test_stack_overflow test by reducing contract size to below allowed max #2002

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

Merged
merged 5 commits into from
Aug 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 14 additions & 2 deletions .github/scripts/parse_ported_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,20 @@ WORKSPACE_PATH="${2:-$GITHUB_WORKSPACE}"

echo "Changed or new test files: $CHANGED_TEST_FILES"

# Extract ported_from markers
uv run fill $CHANGED_TEST_FILES --show-ported-from --clean --quiet --links-as-filled --skip-coverage-missed-reason --ported-from-output-file ported_from_files.txt
FILTERED_FILES=""
for file in $CHANGED_TEST_FILES; do
if git diff origin/main -- "$file" | grep -q "^+.*@pytest.mark.ported_from"; then
FILTERED_FILES="$FILTERED_FILES $file"
fi
done

if [[ -z "$FILTERED_FILES" ]]; then
echo "No new ported_from markers found."
echo "any_ported=false" >> "$GITHUB_OUTPUT"
exit 0
fi

uv run fill $FILTERED_FILES --show-ported-from --clean --quiet --links-as-filled --skip-coverage-missed-reason --ported-from-output-file ported_from_files.txt
files=$(cat ported_from_files.txt)
echo "Extracted converted tests:"
echo "$files"
Expand Down
7 changes: 6 additions & 1 deletion tests/frontier/opcodes/test_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from ethereum_test_forks import Fork, Frontier, Homestead
from ethereum_test_tools import Account, Alloc, Environment, StateTestFiller, Transaction
from ethereum_test_tools import Opcodes as Op
from ethereum_test_vm.bytecode import Bytecode


def get_input_for_push_opcode(opcode: Op) -> bytes:
Expand Down Expand Up @@ -112,7 +113,11 @@ def test_stack_overflow(
| SSTORE | | [0]: excerpt |
+---------------------------------------------------+
"""
contract_code = push_opcode(excerpt) * stack_height + Op.SSTORE
contract_code: Bytecode = Bytecode()
for _ in range(stack_height - 2):
contract_code += Op.PUSH1(0) # mostly push 0 to avoid contract size limit exceeded
contract_code += push_opcode(excerpt) * 2 + Op.SSTORE

contract = pre.deploy_contract(contract_code)

tx = Transaction(
Expand Down
Loading