Repository navigation
Conversation
gnidan
force-pushed
the
bugc-fixed-array-layout
branch
from
October 7, 2026 02:09
6d33a79 to
9b8cfe6
Compare
gnidan
force-pushed
the
bugc-fixed-array-layout
branch
from
October 7, 2026 02:27
9b8cfe6 to
c0ab7fa
Compare
Contributor
|
Member
Author
|
Included in #368. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Storage arrays now have Solidity's layout.
keccak256(slot) + i, but the debug pointer of a fixed-size array described them inline atslot + i, so a debugger read the wrong slots.keccak256(slot).How it is built:
types/storage.tsis the one statement of the layout: an elementary type's size, how many elements share a slot, and how many slots a type takes. The struct layout, the code, and the pointers all use it.emitArrayElementreplaces the two copies of the array branch in the storage chain load and store, and the array literal's storage writes. A fixed-size array literal no longer writes a length word into its first element's slot. For an element that shares its slot, the index's slot and byte offset are computed at run time (div/mod/mul, which constant folding removes for a constant index).read/writeoffset that is not a constant: it shifts byoffset << 3at run time.arrays.bugdeclared its scalars at slots 1 to 5, inside its 10-slot array. They now start at slot 10. The test that expected one element of anint16array atkeccak256(0) + 1, and the IR test that expected acompute_slotfor a fixed-size array in a mapping, now expect the inline layout. The storage verification test needed a local node and was skipped. It now runs on the in-process executor, and it checks the inline slots it always expected. The BUG case study describes the layout.Known limit, unchanged here: a struct member that is itself a struct still takes one slot.
Conflicts to expect: #355 changes
generateStorageWritenext to the offset handling here, and #361 changesirgen/generate/storage.ts.