Commit 5c5d92d4 authored by Maurelian's avatar Maurelian Committed by GitHub

ci(bedrock): Add storage-snapshot script (#2829)

* ci(bedrock): Add storage-snapshot script

* bedrock: add populated storage layout

* Update config.yml
Co-authored-by: default avatarMatthew Slipper <me@matthewslipper.com>
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent a0461090
......@@ -410,6 +410,10 @@ jobs:
forge --version
forge snapshot --check
working_directory: packages/contracts-bedrock
- run:
name: storage snapshot
command: yarn storage-snapshot && git diff --exit-code .storage-layout
working_directory: packages/contracts-bedrock
- run:
name: check go bindings
command: make && git diff --exit-code
......
=======================
👁👁 STORAGE LAYOUT snapshot 👁👁
=======================
=======================
➡ L1CrossDomainMessenger
=======================
+---------------------------+--------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+==============================================================================+
| _initialized | uint8 | 0 | 0 | 1 |
|---------------------------+--------------------------+------+--------+-------|
| _initializing | bool | 0 | 1 | 1 |
|---------------------------+--------------------------+------+--------+-------|
| __gap | uint256[50] | 1 | 0 | 1600 |
|---------------------------+--------------------------+------+--------+-------|
| _owner | address | 51 | 0 | 20 |
|---------------------------+--------------------------+------+--------+-------|
| __gap | uint256[49] | 52 | 0 | 1568 |
|---------------------------+--------------------------+------+--------+-------|
| _paused | bool | 101 | 0 | 1 |
|---------------------------+--------------------------+------+--------+-------|
| __gap | uint256[49] | 102 | 0 | 1568 |
|---------------------------+--------------------------+------+--------+-------|
| _status | uint256 | 151 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| __gap | uint256[49] | 152 | 0 | 1568 |
|---------------------------+--------------------------+------+--------+-------|
| REMOVED_VARIABLE_SPACER_1 | bytes32 | 201 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| REMOVED_VARIABLE_SPACER_2 | bytes32 | 202 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| successfulMessages | mapping(bytes32 => bool) | 203 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| xDomainMsgSender | address | 204 | 0 | 20 |
|---------------------------+--------------------------+------+--------+-------|
| msgNonce | uint256 | 205 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| otherMessenger | address | 206 | 0 | 20 |
|---------------------------+--------------------------+------+--------+-------|
| receivedMessages | mapping(bytes32 => bool) | 207 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| blockedSystemAddresses | mapping(address => bool) | 208 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| portal | contract OptimismPortal | 209 | 0 | 20 |
+---------------------------+--------------------------+------+--------+-------+
=======================
➡ L1StandardBridge
=======================
+-------------+-------------------------------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+=======================================================================================+
| messenger | contract CrossDomainMessenger | 0 | 0 | 20 |
|-------------+-------------------------------------------------+------+--------+-------|
| otherBridge | contract StandardBridge | 1 | 0 | 20 |
|-------------+-------------------------------------------------+------+--------+-------|
| deposits | mapping(address => mapping(address => uint256)) | 2 | 0 | 32 |
+-------------+-------------------------------------------------+------+--------+-------+
=======================
➡ L2OutputOracle
=======================
+-------------------+----------------------------------------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+======================================================================================================+
| _owner | address | 0 | 0 | 20 |
|-------------------+----------------------------------------------------------+------+--------+-------|
| latestBlockNumber | uint256 | 1 | 0 | 32 |
|-------------------+----------------------------------------------------------+------+--------+-------|
| l2Outputs | mapping(uint256 => struct L2OutputOracle.OutputProposal) | 2 | 0 | 32 |
+-------------------+----------------------------------------------------------+------+--------+-------+
=======================
➡ OptimismPortal
=======================
+----------------------+----------------------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+=======================================================================================+
| params | struct ResourceMetering.ResourceParams | 0 | 0 | 32 |
|----------------------+----------------------------------------+------+--------+-------|
| l2Sender | address | 1 | 0 | 20 |
|----------------------+----------------------------------------+------+--------+-------|
| finalizedWithdrawals | mapping(bytes32 => bool) | 2 | 0 | 32 |
+----------------------+----------------------------------------+------+--------+-------+
=======================
➡ DeployerWhitelist
=======================
+-----------+--------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+==============================================================+
| owner | address | 0 | 0 | 20 |
|-----------+--------------------------+------+--------+-------|
| whitelist | mapping(address => bool) | 1 | 0 | 32 |
+-----------+--------------------------+------+--------+-------+
=======================
➡ GasPriceOracle
=======================
+----------+---------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+============================================+
| _owner | address | 0 | 0 | 20 |
|----------+---------+------+--------+-------|
| spacer0 | uint256 | 1 | 0 | 32 |
|----------+---------+------+--------+-------|
| spacer1 | uint256 | 2 | 0 | 32 |
|----------+---------+------+--------+-------|
| overhead | uint256 | 3 | 0 | 32 |
|----------+---------+------+--------+-------|
| scalar | uint256 | 4 | 0 | 32 |
|----------+---------+------+--------+-------|
| decimals | uint256 | 5 | 0 | 32 |
+----------+---------+------+--------+-------+
=======================
➡ L1Block
=======================
+----------------+---------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+==================================================+
| number | uint64 | 0 | 0 | 8 |
|----------------+---------+------+--------+-------|
| timestamp | uint64 | 0 | 8 | 8 |
|----------------+---------+------+--------+-------|
| basefee | uint256 | 1 | 0 | 32 |
|----------------+---------+------+--------+-------|
| hash | bytes32 | 2 | 0 | 32 |
|----------------+---------+------+--------+-------|
| sequenceNumber | uint64 | 3 | 0 | 8 |
+----------------+---------+------+--------+-------+
=======================
➡ L1BlockNumber
=======================
+------+------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+=====================================+
+------+------+------+--------+-------+
=======================
➡ L2CrossDomainMessenger
=======================
+---------------------------+--------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+==============================================================================+
| _initialized | uint8 | 0 | 0 | 1 |
|---------------------------+--------------------------+------+--------+-------|
| _initializing | bool | 0 | 1 | 1 |
|---------------------------+--------------------------+------+--------+-------|
| __gap | uint256[50] | 1 | 0 | 1600 |
|---------------------------+--------------------------+------+--------+-------|
| _owner | address | 51 | 0 | 20 |
|---------------------------+--------------------------+------+--------+-------|
| __gap | uint256[49] | 52 | 0 | 1568 |
|---------------------------+--------------------------+------+--------+-------|
| _paused | bool | 101 | 0 | 1 |
|---------------------------+--------------------------+------+--------+-------|
| __gap | uint256[49] | 102 | 0 | 1568 |
|---------------------------+--------------------------+------+--------+-------|
| _status | uint256 | 151 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| __gap | uint256[49] | 152 | 0 | 1568 |
|---------------------------+--------------------------+------+--------+-------|
| REMOVED_VARIABLE_SPACER_1 | bytes32 | 201 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| REMOVED_VARIABLE_SPACER_2 | bytes32 | 202 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| successfulMessages | mapping(bytes32 => bool) | 203 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| xDomainMsgSender | address | 204 | 0 | 20 |
|---------------------------+--------------------------+------+--------+-------|
| msgNonce | uint256 | 205 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| otherMessenger | address | 206 | 0 | 20 |
|---------------------------+--------------------------+------+--------+-------|
| receivedMessages | mapping(bytes32 => bool) | 207 | 0 | 32 |
|---------------------------+--------------------------+------+--------+-------|
| blockedSystemAddresses | mapping(address => bool) | 208 | 0 | 32 |
+---------------------------+--------------------------+------+--------+-------+
=======================
➡ L2StandardBridge
=======================
+-------------+-------------------------------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+=======================================================================================+
| messenger | contract CrossDomainMessenger | 0 | 0 | 20 |
|-------------+-------------------------------------------------+------+--------+-------|
| otherBridge | contract StandardBridge | 1 | 0 | 20 |
|-------------+-------------------------------------------------+------+--------+-------|
| deposits | mapping(address => mapping(address => uint256)) | 2 | 0 | 32 |
+-------------+-------------------------------------------------+------+--------+-------+
=======================
➡ L2ToL1MessagePasser
=======================
+--------------+--------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+=================================================================+
| sentMessages | mapping(bytes32 => bool) | 0 | 0 | 32 |
|--------------+--------------------------+------+--------+-------|
| nonce | uint256 | 1 | 0 | 32 |
+--------------+--------------------------+------+--------+-------+
=======================
➡ OVM_ETH
=======================
+--------------+-------------------------------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+========================================================================================+
| _balances | mapping(address => uint256) | 0 | 0 | 32 |
|--------------+-------------------------------------------------+------+--------+-------|
| _allowances | mapping(address => mapping(address => uint256)) | 1 | 0 | 32 |
|--------------+-------------------------------------------------+------+--------+-------|
| _totalSupply | uint256 | 2 | 0 | 32 |
|--------------+-------------------------------------------------+------+--------+-------|
| _name | string | 3 | 0 | 32 |
|--------------+-------------------------------------------------+------+--------+-------|
| _symbol | string | 4 | 0 | 32 |
|--------------+-------------------------------------------------+------+--------+-------|
| remoteToken | address | 5 | 0 | 20 |
|--------------+-------------------------------------------------+------+--------+-------|
| bridge | address | 6 | 0 | 20 |
+--------------+-------------------------------------------------+------+--------+-------+
=======================
➡ SequencerFeeVault
=======================
+-------------+---------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+===============================================+
| l1FeeWallet | address | 0 | 0 | 20 |
+-------------+---------+------+--------+-------+
=======================
➡ WETH9
=======================
+-----------+-------------------------------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+=====================================================================================+
| name | string | 0 | 0 | 32 |
|-----------+-------------------------------------------------+------+--------+-------|
| symbol | string | 1 | 0 | 32 |
|-----------+-------------------------------------------------+------+--------+-------|
| decimals | uint8 | 2 | 0 | 1 |
|-----------+-------------------------------------------------+------+--------+-------|
| balanceOf | mapping(address => uint256) | 3 | 0 | 32 |
|-----------+-------------------------------------------------+------+--------+-------|
| allowance | mapping(address => mapping(address => uint256)) | 4 | 0 | 32 |
+-----------+-------------------------------------------------+------+--------+-------+
=======================
➡ ProxyAdmin
=======================
+--------------------+-----------------------------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+============================================================================================+
| owner | address | 0 | 0 | 20 |
|--------------------+-----------------------------------------------+------+--------+-------|
| proxyType | mapping(address => enum ProxyAdmin.ProxyType) | 1 | 0 | 32 |
|--------------------+-----------------------------------------------+------+--------+-------|
| implementationName | mapping(address => string) | 2 | 0 | 32 |
|--------------------+-----------------------------------------------+------+--------+-------|
| addressManager | contract Lib_AddressManager | 3 | 0 | 20 |
|--------------------+-----------------------------------------------+------+--------+-------|
| upgrading | bool | 3 | 20 | 1 |
+--------------------+-----------------------------------------------+------+--------+-------+
=======================
➡ Proxy
=======================
+------+------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+=====================================+
+------+------+------+--------+-------+
=======================
➡ L1ChugSplashProxy
=======================
+------+------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+=====================================+
+------+------+------+--------+-------+
=======================
➡ OptimismMintableERC20
=======================
+--------------+-------------------------------------------------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+========================================================================================+
| _balances | mapping(address => uint256) | 0 | 0 | 32 |
|--------------+-------------------------------------------------+------+--------+-------|
| _allowances | mapping(address => mapping(address => uint256)) | 1 | 0 | 32 |
|--------------+-------------------------------------------------+------+--------+-------|
| _totalSupply | uint256 | 2 | 0 | 32 |
|--------------+-------------------------------------------------+------+--------+-------|
| _name | string | 3 | 0 | 32 |
|--------------+-------------------------------------------------+------+--------+-------|
| _symbol | string | 4 | 0 | 32 |
|--------------+-------------------------------------------------+------+--------+-------|
| remoteToken | address | 5 | 0 | 20 |
|--------------+-------------------------------------------------+------+--------+-------|
| bridge | address | 6 | 0 | 20 |
+--------------+-------------------------------------------------+------+--------+-------+
=======================
➡ OptimismMintableTokenFactory
=======================
+--------+---------+------+--------+-------+
| Name | Type | Slot | Offset | Bytes |
+==========================================+
| bridge | address | 0 | 0 | 20 |
+--------+---------+------+--------+-------+
......@@ -20,6 +20,7 @@
"build:ts": "tsc",
"test": "forge test",
"gas-snapshot": "forge snapshot",
"storage-snapshot": "./scripts/storage-snapshot.sh",
"slither": "slither .",
"clean": "rm -rf ./dist ./artifacts ./forge-artifacts ./cache ./coverage ./tsconfig.tsbuildinfo",
"lint:ts:check": "eslint . --max-warnings=0",
......
#!/usr/bin/env bash
set -e
if ! command -v forge &> /dev/null
then
echo "forge could not be found. Please install forge by running:"
echo "curl -L https://foundry.paradigm.xyz | bash"
exit
fi
contracts=(
L1CrossDomainMessenger
L1StandardBridge
L2OutputOracle
OptimismPortal
DeployerWhitelist
GasPriceOracle
L1Block
L1BlockNumber
L2CrossDomainMessenger
L2StandardBridge
L2ToL1MessagePasser
OVM_ETH
SequencerFeeVault
WETH9
ProxyAdmin
Proxy
L1ChugSplashProxy
OptimismMintableERC20
OptimismMintableTokenFactory
)
dir=$(dirname "$0")
echo "Creating storage layout diagrams.."
echo "=======================" > $dir/../.storage-layout
echo "👁👁 STORAGE LAYOUT snapshot 👁👁" >> $dir/../.storage-layout
echo "=======================" >> $dir/../.storage-layout
for contract in ${contracts[@]}
do
echo -e "\n=======================" >> $dir/../.storage-layout
echo "➡ $contract">> $dir/../.storage-layout
echo -e "=======================\n" >> $dir/../.storage-layout
forge inspect --pretty $contract storage-layout >> $dir/../.storage-layout
done
echo "Storage layout snapshot stored at $dir/../.storage-layout"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment