package tezos-protocol-demo-noops

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file registerer.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

module Source = struct
  let hash =
    Some (Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn "ProtoDemoNoopsDemoNoopsDemoNoopsDemoNoopsDemo6XBoYp")
  let sources = Tezos_base.Protocol.
{ expected_env = V12 ;
  components = [{ name = "Main" ;
                  interface = Some "(*****************************************************************************)\n(*                                                                           *)\n(* Open Source License                                                       *)\n(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com>     *)\n(*                                                                           *)\n(* Permission is hereby granted, free of charge, to any person obtaining a   *)\n(* copy of this software and associated documentation files (the \"Software\"),*)\n(* to deal in the Software without restriction, including without limitation *)\n(* the rights to use, copy, modify, merge, publish, distribute, sublicense,  *)\n(* and/or sell copies of the Software, and to permit persons to whom the     *)\n(* Software is furnished to do so, subject to the following conditions:      *)\n(*                                                                           *)\n(* The above copyright notice and this permission notice shall be included   *)\n(* in all copies or substantial portions of the Software.                    *)\n(*                                                                           *)\n(* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)\n(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  *)\n(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL   *)\n(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)\n(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING   *)\n(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER       *)\n(* DEALINGS IN THE SOFTWARE.                                                 *)\n(*                                                                           *)\n(*****************************************************************************)\n\n(** Tezos Protocol Implementation - Protocol Signature Instance *)\n\ninclude Updater.PROTOCOL with type block_header_data = string\n" ;
                  implementation = "(*****************************************************************************)\n(*                                                                           *)\n(* Open Source License                                                       *)\n(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com>     *)\n(*                                                                           *)\n(* Permission is hereby granted, free of charge, to any person obtaining a   *)\n(* copy of this software and associated documentation files (the \"Software\"),*)\n(* to deal in the Software without restriction, including without limitation *)\n(* the rights to use, copy, modify, merge, publish, distribute, sublicense,  *)\n(* and/or sell copies of the Software, and to permit persons to whom the     *)\n(* Software is furnished to do so, subject to the following conditions:      *)\n(*                                                                           *)\n(* The above copyright notice and this permission notice shall be included   *)\n(* in all copies or substantial portions of the Software.                    *)\n(*                                                                           *)\n(* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)\n(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  *)\n(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL   *)\n(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)\n(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING   *)\n(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER       *)\n(* DEALINGS IN THE SOFTWARE.                                                 *)\n(*                                                                           *)\n(*****************************************************************************)\n\nlet max_block_length = 100\n\nlet max_operation_data_length = 0\n\nlet validation_passes = []\n\nlet acceptable_pass _op = None\n\ntype block_header_data = string\n\nlet block_header_data_encoding =\n  Data_encoding.(obj1 (req \"block_header_data\" (string Plain)))\n\ntype block_header = {\n  shell : Block_header.shell_header;\n  protocol_data : block_header_data;\n}\n\ntype block_header_metadata = unit\n\nlet block_header_metadata_encoding_with_legacy_attestation_name =\n  Data_encoding.unit\n\nlet block_header_metadata_encoding = Data_encoding.unit\n\ntype operation_data = unit\n\nlet operation_data_encoding = Data_encoding.unit\n\nlet operation_data_encoding_with_legacy_attestation_name =\n  operation_data_encoding\n\ntype operation_receipt = unit\n\nlet operation_receipt_encoding = Data_encoding.unit\n\nlet operation_receipt_encoding_with_legacy_attestation_name =\n  operation_receipt_encoding\n\nlet operation_data_and_receipt_encoding =\n  Data_encoding.conv\n    (function ((), ()) -> ())\n    (fun () -> ((), ()))\n    Data_encoding.unit\n\nlet operation_data_and_receipt_encoding_with_legacy_attestation_name =\n  operation_data_and_receipt_encoding\n\ntype operation = {\n  shell : Operation.shell_header;\n  protocol_data : operation_data;\n}\n\nlet compare_operations _ _ = 0\n\ntype validation_state = {context : Context.t; fitness : Fitness.t}\n\ntype application_state = validation_state\n\ntype mode =\n  | Application of block_header\n  | Partial_validation of block_header\n  | Construction of {\n      predecessor_hash : Block_hash.t;\n      timestamp : Time.t;\n      block_header_data : block_header_data;\n    }\n  | Partial_construction of {\n      predecessor_hash : Block_hash.t;\n      timestamp : Time.t;\n    }\n\n(* Same as genesis *)\nlet fitness_from_level level =\n  let version_number = \"\\002\" in\n  let int32_to_bytes i =\n    let b = Bytes.make 4 '\\000' in\n    TzEndian.set_int32 b 0 i ;\n    b\n  in\n  [\n    Bytes.of_string version_number;\n    int32_to_bytes level ;\n    Bytes.empty ;\n    int32_to_bytes (-1l) ;\n    int32_to_bytes 0l ;\n  ]\n\nlet begin_validation context _chain_id mode\n    ~(predecessor : Block_header.shell_header) =\n  let fitness =\n    match mode with\n    | Application block_header | Partial_validation block_header ->\n        block_header.shell.fitness\n    | Construction _ | Partial_construction _ ->\n        fitness_from_level Int32.(succ predecessor.level)\n  in\n  return {context; fitness}\n\nlet begin_application = begin_validation\n\ntype error += No_error\n\nlet () =\n  register_error_kind\n    `Permanent\n    ~id:\"no-error\"\n    ~title:\"No error\"\n    ~description:\"There is no error, this is a no-op protocol\"\n    ~pp:(fun ppf () -> Format.fprintf ppf \"@[<h 0>No error in no-op protocol@]\")\n    Data_encoding.unit\n    (function No_error -> Some () | _ -> None)\n    (fun () -> No_error)\n\nlet validate_operation ?check_signature:_ _state _oph _op = tzfail No_error\n\nlet apply_operation _state _oph _op = tzfail No_error\n\nlet finalize_validation _state = return_unit\n\nlet finalize_application application_state _shell_header =\n  return\n    ( {\n        Updater.message = None;\n        context = application_state.context;\n        fitness = application_state.fitness;\n        max_operations_ttl = 0;\n        last_preserved_block_level = 0l;\n        last_finalized_block_level = 0l ;\n      },\n      () )\n\nlet init _chain_id context block_header =\n  let open Lwt_result_syntax in\n  let open Block_header in\n  let fitness = block_header.fitness in\n  let*! context = Context.Cache.set_cache_layout context [] in\n  return\n    {\n      Updater.message = None;\n      context;\n      fitness;\n      max_operations_ttl = 0;\n      last_finalized_block_level = 0l;\n      last_preserved_block_level = 0l;\n    }\n\nlet value_of_key ~chain_id:_ ~predecessor_context:_ ~predecessor_timestamp:_\n    ~predecessor_level:_ ~predecessor_fitness:_ ~predecessor:_ ~timestamp:_ =\n  return (fun _ -> tzfail No_error)\n\nlet rpc_services = RPC_directory.empty\n\n(* Fake mempool *)\nmodule Mempool = struct\n  type t = unit\n\n  type validation_info = unit\n\n  type conflict_handler =\n    existing_operation:Operation_hash.t * operation ->\n    new_operation:Operation_hash.t * operation ->\n    [`Keep | `Replace]\n\n  type operation_conflict =\n    | Operation_conflict of {\n        existing : Operation_hash.t;\n        new_operation : Operation_hash.t;\n      }\n\n  type add_result =\n    | Added\n    | Replaced of {removed : Operation_hash.t}\n    | Unchanged\n\n  type add_error =\n    | Validation_error of error trace\n    | Add_conflict of operation_conflict\n\n  type merge_error =\n    | Incompatible_mempool\n    | Merge_conflict of operation_conflict\n\n  let init _ _ ~head_hash:_ ~head:_  = Lwt.return_ok ((), ())\n\n  let encoding = Data_encoding.unit\n\n  let add_operation ?check_signature:_ ?conflict_handler:_ _ _ _ =\n    Lwt.return_ok ((), Unchanged)\n\n  let remove_operation () _ = ()\n\n  let merge ?conflict_handler:_ () () = Ok ()\n\n  let operations () = Operation_hash.Map.empty\nend\n" ;
                }] ;
}
end


module Registered =
  Tezos_protocol_updater.Registered_protocol.Register_embedded_V12
    (Tezos_protocol_demo_noops.Environment)
    (Tezos_protocol_demo_noops.Protocol.Main)
    (Source)

OCaml

Innovation. Community. Security.