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

Does not work with Solidity v0.8 "unchecked" blocks #626

Closed
PaulRBerg opened this issue Apr 8, 2021 · 9 comments
Closed

Does not work with Solidity v0.8 "unchecked" blocks #626

PaulRBerg opened this issue Apr 8, 2021 · 9 comments
Labels

Comments

@PaulRBerg
Copy link
Contributor

PaulRBerg commented Apr 8, 2021

Description

Solidity v0.8 introduced checked and unchecked arithmetic.

I recently noticed that none of the code wrapped in my unchecked blocks is analysed by solidity-coverage. For instance, look at line #149 in Coveralls build no. 38616686 of my prb-math repo:

Capture d’écran 2021-04-08 à 11 51 08

None of the code inside is highlighted to reflect whether my tests hit those lines or not. In fact, I know of one line that definitely hasn't been reached by my tests, that is line #230 (and presumably this is also true of some of the many if branches in there).

Environment

  • hardhat@2.1.1
  • prb-math@f49d787
  • solidity-coverage@0.7.16
  • solidity@0.8.3
@cgewecke cgewecke added the bug label Apr 8, 2021
@cgewecke
Copy link
Member

cgewecke commented Apr 8, 2021

@PaulRBerg Yes, makes sense. We need to add unchecked to the parse table and process it like other code blocks.

Thanks for reporting.

@PaulRBerg
Copy link
Contributor Author

Hey @cgewecke, is there any we could help you speed up development on this?

You may have heard about the Gitcoin Grants programme. You basically set up a profile, link it on GitHub and social media, then people can donate ETH and ERC-20 tokens.

I, and I'm sure many others too, would be happy to contribute to your grant.

@cgewecke
Copy link
Member

@PaulRBerg Ah! Really sorry, this fell through cracks.... will look at this ASAP (and fix a few other things here)

Will look at grants, thanks!

@PaulRBerg
Copy link
Contributor Author

Awesome.

@cgewecke
Copy link
Member

This is finally fixed in 0.7.17

@PaulRBerg
Copy link
Contributor Author

I'm using solidity-coverage v0.7.20 and it looks like unchecked blocks have stopped being covered.

Screen Shot 2022-03-04 at 4 00 32 PM

This is with Hardhat v2.8.4 and Solidity v0.8.12.

@cgewecke
Copy link
Member

cgewecke commented Mar 4, 2022

Ok, weird.... I'll look at this again. Need to add a test for this syntax.

@cgewecke
Copy link
Member

This is fixed in 0.7.21 (for real :) )

@PaulRBerg
Copy link
Contributor Author

Amazing, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants