-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsecurity_critical_api_specs.yml
2260 lines (2260 loc) · 88 KB
/
security_critical_api_specs.yml
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
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
version: 1.0.0
title: Watcher security-critical API
description: |
API specification of the Watcher's security-critical Service
Error codes are available in [html](https://github.com/omgnetwork/elixir-omg/blob/master/docs/api_specs/errors.md#error-codes-description) format.
contact:
name: OMG Network
email: engineering@omg.network
license:
name: 'Apache 2.0: https://www.apache.org/licenses/LICENSE-2.0'
url: 'https://omg.network/'
servers:
- url: 'https://watcher.ropsten.v1.omg.network/'
- url: 'http://localhost:7434/'
tags:
- name: Status
description: Status of the child chain.
externalDocs:
description: Byzantine events description
url: 'https://github.com/omgnetwork/elixir-omg/blob/master/docs/api_specs/status_events_specs.md#byzantine-events'
- name: Account
description: Account related API.
- name: Block
description: Block-related API
- name: UTXO
description: UTXO related API.
- name: Transaction
description: Transaction related API.
- name: InFlightExit
description: InFlightExit related API.
paths:
/alarm.get:
get:
tags:
- Alarm
summary: 'Provides alarms related to system memory, cpu and storage and application specific alarms.'
description: |
**Note:** Service operator alarms.
operationId: alarm_get
responses:
'200':
description: System alarms
content:
application/json:
schema:
allOf:
- description: The response schema for a successful operation
type: object
properties:
version:
type: string
success:
type: boolean
data:
type: object
service_name:
type: string
required:
- service_name
- version
- success
- data
example:
service_name: watcher
version: 1.0.0+abcdefa
success: true
data: {}
- type: object
properties:
data:
type: array
items:
type: array
items:
anyOf:
- type: object
properties:
ethereum_connection_error:
type: object
properties:
node:
type: string
reporter:
type: string
- type: object
properties:
ethereum_stalled_sync:
type: object
properties:
ethereum_height:
type: integer
minimum: 0
synced_at:
type: string
format: date-time
- type: object
properties:
invalid_fee_source:
type: object
properties:
node:
type: string
reporter:
type: string
- type: object
properties:
statsd_client_connection:
type: object
properties:
node:
type: string
reporter:
type: string
- type: object
properties:
statsd_client_connection:
type: array
items:
type: string
default: []
- type: object
properties:
disk_almost_full:
type: string
example:
data:
- disk_almost_full: /dev/null
ethereum_connection_error: {}
ethereum_stalled_sync: {}
system_memory_high_watermark: []
'500':
description: Returns an internal server error
content:
application/json:
schema:
description: The response schema for an error
allOf:
- description: The response schema for a successful operation
type: object
properties:
version:
type: string
success:
type: boolean
data:
type: object
service_name:
type: string
required:
- service_name
- version
- success
- data
example:
service_name: watcher
version: 1.0.0+abcdefa
success: true
data: {}
- type: object
properties:
data:
description: The object schema for an error
type: object
properties:
object:
type: string
code:
type: string
description:
type: string
messages:
type: object
required:
- object
- code
- description
- messages
required:
- data
example:
success: false
data:
object: error
code: 'server:internal_server_error'
description: Something went wrong on the server
messages:
error_key: error_reason
/configuration.get:
get:
tags:
- Configuration
summary: Provides configuration values
description: |
**Note:** Configuration values.
operationId: configuration_get
responses:
'200':
description: Configuration response
content:
application/json:
schema:
allOf:
- description: The response schema for a successful operation
type: object
properties:
version:
type: string
success:
type: boolean
data:
type: object
service_name:
type: string
required:
- service_name
- version
- success
- data
example:
service_name: watcher
version: 1.0.0+abcdefa
success: true
data: {}
- type: object
properties:
data:
type: array
items:
type: object
properties:
deposit_finality_margin:
type: integer
format: int256
contract_semver:
type: string
exit_processor_sla_margin:
type: integer
format: int256
network:
type: string
example:
data:
- deposit_finality_margin: 10
contract_semver: 1.0.0.1+a1s29s8
'500':
description: Returns an internal server error
content:
application/json:
schema:
description: The response schema for an error
allOf:
- description: The response schema for a successful operation
type: object
properties:
version:
type: string
success:
type: boolean
data:
type: object
service_name:
type: string
required:
- service_name
- version
- success
- data
example:
service_name: watcher
version: 1.0.0+abcdefa
success: true
data: {}
- type: object
properties:
data:
description: The object schema for an error
type: object
properties:
object:
type: string
code:
type: string
description:
type: string
messages:
type: object
required:
- object
- code
- description
- messages
required:
- data
example:
success: false
data:
object: error
code: 'server:internal_server_error'
description: Something went wrong on the server
messages:
error_key: error_reason
/status.get:
post:
tags:
- Status
summary: Returns information about the current state of the child chain and the watcher.
description: |
The most critical function of the Watcher is to monitor the ChildChain and report dishonest activity. The user must call the `/status.get` endpoint periodically to check. Any situation that requires the user to either exit or challenge an invalid exit will be included in the `byzantine_events` field.
operationId: status_get
responses:
'200':
description: Returns the status of the watcher
content:
application/json:
schema:
description: The response schema for a status
allOf:
- description: The response schema for a successful operation
type: object
properties:
version:
type: string
success:
type: boolean
data:
type: object
service_name:
type: string
required:
- service_name
- version
- success
- data
example:
service_name: watcher
version: 1.0.0+abcdefa
success: true
data: {}
- type: object
properties:
data:
type: object
description: The object schema for a status
properties:
last_validated_child_block_timestamp:
type: integer
format: int64
last_validated_child_block_number:
type: integer
format: int64
last_mined_child_block_timestamp:
type: integer
format: int64
last_mined_child_block_number:
type: integer
format: int64
last_seen_eth_block_timestamp:
type: integer
format: int64
last_seen_eth_block_number:
type: integer
format: int64
contract_addr:
type: object
additionalProperties: true
properties:
plasma_framework:
type: string
eth_syncing:
type: boolean
byzantine_events:
type: array
items:
anyOf:
- type: object
properties:
event:
type: string
enum:
- invalid_exit
details:
type: object
properties:
eth_height:
type: integer
utxo_pos:
type: integer
owner:
type: string
currency:
type: string
amount:
type: integer
root_chain_txhash:
type: string
spending_txhash:
type: string
scheduled_finalization_time:
type: integer
- type: object
properties:
event:
type: string
enum:
- unchallenged_exit
details:
type: object
properties:
eth_height:
type: integer
utxo_pos:
type: integer
owner:
type: string
currency:
type: string
amount:
type: integer
root_chain_txhash:
type: string
spending_txhash:
type: string
scheduled_finalization_time:
type: integer
- type: object
properties:
event:
type: string
enum:
- invalid_block
details:
type: object
properties:
blknum:
type: integer
blockhash:
type: string
error_type:
type: string
enum:
- tx_execution
- incorrect_hash
- type: object
properties:
event:
type: string
enum:
- block_withholding
details:
type: object
properties:
hash:
type: string
blknum:
type: string
- type: object
properties:
event:
type: string
enum:
- noncanonical_ife
details:
type: object
properties:
txbytes:
type: string
- type: object
properties:
event:
type: string
enum:
- invalid_ife_challenge
details:
type: object
properties:
txbytes:
type: string
- type: object
properties:
event:
type: string
enum:
- piggyback_available
details:
type: object
properties:
txbytes:
type: string
available_outputs:
type: array
items:
type: object
properties:
index:
type: integer
address:
type: string
available_inputs:
type: array
items:
type: object
properties:
index:
type: integer
address:
type: string
- type: object
properties:
event:
type: string
enum:
- invalid_piggyback
details:
type: object
properties:
txbytes:
type: string
inputs:
type: array
items:
type: integer
outputs:
type: array
items:
type: integer
- type: object
properties:
ethereum_stalled_sync:
type: object
properties:
ethereum_height:
type: integer
minimum: 0
synced_at:
type: string
format: date-time
in_flight_txs:
type: array
items:
type: object
properties:
txhash:
type: string
txbytes:
type: string
input_addresses:
type: array
items:
type: string
ouput_addresses:
type: array
items:
type: string
in_flight_exits:
type: array
items:
type: object
properties:
txhash:
type: string
txbytes:
type: string
eth_height:
type: integer
piggybacked_inputs:
type: array
items:
type: integer
piggybacked_outputs:
type: array
items:
type: integer
services_synced_heights:
type: array
items:
type: object
properties:
service:
type: string
height:
type: integer
format: int256
required:
- last_validated_child_block_timestamp
- last_validated_child_block_number
- last_mined_child_block_timestamp
- last_mined_child_block_number
- last_seen_eth_block_timestamp
- last_seen_eth_block_number
- contract_addr
- eth_syncing
- byzantine_events
- in_flight_txs
- in_flight_exits
example:
data:
last_validated_child_block_timestamp: 1558535130
last_validated_child_block_number: 10000
last_mined_child_block_timestamp: 1558535190
last_mined_child_block_number: 11000
last_seen_eth_block_timestamp: 1558535190
last_seen_eth_block_number: 4427041
contract_addr:
plasma_framework: '0x44de0ec539b8c4a4b530c78620fe8320167f2f74'
eth_syncing: true
byzantine_events:
- event: invalid_exit
details:
eth_height: 615440
utxo_pos: 10000000010000000
owner: '0xb3256026863eb6ae5b06fa396ab09069784ea8ea'
currency: '0x0000000000000000000000000000000000000000'
amount: 100
root_chain_txhash: '0xde8210dd179e4a067c5649ebeee8871e0f258fecbd1eb02e11db88121bb8de01'
spending_txhash: '0x21aee8dcc74d6b309f6e98a967a6aa6002432f98a5bc13c75529dbe228e04451'
scheduled_finalization_time: 1588144725
- event: unchallenged_exit
details:
eth_height: 615440
utxo_pos: 10000000010000000
owner: '0xb3256026863eb6ae5b06fa396ab09069784ea8ea'
currency: '0x0000000000000000000000000000000000000000'
amount: 100
root_chain_txhash: '0xde8210dd179e4a067c5649ebeee8871e0f258fecbd1eb02e11db88121bb8de01'
spending_txhash: '0x21aee8dcc74d6b309f6e98a967a6aa6002432f98a5bc13c75529dbe228e04451'
scheduled_finalization_time: 1588144725
- event: invalid_block
details:
blockhash: '0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec'
blknum: 10000
error_type: tx_execution
- event: block_withholding
details:
hash: '0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec'
blknum: 10000
- event: noncanonical_ife
details:
txbytes: '0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec'
- event: invalid_ife_challenge
details:
txbytes: '0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec'
- event: piggyback_available
details:
txbytes: '0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec'
available_outputs:
- index: 0
address: '0xb3256026863eb6ae5b06fa396ab09069784ea8ea'
- index: '1,'
address: '0x488f85743ef16cfb1f8d4dd1dfc74c51dc496434'
available_inputs:
- index: 0
address: '0xb3256026863eb6ae5b06fa396ab09069784ea8ea'
- event: invalid_piggyback
details:
txbytes: '0x0017372421f9a92bedb7163310918e623557ab5310befc14e67212b660c33bec'
inputs:
- 1
outputs:
- 0
- event: ethereum_stalled_sync
details:
eth_height: 615440
synced_at: '2020-02-07T10:10:10+00:00'
in_flight_txs:
- txhash: '0xbdf562c24ace032176e27621073df58ce1c6f65de3b5932343b70ba03c72132d'
txbytes: 0x3eb6ae5b06f3...
input_addresses:
- 0x1234...
ouput_addresses:
- 0x1234...
- 0x7890...
in_flight_exits:
- txhash: '0x5df13a6bf96dbcf6e66d8babd6b55bd40d64d4320c3b115364c6588fc18c2a21'
txbytes: 0xf3170101c094...
eth_height: 615441
piggybacked_inputs:
- 1
piggybacked_outputs:
- 0
- 1
services_synced_heights:
- service: block_getter
height: 4427041
- service: challenges_responds_processor
height: 4427029
- service: competitor_processor
height: 4427029
- service: depositor
height: 4427031
- service: exit_challenger
height: 4427029
- service: exit_finalizer
height: 4427029
- service: exit_processor
height: 4427029
- service: ife_exit_finalizer
height: 4427029
- service: in_flight_exit_processor
height: 4427029
- service: piggyback_challenges_processor
height: 4427029
- service: piggyback_processor
height: 4427029
- service: root_chain_height
height: 4427041
'500':
description: Returns an internal server error
content:
application/json:
schema:
description: The response schema for an error
allOf:
- description: The response schema for a successful operation
type: object
properties:
version:
type: string
success:
type: boolean
data:
type: object
service_name:
type: string
required:
- service_name
- version
- success
- data
example:
service_name: watcher
version: 1.0.0+abcdefa
success: true
data: {}
- type: object
properties:
data:
description: The object schema for an error
type: object
properties:
object:
type: string
code:
type: string
description:
type: string
messages:
type: object
required:
- object
- code
- description
- messages
required:
- data
example:
success: false
data:
object: error
code: 'server:internal_server_error'
description: Something went wrong on the server
messages:
error_key: error_reason
/account.get_exitable_utxos:
post:
tags:
- Account
summary: Gets all utxos belonging to the given address.
description: |
**Note:** this is a performance intensive call and should only be used if the chain is byzantine and the user needs to retrieve utxo information to be able to exit. Normally an application should use the Informational API's [Account - Get Utxos](http://TODO) instead. This version is provided in case the Informational API is not available.
operationId: account_get_exitable_utxos
requestBody:
description: HEX-encoded address of the account
required: true
content:
application/json:
schema:
title: AddressBodySchema
type: object
properties:
address:
type: string
required:
- address
example:
address: '0xb3256026863eb6ae5b06fa396ab09069784ea8ea'
responses:
'200':
description: Account utxos succcessful response
content:
application/json:
schema:
allOf:
- description: The response schema for a successful operation
type: object
properties:
version:
type: string
success:
type: boolean
data:
type: object
service_name:
type: string
required:
- service_name
- version
- success
- data
example:
service_name: watcher
version: 1.0.0+abcdefa
success: true
data: {}
- type: object
properties:
data:
type: array
items:
type: object
properties:
blknum:
type: integer
format: int64
txindex:
type: integer
format: int16
otype:
type: integer
format: int16
oindex:
type: integer
format: int8
utxo_pos:
type: integer
format: int256
owner:
type: string
currency:
type: string
amount:
type: integer
format: int256
example:
data:
- blknum: 123000
txindex: 111
oindex: 0
otype: 1
utxo_pos: 123000001110000
owner: '0xb3256026863eb6ae5b06fa396ab09069784ea8ea'
currency: '0x0000000000000000000000000000000000000000'
amount: 10
'500':
description: Returns an internal server error
content:
application/json:
schema:
description: The response schema for an error
allOf:
- description: The response schema for a successful operation
type: object
properties:
version:
type: string
success:
type: boolean
data:
type: object
service_name:
type: string
required:
- service_name
- version
- success
- data
example:
service_name: watcher
version: 1.0.0+abcdefa
success: true
data: {}
- type: object
properties:
data:
description: The object schema for an error
type: object
properties:
object:
type: string
code:
type: string
description:
type: string
messages:
type: object
required:
- object
- code
- description
- messages
required:
- data
example:
success: false
data:
object: error
code: 'server:internal_server_error'
description: Something went wrong on the server
messages:
error_key: error_reason
/block.validate:
post:
tags:
- Block
summary: Verifies the stateless validity of a block.
description: |
- Verifies that given Merkle root matches reconstructed Merkle root.
- Verifies that (payment and fee) transactions are correctly formed.
- Verifies that there are no duplicate inputs at the block level.
- Verifies that the number of transactions falls within the accepted range.
- Verifies that fee transactions are correctly placed and unique per currency.
operationId: validate
requestBody:
description: 'Block object with a hash, number and array of hexadecimal transaction bytes.'
required: true
content:
application/json:
schema:
title: BlockValidateBodySchema
type: object
properties:
hash:
type: string
transactions:
type: array
items:
type: string
number:
type: integer
required:
- hash
- transactions
- number
example:
number: 1000
hash: 0xf8d083015ba98080808080940000...
transactions:
- 0xf8c0f843b841fc6dbf49a4baa783ec576291f6083be5ea...
- 0xf852c003eeed02eb94916f3753bd53e124d6d565ef1701...
responses:
'200':
description: Successful response to calling /block.validate
content:
application/json:
schema:
allOf:
- description: The response schema for a successful operation
type: object
properties:
version:
type: string
success:
type: boolean
data:
type: object
service_name:
type: string
required:
- service_name
- version
- success
- data
example:
service_name: watcher
version: 1.0.0+abcdefa
success: true
data: {}
- type: object
properties:
data:
type: object
properties:
valid:
type: boolean
example:
data:
valid: false
'500':
description: Returns an internal server error
content:
application/json:
schema:
description: The response schema for an error
allOf:
- description: The response schema for a successful operation
type: object
properties:
version:
type: string