Commit c5a2ec41 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

op-bindings: delete ast package (#10299)

This package canonicalized the ast ids that were placed
in the bindings `more` files because any change in the
smart contracts would cause a massive diff in the storage
layout for all storage layouts as they used the ast ids
to represent types. We needed to canonicalize them to have
deterministic bindings generation, otherwise CI would generate
the bindings in a non deterministic way. As we adopted new
solidity features, it would find edge cases in our ast canonicalize
algo, breaking CI. This code helped us for a long time but
now it is no longer used and can be retired.
parent 35f29894
package ast
import (
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"github.com/ethereum-optimism/optimism/op-bindings/solc"
)
var remapTypeRe = regexp.MustCompile(`^(t_[\w_]+\([\w]+\))([\d]+)(_[\w]+)?$`)
var remapAstIdStorage = regexp.MustCompile(`(t_(struct|userDefinedValueType))\(([\w]+)\)([\d]+)_storage`)
// typeRemapping represents a mapping between an a type generated by solc
// and a canonicalized type. This is because solc inserts the ast id into
// certain types.
type typeRemapping struct {
oldType string
newType string
}
// CanonicalizeASTIDs canonicalizes AST IDs in storage layouts so that they
// don't cause unnecessary conflicts/diffs. The implementation is not
// particularly efficient, but is plenty fast enough for our purposes.
// It works in two passes:
//
// 1. First, it finds all AST IDs in storage and types, and builds a
// map to replace them in the second pass.
// 2. The second pass performs the replacement.
//
// This function returns a copy of the passed-in storage layout. The
// inefficiency comes from replaceType, which performs a linear
// search of all replacements when performing substring matches of
// composite types.
func CanonicalizeASTIDs(in *solc.StorageLayout, monorepoBase string) *solc.StorageLayout {
lastId := uint(1000)
astIDRemappings := make(map[uint]uint)
typeRemappings := make(map[string]string)
for _, slot := range in.Storage {
astIDRemappings[slot.AstId] = lastId
lastId++
}
// Go map iteration order is random, so we need to sort
// keys here in order to prevent non-determinism.
var sortedOldTypes sort.StringSlice
for oldType := range in.Types {
sortedOldTypes = append(sortedOldTypes, oldType)
}
sortedOldTypes.Sort()
seenTypes := make(map[string]bool)
for _, oldType := range sortedOldTypes {
if seenTypes[oldType] || oldType == "" {
continue
}
matches := remapTypeRe.FindAllStringSubmatch(oldType, -1)
if len(matches) == 0 {
continue
}
// The storage types include the size when it's a fixed size.
// This is subject to breaking in the future if a type with
// an ast id is added in a fixed storage type. We don't want
// to skip a type with `_storage` in it if it has a subtype
// with an ast id or it has an astid itself.
skip := len(remapAstIdStorage.FindAllStringSubmatch(oldType, -1)) == 0
if strings.Contains(oldType, "storage") && skip {
continue
}
replaceAstID := matches[0][2]
newType := strings.Replace(oldType, replaceAstID, strconv.Itoa(int(lastId)), 1)
typeRemappings[oldType] = newType
lastId++
seenTypes[oldType] = true
}
outLayout := &solc.StorageLayout{
Types: make(map[string]solc.StorageLayoutType),
}
for _, slot := range in.Storage {
contract := slot.Contract
// Normalize the name of the contract since absolute paths
// are used when there are 2 contracts imported with the same
// name
if filepath.IsAbs(contract) {
contract = strings.TrimPrefix(strings.Replace(contract, monorepoBase, "", 1), "/")
}
outLayout.Storage = append(outLayout.Storage, solc.StorageLayoutEntry{
AstId: astIDRemappings[slot.AstId],
Contract: contract,
Label: slot.Label,
Offset: slot.Offset,
Slot: slot.Slot,
Type: replaceType(typeRemappings, slot.Type),
})
}
for _, oldType := range sortedOldTypes {
value := in.Types[oldType]
newType := replaceType(typeRemappings, oldType)
layout := solc.StorageLayoutType{
Encoding: value.Encoding,
Label: value.Label,
NumberOfBytes: value.NumberOfBytes,
Key: replaceType(typeRemappings, value.Key),
Value: replaceType(typeRemappings, value.Value),
}
if value.Base != "" {
layout.Base = replaceType(typeRemappings, value.Base)
}
outLayout.Types[newType] = layout
}
return outLayout
}
func replaceType(typeRemappings map[string]string, in string) string {
if remap := typeRemappings[in]; remap != "" {
return remap
}
// Track the number of matches
matches := []typeRemapping{}
for oldType, newType := range typeRemappings {
if strings.Contains(in, oldType) {
matches = append(matches, typeRemapping{oldType, newType})
}
}
for _, match := range matches {
in = strings.Replace(in, match.oldType, match.newType, 1)
}
return in
}
package ast
import (
"encoding/json"
"os"
"path"
"testing"
"github.com/ethereum-optimism/optimism/op-bindings/solc"
"github.com/stretchr/testify/require"
)
func TestCanonicalize(t *testing.T) {
tests := []struct {
name string
filename string
}{
{
"simple",
"simple.json",
},
{
"remap public variables",
"public-variables.json",
},
{
"values in storage",
"values-in-storage.json",
},
{
"custom types",
"custom-types.json",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
f, err := os.Open(path.Join("testdata", tt.filename))
require.NoError(t, err)
dec := json.NewDecoder(f)
var testData struct {
In *solc.StorageLayout `json:"in"`
Out *solc.StorageLayout `json:"out"`
}
require.NoError(t, dec.Decode(&testData))
require.NoError(t, f.Close())
// Run 100 times to make sure that we aren't relying
// on random map iteration order.
for i := 0; i < 100; i++ {
require.Equal(t, testData.Out, CanonicalizeASTIDs(testData.In, ""))
}
})
}
}
{
"in": {
"storage": [
{
"astId": 59243,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8"
},
{
"astId": 59246,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool"
},
{
"astId": 59671,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage"
},
{
"astId": 59115,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "_owner",
"offset": 0,
"slot": "51",
"type": "t_address"
},
{
"astId": 59235,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "__gap",
"offset": 0,
"slot": "52",
"type": "t_array(t_uint256)49_storage"
},
{
"astId": 4350,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "gameImpls",
"offset": 0,
"slot": "101",
"type": "t_mapping(t_userDefinedValueType(GameType)8945,t_contract(IDisputeGame)5664)"
},
{
"astId": 4357,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "_disputeGames",
"offset": 0,
"slot": "102",
"type": "t_mapping(t_userDefinedValueType(Hash)8927,t_userDefinedValueType(GameId)8939)"
},
{
"astId": 4362,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "_disputeGameList",
"offset": 0,
"slot": "103",
"type": "t_array(t_userDefinedValueType(GameId)8939)dyn_storage"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
},
"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_userDefinedValueType(GameId)8939)dyn_storage": {
"encoding": "dynamic_array",
"label": "GameId[]",
"numberOfBytes": "32",
"base": "t_userDefinedValueType(GameId)8939"
},
"t_bool": {
"encoding": "inplace",
"label": "bool",
"numberOfBytes": "1"
},
"t_contract(IDisputeGame)5664": {
"encoding": "inplace",
"label": "contract IDisputeGame",
"numberOfBytes": "20"
},
"t_mapping(t_userDefinedValueType(GameType)8945,t_contract(IDisputeGame)5664)": {
"encoding": "mapping",
"key": "t_userDefinedValueType(GameType)8945",
"label": "mapping(GameType => contract IDisputeGame)",
"numberOfBytes": "32",
"value": "t_contract(IDisputeGame)5664"
},
"t_mapping(t_userDefinedValueType(Hash)8927,t_userDefinedValueType(GameId)8939)": {
"encoding": "mapping",
"key": "t_userDefinedValueType(Hash)8927",
"label": "mapping(Hash => GameId)",
"numberOfBytes": "32",
"value": "t_userDefinedValueType(GameId)8939"
},
"t_uint256": {
"encoding": "inplace",
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"encoding": "inplace",
"label": "uint8",
"numberOfBytes": "1"
},
"t_userDefinedValueType(GameId)8939": {
"encoding": "inplace",
"label": "GameId",
"numberOfBytes": "32"
},
"t_userDefinedValueType(GameType)8945": {
"encoding": "inplace",
"label": "GameType",
"numberOfBytes": "1"
},
"t_userDefinedValueType(Hash)8927": {
"encoding": "inplace",
"label": "Hash",
"numberOfBytes": "32"
}
}
},
"out": {
"storage": [
{
"astId": 1000,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8"
},
{
"astId": 1001,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool"
},
{
"astId": 1002,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage"
},
{
"astId": 1003,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "_owner",
"offset": 0,
"slot": "51",
"type": "t_address"
},
{
"astId": 1004,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "__gap",
"offset": 0,
"slot": "52",
"type": "t_array(t_uint256)49_storage"
},
{
"astId": 1005,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "gameImpls",
"offset": 0,
"slot": "101",
"type": "t_mapping(t_userDefinedValueType(GameType)1010,t_contract(IDisputeGame)1008)"
},
{
"astId": 1006,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "_disputeGames",
"offset": 0,
"slot": "102",
"type": "t_mapping(t_userDefinedValueType(Hash)1011,t_userDefinedValueType(GameId)1009)"
},
{
"astId": 1007,
"contract": "contracts/dispute/DisputeGameFactory.sol:DisputeGameFactory",
"label": "_disputeGameList",
"offset": 0,
"slot": "103",
"type": "t_array(t_userDefinedValueType(GameId)1009)dyn_storage"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
},
"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_userDefinedValueType(GameId)1009)dyn_storage": {
"encoding": "dynamic_array",
"label": "GameId[]",
"numberOfBytes": "32",
"base": "t_userDefinedValueType(GameId)1009"
},
"t_bool": {
"encoding": "inplace",
"label": "bool",
"numberOfBytes": "1"
},
"t_contract(IDisputeGame)1008": {
"encoding": "inplace",
"label": "contract IDisputeGame",
"numberOfBytes": "20"
},
"t_mapping(t_userDefinedValueType(GameType)1010,t_contract(IDisputeGame)1008)": {
"encoding": "mapping",
"key": "t_userDefinedValueType(GameType)1010",
"label": "mapping(GameType => contract IDisputeGame)",
"numberOfBytes": "32",
"value": "t_contract(IDisputeGame)1008"
},
"t_mapping(t_userDefinedValueType(Hash)1011,t_userDefinedValueType(GameId)1009)": {
"encoding": "mapping",
"key": "t_userDefinedValueType(Hash)1011",
"label": "mapping(Hash => GameId)",
"numberOfBytes": "32",
"value": "t_userDefinedValueType(GameId)1009"
},
"t_uint256": {
"encoding": "inplace",
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"encoding": "inplace",
"label": "uint8",
"numberOfBytes": "1"
},
"t_userDefinedValueType(GameId)1009": {
"encoding": "inplace",
"label": "GameId",
"numberOfBytes": "32"
},
"t_userDefinedValueType(GameType)1010": {
"encoding": "inplace",
"label": "GameType",
"numberOfBytes": "1"
},
"t_userDefinedValueType(Hash)1011": {
"encoding": "inplace",
"label": "Hash",
"numberOfBytes": "32"
}
}
}
}
{
"in": {
"storage": [
{
"astId": 37343,
"contract": "contracts/universal/ProxyAdmin.sol:ProxyAdmin",
"label": "owner",
"offset": 0,
"slot": "0",
"type": "t_address"
},
{
"astId": 27905,
"contract": "contracts/universal/ProxyAdmin.sol:ProxyAdmin",
"label": "proxyType",
"offset": 0,
"slot": "1",
"type": "t_mapping(t_address,t_enum(ProxyType)27899)"
},
{
"astId": 27910,
"contract": "contracts/universal/ProxyAdmin.sol:ProxyAdmin",
"label": "implementationName",
"offset": 0,
"slot": "2",
"type": "t_mapping(t_address,t_string_storage)"
},
{
"astId": 27914,
"contract": "contracts/universal/ProxyAdmin.sol:ProxyAdmin",
"label": "addressManager",
"offset": 0,
"slot": "3",
"type": "t_contract(AddressManager)4431"
},
{
"astId": 27918,
"contract": "contracts/universal/ProxyAdmin.sol:ProxyAdmin",
"label": "upgrading",
"offset": 20,
"slot": "3",
"type": "t_bool"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
},
"t_bool": {
"encoding": "inplace",
"label": "bool",
"numberOfBytes": "1"
},
"t_contract(AddressManager)4431": {
"encoding": "inplace",
"label": "contract AddressManager",
"numberOfBytes": "20"
},
"t_enum(ProxyType)27899": {
"encoding": "inplace",
"label": "enum ProxyAdmin.ProxyType",
"numberOfBytes": "1"
},
"t_mapping(t_address,t_enum(ProxyType)27899)": {
"encoding": "mapping",
"key": "t_address",
"label": "mapping(address => enum ProxyAdmin.ProxyType)",
"numberOfBytes": "32",
"value": "t_enum(ProxyType)27899"
},
"t_mapping(t_address,t_string_storage)": {
"encoding": "mapping",
"key": "t_address",
"label": "mapping(address => string)",
"numberOfBytes": "32",
"value": "t_string_storage"
},
"t_string_storage": {
"encoding": "bytes",
"label": "string",
"numberOfBytes": "32"
}
}
},
"out": {
"storage": [
{
"astId": 1000,
"contract": "contracts/universal/ProxyAdmin.sol:ProxyAdmin",
"label": "owner",
"offset": 0,
"slot": "0",
"type": "t_address"
},
{
"astId": 1001,
"contract": "contracts/universal/ProxyAdmin.sol:ProxyAdmin",
"label": "proxyType",
"offset": 0,
"slot": "1",
"type": "t_mapping(t_address,t_enum(ProxyType)1006)"
},
{
"astId": 1002,
"contract": "contracts/universal/ProxyAdmin.sol:ProxyAdmin",
"label": "implementationName",
"offset": 0,
"slot": "2",
"type": "t_mapping(t_address,t_string_storage)"
},
{
"astId": 1003,
"contract": "contracts/universal/ProxyAdmin.sol:ProxyAdmin",
"label": "addressManager",
"offset": 0,
"slot": "3",
"type": "t_contract(AddressManager)1005"
},
{
"astId": 1004,
"contract": "contracts/universal/ProxyAdmin.sol:ProxyAdmin",
"label": "upgrading",
"offset": 20,
"slot": "3",
"type": "t_bool"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
},
"t_bool": {
"encoding": "inplace",
"label": "bool",
"numberOfBytes": "1"
},
"t_contract(AddressManager)1005": {
"encoding": "inplace",
"label": "contract AddressManager",
"numberOfBytes": "20"
},
"t_enum(ProxyType)1006": {
"encoding": "inplace",
"label": "enum ProxyAdmin.ProxyType",
"numberOfBytes": "1"
},
"t_mapping(t_address,t_enum(ProxyType)1006)": {
"encoding": "mapping",
"key": "t_address",
"label": "mapping(address => enum ProxyAdmin.ProxyType)",
"numberOfBytes": "32",
"value": "t_enum(ProxyType)1006"
},
"t_mapping(t_address,t_string_storage)": {
"encoding": "mapping",
"key": "t_address",
"label": "mapping(address => string)",
"numberOfBytes": "32",
"value": "t_string_storage"
},
"t_string_storage": {
"encoding": "bytes",
"label": "string",
"numberOfBytes": "32"
}
}
}
}
\ No newline at end of file
{
"in": {
"storage": [
{
"astId": 2533,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "number",
"offset": 0,
"slot": "0",
"type": "t_uint64"
},
{
"astId": 2536,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "timestamp",
"offset": 8,
"slot": "0",
"type": "t_uint64"
},
{
"astId": 2539,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "basefee",
"offset": 0,
"slot": "1",
"type": "t_uint256"
},
{
"astId": 2542,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "hash",
"offset": 0,
"slot": "2",
"type": "t_bytes32"
},
{
"astId": 2545,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "sequenceNumber",
"offset": 0,
"slot": "3",
"type": "t_uint64"
},
{
"astId": 2548,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "batcherHash",
"offset": 0,
"slot": "4",
"type": "t_bytes32"
},
{
"astId": 2551,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "l1FeeOverhead",
"offset": 0,
"slot": "5",
"type": "t_uint256"
},
{
"astId": 2554,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "l1FeeScalar",
"offset": 0,
"slot": "6",
"type": "t_uint256"
}
],
"types": {
"t_bytes32": {
"encoding": "inplace",
"label": "bytes32",
"numberOfBytes": "32"
},
"t_uint256": {
"encoding": "inplace",
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint64": {
"encoding": "inplace",
"label": "uint64",
"numberOfBytes": "8"
}
}
},
"out": {
"storage": [
{
"astId": 1000,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "number",
"offset": 0,
"slot": "0",
"type": "t_uint64"
},
{
"astId": 1001,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "timestamp",
"offset": 8,
"slot": "0",
"type": "t_uint64"
},
{
"astId": 1002,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "basefee",
"offset": 0,
"slot": "1",
"type": "t_uint256"
},
{
"astId": 1003,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "hash",
"offset": 0,
"slot": "2",
"type": "t_bytes32"
},
{
"astId": 1004,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "sequenceNumber",
"offset": 0,
"slot": "3",
"type": "t_uint64"
},
{
"astId": 1005,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "batcherHash",
"offset": 0,
"slot": "4",
"type": "t_bytes32"
},
{
"astId": 1006,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "l1FeeOverhead",
"offset": 0,
"slot": "5",
"type": "t_uint256"
},
{
"astId": 1007,
"contract": "contracts/L2/L1Block.sol:L1Block",
"label": "l1FeeScalar",
"offset": 0,
"slot": "6",
"type": "t_uint256"
}
],
"types": {
"t_bytes32": {
"encoding": "inplace",
"label": "bytes32",
"numberOfBytes": "32"
},
"t_uint256": {
"encoding": "inplace",
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint64": {
"encoding": "inplace",
"label": "uint64",
"numberOfBytes": "8"
}
}
}
}
\ No newline at end of file
{
"in": {
"storage": [
{
"astId": 1000,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_balances",
"offset": 0,
"slot": "0",
"type": "t_mapping(t_address,t_uint256)"
},
{
"astId": 1001,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_allowances",
"offset": 0,
"slot": "1",
"type": "t_mapping(t_address,t_mapping(t_address,t_uint256))"
},
{
"astId": 1002,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_totalSupply",
"offset": 0,
"slot": "2",
"type": "t_uint256"
},
{
"astId": 1003,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_name",
"offset": 0,
"slot": "3",
"type": "t_string_storage"
},
{
"astId": 1004,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_symbol",
"offset": 0,
"slot": "4",
"type": "t_string_storage"
},
{
"astId": 1005,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_nonces",
"offset": 0,
"slot": "5",
"type": "t_mapping(t_address,t_struct(Counter)1012_storage)"
},
{
"astId": 1006,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_PERMIT_TYPEHASH_DEPRECATED_SLOT",
"offset": 0,
"slot": "6",
"type": "t_bytes32"
},
{
"astId": 1007,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_delegates",
"offset": 0,
"slot": "7",
"type": "t_mapping(t_address,t_address)"
},
{
"astId": 1008,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_checkpoints",
"offset": 0,
"slot": "8",
"type": "t_mapping(t_address,t_array(t_struct(Checkpoint)1011_storage)dyn_storage)"
},
{
"astId": 1009,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_totalSupplyCheckpoints",
"offset": 0,
"slot": "9",
"type": "t_array(t_struct(Checkpoint)1011_storage)dyn_storage"
},
{
"astId": 1010,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_owner",
"offset": 0,
"slot": "10",
"type": "t_address"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_struct(Checkpoint)1011_storage)dyn_storage": {
"encoding": "dynamic_array",
"label": "struct ERC20Votes.Checkpoint[]",
"numberOfBytes": "32"
},
"t_bytes32": {
"encoding": "inplace",
"label": "bytes32",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_address)": {
"encoding": "mapping",
"label": "mapping(address =u003e address)",
"numberOfBytes": "32",
"key": "t_address",
"value": "t_address"
},
"t_mapping(t_address,t_array(t_struct(Checkpoint)1011_storage)dyn_storage)": {
"encoding": "mapping",
"label": "mapping(address =u003e struct ERC20Votes.Checkpoint[])",
"numberOfBytes": "32",
"key": "t_address",
"value": "t_array(t_struct(Checkpoint)1011_storage)dyn_storage"
},
"t_mapping(t_address,t_mapping(t_address,t_uint256))": {
"encoding": "mapping",
"label": "mapping(address =u003e mapping(address =u003e uint256))",
"numberOfBytes": "32",
"key": "t_address",
"value": "t_mapping(t_address,t_uint256)"
},
"t_mapping(t_address,t_struct(Counter)1012_storage)": {
"encoding": "mapping",
"label": "mapping(address =u003e struct Counters.Counter)",
"numberOfBytes": "32",
"key": "t_address",
"value": "t_struct(Counter)1012_storage"
},
"t_mapping(t_address,t_uint256)": {
"encoding": "mapping",
"label": "mapping(address =u003e uint256)",
"numberOfBytes": "32",
"key": "t_address",
"value": "t_uint256"
},
"t_string_storage": {
"encoding": "bytes",
"label": "string",
"numberOfBytes": "32"
},
"t_struct(Checkpoint)1011_storage": {
"encoding": "inplace",
"label": "struct ERC20Votes.Checkpoint",
"numberOfBytes": "32"
},
"t_struct(Counter)1012_storage": {
"encoding": "inplace",
"label": "struct Counters.Counter",
"numberOfBytes": "32"
},
"t_uint224": {
"encoding": "inplace",
"label": "uint224",
"numberOfBytes": "28"
},
"t_uint256": {
"encoding": "inplace",
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint32": {
"encoding": "inplace",
"label": "uint32",
"numberOfBytes": "4"
}
}
},
"out": {
"storage": [
{
"astId": 1000,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_balances",
"offset": 0,
"slot": "0",
"type": "t_mapping(t_address,t_uint256)"
},
{
"astId": 1001,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_allowances",
"offset": 0,
"slot": "1",
"type": "t_mapping(t_address,t_mapping(t_address,t_uint256))"
},
{
"astId": 1002,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_totalSupply",
"offset": 0,
"slot": "2",
"type": "t_uint256"
},
{
"astId": 1003,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_name",
"offset": 0,
"slot": "3",
"type": "t_string_storage"
},
{
"astId": 1004,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_symbol",
"offset": 0,
"slot": "4",
"type": "t_string_storage"
},
{
"astId": 1005,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_nonces",
"offset": 0,
"slot": "5",
"type": "t_mapping(t_address,t_struct(Counter)1012_storage)"
},
{
"astId": 1006,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_PERMIT_TYPEHASH_DEPRECATED_SLOT",
"offset": 0,
"slot": "6",
"type": "t_bytes32"
},
{
"astId": 1007,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_delegates",
"offset": 0,
"slot": "7",
"type": "t_mapping(t_address,t_address)"
},
{
"astId": 1008,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_checkpoints",
"offset": 0,
"slot": "8",
"type": "t_mapping(t_address,t_array(t_struct(Checkpoint)1011_storage)dyn_storage)"
},
{
"astId": 1009,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_totalSupplyCheckpoints",
"offset": 0,
"slot": "9",
"type": "t_array(t_struct(Checkpoint)1011_storage)dyn_storage"
},
{
"astId": 1010,
"contract": "contracts/L2/GovernanceToken.sol:GovernanceToken",
"label": "_owner",
"offset": 0,
"slot": "10",
"type": "t_address"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_struct(Checkpoint)1011_storage)dyn_storage": {
"encoding": "dynamic_array",
"label": "struct ERC20Votes.Checkpoint[]",
"numberOfBytes": "32"
},
"t_bytes32": {
"encoding": "inplace",
"label": "bytes32",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_address)": {
"encoding": "mapping",
"label": "mapping(address =u003e address)",
"numberOfBytes": "32",
"key": "t_address",
"value": "t_address"
},
"t_mapping(t_address,t_array(t_struct(Checkpoint)1011_storage)dyn_storage)": {
"encoding": "mapping",
"label": "mapping(address =u003e struct ERC20Votes.Checkpoint[])",
"numberOfBytes": "32",
"key": "t_address",
"value": "t_array(t_struct(Checkpoint)1011_storage)dyn_storage"
},
"t_mapping(t_address,t_mapping(t_address,t_uint256))": {
"encoding": "mapping",
"label": "mapping(address =u003e mapping(address =u003e uint256))",
"numberOfBytes": "32",
"key": "t_address",
"value": "t_mapping(t_address,t_uint256)"
},
"t_mapping(t_address,t_struct(Counter)1012_storage)": {
"encoding": "mapping",
"label": "mapping(address =u003e struct Counters.Counter)",
"numberOfBytes": "32",
"key": "t_address",
"value": "t_struct(Counter)1012_storage"
},
"t_mapping(t_address,t_uint256)": {
"encoding": "mapping",
"label": "mapping(address =u003e uint256)",
"numberOfBytes": "32",
"key": "t_address",
"value": "t_uint256"
},
"t_string_storage": {
"encoding": "bytes",
"label": "string",
"numberOfBytes": "32"
},
"t_struct(Checkpoint)1011_storage": {
"encoding": "inplace",
"label": "struct ERC20Votes.Checkpoint",
"numberOfBytes": "32"
},
"t_struct(Counter)1012_storage": {
"encoding": "inplace",
"label": "struct Counters.Counter",
"numberOfBytes": "32"
},
"t_uint224": {
"encoding": "inplace",
"label": "uint224",
"numberOfBytes": "28"
},
"t_uint256": {
"encoding": "inplace",
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint32": {
"encoding": "inplace",
"label": "uint32",
"numberOfBytes": "4"
}
}
}
}
\ No newline at end of file
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