diff --git a/tests/functional/syntax/exceptions/test_constancy_exception.py b/tests/functional/syntax/exceptions/test_constancy_exception.py index 4c6af8f6da..484e291da1 100644 --- a/tests/functional/syntax/exceptions/test_constancy_exception.py +++ b/tests/functional/syntax/exceptions/test_constancy_exception.py @@ -130,6 +130,18 @@ def bar()->DynArray[uint16,3]: @view def topup(amount: uint256): assert extcall self.token.transferFrom(msg.sender, self, amount) + """, + """ +@external +@view +def foo(_topic: bytes32): + raw_log([_topic], b"") + """, + """ +@external +@pure +def foo(_topic: bytes32): + raw_log([_topic], b"") """, ], ) diff --git a/vyper/builtins/functions.py b/vyper/builtins/functions.py index 672d978455..674efda7ce 100644 --- a/vyper/builtins/functions.py +++ b/vyper/builtins/functions.py @@ -1267,6 +1267,8 @@ def infer_arg_types(self, node, expected_return_typ=None): @process_inputs def build_IR(self, expr, args, kwargs, context): + context.check_is_not_constant(f"use {self._id}", expr) + topics_length = len(expr.args[0].elements) topics = args[0].args topics = [unwrap_location(topic) for topic in topics]