foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.27k stars 1.74k forks source link

bug(`forge coverage`): bug while generating lcov report #8395

Closed IWildSniperI closed 1 month ago

IWildSniperI commented 3 months ago

Component

Forge

Have you ensured that all of these are up to date?

What version of Foundry are you on?

0.2.0

What command(s) is the bug in?

forge coverage --report lcov

Operating System

Linux

Describe the bug

image after i run forge coverage --report lcov

with consideration that forge works normally

grandizzy commented 3 months ago

please provide complete output of forge --version, would be great if you could also point to source code to replicate such. thank you

DaniPopes commented 3 months ago

could also be stale artifacts, can you try forge clean and trying again? Otherwise it could be solc mishandling UTF-8 characters

IWildSniperI commented 3 months ago

@grandizzy so sorry for late responses image code with error https://github.com/Cyfrin/2024-07-biconomy.git

i got same error on another Codes too that i don't remember

IWildSniperI commented 3 months ago

@DaniPopes will try and update here

grandizzy commented 3 months ago

works OK here, @IWildSniperI as @DaniPopes says looks to be UTF-8 handling (maybe no locale installed on your OS?), what OS you use? (btw you have to yarn coverage:forge for that repo instead forge coverage --report lcov or add --ir-minimum to support require with custom error)

IWildSniperI commented 3 months ago

@grandizzy i have done what you said Sorry for the confusion for not having that note in the issue body

Not doing --ir-minimum would already have brought stack too deep error

So i preferred to put the main command that had that issue (cause some repos didn't require --ir-minimum) and the problem kept arriving

Iam using wsl on Windows

IWildSniperI commented 3 months ago

Only showed in the new version tho

1 or 2 months earlier i never got such a problem

Right now iam getting it often

grandizzy commented 3 months ago

what's the output for cat /etc/default/locale ?

IWildSniperI commented 3 months ago

image @grandizzy

grandizzy commented 3 months ago

I think I have a theory but to confirm you would need to remove all these headers from sol files and retry :smile:

// ──────────────────────────────────────────────────────────────────────────────
//     _   __    _  __
//    / | / /__ | |/ /_  _______
//   /  |/ / _ \|   / / / / ___/
//  / /|  /  __/   / /_/ (__  )
// /_/ |_/\___/_/|_\__,_/____/
//
// ──────────────────────────────────────────────────────────────────────────────
IWildSniperI commented 3 months ago

@grandizzy 😕really?

Just want to confirm that same problem came for one without headers

See: https://github.com/Cyfrin/2024-07-templegold.git (protocols subfolder)

grandizzy commented 3 months ago

hey @IWildSniperI were you able to test it without those headers? thanks

IWildSniperI commented 3 months ago

image @grandizzy

grandizzy commented 3 months ago

@IWildSniperI it still looks like there's the header, see the message above contains // ──────────────────────────────────────────────────────────────────────────────. Maybe try forge clean. What I want to see if WSL introduce bad chars like in https://github.com/microsoft/terminal/issues/386

IWildSniperI commented 3 months ago

did forge clean same problem

grandizzy commented 3 months ago

can you paste the output, is the header still printed / same error? either way I don't think there's much we can do here as it looks like wsl related issue...

grandizzy commented 3 months ago

also try updating foundryup there are some new things included and error line doesn't match anymore

grandizzy commented 1 month ago

@IWildSniperI going to close this for now, please apply suggested actions and report back if still an issue. thank you!