update db models

This commit is contained in:
i-norden 2022-06-06 10:04:00 -05:00
parent 8593cfd8ec
commit a6f4abf7b0
2 changed files with 14 additions and 35 deletions

View File

@ -69,7 +69,6 @@ type ReceiptBatch struct {
PostStates []string
Contracts []string
ContractHashes []string
LogRoots []string
}
// LogBatch holds the arguments for a batch insert of log data
@ -87,37 +86,28 @@ type LogBatch struct {
Topic3s []string
}
// StateBatch holds the arguments for a batch insert of state data
type StateBatch struct {
// StateLeafBatch holds the arguments for a batch insert of state data
type StateLeafBatch struct {
BlockNumbers []string
HeaderID string
Paths [][]byte
StateKeys []string
NodeTypes []int
CIDs []string
MhKeys []string
Diff bool
}
// AccountBatch holds the arguments for a batch insert of account data
type AccountBatch struct {
BlockNumbers []string
HeaderID string
StatePaths [][]byte
Balances []string
Nonces []uint64
CodeHashes [][]byte
StorageRoots []string
}
// StorageBatch holds the arguments for a batch insert of storage data
type StorageBatch struct {
// StorageLeafBatch holds the arguments for a batch insert of storage data
type StorageLeafBatch struct {
BlockNumbers []string
HeaderID string
StatePaths [][]string
Paths [][]byte
StorageKeys []string
NodeTypes []int
CIDs []string
MhKeys []string
Diff bool

View File

@ -90,59 +90,48 @@ type ReceiptModel struct {
PostState string `db:"post_state"`
Contract string `db:"contract"`
ContractHash string `db:"contract_hash"`
LogRoot string `db:"log_root"`
}
// StateNodeModel is the db model for eth.state_cids
type StateNodeModel struct {
// StateLeafModel is the db model for eth.state_cids
type StateLeafModel struct {
BlockNumber string `db:"block_number"`
HeaderID string `db:"header_id"`
Path []byte `db:"state_path"`
StateKey string `db:"state_leaf_key"`
NodeType int `db:"node_type"`
CID string `db:"cid"`
MhKey string `db:"mh_key"`
Diff bool `db:"diff"`
Balance string `db:"balance"`
Nonce uint64 `db:"nonce"`
CodeHash []byte `db:"code_hash"`
StorageRoot string `db:"storage_root"`
}
// StorageNodeModel is the db model for eth.storage_cids
type StorageNodeModel struct {
// StorageLeafModel is the db model for eth.storage_cids
type StorageLeafModel struct {
BlockNumber string `db:"block_number"`
HeaderID string `db:"header_id"`
StatePath []byte `db:"state_path"`
Path []byte `db:"storage_path"`
StorageKey string `db:"storage_leaf_key"`
NodeType int `db:"node_type"`
CID string `db:"cid"`
MhKey string `db:"mh_key"`
Diff bool `db:"diff"`
}
// StorageNodeWithStateKeyModel is a db model for eth.storage_cids + eth.state_cids.state_key
type StorageNodeWithStateKeyModel struct {
// StorageLeafWithStateKeyModel is a db model for eth.storage_cids + eth.state_cids.state_key
type StorageLeafWithStateKeyModel struct {
BlockNumber string `db:"block_number"`
HeaderID string `db:"header_id"`
StatePath []byte `db:"state_path"`
Path []byte `db:"storage_path"`
StateKey string `db:"state_leaf_key"`
StorageKey string `db:"storage_leaf_key"`
NodeType int `db:"node_type"`
CID string `db:"cid"`
MhKey string `db:"mh_key"`
Diff bool `db:"diff"`
}
// StateAccountModel is a db model for an eth state account (decoded value of state leaf node)
type StateAccountModel struct {
BlockNumber string `db:"block_number"`
HeaderID string `db:"header_id"`
StatePath []byte `db:"state_path"`
Balance string `db:"balance"`
Nonce uint64 `db:"nonce"`
CodeHash []byte `db:"code_hash"`
StorageRoot string `db:"storage_root"`
}
// LogsModel is the db model for eth.logs
type LogsModel struct {
BlockNumber string `db:"block_number"`