{"id":15022932,"url":"https://github.com/rubilmax/foundry-storage-check","last_synced_at":"2025-04-06T08:14:06.481Z","repository":{"id":60840783,"uuid":"533799238","full_name":"Rubilmax/foundry-storage-check","owner":"Rubilmax","description":"🔐 Protect your Smart Contract Proxy from storage collisions upon upgrading, by running this action in a CI on each of your Pull Requests!","archived":false,"fork":false,"pushed_at":"2024-10-23T12:51:32.000Z","size":6941,"stargazers_count":93,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-30T00:32:33.560Z","etag":null,"topics":["cd","checks","ci","evm","forge","foundry","monitoring","proxy","smart-contracts","storage","upgrades"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rubilmax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-07T14:20:37.000Z","updated_at":"2024-10-23T12:49:35.000Z","dependencies_parsed_at":"2024-06-19T06:17:02.706Z","dependency_job_id":"93b20812-3270-47b9-a6a0-cd1466500e0c","html_url":"https://github.com/Rubilmax/foundry-storage-check","commit_stats":{"total_commits":166,"total_committers":2,"mean_commits":83.0,"dds":0.4036144578313253,"last_synced_commit":"f3b1175ec710d06ad40786390db7b197c929f373"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Ffoundry-storage-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Ffoundry-storage-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Ffoundry-storage-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Ffoundry-storage-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rubilmax","download_url":"https://codeload.github.com/Rubilmax/foundry-storage-check/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247451665,"owners_count":20940944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cd","checks","ci","evm","forge","foundry","monitoring","proxy","smart-contracts","storage","upgrades"],"created_at":"2024-09-24T19:58:32.916Z","updated_at":"2025-04-06T08:14:06.462Z","avatar_url":"https://github.com/Rubilmax.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n\u003cimg width=\"836\" alt=\"image\" src=\"https://user-images.githubusercontent.com/3147812/209434273-ff5eb5e6-0b32-4bb0-854b-dda2693e0175.png\"\u003e\n\u003c/p\u003e\n\n# 🔥🛠️ Foundry Storage Upgrade Seatbelt\n\n- Protect your Smart Contract Proxy from storage collisions upon upgrading, by running this action in a CI on each of your Pull Requests!\n- Feel safe when extending your storage layout by trusting this action to check that extended layout is zero-ed out on-chain!\n\n## Live Example\n\nCheck out [PR #21](/pulls/21) for a live example:\n\n- Action is ran on [contracts/Example.sol:Example](./contracts/Example.sol)\n- Warnings \u0026 errors appear on the [Pull Request changes](https://github.com/Rubilmax/foundry-storage-check/pull/21/files)\n\n## Getting started\n\n### Automatically generate \u0026 compare to the previous storage layout on every PR\n\nAdd a workflow (`.github/workflows/foundry-storage-check.yml`):\n\n```yaml\nname: Check storage layout\n\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    # Optionally configure to run only for changes in specific files. For example:\n    # paths:\n    # - src/**\n    # - test/**\n    # - foundry.toml\n    # - remappings.txt\n    # - .github/workflows/foundry-storage-check.yml\n\njobs:\n  check_storage_layout:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Install Foundry\n        uses: foundry-rs/foundry-toolchain@v1.2.0\n\n      - name: Check storage layout\n        uses: Rubilmax/foundry-storage-check@v3.8\n        with:\n          contract: src/Contract.sol:Contract\n          # settings below are optional, but allows to check whether the added storage slots are empty on the deployed contract\n          rpcUrl: wss://eth-mainnet.g.alchemy.com/v2/\u003cYOUR_ALCHEMY_KEY\u003e # the RPC url to use to query the deployed contract's storage slots\n          address: 0x0000000000000000000000000000000000000000 # the address at which the contract check is deployed\n          failOnRemoval: true # fail the CI when removing storage slots (default: false)\n```\n\n\u003e :information_source: **An error will appear at first run!**\u003cbr/\u003e\n\u003e 🔴 \u003cem\u003e**Error:** No workflow run found with an artifact named \"...\"\u003c/em\u003e\u003cbr/\u003e\n\u003e As the action is expecting a comparative file stored on the base branch and cannot find it (because the action never ran on the target branch and thus has never uploaded any storage layout)\n\n---\n\n## How it works\n\nEverytime somebody opens a Pull Request, the action runs [Foundry](https://github.com/foundry-rs/foundry) `forge` to generate the storage layout of the Smart Contract you want to check.\n\nOnce generated, the action will fetch the comparative storage layout stored as an artifact from previous runs and compare them, to perform a series of checks at each storage byte, and raise a notice accordingly:\n\n- Variable changed: `error`\n- Type definition changed: `error`\n- Type definition removed: `warning`\n- Different variable naming: `warning`\n- Variable removed (optional): `error`\n\nThe action automatically checks for:\n\n- All canonic storage bytes\n- Array value (32 bytes) at index `#0`\n- Mapping value (32 bytes) at key `0x00`\n- Zero-ed bytes for added storage variables\n\n---\n\n## Options\n\n### `contract` _{string}_\n\nThe path and name of the contract of which to inspect storage layout (e.g. src/Contract.sol:Contract).\n\n_Required_\n\n### `address` _{string}_\n\nThe address at which the contract is deployed on the EVM-compatible chain queried via `rpcUrl`.\n\n### `rpcUrl` _{string}_\n\nThe HTTP/WS url used to query the EVM-compatible chain for storage slots to check for clashing.\n\n### `failOnRemoval` _{string}_\n\nWhether to fail the CI when removing a storage slot (to only allow added or renamed storage slots).\n\n_Defaults to: `false`_\n\n### `base` _{string}_\n\nThe gas diff reference branch name, used to fetch the previous gas report to compare the freshly generated gas report to.\n\n_Defaults to: `${{ github.base_ref || github.ref_name }}`_\n\n### `head` _{string}_\n\nThe gas diff target branch name, used to upload the freshly generated gas report.\n\n_Defaults to: `${{ github.head_ref || github.ref_name }}`_\n\n### `workingDirectory` _{string}_\n\nThe directory inside which to run forge inspect.\n\n_Defaults to: `.`_\n\n### `retryDelay` _{string}_\n\nThe retry delay (in milliseconds) between each GitHub API query.\n\n_Defaults to: `1000`_\n\n### `token` _{string}_\n\nThe github token allowing the action to upload and download gas reports generated by foundry. You should not need to customize this, as the action already has access to the default Github Action token.\n\n_Defaults to: `${{ github.token }}`_\n\nThis repository is maintained independently from [Foundry](https://github.com/foundry-rs/foundry) and may not work as expected with all versions of `forge`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubilmax%2Ffoundry-storage-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubilmax%2Ffoundry-storage-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubilmax%2Ffoundry-storage-check/lists"}