-
Notifications
You must be signed in to change notification settings - Fork 39
/
enclave.proto
455 lines (360 loc) · 11.9 KB
/
enclave.proto
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
syntax = "proto3";
option go_package = "enclave/rpc/generated";
package generated;
// todo (low priority) - remove these comments which duplicate those in common/enclave.go.
service EnclaveProto {
// Status is used to check whether the server is ready for requests.
rpc Status(StatusRequest) returns (StatusResponse) {}
// Attestation - Produces an attestation report which will be used to request the shared secret from another enclave.
rpc Attestation(AttestationRequest) returns (AttestationResponse) {}
// GenerateSecret - the genesis enclave is responsible with generating the secret entropy
rpc GenerateSecret(GenerateSecretRequest) returns (GenerateSecretResponse) {}
// Init - initialise an enclave with a seed received by another enclave
rpc InitEnclave(InitEnclaveRequest) returns (InitEnclaveResponse) {}
// EnclaveID - request the EnclaveID from the enclave
rpc EnclaveID(EnclaveIDRequest) returns (EnclaveIDResponse) {}
// SubmitL1Block - Used for the host to submit blocks to the enclave, these may be:
// a. historic block - if the enclave is behind and in the process of catching up with the L1 state
// b. the latest block published by the L1, to which the enclave should respond with a rollup
// It is the responsibility of the host to gossip the returned rollup
// For good functioning the caller should always submit blocks ordered by height
// submitting a block before receiving ancestors of it, will result in it being ignored
rpc SubmitL1Block(SubmitBlockRequest) returns (SubmitBlockResponse) {}
// SubmitTx - user transactions
rpc SubmitTx(SubmitTxRequest) returns (SubmitTxResponse) {}
// SubmitBatch submits a batch received from the sequencer for processing.
rpc SubmitBatch(SubmitBatchRequest) returns (SubmitBatchResponse) {}
// ObsCall - returns the result of executing the smart contract as a user, encrypted with the
// viewing key corresponding to the `from` field
rpc ObsCall(ObsCallRequest) returns (ObsCallResponse) {}
// GetTransactionCount - returns the nonce of the wallet with the given address.
rpc GetTransactionCount(GetTransactionCountRequest) returns (GetTransactionCountResponse) {}
// Stop gracefully stops the enclave
rpc Stop(StopRequest) returns (StopResponse) {}
// GetTransaction returns a transaction given its Signed Hash, returns nil, false when Transaction is unknown
rpc GetTransaction(GetTransactionRequest) returns (GetTransactionResponse) {}
// GetTransaction returns a transaction receipt given the transaction's signed hash, encrypted with the viewing key
// corresponding to the original transaction submitter
rpc GetTransactionReceipt(GetTransactionReceiptRequest) returns (GetTransactionReceiptResponse) {}
// GetBalance returns the address's balance on the Obscuro network, encrypted with the viewing key corresponding to
// the address
rpc GetBalance(GetBalanceRequest) returns (GetBalanceResponse) {}
// GetCode returns the code stored at the given address in the state for the given rollup height or rollup hash
rpc GetCode(GetCodeRequest) returns (GetCodeResponse) {}
rpc Subscribe(SubscribeRequest) returns (SubscribeResponse) {}
rpc Unsubscribe(UnsubscribeRequest) returns (UnsubscribeResponse) {}
// EstimateGas returns the estimation of gas used for the given transactions
rpc EstimateGas(EstimateGasRequest) returns (EstimateGasResponse) {}
rpc GetLogs(GetLogsRequest) returns (GetLogsResponse) {}
// HealthCheck returns the health status of enclave + db
rpc HealthCheck(EmptyArgs) returns (HealthCheckResponse) {}
// GetBatch returns the encrypted batch based on a hash
rpc GetBatch(GetBatchRequest) returns (GetBatchResponse) {}
// GetBatch returns the encrypted batch based on a hash
rpc GetBatchBySeqNo(GetBatchBySeqNoRequest) returns (GetBatchResponse) {}
// GetRollupData returns the first batch sequence number in the rollup and the timestamp
rpc GetRollupData(GetRollupDataRequest) returns (GetRollupDataResponse) {}
rpc CreateBatch(CreateBatchRequest) returns (CreateBatchResponse) {}
rpc CreateRollup(CreateRollupRequest) returns (CreateRollupResponse) {}
rpc DebugTraceTransaction(DebugTraceTransactionRequest) returns (DebugTraceTransactionResponse) {}
rpc StreamL2Updates(StreamL2UpdatesRequest) returns (stream EncodedUpdateResponse) {}
rpc DebugEventLogRelevancy(DebugEventLogRelevancyRequest) returns (DebugEventLogRelevancyResponse) {}
rpc GetTotalContractCount(GetTotalContractCountRequest) returns (GetTotalContractCountResponse) {}
rpc GetReceiptsByAddress(GetReceiptsByAddressRequest) returns (GetReceiptsByAddressResponse) {}
rpc GetPublicTransactionData(GetPublicTransactionDataRequest) returns (GetPublicTransactionDataResponse) {}
// EnclavePublicConfig returns public network data that is known to the enclave but may not be known to the host
rpc EnclavePublicConfig(EnclavePublicConfigRequest) returns (EnclavePublicConfigResponse) {}
}
message GetPublicTransactionDataRequest {
Pagination pagination = 1;
}
message GetPublicTransactionDataResponse{
bytes publicTransactionData = 1;
SystemError systemError = 2;
}
message EnclavePublicConfigRequest {}
message EnclavePublicConfigResponse{
bytes l2MessageBusAddress = 1;
SystemError systemError = 2;
}
message GetReceiptsByAddressRequest {
bytes encryptedParams = 1;
}
message GetReceiptsByAddressResponse{
bytes encodedEnclaveResponse = 1;
SystemError systemError = 2;
}
message GetBatchRequest {
bytes knownHead = 1;
}
message GetBatchBySeqNoRequest {
uint64 seqNo = 1;
}
message GetBatchResponse {
bytes batch = 1;
SystemError systemError = 2;
}
message GetRollupDataRequest {
bytes internalRollup = 1;
}
message GetRollupDataResponse {
bytes rollupMetadata = 1;
SystemError systemError = 2;
}
message StreamL2UpdatesRequest {}
message EncodedUpdateResponse {
bytes batch = 1;
}
message Pagination{
int32 offset = 1;
int32 size = 2;
}
message SystemError{
int32 errorCode = 1;
string errorString = 2;
}
message GetTotalContractCountRequest {}
message GetTotalContractCountResponse{
int64 count = 1;
SystemError systemError = 2;
}
message DebugEventLogRelevancyRequest{
bytes txHash = 1;
}
message DebugEventLogRelevancyResponse{
string msg = 1;
SystemError systemError = 2;
}
message DebugTraceTransactionRequest{
bytes txHash = 1;
bytes config = 2;
}
message DebugTraceTransactionResponse{
string msg = 1;
SystemError systemError = 2;
}
message CreateBatchRequest{
bool skipIfEmpty = 1;
}
message CreateBatchResponse{
string error = 2;
}
message CreateRollupRequest{
optional uint64 fromSequenceNumber = 1;
}
message CreateRollupResponse{
ExtRollupMsg msg = 1;
SystemError systemError = 2;
}
message StatusRequest {}
message StatusResponse {
int32 statusCode = 1;
bytes l1Head = 2; // hash for the L1 head block in enclave's view of the canonical chain
bytes l2Head = 3; // seq number (big.Int) for the L2 head batch that the enclave has seen
SystemError systemError = 4;
}
message AttestationRequest {}
message AttestationResponse {
AttestationReportMsg attestationReportMsg = 1;
SystemError systemError = 2;
}
message GenerateSecretRequest {}
message GenerateSecretResponse {
bytes encryptedSharedEnclaveSecret = 1;
SystemError systemError = 2;
}
message InitEnclaveRequest {
bytes encryptedSharedEnclaveSecret = 1;
}
message InitEnclaveResponse {
SystemError systemError = 1;
}
message EnclaveIDRequest {}
message EnclaveIDResponse {
bytes enclaveID = 1;
SystemError systemError = 2;
}
message StartRequest {
bytes encodedBlock = 1;
}
message StartResponse {
SystemError systemError = 1;
}
message SubmitBlockRequest {
bytes encodedBlock = 1;
bytes encodedReceipts = 2;
bool isLatest = 3;
}
message SubmitBlockResponse {
BlockSubmissionResponseMsg blockSubmissionResponse = 1;
SystemError systemError = 2;
}
message SubmitTxRequest {
bytes encryptedTx = 1;
}
message SubmitTxResponse {
bytes encodedEnclaveResponse = 1;
SystemError systemError = 2;
}
message SubmitBatchRequest {
ExtBatchMsg batch = 1;
}
message SubmitBatchResponse {
SystemError systemError = 1;
}
message ObsCallRequest {
bytes encryptedParams = 1;
}
message ObsCallResponse {
bytes encodedEnclaveResponse = 1;
SystemError systemError = 2;
}
message GetTransactionCountRequest {
bytes encryptedParams = 1;
}
message GetTransactionCountResponse {
bytes encodedEnclaveResponse = 1;
SystemError systemError = 2;
}
message StopRequest {}
message StopResponse {
SystemError systemError = 1;
}
message GetTransactionRequest {
bytes encryptedParams = 1;
}
message GetTransactionResponse {
bytes encodedEnclaveResponse = 1;
SystemError systemError = 2;
}
message GetTransactionReceiptRequest {
bytes encryptedParams = 1;
}
message GetTransactionReceiptResponse {
bytes encodedEnclaveResponse = 1;
SystemError systemError = 2;
}
message GetBalanceRequest {
bytes encryptedParams = 1;
}
message GetBalanceResponse {
bytes encodedEnclaveResponse = 1;
SystemError systemError = 2;
}
message GetCodeRequest {
bytes address = 1;
bytes rollupHash = 2;
}
message GetCodeResponse {
bytes code = 1;
SystemError systemError = 2;
}
message SubscribeRequest {
bytes id = 1;
bytes encryptedSubscription = 2;
}
message SubscribeResponse {
SystemError systemError = 2;
}
message UnsubscribeRequest {
bytes id = 1;
}
message UnsubscribeResponse {
SystemError systemError = 2;
}
message EstimateGasRequest {
bytes encryptedParams = 1;
}
message EstimateGasResponse {
bytes encodedEnclaveResponse = 1;
SystemError systemError = 2;
}
message GetLogsRequest {
bytes encryptedParams = 1;
}
message GetLogsResponse {
bytes encodedEnclaveResponse = 1;
SystemError systemError = 2;
}
message HealthCheckResponse {
bool status = 1;
SystemError systemError = 2;
}
message EmptyArgs {}
// Nested message types.
message AttestationReportMsg {
bytes Report = 1; // The actual report bytes so it can be shared and verified by other nodes
bytes PubKey = 2; // Public key to encrypt traffic back to this enclave
bytes Owner = 3;
string HostAddress = 4; // The IP address on which the host can be contacted by other Obscuro hosts for peer-to-peer communication
SystemError systemError = 5;
}
message BlockSubmissionResponseMsg {
repeated SecretResponseMsg producedSecretResponses = 1;
BlockSubmissionErrorMsg error = 2; // todo (@matt) - remove this BlockSubmissionError field once we are using the Status() to update host view of enclave state
}
message BlockSubmissionErrorMsg {
string cause = 1; // error cause description
bytes l1Head = 2; // hash for the L1 head block in enclave's view of the canonical chain
}
message CrossChainMsg {
bytes Sender = 1;
uint64 Sequence = 2;
uint32 Nonce = 3;
uint32 Topic = 4;
bytes Payload = 5;
}
message ExtBatchMsg {
BatchHeaderMsg header = 1;
repeated bytes txHashes = 2;
bytes txs = 3;
}
message BatchHeaderMsg {
bytes ParentHash = 1;
bytes Proof = 2;
bytes Root = 3;
bytes TxHash = 4;
uint64 Number = 5;
uint64 SequencerOrderNo = 6;
bytes ReceiptHash = 7;
bytes Extra = 8;
bytes R = 9;
bytes S = 10;
uint64 GasLimit = 11;
uint64 GasUsed = 12;
uint64 Time = 13;
uint64 BaseFee = 14;
bytes LatestInboundCrossChainHeight = 15;
bytes LatestInboundCrossChainHash = 16;
repeated CrossChainMsg CrossChainMessages = 17;
bytes TransferTree = 18;
bytes Coinbase = 19;
}
message ExtRollupMsg {
RollupHeaderMsg header = 1;
bytes batchPayloads = 2;
bytes calldataRollupHeader = 3;
}
message RollupHeaderMsg {
bytes ParentHash = 1;
bytes CompressionL1Head = 2;
uint64 ProofNumber = 3;
uint64 Number = 4;
uint64 Time = 5;
bytes Coinbase = 6;
repeated CrossChainMsg CrossChainMessages = 7;
bytes R = 8;
bytes S = 9;
uint64 LastBatchSeqNo = 10;
}
message SecretResponseMsg {
bytes Secret = 1;
bytes RequesterID = 2;
string HostAddress = 3;
SystemError systemError = 4;
}
message WithdrawalMsg {
bytes amount = 1;
bytes recipient = 2;
bytes contract = 3;
}