Skip to content

Commit

Permalink
chore: note Context.in_assertion is dead
Browse files Browse the repository at this point in the history
the Context has an `in_assertion` flag which, when set, indicates that
the context should be constant according to is_constant() definition.
however, this flag is never set during code generation, specifically, it
is possible to have non-constant expression in an assert statement. For
example, the following contract compiles:

```
x: uint256

@internal
def bar() -> uint256:
    self.x = 1
    return self.x

@external
def foo():
    assert self.bar() == 1
```

CS-VYPER_MAY_2023-005
  • Loading branch information
charles-cooper committed Aug 27, 2023
1 parent 43c8d85 commit febcdd1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions vyper/codegen/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def __init__(
self.constancy = constancy

# Whether body is currently in an assert statement
# XXX: dead, never set to True
self.in_assertion = False

# Whether we are currently parsing a range expression
Expand Down

0 comments on commit febcdd1

Please sign in to comment.