From 359fdbae1b5c46ae6072eb7a9e4f9eb71a5d7699 Mon Sep 17 00:00:00 2001 From: banteg <4562643+banteg@users.noreply.github.com> Date: Fri, 12 Jun 2026 14:33:19 +0400 Subject: [PATCH 1/2] fix[venom]: assert staticcall in constant context --- vyper/codegen_venom/expr.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vyper/codegen_venom/expr.py b/vyper/codegen_venom/expr.py index 205696e1f9..68a23117ab 100644 --- a/vyper/codegen_venom/expr.py +++ b/vyper/codegen_venom/expr.py @@ -1793,6 +1793,8 @@ def _lower_external_call(self) -> VyperValue: # === Dispatch CALL or STATICCALL === use_staticcall = fn_type.mutability in (StateMutability.VIEW, StateMutability.PURE) + if self.ctx.is_constant(): + assert use_staticcall, "typechecker missed this" # Return buffer location and size ret_ofst = buf._ptr From a1b81206f6e6096beb95b2ea83bf8680cbd69cd6 Mon Sep 17 00:00:00 2001 From: banteg <4562643+banteg@users.noreply.github.com> Date: Mon, 22 Jun 2026 16:32:17 +0400 Subject: [PATCH 2/2] refactor[venom]: document staticcall assertion --- vyper/codegen_venom/expr.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vyper/codegen_venom/expr.py b/vyper/codegen_venom/expr.py index 68a23117ab..c834b2d090 100644 --- a/vyper/codegen_venom/expr.py +++ b/vyper/codegen_venom/expr.py @@ -1794,7 +1794,8 @@ def _lower_external_call(self) -> VyperValue: # === Dispatch CALL or STATICCALL === use_staticcall = fn_type.mutability in (StateMutability.VIEW, StateMutability.PURE) if self.ctx.is_constant(): - assert use_staticcall, "typechecker missed this" + # Non-static calls in constant context should be rejected by the typechecker. + assert use_staticcall # Return buffer location and size ret_ofst = buf._ptr