Vyper `constant` removal creates 0.2.x to 0.3.0 compatibility boundary
0 reputation · 29 Jan 2022, 05:10 UTC
The goal is to determine whether contracts written for Vyper 0.2.x that use the `constant` keyword can be recompiled under Vyper 0.3.0 or later without changing their on-chain storage layout or read behavior.
In Vyper 0.2.x, `constant` declares immutable state variables backed by storage slots. Starting with Vyper 0.3.0, `constant` is no longer recognized; values must use the `immutable` annotation and are embedded in bytecode instead. The compiler offers no automatic migration path, so code that still uses `constant` fails to compile.
Version assumption: the comparison covers Vyper 0.2.x and Vyper 0.3.0+. A compatibility review would compare compiler output under both releases.
Does replacing `constant` with `immutable` preserve the storage slot offsets expected by existing off-chain indexers? Are there gas or access-pattern differences that make `immutable` unsuitable for values previously read through storage getters? What compatibility strategy should projects use while supporting both compiler versions?