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

Fixes issue 2524, Slot Calculation for Variables that Cross 32-Byte #2664

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

Jayakumar2812
Copy link

Slot Calculation Incorrect for Variables that Cross 32-Byte Boundaries:

  • The function correctly increments slot when offset >= 256 (a full slot), but it does not properly handle cases where a variable starts in one slot but extends into the next.( issue-2524)
  • ✅ Fix: If size > (256 - offset), then increment the slot before assigning.

Changes made :

*Added a new struct to StorageLayout.sol to test variables that cross the 32-byte boundary.

  • replaced StorageLayout.bin with new values to reflect changes
  • added test cases in TEST_storage_layout.json to test variables that cross the 32-byte boundary.
  • changed the if condition in read_storage.py

@CLAassistant
Copy link

CLAassistant commented Feb 12, 2025

CLA assistant check
All committers have signed the CLA.

@Jayakumar2812 Jayakumar2812 changed the base branch from master to dev February 12, 2025 12:12
@smonicas smonicas merged commit b392536 into crytic:dev Feb 21, 2025
37 checks passed
@smonicas
Copy link
Collaborator

Thanks

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.

3 participants