Skip to content

feat(proofs): axiomatize mapping-slot collision-resistance - #2361

Merged
Th0rgal merged 1 commit into
mainfrom
feat/c5-mapping-slot-injective
Aug 17, 2026
Merged

feat(proofs): axiomatize mapping-slot collision-resistance#2361
Th0rgal merged 1 commit into
mainfrom
feat/c5-mapping-slot-injective

Conversation

@Th0rgal

@Th0rgal Th0rgal commented Aug 17, 2026

Copy link
Copy Markdown
Member

Summary

  • add solidityMappingSlot_injective: keccak256(abi.encode(key, base)) does not collide on distinct (base, key) pairs
  • not injectivity of keccak256 on arbitrary byte strings (256-bit output)
  • prove writeMap_aligned_preserves_mappingCoherent (global aligned address-map write)
  • register the axiom in AXIOMS.md, check_axioms.py, and Layer-2 docsync (Layer 2 stays 0 axioms)
  • C5 step 4 is not axiom-free complete; lone writeSlot all-keys remains open

Test Plan

  • lake build Compiler.Proofs.Storage.MappingCoherence
  • make check

Related

C5 step 4 increment. Issue 2330 stays open.


Note

Medium Risk
Adds a cryptographic collision-resistance axiom used by global mapping-coherence preservation; a collision on the ABI mapping preimage family would falsify that theorem, though finite certificate paths remain axiom-free.

Overview
Reintroduces a single documented project axiom, solidityMappingSlot_injective, for collision-resistance of keccak256(abi.encode(key, base)) on distinct (base, key) pairs — not injectivity of keccak on arbitrary byte strings. The mapping-slot range property stays a proved theorem via the kernel Keccak engine.

On top of that axiom, the PR adds solidityMappingSlot_ne, nested abstractNestedMappingSlot_injective / _ne, and mapping-coherence lemmas (addressToWord_injective, distinct StorageKey.map* ⇒ distinct derived slots). It proves global preservation of address-keyed MappingCoherent under aligned writeMap + writeSlot (writeMap_aligned_preserves_mappingCoherent). Finite-list / certificate-based preservation in MappingCoherenceOn is unchanged and still does not need the axiom.

Trust and CI: AXIOMS.md, AUDIT.md, TRUST_ASSUMPTIONS.md, docs/ROADMAP.md, verification_status.json, llms.txt, and scripts/check_axioms.py / docsync.py now record 1 active axiom (Layer 2 compilation proofs remain 0 axioms). PrintAxioms registers the new theorems.

Docs explicitly state C5 step 4 is not axiom-free complete; lone writeSlot all-keys MappingCoherent preservation stays open.

Reviewed by Cursor Bugbot for commit 7ff15db. Bugbot is set up for automated code reviews on this repo. Configure here.

Add solidityMappingSlot_injective: distinct (base, key) ABI pairs
map to distinct Solidity slots. This is keccak collision-resistance
on the 64-byte mapping preimage, not injectivity of keccak256 on
all ByteArrays.

Prove writeMap_aligned_preserves_mappingCoherent from that axiom.
Document the trust boundary. C5 step 4 is not axiom-free complete.
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
verity Ready Ready Preview Aug 17, 2026 8:29am

Request Review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@cursor

cursor Bot commented Aug 17, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_8e964919-ab6d-4f44-9705-d922eea63cc4)

@github-actions

Copy link
Copy Markdown
Contributor
\n### CI Failure Hints\n\nFailed jobs: `build`\n\nCopy-paste local triage:\n```bash\nmake check\nlake build\nFOUNDRY_PROFILE=difftest forge test -vv\n```

@Th0rgal
Th0rgal merged commit 5998acb into main Aug 17, 2026
18 of 20 checks passed
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