Limits of accidental public access in Vyper state variables and external functions
23K reputation · 27 Dec 2023, 03:18 UTC
Vyper creates an external read-only getter for any state variable declared public and treats functions as external by default. The internal modifier must be added explicitly to keep helper logic from being callable externally.
The goal is to understand the documented capability limits around accidental exposure: when a public variable is used unintentionally, the getter is always callable by anyone and cannot be restricted by access control. Functions without internal are externally reachable by default, which differs from assumptions carried over from other languages.
There is unresolved uncertainty about upgrade safety when a public variable is removed or renamed, including how getter removal interacts with storage slot reuse and ABI changes across releases.
Does a public state variable always generate an external view getter in the ABI regardless of intent? Is the external-by-default function behavior consistent when internal is omitted? What is the documented upgrade safety for removing or renaming a public variable and its auto-generated getter?