@@ -4,46 +4,39 @@ package sf.substreams.rpc.v2;
4
4
5
5
import "google/protobuf/any.proto" ;
6
6
import "substreams.proto" ;
7
- import "firehose.proto" ;
8
7
9
- service EndpointInfo {
10
- rpc Info ( sf . firehose . v2 . InfoRequest ) returns (sf . firehose . v2 . InfoResponse );
8
+ service Stream {
9
+ rpc Blocks ( Request ) returns (stream Response );
11
10
}
12
11
13
- service Stream { rpc Blocks (Request ) returns (stream Response ); }
14
-
15
12
message Request {
16
13
int64 start_block_num = 1 ;
17
14
string start_cursor = 2 ;
18
15
uint64 stop_block_num = 3 ;
19
16
20
17
// With final_block_only, you only receive blocks that are irreversible:
21
- // 'final_block_height' will be equal to current block and no 'undo_signal'
22
- // will ever be sent
18
+ // 'final_block_height' will be equal to current block and no 'undo_signal' will ever be sent
23
19
bool final_blocks_only = 4 ;
24
20
25
- // Substreams has two mode when executing your module(s) either development
26
- // mode or production mode . Development and production modes impact the
27
- // execution of Substreams, important aspects of execution include:
21
+ // Substreams has two mode when executing your module(s) either development mode or production
22
+ // mode. Development and production modes impact the execution of Substreams, important aspects
23
+ // of execution include:
28
24
// * The time required to reach the first byte.
29
25
// * The speed that large ranges get executed.
30
26
// * The module logs and outputs sent back to the client.
31
27
//
32
- // By default, the engine runs in developer mode, with richer and deeper
33
- // output. Differences between production and development modes include:
34
- // * Forward parallel execution is enabled in production mode and disabled in
35
- // development mode
36
- // * The time required to reach the first byte in development mode is faster
37
- // than in production mode.
28
+ // By default, the engine runs in developer mode, with richer and deeper output. Differences
29
+ // between production and development modes include:
30
+ // * Forward parallel execution is enabled in production mode and disabled in development mode
31
+ // * The time required to reach the first byte in development mode is faster than in production mode.
38
32
//
39
33
// Specific attributes of development mode include:
40
34
// * The client will receive all of the executed module's logs.
41
- // * It's possible to request specific store snapshots in the execution tree
42
- // (via `debug_initial_store_snapshot_for_modules`).
35
+ // * It's possible to request specific store snapshots in the execution tree (via `debug_initial_store_snapshot_for_modules`).
43
36
// * Multiple module's output is possible.
44
37
//
45
- // With production mode`, however, you trade off functionality for high speed
46
- // enabling forward parallel execution of module ahead of time.
38
+ // With production mode`, however, you trade off functionality for high speed enabling forward
39
+ // parallel execution of module ahead of time.
47
40
bool production_mode = 5 ;
48
41
49
42
string output_module = 6 ;
@@ -54,24 +47,23 @@ message Request {
54
47
repeated string debug_initial_store_snapshot_for_modules = 10 ;
55
48
}
56
49
50
+
57
51
message Response {
58
52
oneof message {
59
- SessionInit session = 1 ; // Always sent first
60
- ModulesProgress progress = 2 ; // Progress of data preparation, before
61
- // sending in the stream of `data` events.
53
+ SessionInit session = 1 ; // Always sent first
54
+ ModulesProgress progress = 2 ; // Progress of data preparation, before sending in the stream of `data` events.
62
55
BlockScopedData block_scoped_data = 3 ;
63
56
BlockUndoSignal block_undo_signal = 4 ;
64
57
Error fatal_error = 5 ;
65
58
66
- // Available only in developer mode, and only if
67
- // `debug_initial_store_snapshot_for_modules` is set.
59
+ // Available only in developer mode, and only if `debug_initial_store_snapshot_for_modules` is set.
68
60
InitialSnapshotData debug_snapshot_data = 10 ;
69
- // Available only in developer mode, and only if
70
- // `debug_initial_store_snapshot_for_modules` is set.
61
+ // Available only in developer mode, and only if `debug_initial_store_snapshot_for_modules` is set.
71
62
InitialSnapshotComplete debug_snapshot_complete = 11 ;
72
63
}
73
64
}
74
65
66
+
75
67
// BlockUndoSignal informs you that every bit of data
76
68
// with a block number above 'last_valid_block' has been reverted
77
69
// on-chain. Delete that data and restart from 'last_valid_cursor'
@@ -92,14 +84,16 @@ message BlockScopedData {
92
84
repeated StoreModuleOutput debug_store_outputs = 11 ;
93
85
}
94
86
95
- message SessionInit {
87
+ message SessionInit {
96
88
string trace_id = 1 ;
97
89
uint64 resolved_start_block = 2 ;
98
90
uint64 linear_handoff_block = 3 ;
99
91
uint64 max_parallel_workers = 4 ;
100
92
}
101
93
102
- message InitialSnapshotComplete { string cursor = 1 ; }
94
+ message InitialSnapshotComplete {
95
+ string cursor = 1 ;
96
+ }
103
97
104
98
message InitialSnapshotData {
105
99
string module_name = 1 ;
@@ -116,9 +110,9 @@ message MapModuleOutput {
116
110
}
117
111
118
112
// StoreModuleOutput are produced for store modules in development mode.
119
- // It is not possible to retrieve store models in production, with
120
- // parallelization enabled. If you need the deltas directly, write a pass
121
- // through mapper module that will get them down to you.
113
+ // It is not possible to retrieve store models in production, with parallelization
114
+ // enabled. If you need the deltas directly, write a pass through mapper module
115
+ // that will get them down to you.
122
116
message StoreModuleOutput {
123
117
string name = 1 ;
124
118
repeated StoreDelta debug_store_deltas = 2 ;
@@ -127,18 +121,16 @@ message StoreModuleOutput {
127
121
128
122
message OutputDebugInfo {
129
123
repeated string logs = 1 ;
130
- // LogsTruncated is a flag that tells you if you received all the logs or if
131
- // they were truncated because you logged too much (fixed limit currently is
132
- // set to 128 KiB).
124
+ // LogsTruncated is a flag that tells you if you received all the logs or if they
125
+ // were truncated because you logged too much (fixed limit currently is set to 128 KiB).
133
126
bool logs_truncated = 2 ;
134
127
bool cached = 3 ;
135
128
}
136
129
137
130
// ModulesProgress is a message that is sent every 500ms
138
131
message ModulesProgress {
139
132
// previously: repeated ModuleProgress modules = 1;
140
- // these previous `modules` messages were sent in bursts and are not sent
141
- // anymore.
133
+ // these previous `modules` messages were sent in bursts and are not sent anymore.
142
134
reserved 1 ;
143
135
// List of jobs running on tier2 servers
144
136
repeated Job running_jobs = 2 ;
@@ -155,82 +147,73 @@ message ProcessedBytes {
155
147
uint64 total_bytes_written = 2 ;
156
148
}
157
149
150
+
158
151
message Error {
159
152
string module = 1 ;
160
153
string reason = 2 ;
161
154
repeated string logs = 3 ;
162
- // FailureLogsTruncated is a flag that tells you if you received all the logs
163
- // or if they were truncated because you logged too much (fixed limit
164
- // currently is set to 128 KiB).
155
+ // FailureLogsTruncated is a flag that tells you if you received all the logs or if they
156
+ // were truncated because you logged too much (fixed limit currently is set to 128 KiB).
165
157
bool logs_truncated = 4 ;
166
158
}
167
159
160
+
168
161
message Job {
169
- uint32 stage = 1 ;
170
- uint64 start_block = 2 ;
171
- uint64 stop_block = 3 ;
172
- uint64 processed_blocks = 4 ;
173
- uint64 duration_ms = 5 ;
162
+ uint32 stage = 1 ;
163
+ uint64 start_block = 2 ;
164
+ uint64 stop_block = 3 ;
165
+ uint64 processed_blocks = 4 ;
166
+ uint64 duration_ms = 5 ;
174
167
}
175
168
176
169
message Stage {
177
- repeated string modules = 1 ;
178
- repeated BlockRange completed_ranges = 2 ;
170
+ repeated string modules = 1 ;
171
+ repeated BlockRange completed_ranges = 2 ;
179
172
}
180
173
181
- // ModuleStats gathers metrics and statistics from each module, running on tier1
182
- // or tier2 All the 'count' and 'time_ms' values may include duplicate for each
183
- // stage going over that module
174
+ // ModuleStats gathers metrics and statistics from each module, running on tier1 or tier2
175
+ // All the 'count' and 'time_ms' values may include duplicate for each stage going over that module
184
176
message ModuleStats {
185
- // name of the module
186
- string name = 1 ;
177
+ // name of the module
178
+ string name = 1 ;
187
179
188
- // total_processed_blocks is the sum of blocks sent to that module code
189
- uint64 total_processed_block_count = 2 ;
190
- // total_processing_time_ms is the sum of all time spent running that module
191
- // code
192
- uint64 total_processing_time_ms = 3 ;
180
+ // total_processed_blocks is the sum of blocks sent to that module code
181
+ uint64 total_processed_block_count = 2 ;
182
+ // total_processing_time_ms is the sum of all time spent running that module code
183
+ uint64 total_processing_time_ms = 3 ;
193
184
194
- //// external_calls are chain-specific intrinsics, like "Ethereum RPC calls".
195
- repeated ExternalCallMetric external_call_metrics = 4 ;
185
+ //// external_calls are chain-specific intrinsics, like "Ethereum RPC calls".
186
+ repeated ExternalCallMetric external_call_metrics = 4 ;
196
187
197
- // total_store_operation_time_ms is the sum of all time spent running that
198
- // module code waiting for a store operation (ex: read, write, delete...)
199
- uint64 total_store_operation_time_ms = 5 ;
200
- // total_store_read_count is the sum of all the store Read operations called
201
- // from that module code
202
- uint64 total_store_read_count = 6 ;
188
+ // total_store_operation_time_ms is the sum of all time spent running that module code waiting for a store operation (ex: read, write, delete...)
189
+ uint64 total_store_operation_time_ms = 5 ;
190
+ // total_store_read_count is the sum of all the store Read operations called from that module code
191
+ uint64 total_store_read_count = 6 ;
203
192
204
- // total_store_write_count is the sum of all store Write operations called
205
- // from that module code (store-only)
206
- uint64 total_store_write_count = 10 ;
193
+ // total_store_write_count is the sum of all store Write operations called from that module code (store-only)
194
+ uint64 total_store_write_count = 10 ;
207
195
208
- // total_store_deleteprefix_count is the sum of all store DeletePrefix
209
- // operations called from that module code (store-only) note that DeletePrefix
210
- // can be a costly operation on large stores
211
- uint64 total_store_deleteprefix_count = 11 ;
196
+ // total_store_deleteprefix_count is the sum of all store DeletePrefix operations called from that module code (store-only)
197
+ // note that DeletePrefix can be a costly operation on large stores
198
+ uint64 total_store_deleteprefix_count = 11 ;
212
199
213
- // store_size_bytes is the uncompressed size of the full KV store for that
214
- // module, from the last 'merge' operation (store-only)
215
- uint64 store_size_bytes = 12 ;
200
+ // store_size_bytes is the uncompressed size of the full KV store for that module, from the last 'merge' operation (store-only)
201
+ uint64 store_size_bytes = 12 ;
216
202
217
- // total_store_merging_time_ms is the time spent merging partial stores into a
218
- // full KV store for that module (store-only)
219
- uint64 total_store_merging_time_ms = 13 ;
203
+ // total_store_merging_time_ms is the time spent merging partial stores into a full KV store for that module (store-only)
204
+ uint64 total_store_merging_time_ms = 13 ;
220
205
221
- // store_currently_merging is true if there is a merging operation (partial
222
- // store to full KV store) on the way.
223
- bool store_currently_merging = 14 ;
206
+ // store_currently_merging is true if there is a merging operation (partial store to full KV store) on the way.
207
+ bool store_currently_merging = 14 ;
224
208
225
- // highest_contiguous_block is the highest block in the highest merged full KV
226
- // store of that module (store-only)
227
- uint64 highest_contiguous_block = 15 ;
209
+ // highest_contiguous_block is the highest block in the highest merged full KV store of that module (store-only)
210
+ uint64 highest_contiguous_block = 15 ;
228
211
}
229
212
230
213
message ExternalCallMetric {
231
- string name = 1 ;
232
- uint64 count = 2 ;
233
- uint64 time_ms = 3 ;
214
+ string name = 1 ;
215
+ uint64 count = 2 ;
216
+ uint64 time_ms = 3 ;
234
217
}
235
218
236
219
message StoreDelta {
0 commit comments