Skip to content

Fix Vyper interface calls omitting a default argument - #3077

Open
Eljees wants to merge 1 commit into
crytic:masterfrom
Eljees:fix/vyper-interface-default-arg
Open

Eljees wants to merge 1 commit into
crytic:masterfrom
Eljees:fix/vyper-interface-default-arg

Conversation

@Eljees

@Eljees Eljees commented Aug 9, 2026

Copy link
Copy Markdown

Summary

Fixes #2375.

Vyper interface functions with default arguments expose call forms with fewer arguments. Slither only considered functions whose parameter count exactly matched the call, so an omitted defaulted argument left the call unresolved and later crashed while dereferencing a missing function.

This change adds a fallback candidate lookup when exact arity finds nothing. A function is eligible only when the omitted arguments are trailing defaulted parameters; the normal exact-arity path remains unchanged.

The regression test verifies that Pool(a).price_oracle() resolves to the declared price_oracle(i: uint256 = 0) interface function.

This differs from the withdrawn #2984: that patch guarded the null dereference, while this one restores the call target and keeps the SlithIR useful to downstream analyses.

Validation

  • Before: the new test fails with AttributeError: 'NoneType' object has no attribute 'type'
  • After: pytest tests/unit/slithir/vyper/test_ir_generation.py -q — 4 passed
  • Ruff check and format check pass for both changed files
  • Tested with Vyper 0.3.7, matching the repository test setup

AI-assisted (LLM used for implementation and drafting); the change and tests were reviewed and run by me.

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]: Vyper interfaces with default argument crash Slither

1 participant