Skip to content

Commit

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

```vyper
x: uint256

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

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

chainsec june 2023 review 5.5
  • Loading branch information
charles-cooper authored Aug 31, 2023
1 parent 6a819b1 commit fa89ca2
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 fa89ca2

Please sign in to comment.