quorum_sdk 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,10 +5,9 @@ package quorum.pb;
5
5
  option go_package = "github.com/rumsystem/quorum/pkg/pb";
6
6
 
7
7
  enum PackageType {
8
- TRX = 0;
9
- BLOCK = 1;
10
- SNAPSHOT = 2;
11
- HBB = 3;
8
+ TRX = 0;
9
+ BLOCK = 1;
10
+ HBB = 2;
12
11
  }
13
12
 
14
13
  message Package {
@@ -16,27 +15,9 @@ message Package {
16
15
  bytes Data = 2;
17
16
  }
18
17
 
19
- enum TrxType {
20
- POST = 0; // post to group
21
- SCHEMA = 2; // group schema
22
- PRODUCER = 3; // update group producer
23
- ANNOUNCE = 4; // self announce, producer or user)
24
- REQ_BLOCK_FORWARD = 5; // request next block
25
- REQ_BLOCK_BACKWARD = 6; // request previous block
26
- REQ_BLOCK_RESP = 7; // response request next block
27
- BLOCK_SYNCED = 8; // block for producer to sync (old block)
28
- BLOCK_PRODUCED = 9; // block for producer to merge (newly produced block)
29
- USER = 10; // update group user
30
- ASK_PEERID = 11; // ask owner/producer peerid
31
- ASK_PEERID_RESP = 12; // response ask peerid
32
- CHAIN_CONFIG = 13; // predefined chain configuration
33
- APP_CONFIG = 14; // group app customized configuration
34
- }
35
-
36
18
  enum AnnounceType {
37
19
  AS_USER = 0;
38
20
  AS_PRODUCER = 1;
39
- AS_USER_ENCRYPT = 2;
40
21
  }
41
22
 
42
23
  enum ApproveType {
@@ -55,129 +36,78 @@ enum TrxStroageType {
55
36
  CACHE = 1;
56
37
  }
57
38
 
58
- message Trx {
59
- string TrxId = 1;
60
- TrxType Type = 2;
61
- string GroupId = 3;
62
- bytes Data = 4;
63
- int64 TimeStamp = 5;
64
- string Version = 6;
65
- int64 Expired = 7;
66
- int64 ResendCount = 8;
67
- int64 Nonce = 9;
68
- string SenderPubkey = 10;
69
- bytes SenderSign = 11;
70
- TrxStroageType StorageType = 12;
71
- }
72
-
73
- message Block {
74
- string BlockId = 1;
75
- string GroupId = 2;
76
- string PrevBlockId = 3;
77
- bytes PreviousHash = 4;
78
- repeated Trx Trxs = 5;
79
- string ProducerPubKey = 6;
80
- bytes Hash = 7;
81
- bytes Signature = 8;
82
- int64 TimeStamp = 9;
83
- }
84
-
85
- message Snapshot {
86
- string SnapshotId = 1;
87
- string SnapshotPackageId = 2;
88
- int64 TotalCount = 3;
89
- string GroupId = 4;
90
- int64 Nonce = 5;
91
- repeated SnapshotItem SnapshotItems = 6;
92
- string SenderPubkey = 7;
93
- bytes Singature = 8;
94
- int64 TimeStamp = 9;
95
- int64 HighestHeight = 10;
96
- string HighestBlockId = 11;
97
- bytes ItemsHash = 12;
98
- }
99
-
100
- message SnapshotItem {
101
- string SnapshotItemId = 1;
102
- SnapShotItemType Type = 2;
103
- bytes Data = 3;
104
- }
105
-
106
- enum SnapShotItemType {
107
- SNAPSHOT_APP_CONFIG = 0; //app_config item
108
- SNAPSHOT_CHAIN_CONFIG = 1; //chain_config item
109
- SNAPSHOT_PRODUCER = 2; //producer item
110
- SNAPSHOT_USER = 3; //user item
111
- SNAPSHOT_ANNOUNCE = 4; //announce item
112
- }
113
-
114
- message SnapShotTag {
115
- int64 TimeStamp = 1;
116
- int64 HighestHeight = 2;
117
- string HighestBlockId = 3;
118
- bytes ItemsHash = 4;
119
- int64 Nonce = 5;
120
- string SnapshotPackageId = 6;
121
- string SenderPubkey = 7;
122
- }
123
-
124
- message BlockDbChunk {
125
- string BlockId = 1;
126
- Block BlockItem = 2;
127
- string ParentBlockId = 3;
128
- repeated string SubBlockId = 4;
129
- int64 Height = 6;
130
- }
131
-
132
- message ReqBlock {
133
- string BlockId = 1; //block id
134
- string GroupId = 2; //group id
135
- string UserId = 3; //requester
136
- }
137
-
138
- message BlockSynced {
139
- Block BlockItem = 1;
39
+ enum TrxType {
40
+ POST = 0; // post to group
41
+ ANNOUNCE = 1; // producer or user self announce
42
+ PRODUCER = 2; // owner update group producer
43
+ USER = 3; // owner update group user
44
+ REQ_BLOCK = 4; // request block
45
+ REQ_BLOCK_RESP = 5; // response request block
46
+ CHAIN_CONFIG = 6; // chain configuration
47
+ APP_CONFIG = 7; // app configuration
140
48
  }
141
49
 
142
- message AskPeerId {
143
- string GroupId = 1;
144
- string UserPeerId = 2;
145
- string UserPubkey = 3;
146
- string UserSign = 4;
147
- string Memo = 5;
50
+ message Trx {
51
+ string TrxId = 1;
52
+ TrxType Type = 2;
53
+ string GroupId = 3;
54
+ bytes Data = 4;
55
+ int64 TimeStamp = 5;
56
+ string Version = 6;
57
+ int64 Expired = 7;
58
+ int64 ResendCount = 8;
59
+ string SenderPubkey = 10;
60
+ bytes SenderSign = 11;
61
+ TrxStroageType StorageType = 12;
62
+ reserved 9;
63
+ }
64
+
65
+ message Block {
66
+ string GroupId = 1;
67
+ uint64 BlockId = 2;
68
+ uint64 Epoch = 3;
69
+ bytes PrevHash = 4;
70
+ string ProducerPubkey = 5;
71
+ repeated Trx Trxs = 6;
72
+ bool Sudo = 7;
73
+ int64 TimeStamp = 8;
74
+ bytes BlockHash = 9;
75
+ bytes ProducerSign = 10;
148
76
  }
149
77
 
150
- message AskPeerIdResp {
151
- string GroupId = 1;
152
- string RespPeerId = 2;
153
- string RespPeerPubkey = 3;
154
- string RespSign = 4;
155
- bool IsDirectConnected = 5;
78
+ message ReqBlock {
79
+ string GroupId = 1; //group id
80
+ uint64 FromBlock = 2; //from which block
81
+ int32 BlksRequested = 3; //how many blocks requested, "-1" means many as possible
82
+ string ReqPubkey = 4; //requester pubkey
156
83
  }
157
84
 
158
- message BlockProduced {
159
- Block BlockItem = 1;
85
+ message BlocksBundle {
86
+ repeated Block Blocks = 1;
160
87
  }
161
88
 
162
89
  enum ReqBlkResult {
163
- BLOCK_IN_TRX = 0; //block data in trx
164
- BLOCK_NOT_FOUND = 1; //block not found
90
+ BLOCK_IN_RESP = 0; //"block(s) in resp and I may have more"
91
+ BLOCK_IN_RESP_ON_TOP = 1; //"block(s) in resp and I have no more block(when get req)"
92
+ BLOCK_NOT_FOUND = 2; //"no block in resp and I don't have the requested block"
165
93
  }
166
94
 
167
95
  message ReqBlockResp {
168
- ReqBlkResult Result = 1;
169
- string ProviderPubkey = 2;
170
- string RequesterPubkey = 3;
171
- string GroupId = 4;
172
- string BlockId = 5;
173
- bytes Block = 6;
96
+ string GroupId = 1;
97
+ string RequesterPubkey = 2;
98
+ string ProviderPubkey = 3;
99
+ ReqBlkResult Result = 4;
100
+ uint64 FromBlock = 5;
101
+ int32 BlksRequested = 6;
102
+ int32 BlksProvided = 7;
103
+ BlocksBundle Blocks = 8;
174
104
  }
175
105
 
176
106
  message PostItem {
177
- string TrxId = 1;
178
- string PublisherPubkey = 2;
179
- bytes Content = 3;
180
- int64 TimeStamp = 4;
107
+ string TrxId = 1;
108
+ string SenderPubkey = 2;
109
+ bytes Content = 3;
110
+ int64 TimeStamp = 4;
181
111
  }
182
112
 
183
113
  message ProducerItem {
@@ -185,12 +115,16 @@ message ProducerItem {
185
115
  string ProducerPubkey = 2;
186
116
  string GroupOwnerPubkey = 3;
187
117
  string GroupOwnerSign = 4;
188
- int64 TimeStamp = 5;
189
- ActionType Action = 6;
190
- int64 BlockProduced = 7;
118
+ ActionType Action = 5;
119
+ int64 WithnessBlocks = 6;
120
+ int64 TimeStamp = 7;
191
121
  string Memo = 8;
192
122
  }
193
123
 
124
+ message BFTProducerBundleItem {
125
+ repeated ProducerItem Producers = 1;
126
+ }
127
+
194
128
  message UserItem {
195
129
  string GroupId = 1;
196
130
  string UserPubkey = 2;
@@ -216,40 +150,28 @@ message AnnounceItem {
216
150
  string Memo = 11;
217
151
  }
218
152
 
219
- message SchemaItem {
220
- string GroupId = 1;
221
- string GroupOwnerPubkey = 2;
222
- string GroupOwnerSign = 3;
223
- string Type = 4;
224
- string Rule = 5;
225
- int64 TimeStamp = 6;
226
- ActionType Action = 7;
227
- }
228
-
229
153
  enum GroupEncryptType {
230
- PUBLIC = 0; //public group
231
- PRIVATE = 1; //private group
154
+ PUBLIC = 0;
155
+ PRIVATE = 1;
232
156
  }
233
157
 
234
158
  enum GroupConsenseType {
235
- POA = 0; //proof of authen
159
+ POA = 0;
236
160
  POS = 1;
237
161
  }
238
162
 
239
163
  message GroupItem {
240
- string GroupId = 1;
241
- string GroupName = 2;
242
- string OwnerPubKey = 3;
243
- string UserSignPubkey = 4;
244
- string UserEncryptPubkey = 5;
245
- int64 LastUpdate = 6;
246
- int64 HighestHeight = 7;
247
- string HighestBlockId = 8;
248
- Block GenesisBlock = 9;
249
- GroupEncryptType EncryptType = 10;
250
- GroupConsenseType ConsenseType = 11;
251
- string CipherKey = 12;
252
- string AppKey = 13;
164
+ string GroupId = 1;
165
+ string GroupName = 2;
166
+ string OwnerPubKey = 3;
167
+ string UserSignPubkey = 4;
168
+ string UserEncryptPubkey = 5;
169
+ int64 LastUpdate = 6;
170
+ Block GenesisBlock = 7;
171
+ GroupEncryptType EncryptType = 8;
172
+ GroupConsenseType ConsenseType = 9;
173
+ string CipherKey = 10;
174
+ string AppKey = 11;
253
175
  }
254
176
 
255
177
  enum RoleV0 {
@@ -294,23 +216,6 @@ message SetTrxAuthModeItem {
294
216
  TrxAuthMode Mode = 2;
295
217
  }
296
218
 
297
- message GroupItemV0 {
298
- string GroupId = 1;
299
- string GroupName = 2;
300
- string OwnerPubKey = 3;
301
- string UserSignPubkey = 4;
302
- string UserEncryptPubkey = 5;
303
- RoleV0 UserRole = 6;
304
- int64 LastUpdate = 7;
305
- int64 HighestHeight = 8;
306
- string HighestBlockId = 9;
307
- Block GenesisBlock = 10;
308
- GroupEncryptType EncryptType = 11;
309
- GroupConsenseType ConsenseType = 12;
310
- string CipherKey = 13;
311
- string AppKey = 14;
312
- }
313
-
314
219
  enum AppConfigType {
315
220
  INT = 0;
316
221
  BOOL = 1;
@@ -329,93 +234,123 @@ message AppConfigItem{
329
234
  int64 TimeStamp = 9;
330
235
  }
331
236
 
332
- message PSPing {
333
- int32 Seqnum = 1;
334
- bool IsResp = 2;
335
- int64 TimeStamp = 3;
336
- bytes Payload = 4;
337
- }
338
-
339
237
  message GroupSeed {
340
- Block GenesisBlock = 1;
341
- string GroupId = 2;
342
- string GroupName = 3;
343
- string OwnerPubkey = 4;
238
+ Block GenesisBlock = 1;
239
+ string GroupId = 2;
240
+ string GroupName = 3;
241
+ string OwnerPubkey = 4;
344
242
  string ConsensusType = 5;
345
243
  string EncryptionType = 6;
346
- string CipherKey = 7;
347
- string AppKey = 8;
348
- string Signature = 9;
244
+ string CipherKey = 7;
245
+ string AppKey = 8;
246
+ string Signature = 9;
349
247
  }
350
248
 
351
249
  message NodeSDKGroupItem {
352
- GroupItem Group = 1;
353
- string EncryptAlias = 2;
354
- string SignAlias = 3;
355
- repeated string ApiUrl = 4;
356
- string GroupSeed = 5;
250
+ GroupItem Group = 1;
251
+ string EncryptAlias = 2;
252
+ string SignAlias = 3;
253
+ repeated string ApiUrl = 4;
254
+ string GroupSeed = 5;
357
255
  }
358
256
 
359
- enum HBBMsgType {
360
- AGREEMENT = 0;
361
- BROADCAST = 1;
257
+ message HBTrxBundle {
258
+ repeated Trx Trxs = 1;
259
+ }
260
+
261
+ message HBMsgv1 {
262
+ string MsgId = 1;
263
+ uint64 Epoch = 2;
264
+ HBMsgPayloadType PayloadType = 3; // RBC or BBA
265
+ bytes Payload = 4;
362
266
  }
363
267
 
364
- message HBMsg {
365
- string MsgId = 1;
366
- HBBMsgType MsgType = 2;
367
- bytes Payload = 3;
268
+ enum HBMsgPayloadType {
269
+ RBC = 0;
270
+ BBA = 1;
368
271
  }
369
272
 
370
- enum BroadcastMsgType {
371
- PROOF = 0;
372
- READY = 1;
273
+ // RBC
274
+ message RBCMsg {
275
+ RBCMsgType Type = 1; //INIT_PROPOSE / PROOF / READY
276
+ bytes Payload = 2;
373
277
  }
374
278
 
375
- message HBTrxBundle {
376
- repeated Trx Trxs = 1;
279
+ enum RBCMsgType {
280
+ INIT_PROPOSE = 0;
281
+ ECHO = 1;
282
+ READY = 2;
377
283
  }
378
284
 
379
- message BroadcastMsg {
380
- string SenderPubkey = 1;
381
- BroadcastMsgType Type = 2;
382
- int64 Epoch = 3;
383
- bytes Payload = 4;
285
+ message InitPropose {
286
+ bytes RootHash = 1;
287
+ repeated bytes Proof = 2;
288
+ int64 Index = 3;
289
+ int64 Leaves = 4;
290
+ int64 OriginalDataSize = 5;
291
+ string RecvNodePubkey = 6; //producer which should handle this ecc data shard
292
+ string ProposerPubkey = 7; //producer which make this propose (part of ecc shards)
293
+ bytes ProposerSign = 8; //signature of producer made this propose
384
294
  }
385
295
 
386
- message Proof{
387
- bytes RootHash = 1;
388
- repeated bytes Proof = 2;
389
- int64 Index = 3;
390
- int64 Leaves = 4;
391
- bytes ProposerPubkey = 5;
392
- bytes ProposerSign = 6;
296
+ message Echo {
297
+ bytes RootHash = 1;
298
+ repeated bytes Proof = 2;
299
+ int64 Index = 3;
300
+ int64 Leaves = 4;
301
+ int64 OriginalDataSize = 5;
302
+ string OriginalProposerPubkey = 6; //producer make this original input
303
+ string EchoProviderPubkey = 7; //producer which broadcast this Echo
304
+ bytes EchoProviderSign = 8; //signature of producer broadcast this Echo
393
305
  }
394
306
 
395
307
  message Ready {
396
- bytes RootHash = 1;
397
- bytes ProoferPubkey = 2;
398
- bytes ProposerPubkey = 3;
399
- bytes ProposerSign = 4;
308
+ bytes RootHash = 1;
309
+ string OriginalProposerPubkey = 2;
310
+ string ReadyProviderPubkey = 3;
311
+ bytes ReadyProviderSign = 4;
400
312
  }
401
313
 
402
- enum AgreementMsgType {
403
- BVAL = 0;
404
- AUX = 1;
314
+ // BBA
315
+ message BBAMsg {
316
+ BBAMsgType Type = 1; //BVAL or AUX
317
+ bytes Payload = 2;
405
318
  }
406
319
 
407
- message AgreementMsg {
408
- AgreementMsgType Type = 1;
409
- string ProposerId = 2;
410
- string SenderId = 3;
411
- int64 Epoch = 4;
412
- bytes Payload = 5;
320
+ enum BBAMsgType {
321
+ BVAL = 0;
322
+ AUX = 1;
413
323
  }
414
324
 
415
325
  message Bval {
416
- bool Value = 1;
326
+ string ProposerId = 1;
327
+ string SenderPubkey = 2;
328
+ int64 Epoch = 3;
329
+ bool Value = 4;
417
330
  }
418
331
 
419
332
  message Aux {
420
- bool Value = 1;
333
+ string ProposerId = 1;
334
+ string SenderPubkey = 2;
335
+ uint64 Epoch = 3;
336
+ bool Value = 4;
421
337
  }
338
+
339
+ //old proto msg
340
+ message GroupItemV0 {
341
+ string GroupId = 1;
342
+ string GroupName = 2;
343
+ string OwnerPubKey = 3;
344
+ string UserSignPubkey = 4;
345
+ string UserEncryptPubkey = 5;
346
+ RoleV0 UserRole = 6;
347
+ int64 LastUpdate = 7;
348
+ int64 HighestHeight = 8;
349
+ string HighestBlockId = 9;
350
+ Block GenesisBlock = 10;
351
+ GroupEncryptType EncryptType = 11;
352
+ GroupConsenseType ConsenseType = 12;
353
+ string CipherKey = 13;
354
+ string AppKey = 14;
355
+ }
356
+