Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bug(StdStorage): finds() returns different results in test vs coverage #477

Copy link
Copy link

Description

@allan-wei-tx
Issue body actions

https://github.com/foundry-rs/forge-std/blob/37a37ab73364d6644bfe11edf88a07880f99bd56/src/StdStorage.sol#L50C27-L50C32
I ran into a problem lately regarding to stdStorage.finds, where I used a TransparentUpgradeableProxy contract in a project, and then run finds on the implementation contract which is the standard procedure, and I found the slot I wanted in my unit test, but what puzzled me was that the forge coverage failed because the slot couldn't be found. Then I dug deeper into the source code of StdStorage, and I found that during test phase, the lengths of the reads (bytes32[] memory reads,) = vm.accesses(address(who)); was 1 while the length was 4 during the coverage phase. and all 4 elements in reads array during coverage phase are exactly the same. So I'm wondering if the reads array should be deduped and if this is a potential bug?

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.