Skip to content

fix: analyse Vyper function bodies that start with pass - #3076

Open
Eljees wants to merge 1 commit into
crytic:masterfrom
Eljees:fix/vyper-pass-body
Open

Eljees wants to merge 1 commit into
crytic:masterfrom
Eljees:fix/vyper-pass-body

Conversation

@Eljees

@Eljees Eljees commented Aug 8, 2026

Copy link
Copy Markdown

Fixes #2192.

Root cause. FunctionVyper.analyze_content decides whether a Vyper function has a body with

if body and not isinstance(body[0], Pass):

The intent is "an empty Vyper body is written as pass", but the check only looks at the first
statement. Any function whose body merely starts with pass is therefore treated as
unimplemented: no CFG is built and every detector sees an empty function.

_parse_statement already handles Pass anywhere in a body
(elif isinstance(expr, Pass): pass), so the guard is only needed for the genuinely empty case.

Fix. Treat the body as empty only when every statement is Pass.

Effect. On the contract from the issue, slither reported three findings before the change
(unimplemented-functions, unused-state, constable-states) and reports none after it.

Test. tests/unit/core/test_function_declaration.py::test_vyper_function_body_starting_with_pass,
next to the existing test_vyper_functions. It covers both directions: a body starting with pass
must be analysed, and a body consisting solely of pass must stay empty — the latter is the
contract already asserted for __init__() and __default__() in test_vyper_functions.

Verified per CLAUDE.md ("temporarily break code to verify the test fails"): with the test added and
the fix reverted the run fails on assert f.is_implemented; with the fix applied
tests/unit/slithir/vyper, tests/e2e/vyper_parsing and the vyper tests in
tests/unit/core/test_function_declaration.py are green.

@Eljees
Eljees requested a review from smonicas as a code owner August 8, 2026 07:03
@CLAassistant

CLAassistant commented Aug 8, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Eljees

Eljees commented Aug 14, 2026

Copy link
Copy Markdown
Author

Ping — this one and #3077 have been open since 8 and 9 August with no review.

The CLA check is green on both, but it is the only check that has run — the github-actions suites are at action_required, waiting on a maintainer to approve a workflow run, so neither has been through the test suite yet.

Both are Vyper parsing fixes and are independent of each other.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Body of Vyper functions that start with pass are not analysed

2 participants