-
Notifications
You must be signed in to change notification settings - Fork 45
/
27_fevm_traces.go
50 lines (46 loc) · 1.35 KB
/
27_fevm_traces.go
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
package v1
func init() {
patches.Register(
27,
`
{{- if and .SchemaName (ne .SchemaName "public") }}
SET search_path TO {{ .SchemaName }},public;
{{- end }}
CREATE TABLE IF NOT EXISTS {{ .SchemaName | default "public"}}.fevm_traces (
height BIGINT NOT NULL,
message_state_root TEXT,
transaction_hash TEXT,
message_cid TEXT,
trace_cid TEXT,
"from" TEXT,
"to" TEXT,
from_filecoin_address TEXT,
to_filecoin_address TEXT,
value NUMERIC,
method BIGINT,
parsed_method TEXT,
actor_code TEXT,
exit_code BIGINT,
params TEXT,
returns TEXT,
index BIGINT,
parsed_params JSONB,
parsed_returns JSONB,
params_codec BIGINT,
returns_codec BIGINT,
PRIMARY KEY(height, message_state_root, trace_cid, message_cid)
);
CREATE INDEX IF NOT EXISTS fevm_traces_height_idx ON {{ .SchemaName | default "public"}}.fevm_traces USING BTREE (height);
CREATE INDEX IF NOT EXISTS fevm_traces_from_idx ON {{ .SchemaName | default "public"}}.fevm_traces USING HASH ("from");
CREATE INDEX IF NOT EXISTS fevm_traces_to_idx ON {{ .SchemaName | default "public"}}.fevm_traces USING HASH ("to");
SELECT create_hypertable(
'fevm_traces',
'height',
chunk_time_interval => 2880,
if_not_exists => TRUE,
migrate_data => TRUE
);
SELECT set_integer_now_func('fevm_traces', 'current_height', replace_if_exists => true);
`,
)
}