Bitfield-packed struct storage writes in mappings (#1976)#2011
Open
Th0rgal wants to merge 2 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
# Conflicts: # PrintAxioms.lean
Contributor
| \n### CI Failure Hints\n\nFailed jobs: `compiler-audits`\n\nCopy-paste local triage:\n```bash\nmake check\nlake build\nFOUNDRY_PROFILE=difftest forge test -vv\n``` |
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.
Summary
setStructMember/setStructMember2write semantics for bitfield-packed structs stored in mappings, with a nested packed mapping-struct helper for read-modify-write slot updates.writeAddressKeyedMapping2PackedWordSlots_eqand regeneratesPrintAxioms.lean(zero new axioms, 0 sorry'd).DepositInfoword update preserving adjacent fields (Compiler/CompilationModelFeatureTest.lean).Closes #1976.
Test plan
lake build Verity Contracts Compiler PrintAxioms→ "Build completed successfully."make check→ "All checks passed."Note
Medium Risk
Changes contract storage semantics for packed fields in mapping structs across Denote and SourceSemantics; incorrect slot or bit masking would corrupt adjacent packed data, though behavior mirrors existing single-key packed mapping paths and is covered by agreement proofs and eval smoke.
Overview
Extends packed struct member storage semantics so
setStructMember/setStructMember2can update bitfield members inside mapping-backed structs, not only full-word members. Packed writes use read-modify-write via existingpackedWordWrite; invalidPackedBitsstill revert.Adds
writeAddressKeyedMapping2PackedWordSlotsfor double-keyed mappings (nested slot resolution + packed update), mirrors it in SourceSemantics, and proveswriteAddressKeyedMapping2PackedWordSlots_eqfor denote/source agreement.PrintAxioms.leanpicks up the new theorem (5197 total, still 0 sorry'd).Adds
PackedStructMemberDenoteSmoke: an ERC-4337-style packedDepositInfoword where updatingstakepreserves adjacent packed fields in the same storage word.Reviewed by Cursor Bugbot for commit 139787b. Bugbot is set up for automated code reviews on this repo. Configure here.