Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: note Context.in_assertion is dead #3564

Merged

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Aug 25, 2023

the Context class 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

chainsec june 2023 review 5.5

What I did

How I did it

How to verify it

Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

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
```

chainsec june review 5.5
@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2023

Codecov Report

Merging #3564 (998d2f0) into master (43c8d85) will increase coverage by 0.01%.
Report is 2 commits behind head on master.
The diff coverage is n/a.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #3564      +/-   ##
==========================================
+ Coverage   89.13%   89.15%   +0.01%     
==========================================
  Files          85       85              
  Lines       11365    11365              
  Branches     2585     2585              
==========================================
+ Hits        10130    10132       +2     
+ Misses        813      812       -1     
+ Partials      422      421       -1     
Files Changed Coverage Δ
vyper/codegen/context.py 92.74% <ø> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@charles-cooper charles-cooper force-pushed the chore/note-dead-code branch 2 times, most recently from febcdd1 to 998d2f0 Compare August 27, 2023 21:17
@charles-cooper charles-cooper changed the title chore: note Context.in_assertion is dead fix: note Context.in_assertion is dead Aug 31, 2023
@charles-cooper charles-cooper changed the title fix: note Context.in_assertion is dead chore: note Context.in_assertion is dead Aug 31, 2023
@charles-cooper charles-cooper merged commit fa89ca2 into vyperlang:master Aug 31, 2023
150 of 152 checks passed
@charles-cooper charles-cooper deleted the chore/note-dead-code branch August 31, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants