Skip to content

bug(StdStorage): find() does not work for short strings #345

@rzmahmood

Description

@rzmahmood

Example contract:

contract MyContract {
   // short string as it only has 31 characters
    string public exists = "thequickbrownfoxjumpsoverthelaz";
}

Script:

contract MyScript is Script {
    using stdStorage for StdStorage;

    function run() public {
        uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
        vm.startBroadcast(deployerPrivateKey);

        MyContract s = new MyContract();

        uint256 slot = stdstore.target(address(s)).sig("exists()").find();
        console2.log(slot);
        vm.stopBroadcast();
    }
}

Output:

stdStorage find(StdStorage): Slot(s) not found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions