update types to remove unused fields

This commit is contained in:
i-norden 2023-02-16 15:52:07 -06:00
parent 50d08bcb36
commit 6daab10ca4

View File

@ -30,10 +30,10 @@ type StateRoots struct {
// StateObject is the final output structure from the builder // StateObject is the final output structure from the builder
type StateObject struct { type StateObject struct {
BlockNumber *big.Int `json:"blockNumber" gencodec:"required"` BlockNumber *big.Int `json:"blockNumber" gencodec:"required"`
BlockHash common.Hash `json:"blockHash" gencodec:"required"` BlockHash common.Hash `json:"blockHash" gencodec:"required"`
Nodes []StateNode `json:"nodes" gencodec:"required"` Nodes []StateLeafNode `json:"nodes" gencodec:"required"`
CodeAndCodeHashes []CodeAndCodeHash `json:"codeMapping"` IPLDs []IPLD `json:"iplds"`
} }
// AccountMap is a mapping of hex encoded path => account wrapper // AccountMap is a mapping of hex encoded path => account wrapper
@ -41,39 +41,35 @@ type AccountMap map[string]AccountWrapper
// AccountWrapper is used to temporary associate the unpacked node with its raw values // AccountWrapper is used to temporary associate the unpacked node with its raw values
type AccountWrapper struct { type AccountWrapper struct {
Account *types.StateAccount Account *types.StateAccount
Removed bool LeafKey []byte
LeafKey []byte NodeHash []byte
LeafNodeHash []byte
} }
// StateNode holds the data for a single state diff node // StateLeafNode holds the data for a single state diff leaf node
type StateNode struct { type StateLeafNode struct {
Removed bool `json:"removed" gencodec:"required"` Removed bool
NodeValue []byte `json:"value" gencodec:"required"` AccountWrapper AccountWrapper
StorageNodes []StorageNode `json:"storage"` StorageDiff []StorageLeafNode
LeafKey []byte `json:"leafKey"`
NodeHash []byte `json:"hash"`
} }
// StorageNode holds the data for a single storage diff node // StorageLeafNode holds the data for a single storage diff node leaf node
type StorageNode struct { type StorageLeafNode struct {
Removed bool `json:"removed" gencodec:"required"` Removed bool
NodeValue []byte `json:"value" gencodec:"required"` Value []byte
LeafKey []byte `json:"leafKey"` LeafKey []byte
NodeHash []byte `json:"hash"` NodeHash []byte
} }
// CodeAndCodeHash struct for holding codehash => code mappings // IPLD holds a cid:content pair, e.g. for codehash to code mappings or for intermediate node IPLD objects
// we can't use an actual map because they are not rlp serializable type IPLD struct {
type CodeAndCodeHash struct { CID string
Hash common.Hash `json:"codeHash"` Content []byte
Code []byte `json:"code"`
} }
type StateNodeSink func(StateNode) error type StateNodeSink func(node StateLeafNode) error
type StorageNodeSink func(StorageNode) error type StorageNodeSink func(node StorageLeafNode) error
type CodeSink func(CodeAndCodeHash) error type IPLDSink func(IPLD) error
// OperationType for type of WatchAddress operation // OperationType for type of WatchAddress operation
type OperationType string type OperationType string