You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 13, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+36-8Lines changed: 36 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,11 @@
4
4
5
5
## Live Example
6
6
7
-
Checkout[PR #21](/pulls/21) for a live example:
7
+
Check out[PR #21](/pulls/21) for a live example:
8
8
9
9
- Action is ran on [contracts/Example.sol:Example](./contracts/Example.sol)
10
10
- Warnings & errors appear on the [Pull Request changes](https://github.com/Rubilmax/foundry-storage-check/pull/21/files)
11
11
12
-
## How it works
13
-
14
-
Everytime 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.
15
-
16
-
Once generated, the action will fetch the comparative storage layout stored as an artifact from previous runs; parse & compare them, pinning warnings and errors on the Pull Request.
17
-
18
12
## Getting started
19
13
20
14
### Automatically generate & compare to the previous storage layout on every PR
@@ -52,15 +46,35 @@ jobs:
52
46
version: nightly
53
47
54
48
- name: Check storage layout
55
-
uses: Rubilmax/foundry-storage-check@v2.1
49
+
uses: Rubilmax/foundry-storage-check@v3
56
50
with:
57
51
contract: src/Contract.sol:Contract
52
+
# settings below are optional, but allows to check whether the added storage slots are empty on the deployed contract
53
+
rpcUrl: wss://eth-mainnet.g.alchemy.com/v2/<YOUR_ALCHEMY_KEY> # the RPC url to use to query the deployed contract's storage slots
54
+
address: 0x0000000000000000000000000000000000000000# the address at which the contract check is deployed
55
+
failOnRemoval: true # fail the CI when removing storage slots (default: false)
58
56
```
59
57
60
58
> :information_source: **An error will appear at first run!**<br/>
61
59
> 🔴 <em>**Error:** No workflow run found with an artifact named "..."</em><br/>
62
60
> 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)
63
61
62
+
---
63
+
64
+
## How it works
65
+
66
+
Everytime 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.
67
+
68
+
Once 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:
69
+
70
+
- Variable changed: `error`
71
+
- Type definition changed: `error`
72
+
- Type definition removed: `warning`
73
+
- Different variable naming: `warning`
74
+
- Variable removed (optional): `error`
75
+
76
+
---
77
+
64
78
## Options
65
79
66
80
### `contract` _{string}_
@@ -69,6 +83,20 @@ The path and name of the contract of which to inspect storage layout (e.g. src/C
69
83
70
84
_Required_
71
85
86
+
### `address` _{string}_
87
+
88
+
The address at which the contract is deployed on the EVM-compatible chain queried via `rpcUrl`.
89
+
90
+
### `rpcUrl` _{string}_
91
+
92
+
The HTTP/WS url used to query the EVM-compatible chain for storage slots to check for clashing.
93
+
94
+
### `failOnRemoval` _{string}_
95
+
96
+
Whether to fail the CI when removing a storage slot (to only allow added or renamed storage slots).
97
+
98
+
_Defaults to: `false`_
99
+
72
100
### `base` _{string}_
73
101
74
102
The gas diff reference branch name, used to fetch the previous gas report to compare the freshly generated gas report to.
_sortBy(diffs,["location.slot","location.offset"]),// make sure it's ordered by storage byte order
268
+
({location: location1, ...diff1},{location: location2, ...diff2})=>_isEqual(diff1,diff2)// only keep first byte diff of a variable, which corresponds to the start byte
0 commit comments