2022-02-09 15:19:10 +00:00
|
|
|
package types
|
|
|
|
|
|
|
|
var TableIPLDBlock = Table{
|
|
|
|
`public.blocks`,
|
|
|
|
[]column{
|
2022-04-19 10:19:49 +00:00
|
|
|
{"block_number", bigint},
|
2022-02-15 10:41:31 +00:00
|
|
|
{"key", text},
|
|
|
|
{"data", bytea},
|
2022-02-09 15:19:10 +00:00
|
|
|
},
|
2022-05-17 13:49:52 +00:00
|
|
|
"ON CONFLICT (key, block_number) DO NOTHING",
|
2022-02-09 15:19:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var TableNodeInfo = Table{
|
|
|
|
Name: `public.nodes`,
|
|
|
|
Columns: []column{
|
2022-02-15 10:41:31 +00:00
|
|
|
{"genesis_block", varchar},
|
|
|
|
{"network_id", varchar},
|
|
|
|
{"node_id", varchar},
|
|
|
|
{"client_name", varchar},
|
|
|
|
{"chain_id", integer},
|
2022-02-09 15:19:10 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
var TableHeader = Table{
|
|
|
|
"eth.header_cids",
|
|
|
|
[]column{
|
2022-02-15 10:41:31 +00:00
|
|
|
{"block_number", bigint},
|
|
|
|
{"block_hash", varchar},
|
|
|
|
{"parent_hash", varchar},
|
|
|
|
{"cid", text},
|
|
|
|
{"td", numeric},
|
|
|
|
{"node_id", varchar},
|
|
|
|
{"reward", numeric},
|
|
|
|
{"state_root", varchar},
|
|
|
|
{"tx_root", varchar},
|
|
|
|
{"receipt_root", varchar},
|
2022-08-11 01:23:04 +00:00
|
|
|
{"uncles_hash", varchar},
|
2022-02-15 10:41:31 +00:00
|
|
|
{"bloom", bytea},
|
|
|
|
{"timestamp", numeric},
|
|
|
|
{"mh_key", text},
|
|
|
|
{"times_validated", integer},
|
|
|
|
{"coinbase", varchar},
|
2022-02-09 15:19:10 +00:00
|
|
|
},
|
2022-08-11 01:23:04 +00:00
|
|
|
"ON CONFLICT (block_hash, block_number) DO UPDATE SET (parent_hash, cid, td, node_id, reward, state_root, tx_root, receipt_root, uncles_hash, bloom, timestamp, mh_key, times_validated, coinbase) = (EXCLUDED.parent_hash, EXCLUDED.cid, EXCLUDED.td, EXCLUDED.node_id, EXCLUDED.reward, EXCLUDED.state_root, EXCLUDED.tx_root, EXCLUDED.receipt_root, EXCLUDED.uncles_hash, EXCLUDED.bloom, EXCLUDED.timestamp, EXCLUDED.mh_key, eth.header_cids.times_validated + 1, EXCLUDED.coinbase)",
|
2022-02-09 15:19:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var TableStateNode = Table{
|
|
|
|
"eth.state_cids",
|
|
|
|
[]column{
|
2022-04-19 10:19:49 +00:00
|
|
|
{"block_number", bigint},
|
2022-02-15 10:41:31 +00:00
|
|
|
{"header_id", varchar},
|
|
|
|
{"state_leaf_key", varchar},
|
|
|
|
{"cid", text},
|
|
|
|
{"state_path", bytea},
|
|
|
|
{"node_type", integer},
|
|
|
|
{"diff", boolean},
|
|
|
|
{"mh_key", text},
|
2022-02-09 15:19:10 +00:00
|
|
|
},
|
2022-05-17 13:49:52 +00:00
|
|
|
"ON CONFLICT (header_id, state_path, block_number) DO UPDATE SET (state_leaf_key, cid, node_type, diff, mh_key) = (EXCLUDED.state_leaf_key, EXCLUDED.cid, EXCLUDED.node_type, EXCLUDED.diff, EXCLUDED.mh_key)",
|
2022-02-09 15:19:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var TableStorageNode = Table{
|
|
|
|
"eth.storage_cids",
|
|
|
|
[]column{
|
2022-04-19 10:19:49 +00:00
|
|
|
{"block_number", bigint},
|
2022-02-15 10:41:31 +00:00
|
|
|
{"header_id", varchar},
|
|
|
|
{"state_path", bytea},
|
|
|
|
{"storage_leaf_key", varchar},
|
|
|
|
{"cid", text},
|
|
|
|
{"storage_path", bytea},
|
|
|
|
{"node_type", integer},
|
|
|
|
{"diff", boolean},
|
|
|
|
{"mh_key", text},
|
2022-02-09 15:19:10 +00:00
|
|
|
},
|
2022-05-17 13:49:52 +00:00
|
|
|
"ON CONFLICT (header_id, state_path, storage_path, block_number) DO UPDATE SET (storage_leaf_key, cid, node_type, diff, mh_key) = (EXCLUDED.storage_leaf_key, EXCLUDED.cid, EXCLUDED.node_type, EXCLUDED.diff, EXCLUDED.mh_key)",
|
2022-02-09 15:19:10 +00:00
|
|
|
}
|