Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foundry storage check #88

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ jobs:
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install dependencies
run: yarn install

Expand All @@ -70,6 +75,9 @@ jobs:
- name: Interface compatibility
run: yarn run test:compatibility

- name: Forge build
run: forge build

- name: Test Storage Layouts
run: yarn run test:storage

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ node_modules/
deployments/
/test/prover/proofs/*.json
/test/prover/spec-proofs/*.json
/test/storage/*-old.dot
/test/storage/*-old
scripts/config.ts
forge-cache/
out/
Expand Down
15 changes: 15 additions & 0 deletions test/storage/Bridge
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
| Name | Type | Slot | Offset | Bytes | Contract |
|----------------------------------|------------------------------------------------|------|--------|-------|------------------------------|
| _initialized | bool | 0 | 0 | 1 | src/bridge/Bridge.sol:Bridge |
| _initializing | bool | 0 | 1 | 1 | src/bridge/Bridge.sol:Bridge |
| allowedDelayedInboxesMap | mapping(address => struct AbsBridge.InOutInfo) | 1 | 0 | 32 | src/bridge/Bridge.sol:Bridge |
| allowedOutboxesMap | mapping(address => struct AbsBridge.InOutInfo) | 2 | 0 | 32 | src/bridge/Bridge.sol:Bridge |
| allowedDelayedInboxList | address[] | 3 | 0 | 32 | src/bridge/Bridge.sol:Bridge |
| allowedOutboxList | address[] | 4 | 0 | 32 | src/bridge/Bridge.sol:Bridge |
| _activeOutbox | address | 5 | 0 | 20 | src/bridge/Bridge.sol:Bridge |
| delayedInboxAccs | bytes32[] | 6 | 0 | 32 | src/bridge/Bridge.sol:Bridge |
| sequencerInboxAccs | bytes32[] | 7 | 0 | 32 | src/bridge/Bridge.sol:Bridge |
| rollup | contract IOwnable | 8 | 0 | 20 | src/bridge/Bridge.sol:Bridge |
| sequencerInbox | address | 9 | 0 | 20 | src/bridge/Bridge.sol:Bridge |
| sequencerReportedSubMessageCount | uint256 | 10 | 0 | 32 | src/bridge/Bridge.sol:Bridge |
| __gap | uint256[40] | 11 | 0 | 1280 | src/bridge/Bridge.sol:Bridge |
30 changes: 0 additions & 30 deletions test/storage/Bridge.dot

This file was deleted.

8 changes: 8 additions & 0 deletions test/storage/ChallengeManager
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
| Name | Type | Slot | Offset | Bytes | Contract |
|------------------------|---------------------------------------------------|------|--------|-------|-----------------------------------------------------|
| totalChallengesCreated | uint64 | 0 | 0 | 8 | src/challenge/ChallengeManager.sol:ChallengeManager |
| challenges | mapping(uint256 => struct ChallengeLib.Challenge) | 1 | 0 | 32 | src/challenge/ChallengeManager.sol:ChallengeManager |
| resultReceiver | contract IChallengeResultReceiver | 2 | 0 | 20 | src/challenge/ChallengeManager.sol:ChallengeManager |
| sequencerInbox | contract ISequencerInbox | 3 | 0 | 20 | src/challenge/ChallengeManager.sol:ChallengeManager |
| bridge | contract IBridge | 4 | 0 | 20 | src/challenge/ChallengeManager.sol:ChallengeManager |
| osp | contract IOneStepProofEntry | 5 | 0 | 20 | src/challenge/ChallengeManager.sol:ChallengeManager |
9 changes: 0 additions & 9 deletions test/storage/ChallengeManager.dot

This file was deleted.

16 changes: 16 additions & 0 deletions test/storage/ERC20Bridge
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
| Name | Type | Slot | Offset | Bytes | Contract |
|----------------------------------|------------------------------------------------|------|--------|-------|----------------------------------------|
| _initialized | bool | 0 | 0 | 1 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| _initializing | bool | 0 | 1 | 1 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| allowedDelayedInboxesMap | mapping(address => struct AbsBridge.InOutInfo) | 1 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| allowedOutboxesMap | mapping(address => struct AbsBridge.InOutInfo) | 2 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| allowedDelayedInboxList | address[] | 3 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| allowedOutboxList | address[] | 4 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| _activeOutbox | address | 5 | 0 | 20 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| delayedInboxAccs | bytes32[] | 6 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| sequencerInboxAccs | bytes32[] | 7 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| rollup | contract IOwnable | 8 | 0 | 20 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| sequencerInbox | address | 9 | 0 | 20 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| sequencerReportedSubMessageCount | uint256 | 10 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| __gap | uint256[40] | 11 | 0 | 1280 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
| nativeToken | address | 51 | 0 | 20 | src/bridge/ERC20Bridge.sol:ERC20Bridge |
27 changes: 0 additions & 27 deletions test/storage/ERC20Bridge.dot

This file was deleted.

12 changes: 12 additions & 0 deletions test/storage/ERC20Inbox
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
| Name | Type | Slot | Offset | Bytes | Contract |
|------------------|--------------------------|------|--------|-------|--------------------------------------|
| _initialized | bool | 0 | 0 | 1 | src/bridge/ERC20Inbox.sol:ERC20Inbox |
| _initializing | bool | 0 | 1 | 1 | src/bridge/ERC20Inbox.sol:ERC20Inbox |
| __gap | uint256[50] | 1 | 0 | 1600 | src/bridge/ERC20Inbox.sol:ERC20Inbox |
| _paused | bool | 51 | 0 | 1 | src/bridge/ERC20Inbox.sol:ERC20Inbox |
| __gap | uint256[49] | 52 | 0 | 1568 | src/bridge/ERC20Inbox.sol:ERC20Inbox |
| bridge | contract IBridge | 101 | 0 | 20 | src/bridge/ERC20Inbox.sol:ERC20Inbox |
| sequencerInbox | contract ISequencerInbox | 102 | 0 | 20 | src/bridge/ERC20Inbox.sol:ERC20Inbox |
| allowListEnabled | bool | 102 | 20 | 1 | src/bridge/ERC20Inbox.sol:ERC20Inbox |
| isAllowed | mapping(address => bool) | 103 | 0 | 32 | src/bridge/ERC20Inbox.sol:ERC20Inbox |
| __gap | uint256[47] | 104 | 0 | 1504 | src/bridge/ERC20Inbox.sol:ERC20Inbox |
15 changes: 0 additions & 15 deletions test/storage/ERC20Inbox.dot

This file was deleted.

8 changes: 8 additions & 0 deletions test/storage/ERC20Outbox
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
| Name | Type | Slot | Offset | Bytes | Contract |
|---------|--------------------------------|------|--------|-------|----------------------------------------|
| rollup | address | 0 | 0 | 20 | src/bridge/ERC20Outbox.sol:ERC20Outbox |
| bridge | contract IBridge | 1 | 0 | 20 | src/bridge/ERC20Outbox.sol:ERC20Outbox |
| spent | mapping(uint256 => bytes32) | 2 | 0 | 32 | src/bridge/ERC20Outbox.sol:ERC20Outbox |
| roots | mapping(bytes32 => bytes32) | 3 | 0 | 32 | src/bridge/ERC20Outbox.sol:ERC20Outbox |
| context | struct AbsOutbox.L2ToL1Context | 4 | 0 | 128 | src/bridge/ERC20Outbox.sol:ERC20Outbox |
| __gap | uint256[42] | 8 | 0 | 1344 | src/bridge/ERC20Outbox.sol:ERC20Outbox |
12 changes: 0 additions & 12 deletions test/storage/ERC20Outbox.dot

This file was deleted.

Loading
Loading