package octez-shell-libs
Octez shell libraries
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/octez-shell-libs.shell-services/store_errors.ml.html
Source file store_errors.ml
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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020-2021 Nomadic Labs, <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type error += | Block_not_found of {hash : Block_hash.t; distance : int} | Resulting_context_hash_not_found of {hash : Block_hash.t; level : int32} | Bad_level of {head_level : Int32.t; given_level : Int32.t} | Block_metadata_not_found of Block_hash.t | Protocol_not_found of {protocol_level : int} | Cannot_switch_history_mode of { previous_mode : History_mode.t; next_mode : History_mode.t; } | Invalid_head_switch of { checkpoint_level : int32; given_head : Block_hash.t * int32; } | Inconsistent_store_state of string | Inconsistent_operations_hash of { expected : Operation_list_list_hash.t; got : Operation_list_list_hash.t; } let () = register_error_kind `Permanent ~id:"store.block_not_found" ~title:"Block not found" ~description:"Block not found" ~pp:(fun ppf (block_hash, distance) -> Format.fprintf ppf "Cannot find block at distance %d from block %a." distance Block_hash.pp block_hash) Data_encoding.( obj1 (req "block_not_found" @@ tup2 Block_hash.encoding int31)) (function | Block_not_found {hash; distance} -> Some (hash, distance) | _ -> None) (fun (hash, distance) -> Block_not_found {hash; distance}) ; register_error_kind `Permanent ~id:"store.resulting_context_hash_not_found" ~title:"Resulting context hash not found" ~description:"Resulting context hash not found" ~pp:(fun ppf (block_hash, level) -> Format.fprintf ppf "Cannot find the resulting context hash for the block %a (level: %ld)." Block_hash.pp block_hash level) Data_encoding.( obj1 (req "block_not_found" @@ tup2 Block_hash.encoding int32)) (function | Resulting_context_hash_not_found {hash; level} -> Some (hash, level) | _ -> None) (fun (hash, level) -> Resulting_context_hash_not_found {hash; level}) ; register_error_kind `Permanent ~id:"store.bad_level" ~title:"Bad level" ~description:"Read a block at level past our current head." ~pp:(fun ppf (head_level, given_level) -> Format.fprintf ppf "The block at level %ld is beyond our current head's level : %ld." given_level head_level) Data_encoding.(obj2 (req "head_level" int32) (req "given_level" int32)) (function | Bad_level {head_level; given_level} -> Some (head_level, given_level) | _ -> None) (fun (head_level, given_level) -> Bad_level {head_level; given_level}) ; register_error_kind `Permanent ~id:"store.metadata_not_found" ~title:"Block metadata not found" ~description:"Block metadata not found" ~pp:(fun ppf block_hash -> Format.fprintf ppf "Unable to find block %a's metadata." Block_hash.pp block_hash) Data_encoding.(obj1 (req "block_metadata_not_found" Block_hash.encoding)) (function | Block_metadata_not_found block_hash -> Some block_hash | _ -> None) (fun block_hash -> Block_metadata_not_found block_hash) ; register_error_kind `Permanent ~id:"store.protocol_not_found" ~title:"Protocol not found" ~description:"Protocol not found" ~pp:(fun ppf protocol_level -> Format.fprintf ppf "Unable to find protocol %d." protocol_level) Data_encoding.(obj1 (req "protocol_level" int31)) (function | Protocol_not_found {protocol_level} -> Some protocol_level | _ -> None) (fun protocol_level -> Protocol_not_found {protocol_level}) ; register_error_kind `Permanent ~id:"config_file.cannot_switch_history_mode" ~title:"Cannot switch history mode" ~description:"Cannot switch history mode." ~pp:(fun ppf (prev, next) -> Format.fprintf ppf "Cannot switch from history mode %a to %a. In order to change your \ history mode please refer to the Tezos node documentation. If you \ really want to change your history mode, run this command again with \ the `--force-history-mode-switch` option." History_mode.pp prev History_mode.pp next) (Data_encoding.obj2 (Data_encoding.req "previous_mode" History_mode.encoding) (Data_encoding.req "next_mode" History_mode.encoding)) (function | Cannot_switch_history_mode x -> Some (x.previous_mode, x.next_mode) | _ -> None) (fun (previous_mode, next_mode) -> Cannot_switch_history_mode {previous_mode; next_mode}) ; register_error_kind `Permanent ~id:"store.invalid_head_switch" ~title:"Invalid head switch" ~description: "The given head is not consistent with the current store's savepoint" ~pp:(fun ppf (minimum_allowed_level, (head_hash, head_level)) -> Format.fprintf ppf "The given head %a (%ld) is below the minimum allowed level %ld." Block_hash.pp head_hash head_level minimum_allowed_level) Data_encoding.( obj2 (req "minimum_allowed_level" int32) (req "given_head" @@ tup2 Block_hash.encoding int32)) (function | Invalid_head_switch {checkpoint_level; given_head} -> Some (checkpoint_level, given_head) | _ -> None) (fun (checkpoint_level, given_head) -> Invalid_head_switch {checkpoint_level; given_head}) ; register_error_kind `Permanent ~id:"snapshots.inconsistent_operation_hashes" ~title:"Inconsistent operation hashes" ~description:"The operations given do not match their hashes." ~pp:(fun ppf (oph, oph') -> Format.fprintf ppf "Inconsistent operation hashes. Expected: %a, got %a." Operation_list_list_hash.pp oph Operation_list_list_hash.pp oph') Data_encoding.( obj2 (req "expected_operation_hashes" Operation_list_list_hash.encoding) (req "received_operation_hashes" Operation_list_list_hash.encoding)) (function | Inconsistent_operations_hash {expected; got} -> Some (expected, got) | _ -> None) (fun (expected, got) -> Inconsistent_operations_hash {expected; got}) type cemented_store_inconsistency = | Missing_cycle of {low_cycle : string; high_cycle : string} | Inconsistent_cycle_start of { cycle_start : Int32.t; expected_cycle_start : Int32.t; } | Bad_offset of {level : int; cycle : string} | Unexpected_level of { block_hash : Block_hash.t; expected : Int32.t; got : Int32.t; } | Corrupted_index of Block_hash.t | Inconsistent_highest_cemented_level of { highest_cemented_level : Int32.t; cementing_highwatermark : Int32.t; } let cemented_store_inconsistency_encoding = let open Data_encoding in union [ case (Tag 0) ~title:"Missing cycle" (obj2 (req "low_cycle" string) (req "high_cycle" string)) (function | Missing_cycle {low_cycle; high_cycle} -> Some (low_cycle, high_cycle) | _ -> None) (fun (low_cycle, high_cycle) -> Missing_cycle {low_cycle; high_cycle}); case (Tag 1) ~title:"Inconsistent_cycle_start" (obj2 (req "cycle_start" int32) (req "expected_cycle_start" int32)) (function | Inconsistent_cycle_start {expected_cycle_start; cycle_start} -> Some (expected_cycle_start, cycle_start) | _ -> None) (fun (expected_cycle_start, cycle_start) -> Inconsistent_cycle_start {expected_cycle_start; cycle_start}); case (Tag 2) ~title:"Bad offset" (obj2 (req "level" int31) (req "cycle" string)) (function | Bad_offset {level; cycle} -> Some (level, cycle) | _ -> None) (fun (level, cycle) -> Bad_offset {level; cycle}); case (Tag 3) ~title:"Unexpected level" (obj3 (req "block_hash" Block_hash.encoding) (req "expected" int32) (req "got" int32)) (function | Unexpected_level {block_hash; expected; got} -> Some (block_hash, expected, got) | _ -> None) (fun (block_hash, expected, got) -> Unexpected_level {block_hash; expected; got}); case (Tag 4) ~title:"Corrupted index" (obj1 (req "block_hash" Block_hash.encoding)) (function Corrupted_index h -> Some h | _ -> None) (fun h -> Corrupted_index h); case (Tag 5) ~title:"Inconsistent highest cemented level" (obj2 (req "highest_cemented_level" int32) (req "cementing_highwatermark" int32)) (function | Inconsistent_highest_cemented_level {highest_cemented_level; cementing_highwatermark} -> Some (highest_cemented_level, cementing_highwatermark) | _ -> None) (fun (highest_cemented_level, cementing_highwatermark) -> Inconsistent_highest_cemented_level {highest_cemented_level; cementing_highwatermark}); ] type store_block_error = | Invalid_block | Invalid_operations_length of {validation_passes : int; operations : int} | Invalid_operations_data_length of { validation_passes : int; operations_data : int; } | Inconsistent_operations_lengths of { operations_lengths : string; operations_data_lengths : string; } | Invalid_last_preserved_block_level of { last_preserved_block_level : int32; genesis_level : int32; } let store_block_error_encoding = let open Data_encoding in union [ case (Tag 0) ~title:"Invalid operations length" (obj2 (req "validation_passes" int31) (req "operations" int31)) (function | Invalid_operations_length {validation_passes; operations} -> Some (validation_passes, operations) | _ -> None) (fun (validation_passes, operations) -> Invalid_operations_length {validation_passes; operations}); case (Tag 1) ~title:"Invalid operations data length" (obj2 (req "validation_passes" int31) (req "operations_data" int31)) (function | Invalid_operations_data_length {validation_passes; operations_data} -> Some (validation_passes, operations_data) | _ -> None) (fun (validation_passes, operations_data) -> Invalid_operations_data_length {validation_passes; operations_data}); case (Tag 2) ~title:"Inconsistent operations length" (obj2 (req "operations_lengths" string) (req "operations_data_lengths" string)) (function | Inconsistent_operations_lengths {operations_lengths; operations_data_lengths} -> Some (operations_lengths, operations_data_lengths) | _ -> None) (fun (operations_lengths, operations_data_lengths) -> Inconsistent_operations_lengths {operations_lengths; operations_data_lengths}); ] type error += | Cannot_write_in_readonly | Wrong_predecessor of Block_hash.t * int | Invalid_blocks_to_cement | Wrong_floating_kind_swap | Cannot_update_floating_store | Cannot_instanciate_temporary_floating_store | Merge_already_running | Merge_error | Cannot_load_degraded_store | Cannot_merge_store of {status : string} | Failed_to_init_cemented_block_store of string | Cannot_cement_blocks_metadata of [`Empty | `Not_cemented] | Cannot_cement_blocks of [`Empty | `Higher_cemented] | Temporary_cemented_file_exists of string | Inconsistent_cemented_file of string * string | Inconsistent_cemented_store of cemented_store_inconsistency | Missing_last_preserved_block | Inconsistent_block_hash of { level : Int32.t; expected_hash : Block_hash.t; computed_hash : Block_hash.t; } | Inconsistent_block_predecessor of { block_hash : Block_hash.t; level : Int32.t; expected_hash : Block_hash.t; computed_hash : Block_hash.t; } | Cannot_encode_block of Block_hash.t | Cannot_store_block of Block_hash.t * store_block_error | Cannot_checkout_context of Block_hash.t * Context_hash.t | Cannot_find_protocol of int | Invalid_genesis_marking | Cannot_retrieve_savepoint of Int32.t | Cannot_set_target of (Block_hash.t * Int32.t) | Missing_commit_info of string | Inconsistent_chain_store | Fork_testchain_not_allowed | Cannot_fork_testchain of Chain_id.t | Cannot_load_testchain of string | Missing_activation_block of Block_hash.t * Protocol_hash.t * History_mode.t | Inconsistent_protocol_commit_info of Block_hash.t * Protocol_hash.t | Failed_to_get_live_blocks of Block_hash.t | Target_mismatch | Bad_head_invariant let () = Error_monad.register_error_kind `Permanent ~id:"store.cannot_write_in_readonly" ~title:"Cannot write in readonly" ~description:"Cannot write data in store when in readonly" ~pp:(fun ppf () -> Format.fprintf ppf "Cannot write data in store when in readonly.") Data_encoding.empty (function Cannot_write_in_readonly -> Some () | _ -> None) (fun () -> Cannot_write_in_readonly) ; Error_monad.register_error_kind `Temporary ~id:"store.wrong_predecessor" ~title:"Wrong predecessor" ~description:"Failed to get block's predecessor" ~pp:(fun ppf (hash, offset) -> Format.fprintf ppf "Failed to get the nth predecessor of %a. The offset is invalid: %d." Block_hash.pp hash offset) Data_encoding.(obj2 (req "hash" Block_hash.encoding) (req "offset" int31)) (function | Wrong_predecessor (hash, offset) -> Some (hash, offset) | _ -> None) (fun (hash, offset) -> Wrong_predecessor (hash, offset)) ; Error_monad.register_error_kind `Temporary ~id:"store.invalid_blocks_to_cement" ~title:"Invalid blocks to cement" ~description:"Invalid block list to cement" ~pp:(fun ppf () -> Format.fprintf ppf "Invalid block list to cement: the block list must be correctly \ chained and their levels growing strictly by one between each block.") Data_encoding.empty (function Invalid_blocks_to_cement -> Some () | _ -> None) (fun () -> Invalid_blocks_to_cement) ; Error_monad.register_error_kind `Temporary ~id:"store.wrong_floating_kind_swap" ~title:"Wrong floating kind swap" ~description:"Try to swap wrong floating store kind" ~pp:(fun ppf () -> Format.fprintf ppf "Failed to swap floating stores: tried to swap floating store of the \ same kind.") Data_encoding.empty (function Wrong_floating_kind_swap -> Some () | _ -> None) (fun () -> Wrong_floating_kind_swap) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_update_floating_store" ~title:"Cannot update floating store" ~description:"Cannot update floating store" ~pp:(fun ppf () -> Format.fprintf ppf "Cannot update the floating store: failed to retrieve enough blocks to \ cement.") Data_encoding.empty (function Cannot_update_floating_store -> Some () | _ -> None) (fun () -> Cannot_update_floating_store) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_instanciate_temporary_floating_store" ~title:"Cannot instanciate temporary floating store" ~description:"Cannot instanciate temporary floating store" ~pp:(fun ppf () -> Format.fprintf ppf "Cannot instanciate temporary floating store.") Data_encoding.empty (function | Cannot_instanciate_temporary_floating_store -> Some () | _ -> None) (fun () -> Cannot_instanciate_temporary_floating_store) ; Error_monad.register_error_kind `Temporary ~id:"store.merge_error" ~title:"Merge error" ~description:"Error while merging the store" ~pp:(fun ppf () -> Format.fprintf ppf "Error while merging the store.") Data_encoding.empty (function Merge_error -> Some () | _ -> None) (fun () -> Merge_error) ; Error_monad.register_error_kind `Temporary ~id:"store.merge_already_running" ~title:"Merge already running" ~description:"The store's merge is already running" ~pp:(fun ppf () -> Format.fprintf ppf "The store's merge is already running.") Data_encoding.empty (function Merge_already_running -> Some () | _ -> None) (fun () -> Merge_already_running) ; Error_monad.register_error_kind `Permanent ~id:"store.cannot_load_degraded_store" ~title:"Cannot load degraded store" ~description:"Cannot load a degraded block store." ~pp:(fun ppf () -> Format.fprintf ppf "Cannot load a degraded store. Its consistency must first be restored.") Data_encoding.empty (function Cannot_load_degraded_store -> Some () | _ -> None) (fun () -> Cannot_load_degraded_store) ; Error_monad.register_error_kind `Permanent ~id:"store.cannot_merge_store" ~title:"Cannot merge store" ~description:"Cannot merge the store." ~pp:(fun ppf status -> Format.fprintf ppf "Cannot merge the store, unexpected status: %s." status) Data_encoding.(obj1 (req "status" string)) (function Cannot_merge_store {status} -> Some status | _ -> None) (fun status -> Cannot_merge_store {status}) ; Error_monad.register_error_kind `Temporary ~id:"store.failed_to_init_cemented_block_store" ~title:"Failed to init cemented block store" ~description:"Failed to initialize the cemented block store" ~pp:(fun ppf path -> Format.fprintf ppf "Failed to initialize the cemented block store: file %s is not a \ directory." path) Data_encoding.(obj1 (req "path" string)) (function | Failed_to_init_cemented_block_store path -> Some path | _ -> None) (fun path -> Failed_to_init_cemented_block_store path) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_cement_blocks_metadata" ~title:"Cannot cement blocks metadata" ~description:"Cannot cement blocks metadata" ~pp:(fun ppf reason -> Format.fprintf ppf "Failed to cement the blocks metadata: %s." (match reason with | `Empty -> "the given list of blocks is empty" | `Not_cemented -> "the given blocks ar not cemented")) Data_encoding.( obj1 (req "reason" (string_enum [("empty", `Empty); ("not_cemented", `Not_cemented)]))) (function Cannot_cement_blocks_metadata r -> Some r | _ -> None) (fun r -> Cannot_cement_blocks_metadata r) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_cement_blocks" ~title:"Cannot cement blocks" ~description:"Cannot cement blocks" ~pp:(fun ppf reason -> Format.fprintf ppf "Failed to merge the store: %s." (match reason with | `Empty -> "no valid cycles were found" | `Higher_cemented -> "the highest cemented block has a higher level than the given \ blocks")) Data_encoding.( obj1 (req "reason" (string_enum [("empty", `Empty); ("higher_cemented", `Higher_cemented)]))) (function Cannot_cement_blocks r -> Some r | _ -> None) (fun r -> Cannot_cement_blocks r) ; Error_monad.register_error_kind `Temporary ~id:"store.temporary_cemented_file_exists" ~title:"Temporary cemented file exists" ~description:"The temporary cemented file already exists" ~pp:(fun ppf path -> Format.fprintf ppf "Error while merging the store: the temporary cemented file %s already \ exists." path) Data_encoding.(obj1 (req "path" string)) (function Temporary_cemented_file_exists path -> Some path | _ -> None) (fun path -> Temporary_cemented_file_exists path) ; Error_monad.register_error_kind `Temporary ~id:"store.inconsistent_cemented_file" ~title:"Inconsistent cemented file" ~description:"Failed to read a cemented file" ~pp:(fun ppf (path, trace) -> Format.fprintf ppf "Failed to read the cemented file %s. Unexpected failure: %s." path trace) Data_encoding.(obj2 (req "path" string) (req "trace" string)) (function | Inconsistent_cemented_file (path, trace) -> Some (path, trace) | _ -> None) (fun (path, trace) -> Inconsistent_cemented_file (path, trace)) ; Error_monad.register_error_kind `Temporary ~id:"store.inconsistent_cemented_store" ~title:"Inconsistent cemented store" ~description:"Failed to check indexes consistency" ~pp:(fun ppf csi -> Format.fprintf ppf "The store is in an unexpected and inconsistent state: %s." (match csi with | Missing_cycle {low_cycle; high_cycle} -> Format.sprintf "missing cycle between %s and %s" low_cycle high_cycle | Inconsistent_cycle_start {cycle_start; expected_cycle_start} -> Format.asprintf "inconsistent cycle starting at %ld but expected at %ld" cycle_start expected_cycle_start | Bad_offset {level; cycle} -> Format.asprintf "bad offset found for block %d in cycle %s" level cycle | Unexpected_level {block_hash; expected; got} -> Format.asprintf "bad level found for block %a - expected %ld got %ld" Block_hash.pp block_hash expected got | Corrupted_index h -> Format.asprintf "%a was not found in the imported store" Block_hash.pp h | Inconsistent_highest_cemented_level {highest_cemented_level; cementing_highwatermark} -> Format.sprintf "the most recent cemented block (%ld) is not the previous \ cemented highwatermark (%ld)" highest_cemented_level cementing_highwatermark)) Data_encoding.( obj1 (req "inconsistent_cemented_file" cemented_store_inconsistency_encoding)) (function Inconsistent_cemented_store csi -> Some csi | _ -> None) (fun csi -> Inconsistent_cemented_store csi) ; Error_monad.register_error_kind `Temporary ~id:"store.missing_last_preserved_block" ~title:"Missing last preserved block" ~description: "Current head's last preserved block (or its associated metadata) cannot \ be found in the store." ~pp:(fun ppf () -> Format.fprintf ppf "Current head's last preserved block or (its associated metadata) \ cannot be found in the store.") Data_encoding.empty (function Missing_last_preserved_block -> Some () | _ -> None) (fun () -> Missing_last_preserved_block) ; Error_monad.register_error_kind `Temporary ~id:"store.inconsistent_block_hash" ~title:"Inconsistent block hash" ~description:"Inconsistent block hash found" ~pp:(fun ppf (level, expected_hash, computed_hash) -> Format.fprintf ppf "Inconsistent block: inconsistent hash found for block %ld. Expected \ %a, got %a." level Block_hash.pp expected_hash Block_hash.pp computed_hash) Data_encoding.( obj3 (req "level" int32) (req "expected_hash" Block_hash.encoding) (req "computed_hash" Block_hash.encoding)) (function | Inconsistent_block_hash {level; expected_hash; computed_hash} -> Some (level, expected_hash, computed_hash) | _ -> None) (fun (level, expected_hash, computed_hash) -> Inconsistent_block_hash {level; expected_hash; computed_hash}) ; Error_monad.register_error_kind `Temporary ~id:"store.inconsistent_block_predecessor" ~title:"Inconsistent block predecessor" ~description:"Inconsistent block predecessor" ~pp:(fun ppf (block_hash, level, expected_hash, computed_hash) -> Format.fprintf ppf "Inconsistent block: inconsistent predecessor found for block %a (%ld) \ - expected: %a vs got: %a." Block_hash.pp block_hash level Block_hash.pp expected_hash Block_hash.pp computed_hash) Data_encoding.( obj4 (req "block_hash" Block_hash.encoding) (req "level" int32) (req "expected_hash" Block_hash.encoding) (req "computed_hash" Block_hash.encoding)) (function | Inconsistent_block_predecessor {block_hash; level; expected_hash; computed_hash} -> Some (block_hash, level, expected_hash, computed_hash) | _ -> None) (fun (block_hash, level, expected_hash, computed_hash) -> Inconsistent_block_predecessor {block_hash; level; expected_hash; computed_hash}) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_encode_block" ~title:"Cannot encode block" ~description:"Failed to encode block" ~pp:(fun ppf hash -> Format.fprintf ppf "Failed to write block in floating store: cannot encode block %a." Block_hash.pp hash) Data_encoding.(obj1 (req "hash" Block_hash.encoding)) (function Cannot_encode_block hash -> Some hash | _ -> None) (fun hash -> Cannot_encode_block hash) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_store_block" ~title:"Cannot store block" ~description:"Failed to store block" ~pp:(fun ppf (hash, err) -> Format.fprintf ppf "Failed to store block %a: %s." Block_hash.pp hash (match err with | Invalid_block -> "the block is marked as invalid" | Invalid_operations_length {validation_passes; operations} -> Format.sprintf "invalid operations length %d (%d was expected)" operations validation_passes | Invalid_operations_data_length {validation_passes; operations_data} -> Format.sprintf "invalid operation_data length %d (%d was expected)" validation_passes operations_data | Inconsistent_operations_lengths {operations_lengths; operations_data_lengths} -> Format.sprintf "inconsistent operations (%s) and operations_data (%s) lengths" operations_lengths operations_data_lengths | Invalid_last_preserved_block_level {last_preserved_block_level; genesis_level} -> Format.sprintf "block's last preserved level (%ld) is below the genesis level \ (%ld)" last_preserved_block_level genesis_level)) Data_encoding.( obj2 (req "hash" Block_hash.encoding) (req "err" store_block_error_encoding)) (function Cannot_store_block (hash, err) -> Some (hash, err) | _ -> None) (fun (hash, err) -> Cannot_store_block (hash, err)) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_checkout_context" ~title:"Cannot checkout context" ~description:"Failed to checkout context" ~pp:(fun ppf (bh, ch) -> Format.fprintf ppf "Failed to checkout the context (%a) for block %a." Context_hash.pp ch Block_hash.pp bh) Data_encoding.( obj2 (req "block_hash" Block_hash.encoding) (req "context_hash" Context_hash.encoding)) (function Cannot_checkout_context (bh, ch) -> Some (bh, ch) | _ -> None) (fun (bh, ch) -> Cannot_checkout_context (bh, ch)) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_find_protocol" ~title:"Cannot find protocol" ~description:"Cannot find protocol" ~pp:(fun ppf proto_level -> Format.fprintf ppf "Cannot find protocol with level %d." proto_level) Data_encoding.(obj1 (req "protocol_level" int31)) (function | Cannot_find_protocol proto_level -> Some proto_level | _ -> None) (fun proto_level -> Cannot_find_protocol proto_level) ; Error_monad.register_error_kind `Temporary ~id:"store.invalid_genesis_marking" ~title:"Invalid genesis marking" ~description:"Cannot mark genesis as invalid" ~pp:(fun ppf () -> Format.fprintf ppf "Cannot mark the genesis block is invalid.") Data_encoding.empty (function Invalid_genesis_marking -> Some () | _ -> None) (fun () -> Invalid_genesis_marking) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_retrieve_savepoint" ~title:"Cannot retrieve savepoint" ~description:"Failed to retrieve savepoint" ~pp:(fun ppf level -> Format.fprintf ppf "Failed to retrieve the new savepoint hash (expected at level %ld)." level) Data_encoding.(obj1 (req "level" int32)) (function Cannot_retrieve_savepoint level -> Some level | _ -> None) (fun level -> Cannot_retrieve_savepoint level) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_set_target" ~title:"Cannot set target" ~description:"The given block to be set as target is invalid." ~pp:(fun ppf (given_target_hash, given_target_level) -> Format.fprintf ppf "Failed to set the given target %a (%ld): it is either invalid, or not \ a predecessor of the checkpoint." Block_hash.pp given_target_hash given_target_level) Data_encoding.(obj1 (req "given_target" (tup2 Block_hash.encoding int32))) (function Cannot_set_target given_target -> Some given_target | _ -> None) (fun given_target -> Cannot_set_target given_target) ; Error_monad.register_error_kind `Temporary ~id:"store.missing_commit_info" ~title:"Missing commit info" ~description:"Failed to retreive commit info" ~pp:(fun ppf trace -> Format.fprintf ppf "Failed to retreive commit info: %s@.Is the context initialized?" trace) Data_encoding.(obj1 (req "trace" string)) (function Missing_commit_info trace -> Some trace | _ -> None) (fun trace -> Missing_commit_info trace) ; Error_monad.register_error_kind `Temporary ~id:"store.inconsistent_chain_store" ~title:"Inconsistent chain store" ~description:"Failed to load chain store" ~pp:(fun ppf () -> Format.fprintf ppf "Failed to load the chain store: could not retrieve head metadata.") Data_encoding.empty (function Inconsistent_chain_store -> Some () | _ -> None) (fun () -> Inconsistent_chain_store) ; Error_monad.register_error_kind `Temporary ~id:"store.fork_testchain_not_allowed" ~title:"Fork testchain not allowed" ~description:"Forking the test chain is not allowed" ~pp:(fun ppf () -> Format.fprintf ppf "Failed to fork the test chain: it is not allowed by the store's \ configuration.") Data_encoding.empty (function Fork_testchain_not_allowed -> Some () | _ -> None) (fun () -> Fork_testchain_not_allowed) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_fork_testchain" ~title:"Cannot fork testchain" ~description:"Failed to fork testchain" ~pp:(fun ppf chain_id -> Format.fprintf ppf "Failed to fork the testchain: the testchain %a already exists." Chain_id.pp chain_id) Data_encoding.(obj1 (req "chain_id" Chain_id.encoding)) (function Cannot_fork_testchain chain_id -> Some chain_id | _ -> None) (fun chain_id -> Cannot_fork_testchain chain_id) ; Error_monad.register_error_kind `Temporary ~id:"store.cannot_load_testchain" ~title:"Cannot load testchain" ~description:"Failed to load the testchain" ~pp:(fun ppf path -> Format.fprintf ppf "Failed to load the testchain as it was not found in %s." path) Data_encoding.(obj1 (req "path" string)) (function Cannot_load_testchain path -> Some path | _ -> None) (fun path -> Cannot_load_testchain path) ; Error_monad.register_error_kind `Temporary ~id:"store.missing_activation_block" ~title:"Missing activation block" ~description:"Missing activation block while restoring snapshot" ~pp:(fun ppf (bh, ph, hm) -> Format.fprintf ppf "Failed to restore snapshot: the expected activation block %a \ originating the protocol %a was not found for %a." Block_hash.pp bh Protocol_hash.pp ph History_mode.pp hm) Data_encoding.( obj3 (req "block_hash" Block_hash.encoding) (req "protocol_hash" Protocol_hash.encoding) (req "history_mode" History_mode.encoding)) (function | Missing_activation_block (bh, ph, hm) -> Some (bh, ph, hm) | _ -> None) (fun (bh, ph, hm) -> Missing_activation_block (bh, ph, hm)) ; Error_monad.register_error_kind `Temporary ~id:"store.inconsistent_protocol_commit_info" ~title:"Inconsistent protocol commit info" ~description:"Inconsistent protocol commit info while restoring snapshot" ~pp:(fun ppf (bh, ph) -> Format.fprintf ppf "Failed to restore snapshot: inconsistent commit info found for \ transition block %a activating protocol %a." Block_hash.pp bh Protocol_hash.pp ph) Data_encoding.( obj2 (req "block_hash" Block_hash.encoding) (req "protocol_hash" Protocol_hash.encoding)) (function | Inconsistent_protocol_commit_info (bh, ph) -> Some (bh, ph) | _ -> None) (fun (bh, ph) -> Inconsistent_protocol_commit_info (bh, ph)) ; Error_monad.register_error_kind `Permanent ~id:"store.failed_to_get_live_blocks" ~title:"Fail to get live blocks" ~description:"Unable to compute live blocks from a given block." ~pp:(fun ppf (hash : Block_hash.t) -> Format.fprintf ppf "Failed to get live blocks from block %a" Block_hash.pp hash) Data_encoding.(obj1 (req "hash" Block_hash.encoding)) (function Failed_to_get_live_blocks h -> Some h | _ -> None) (fun h -> Failed_to_get_live_blocks h) ; Error_monad.register_error_kind `Permanent ~id:"store.target_mismatch" ~title:"target mismatch" ~description:"Target is reached but it is not a head's ancestor." ~pp:(fun ppf () -> Format.fprintf ppf "Target is reached but it is not a head's ancestor.") Data_encoding.empty (function Target_mismatch -> Some () | _ -> None) (fun () -> Target_mismatch) ; Error_monad.register_error_kind `Permanent ~id:"store.bad_head_invariant" ~title:"Bad head invariant" ~description:"Bad invariant during Store.set_head" ~pp:(fun ppf () -> Format.fprintf ppf "Bad invariant during Store.set_head") Data_encoding.empty (function Bad_head_invariant -> Some () | _ -> None) (fun () -> Bad_head_invariant) (* Consistency errors: *) type error += | Unexpected_missing_block of { block_name : string; level : Int32.t; hash : Block_hash.t; } | Unexpected_missing_block_metadata of { block_name : string; level : Int32.t; hash : Block_hash.t; } | Unexpected_missing_activation_block of { block : Block_hash.t; protocol : Protocol_hash.t; } | Unexpected_missing_protocol of {protocol_level : int} | Inconsistent_genesis of {expected : Block_hash.t; got : Block_hash.t} | Inconsistent_cementing_highwatermark of { highest_cemented_level : Int32.t; cementing_highwatermark : Int32.t; } | Inconsistent_history_mode of History_mode.t | Bad_ordering_invariant of { genesis : Int32.t; caboose : Int32.t; savepoint : Int32.t; cementing_highwatermark : Int32.t option; checkpoint : Int32.t; head : Int32.t; } let () = register_error_kind `Permanent ~id:"store.unexpected_missing_block" ~title:"Unexpected missing block" ~description:"A block is unexpectedly missing from the store." ~pp:(fun ppf (block_name, level, hash) -> Format.fprintf ppf "The block '%s' (%ld, %a) is unexpectedly missing from the store." block_name level Block_hash.pp_short hash) Data_encoding.( obj3 (req "missing_block" string) (req "level" int32) (req "hash" Block_hash.encoding)) (function | Unexpected_missing_block {block_name; level; hash} -> Some (block_name, level, hash) | _ -> None) (fun (block_name, level, hash) -> Unexpected_missing_block {block_name; level; hash}) ; register_error_kind `Permanent ~id:"store.unexpected_missing_block_metadata" ~title:"Unexpected missing block metadata" ~description:"A block's metadata is unexpectedly missing from the store." ~pp:(fun ppf (block_name, level, hash) -> Format.fprintf ppf "The block '%s' (%ld, %a) metadata is unexpectedly missing from the \ store." block_name level Block_hash.pp_short hash) Data_encoding.( obj3 (req "missing_block_metadata" string) (req "level" int32) (req "hash" Block_hash.encoding)) (function | Unexpected_missing_block_metadata {block_name; level; hash} -> Some (block_name, level, hash) | _ -> None) (fun (block_name, level, hash) -> Unexpected_missing_block_metadata {block_name; level; hash}) ; register_error_kind `Permanent ~id:"store.unexpected_missing_activation_block" ~title:"Unexpected missing activaiton block" ~description:"An activation block is unexpectedly missing from the store." ~pp:(fun ppf (block, proto) -> Format.fprintf ppf "The block %a activating protocol %a is unexpectedly missing from the \ store." Block_hash.pp block Protocol_hash.pp proto) Data_encoding.( obj2 (req "block" Block_hash.encoding) (req "protocol" Protocol_hash.encoding)) (function | Unexpected_missing_activation_block {block; protocol} -> Some (block, protocol) | _ -> None) (fun (block, protocol) -> Unexpected_missing_activation_block {block; protocol}) ; register_error_kind `Permanent ~id:"store.unexpected_missing_protocol" ~title:"Unexpected missing protocol" ~description:"A protocol is unexpectedly missing from the store." ~pp:(fun ppf protocol_level -> Format.fprintf ppf "The protocol %d is unexpectedly missing from the store." protocol_level) Data_encoding.(obj1 (req "protocol_level" int31)) (function | Unexpected_missing_protocol {protocol_level} -> Some protocol_level | _ -> None) (fun protocol_level -> Unexpected_missing_protocol {protocol_level}) ; register_error_kind `Permanent ~id:"store.inconsistent_genesis" ~title:"Inconsistent genesis" ~description:"The given genesis block is inconsistent with the store." ~pp:(fun ppf (expected, got) -> Format.fprintf ppf "The genesis (%a) found in the store is not the one expected (%a)." Block_hash.pp got Block_hash.pp expected) Data_encoding.( obj2 (req "expected" Block_hash.encoding) (req "got" Block_hash.encoding)) (function | Inconsistent_genesis {expected; got} -> Some (expected, got) | _ -> None) (fun (expected, got) -> Inconsistent_genesis {expected; got}) ; register_error_kind `Permanent ~id:"store.inconsistent_cementing_highwatermark" ~title:"Inconsistent cementing highwatermark" ~description: "The stored cementing highwatermark is inconsistent with the store." ~pp:(fun ppf (highest_cemented_level, cementing_highwatermark) -> Format.fprintf ppf "The stored cemented highwatermark (level: %ld) differs from the \ highest cemented block (level: %ld)" cementing_highwatermark highest_cemented_level) Data_encoding.( obj2 (req "highest_cemented_level" int32) (req "cementing_highwatermark" int32)) (function | Inconsistent_cementing_highwatermark {highest_cemented_level; cementing_highwatermark} -> Some (highest_cemented_level, cementing_highwatermark) | _ -> None) (fun (highest_cemented_level, cementing_highwatermark) -> Inconsistent_cementing_highwatermark {highest_cemented_level; cementing_highwatermark}) ; register_error_kind `Permanent ~id:"store.inconsistent_history_mode" ~title:"Inconsistent history mode" ~description:"The history mode does not correspond to the store." ~pp:(fun ppf history_mode -> Format.fprintf ppf "the history mode (%a) is not compatible with the store" History_mode.pp history_mode) Data_encoding.(obj1 (req "history_mode" History_mode.encoding)) (function Inconsistent_history_mode hm -> Some hm | _ -> None) (fun hm -> Inconsistent_history_mode hm) ; register_error_kind `Permanent ~id:"store.bad_ordering_invariant" ~title:"Bad ordering invariant" ~description:"The ordering invariant does not hold" ~pp: (fun ppf ( genesis, caboose, savepoint, cementing_highwatermark, checkpoint, head ) -> Format.fprintf ppf "Invariant '%ld (genesis) ≤ %ld (caboose) ≤ %ld (savepoint) ≤ %a \ [cementing_highwatermark] ≤\n\ \ %ld (checkpoint) ≤ all(alternate_heads ∪ (%ld) current_head)' does \ not hold" genesis caboose savepoint (Format.pp_print_option ~none:(fun ppf () -> Format.fprintf ppf "(n/a)") (fun ppf -> Format.fprintf ppf "%ld")) cementing_highwatermark checkpoint head) Data_encoding.( obj6 (req "genesis" int32) (req "caboose" int32) (req "savepoint" int32) (req "cementing_highwatermark" (option int32)) (req "checkpoint" int32) (req "head" int32)) (function | Bad_ordering_invariant { genesis; caboose; savepoint; cementing_highwatermark; checkpoint; head; } -> Some ( genesis, caboose, savepoint, cementing_highwatermark, checkpoint, head ) | _ -> None) (fun (genesis, caboose, savepoint, cementing_highwatermark, checkpoint, head) -> Bad_ordering_invariant {genesis; caboose; savepoint; cementing_highwatermark; checkpoint; head}) type corruption_kind = | Inferred_head of Block_hash.t * Int32.t | Cannot_find_floating_savepoint | Cannot_find_savepoint_candidate | Cannot_find_floating_caboose | Cannot_find_caboose_candidate | Cannot_find_block_with_metadata | Cannot_find_activation_block of int | Missing_genesis let corruption_kind_encoding = let open Data_encoding in union [ case (Tag 0) ~title:"Inferred_head" (obj2 (req "hash" Block_hash.encoding) (req "level" int32)) (function | Inferred_head (hash, level) -> Some (hash, level) | _ -> None) (fun (hash, level) -> Inferred_head (hash, level)); case (Tag 1) ~title:"Cannot_find_floating_savepoint" empty (function Cannot_find_floating_savepoint -> Some () | _ -> None) (fun () -> Cannot_find_floating_savepoint); case (Tag 2) ~title:"Cannot_find_savepoint_candidate" empty (function Cannot_find_savepoint_candidate -> Some () | _ -> None) (fun () -> Cannot_find_savepoint_candidate); case (Tag 3) ~title:"Cannot_find_floating_caboose" empty (function Cannot_find_floating_caboose -> Some () | _ -> None) (fun () -> Cannot_find_floating_caboose); case (Tag 4) ~title:"Cannot_find_caboose_candidate" empty (function Cannot_find_caboose_candidate -> Some () | _ -> None) (fun () -> Cannot_find_caboose_candidate); case (Tag 5) ~title:"Cannot_find_block_with_metadata" empty (function Cannot_find_block_with_metadata -> Some () | _ -> None) (fun () -> Cannot_find_block_with_metadata); case (Tag 6) ~title:"Cannot_find_activation_block" (obj1 (req "proto_level" int31)) (function | Cannot_find_activation_block proto_level -> Some proto_level | _ -> None) (fun proto_level -> Cannot_find_activation_block proto_level); case (Tag 7) ~title:"Missing_genesis" empty (function Missing_genesis -> Some () | _ -> None) (fun () -> Missing_genesis); ] let pp_corruption_kind ppf = function | Inferred_head (hash, level) -> Format.fprintf ppf "inferred head (%a, %ld) must have metadata" Block_hash.pp hash level | Cannot_find_floating_savepoint -> Format.fprintf ppf "failed to find a valid savepoint in the floating store. No block with \ metadata were found" | Cannot_find_savepoint_candidate -> Format.fprintf ppf "failed to find the savepoint candidate in the store" | Cannot_find_floating_caboose -> Format.fprintf ppf "failed to find a valid caboose in the floating store" | Cannot_find_caboose_candidate -> Format.fprintf ppf "failed to find the caboose candidate in the store" | Cannot_find_block_with_metadata -> Format.fprintf ppf "cannot find block with metadata in the store. At least the head must \ have metadata" | Cannot_find_activation_block proto_level -> Format.fprintf ppf "failed to find a valid activation block for protocol %d" proto_level | Missing_genesis -> Format.fprintf ppf "the genesis block is not available in the store" type error += Corrupted_store of corruption_kind let () = Error_monad.register_error_kind `Permanent ~id:"store.corrupted_store" ~title:"Corrupted store" ~description:"The store is corrupted" ~pp:(fun ppf kind -> Format.fprintf ppf "The store is corrupted irremediably: %a." pp_corruption_kind kind) Data_encoding.(obj1 (req "kind" corruption_kind_encoding)) (function Corrupted_store k -> Some k | _ -> None) (fun k -> Corrupted_store k) (* Store upgrade errors *) type error += | Cannot_find_chain_dir of string | V_3_0_upgrade_missing_floating_block of { block_hash : Block_hash.t; block_level : Int32.t; floating_kind : string; } let () = Error_monad.register_error_kind `Permanent ~id:"store.cannot_find_chain_dir" ~title:"Cannot find chain dir" ~description:"Cannot find chain dir while upgrading storage" ~pp:(fun ppf path -> Format.fprintf ppf "Failed to upgrade the storage. The chain directory %s cannot be \ found. Make sure that the data directory contains data of the \ expected network." path) Data_encoding.(obj1 (req "path" string)) (function Cannot_find_chain_dir p -> Some p | _ -> None) (fun p -> Cannot_find_chain_dir p) ; register_error_kind `Permanent ~id:"block_store.v_3_0_upgrade_missing_floating_block" ~title:"V.3.0 upgrade missing floating block" ~description:"Failed to upgrade the floating store" ~pp:(fun ppf (block_hash, block_level, floating_kind) -> Format.fprintf ppf "Failed to upgrade block %a (level %ld) for %s floating store: block \ not found in the index." Block_hash.pp block_hash block_level floating_kind) Data_encoding.( obj3 (req "block_hash" Block_hash.encoding) (req "block_level" int32) (req "floating_kind" string)) (function | V_3_0_upgrade_missing_floating_block {block_hash; block_level; floating_kind} -> Some (block_hash, block_level, floating_kind) | _ -> None) (fun (block_hash, block_level, floating_kind) -> V_3_0_upgrade_missing_floating_block {block_hash; block_level; floating_kind})
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>