Skip to content

fix(StdStorage): find short string and bytes slots - #894

Merged
grandizzy merged 3 commits into
foundry-rs:masterfrom
stevencartavia:fix-stdstorage-strings
Aug 7, 2026
Merged

fix(StdStorage): find short string and bytes slots#894
grandizzy merged 3 commits into
foundry-rs:masterfrom
stevencartavia:fix-stdstorage-strings

Conversation

@stevencartavia

Copy link
Copy Markdown
Member

Fixes stdStorage.find() for non-empty short string and bytes values of 1–31 bytes.

The implementation matches Solidity’s short-value storage encoding and confirms the candidate slot by temporarily clearing and restoring it. Existing static, packed-slot, and .depth() behavior remains unchanged.

Fixes #345.

Comment thread src/StdStorage.sol Outdated

@mablr mablr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one non-blocking suggestion

Comment thread test/StdStorage.t.sol
@stevencartavia
stevencartavia requested a review from mablr August 6, 2026 16:53

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@grandizzy
grandizzy merged commit 37a36ca into foundry-rs:master Aug 7, 2026
23 of 28 checks passed
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.

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

5 participants