The segment schema says offset: 0 means the segment "begins at the start of the specified slot", but not whether that's the most or the least significant byte.
The reference implementation (packages/pointers/src/read.ts) slices the word from byte 0, i.e. the most significant byte, and a length that runs past the slot continues into the next one, which also only makes sense that way.
Solidity's storage layout counts from the other end (packed values are "lower-order aligned"), so solc has to convert its offsets when emitting
pointers. This came up in review of that code because the schema text doesn't settle it. It would help if the description said explicitly that offset counts from the most significant byte, ideally with a packed example like a uint8 in the last byte at "offset": 31.
See this for the context: argotorg/solidity#16990 (comment)
cc @cameel @gnidan
The segment schema says
offset: 0means the segment "begins at the start of the specified slot", but not whether that's the most or the least significant byte.The reference implementation (
packages/pointers/src/read.ts) slices the word from byte 0, i.e. the most significant byte, and alengththat runs past the slot continues into the next one, which also only makes sense that way.Solidity's storage layout counts from the other end (packed values are "lower-order aligned"), so solc has to convert its offsets when emitting
pointers. This came up in review of that code because the schema text doesn't settle it. It would help if the description said explicitly that
offsetcounts from the most significant byte, ideally with a packed example like auint8in the last byte at"offset": 31.See this for the context: argotorg/solidity#16990 (comment)
cc @cameel @gnidan