-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path001_create_tables.sql
More file actions
88 lines (79 loc) · 2.54 KB
/
001_create_tables.sql
File metadata and controls
88 lines (79 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
CREATE TABLE IF NOT EXISTS ${DB}.l1_head_events (
l1_block_number UInt64,
block_hash FixedString(32),
slot UInt64,
block_ts UInt64,
inserted_at DateTime64(3) DEFAULT now64()
) ENGINE = MergeTree()
ORDER BY (l1_block_number);
CREATE TABLE IF NOT EXISTS ${DB}.preconf_data (
slot UInt64,
candidates Array(FixedString(20)),
current_operator Nullable(FixedString(20)),
next_operator Nullable(FixedString(20)),
inserted_at DateTime64(3) DEFAULT now64()
) ENGINE = MergeTree()
ORDER BY (slot);
CREATE TABLE IF NOT EXISTS ${DB}.l2_head_events (
l2_block_number UInt64,
block_hash FixedString(32),
block_ts UInt64,
sum_gas_used UInt128,
sum_tx UInt32,
sum_priority_fee UInt128,
sum_base_fee UInt128,
sequencer FixedString(20),
inserted_at DateTime64(3) DEFAULT now64()
) ENGINE = MergeTree()
ORDER BY (l2_block_number);
CREATE TABLE IF NOT EXISTS ${DB}.batches (
l1_block_number UInt64,
batch_id UInt64,
batch_size UInt16,
last_l2_block_number UInt64,
proposer_addr FixedString(20),
blob_count UInt8,
blob_total_bytes UInt32,
inserted_at DateTime64(3) DEFAULT now64()
) ENGINE = MergeTree()
ORDER BY (l1_block_number, batch_id);
CREATE TABLE IF NOT EXISTS ${DB}.proved_batches (
l1_block_number UInt64,
batch_id UInt64,
verifier_addr FixedString(20),
parent_hash FixedString(32),
block_hash FixedString(32),
state_root FixedString(32),
inserted_at DateTime64(3) DEFAULT now64()
) ENGINE = MergeTree()
ORDER BY (l1_block_number, batch_id);
CREATE TABLE IF NOT EXISTS ${DB}.l2_reorgs (
l2_block_number UInt64,
depth UInt16,
inserted_at DateTime64(3) DEFAULT now64()
) ENGINE = MergeTree()
ORDER BY (inserted_at);
CREATE TABLE IF NOT EXISTS ${DB}.forced_inclusion_processed (
blob_hash FixedString(32),
inserted_at DateTime64(3) DEFAULT now64()
) ENGINE = MergeTree()
ORDER BY (inserted_at);
CREATE TABLE IF NOT EXISTS ${DB}.verified_batches (
l1_block_number UInt64,
batch_id UInt64,
block_hash FixedString(32),
inserted_at DateTime64(3) DEFAULT now64()
) ENGINE = MergeTree()
ORDER BY (l1_block_number, batch_id);
CREATE TABLE IF NOT EXISTS ${DB}.slashing_events (
l1_block_number UInt64,
validator_addr FixedString(20),
inserted_at DateTime64(3) DEFAULT now64()
) ENGINE = MergeTree()
ORDER BY (l1_block_number, validator_addr);
CREATE TABLE IF NOT EXISTS ${DB}.l1_data_costs (
l1_block_number UInt64,
cost UInt128,
inserted_at DateTime64(3) DEFAULT now64()
) ENGINE = MergeTree()
ORDER BY (l1_block_number);