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

improve(forge-ci): Ignore astId and other non-storage slot related props when diffing storage layouts #523

Merged
merged 4 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 6 additions & 1 deletion scripts/checkStorageLayout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ CONTRACTS=("Arbitrum_SpokePool" "Optimism_SpokePool" "Polygon_SpokePool" "Linea_
if [[ "$1" == "--overwrite" ]]; then
for CONTRACT in "${CONTRACTS[@]}"; do
echo "Overwrite flag detected. Creating new storage layout snapshot of the $CONTRACT contract"
forge inspect $CONTRACT storagelayout > ./storage-layouts/$CONTRACT.json
forge inspect $CONTRACT storagelayout > ./storage-layouts/temp.$CONTRACT.json
# Delete any astId keys from the file, which seem to change every time the bytecode changes
# and the types object which also contains astId changes. We only care about the size and relative
# location of state variable slots.
jq 'del(.storage[] | .astId)' ./storage-layouts/temp.$CONTRACT.json | jq 'del(.types)' > ./storage-layouts/$CONTRACT.json
rm ./storage-layouts/temp.$CONTRACT.json
echo "✅ 'forge inspect' saved new $CONTRACT storage layout at './storage-layouts/$CONTRACT.json'."
done
exit 0
Expand Down
173 changes: 3 additions & 170 deletions storage-layouts/Arbitrum_SpokePool.json
Original file line number Diff line number Diff line change
@@ -1,360 +1,193 @@
{
"storage": [
{
"astId": 65627,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8"
},
{
"astId": 65630,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool"
},
{
"astId": 65609,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage"
},
{
"astId": 65925,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "__gap",
"offset": 0,
"slot": "51",
"type": "t_array(t_uint256)50_storage"
},
{
"astId": 65941,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "_status",
"offset": 0,
"slot": "101",
"type": "t_uint256"
},
{
"astId": 66010,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "__gap",
"offset": 0,
"slot": "102",
"type": "t_array(t_uint256)49_storage"
},
{
"astId": 18041,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "__gap",
"offset": 0,
"slot": "151",
"type": "t_array(t_uint256)1000_storage"
},
{
"astId": 17773,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "_HASHED_NAME",
"offset": 0,
"slot": "1151",
"type": "t_bytes32"
},
{
"astId": 17775,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "_HASHED_VERSION",
"offset": 0,
"slot": "1152",
"type": "t_bytes32"
},
{
"astId": 17874,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "__gap",
"offset": 0,
"slot": "1153",
"type": "t_array(t_uint256)1000_storage"
},
{
"astId": 5938,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "crossDomainAdmin",
"offset": 0,
"slot": "2153",
"type": "t_address"
},
{
"astId": 5940,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "hubPool",
"offset": 0,
"slot": "2154",
"type": "t_address"
},
{
"astId": 5943,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "DEPRECATED_wrappedNativeToken",
"offset": 0,
"slot": "2155",
"type": "t_contract(WETH9Interface)13511"
"type": "t_contract(WETH9Interface)8655"
},
{
"astId": 5945,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "DEPRECATED_depositQuoteTimeBuffer",
"offset": 20,
"slot": "2155",
"type": "t_uint32"
},
{
"astId": 5947,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "numberOfDeposits",
"offset": 24,
"slot": "2155",
"type": "t_uint32"
},
{
"astId": 5949,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "pausedFills",
"offset": 28,
"slot": "2155",
"type": "t_bool"
},
{
"astId": 5951,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "pausedDeposits",
"offset": 29,
"slot": "2155",
"type": "t_bool"
},
{
"astId": 5955,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "rootBundles",
"offset": 0,
"slot": "2156",
"type": "t_array(t_struct(RootBundle)14088_storage)dyn_storage"
"type": "t_array(t_struct(RootBundle)9232_storage)dyn_storage"
},
{
"astId": 5961,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "enabledDepositRoutes",
"offset": 0,
"slot": "2157",
"type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))"
},
{
"astId": 5965,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "DEPRECATED_relayFills",
"offset": 0,
"slot": "2158",
"type": "t_mapping(t_bytes32,t_uint256)"
},
{
"astId": 5969,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "DEPRECATED_fillCounter",
"offset": 0,
"slot": "2159",
"type": "t_mapping(t_address,t_uint256)"
},
{
"astId": 5973,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "DEPRECATED_depositCounter",
"offset": 0,
"slot": "2160",
"type": "t_mapping(t_address,t_uint256)"
},
{
"astId": 5977,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "DEPRECATED_refundsRequested",
"offset": 0,
"slot": "2161",
"type": "t_mapping(t_bytes32,t_uint256)"
},
{
"astId": 5981,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "fillStatuses",
"offset": 0,
"slot": "2162",
"type": "t_mapping(t_bytes32,t_uint256)"
},
{
"astId": 7932,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "__gap",
"offset": 0,
"slot": "2163",
"type": "t_array(t_uint256)999_storage"
},
{
"astId": 98,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "l2GatewayRouter",
"offset": 0,
"slot": "3162",
"type": "t_address"
},
{
"astId": 102,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "whitelistedTokens",
"offset": 0,
"slot": "3163",
"type": "t_mapping(t_address,t_address)"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_struct(RootBundle)14088_storage)dyn_storage": {
"encoding": "dynamic_array",
"label": "struct SpokePoolInterface.RootBundle[]",
"numberOfBytes": "32",
"base": "t_struct(RootBundle)14088_storage"
},
"t_array(t_uint256)1000_storage": {
"encoding": "inplace",
"label": "uint256[1000]",
"numberOfBytes": "32000",
"base": "t_uint256"
},
"t_array(t_uint256)49_storage": {
"encoding": "inplace",
"label": "uint256[49]",
"numberOfBytes": "1568",
"base": "t_uint256"
},
"t_array(t_uint256)50_storage": {
"encoding": "inplace",
"label": "uint256[50]",
"numberOfBytes": "1600",
"base": "t_uint256"
},
"t_array(t_uint256)999_storage": {
"encoding": "inplace",
"label": "uint256[999]",
"numberOfBytes": "31968",
"base": "t_uint256"
},
"t_bool": {
"encoding": "inplace",
"label": "bool",
"numberOfBytes": "1"
},
"t_bytes32": {
"encoding": "inplace",
"label": "bytes32",
"numberOfBytes": "32"
},
"t_contract(WETH9Interface)13511": {
"encoding": "inplace",
"label": "contract WETH9Interface",
"numberOfBytes": "20"
},
"t_mapping(t_address,t_address)": {
"encoding": "mapping",
"key": "t_address",
"label": "mapping(address => address)",
"numberOfBytes": "32",
"value": "t_address"
},
"t_mapping(t_address,t_mapping(t_uint256,t_bool))": {
"encoding": "mapping",
"key": "t_address",
"label": "mapping(address => mapping(uint256 => bool))",
"numberOfBytes": "32",
"value": "t_mapping(t_uint256,t_bool)"
},
"t_mapping(t_address,t_uint256)": {
"encoding": "mapping",
"key": "t_address",
"label": "mapping(address => uint256)",
"numberOfBytes": "32",
"value": "t_uint256"
},
"t_mapping(t_bytes32,t_uint256)": {
"encoding": "mapping",
"key": "t_bytes32",
"label": "mapping(bytes32 => uint256)",
"numberOfBytes": "32",
"value": "t_uint256"
},
"t_mapping(t_uint256,t_bool)": {
"encoding": "mapping",
"key": "t_uint256",
"label": "mapping(uint256 => bool)",
"numberOfBytes": "32",
"value": "t_bool"
},
"t_mapping(t_uint256,t_uint256)": {
"encoding": "mapping",
"key": "t_uint256",
"label": "mapping(uint256 => uint256)",
"numberOfBytes": "32",
"value": "t_uint256"
},
"t_struct(RootBundle)14088_storage": {
"encoding": "inplace",
"label": "struct SpokePoolInterface.RootBundle",
"numberOfBytes": "96",
"members": [
{
"astId": 14081,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "slowRelayRoot",
"offset": 0,
"slot": "0",
"type": "t_bytes32"
},
{
"astId": 14083,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "relayerRefundRoot",
"offset": 0,
"slot": "1",
"type": "t_bytes32"
},
{
"astId": 14087,
"contract": "contracts/Arbitrum_SpokePool.sol:Arbitrum_SpokePool",
"label": "claimedBitmap",
"offset": 0,
"slot": "2",
"type": "t_mapping(t_uint256,t_uint256)"
}
]
},
"t_uint256": {
"encoding": "inplace",
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint32": {
"encoding": "inplace",
"label": "uint32",
"numberOfBytes": "4"
},
"t_uint8": {
"encoding": "inplace",
"label": "uint8",
"numberOfBytes": "1"
}
}
]
}
Loading
Loading