Skip to content

feat: enforce additive-only storage layout changes for PDPVerifier#263

Open
Chaitu-Tatipamula wants to merge 4 commits intoFilOzone:mainfrom
Chaitu-Tatipamula:main
Open

feat: enforce additive-only storage layout changes for PDPVerifier#263
Chaitu-Tatipamula wants to merge 4 commits intoFilOzone:mainfrom
Chaitu-Tatipamula:main

Conversation

@Chaitu-Tatipamula
Copy link
Copy Markdown
Contributor

@Chaitu-Tatipamula Chaitu-Tatipamula commented Mar 24, 2026

Summary

Implements storage slot safety for the PDPVerifier upgradable contract
by enforcing that storage layout changes are strictly additive,
preventing storage collision bugs during contract upgrades.

Resolves #258

What's Checked

Scenario Detected
❌ Removing existing storage slots Yes
❌ Changing the slot number of an existing variable Yes
❌ Inserting new slots in the middle (shifting existing slots) Yes
✅ Appending new slots at the end Allowed

Changes

  • tools/generate_storage_layout.sh: Script to generate
    PDPVerifierLayout.sol from contract source using forge inspect
  • tools/check_storage_layout.sh: Validates that storage layout
    changes only add new slots at the end; flags destructive changes like
    removed slots, moved slots, or inserted slots
  • src/PDPVerifierLayout.sol: Generated file with 17 storage slots
    (must be committed and kept in sync)
  • Makefile: Added gen, check-layout, clean-gen targets for
    managing storage layout
  • .github/workflows/check-storage-layout.yml: New CI workflow to
    verify storage layout on all pushes/PRs
  • .github/workflows/makefile.yml: Added storage layout check to
    existing CI

Usage

make gen              # Generate/rebuild storage layout
make check-layout     # Check for destructive changes (runs in CI)
make clean-gen        # Clean generated files       

@Chaitu-Tatipamula Chaitu-Tatipamula force-pushed the main branch 4 times, most recently from cd8e935 to 4f8bf8c Compare March 24, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Setup *ServiceLayout.sol and enforce that we only make additions

1 participant