Skip to content

Pack initialized with adminCount in MockB20 storage#39

Merged
amiecorso merged 1 commit into
mainfrom
amie/pack-b20-storage-layout
May 20, 2026
Merged

Pack initialized with adminCount in MockB20 storage#39
amiecorso merged 1 commit into
mainfrom
amie/pack-b20-storage-layout

Conversation

@amiecorso
Copy link
Copy Markdown
Collaborator

Summary

  • Pack initialized with adminCount in MockB20Storage.Layout by narrowing adminCount to uint248 and colocating the flag in slot 8.
  • Update storage offset constants so ADMIN_COUNT_OFFSET and INITIALIZED_OFFSET both point to slot 8, and add INITIALIZED_BYTE_OFFSET for byte-precise writes.
  • Replace factory bootstrap close logic from whole-slot bool write to masked packed-byte write, preventing initialized=true from clobbering packed adminCount.

Test plan

  • forge test --match-path "test/unit/TokenFactory/*.t.sol"
  • forge test --match-path "test/unit/B20/roles/*.t.sol"
  • forge test --match-path "test/unit/storage/*.t.sol"

Made with Cursor

Reduce layout footprint by packing `initialized` into the adminCount slot and update factory bootstrap writes to set only the initialized byte without clobbering packed data.

Co-authored-by: Cursor <cursoragent@cursor.com>
@amiecorso amiecorso marked this pull request as ready for review May 20, 2026 21:56
@amiecorso amiecorso merged commit ba2e257 into main May 20, 2026
3 checks passed
@amiecorso amiecorso deleted the amie/pack-b20-storage-layout branch May 20, 2026 22:00
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.

1 participant