text stringlengths 0 601k |
|---|
let replace_simple_op_with_a_batched = replacement_test_helper ~ __LOC__ ~ title " : 2nd operation ' s gas limit is constant . Replacement possible . " ~ op1 : default_op ~ op2 : { default_op with gas = default_gas / 2 ; fee = ( replacement_fee / 2 ) + 1 } ~ size2 : 2 ~ incheck1 : check_applied ~ incheck2 : check_appli... |
let replace_batched_op_with_simple_one_low_fees = replacement_test_helper ~ __LOC__ ~ title " : Replacing a batched operation not possible due to low fees " ~ op1 : default_op ~ size1 : 2 ~ op2 : replacement_op ~ incheck1 : check_applied ~ incheck2 : check_branch_delayed ~ postcheck2 ( : fun nodes h1 _h2 -> op_is_appli... |
let replace_batched_op_with_simple_one = replacement_test_helper ~ __LOC__ ~ title " : Replacing a batched op is possible if enough fees are provided " ~ op1 { : default_op with fee = default_op . fee / 2 } ~ size1 : 2 ~ op2 : replacement_op ~ incheck1 : check_applied ~ incheck2 : check_applied ~ postcheck2 ( : fun nod... |
let low_balance_to_pay_fees = replacement_test_helper ~ __LOC__ ~ title " : Low balance - second op ' s fees are equal to max_int64 - 1 " ~ op1 : default_op ~ op2 { : default_op with fee = max_int } ~ size2 : 2 ~ incheck1 : check_applied ~ incheck2 : check_branch_delayed ~ postcheck2 ( : fun nodes h1 _h2 -> op_is_appli... |
let sum_fees_overflow = replacement_test_helper ~ __LOC__ ~ title " : Sum of fees of the 2nd operation overflow on int64 " ~ op1 : default_op ~ op2 { : default_op with fee = max_int } ~ size2 : 10 ~ incheck1 : check_applied ~ incheck2 : check_refused ~ postcheck2 ( : fun nodes h1 _h2 -> op_is_applied ~ __LOC__ nodes h1... |
let register ~ protocols = identical_operations ~ protocols ; same_gas_and_fees_but_different_ops ~ protocols ; replacement_fees_below_threshold ~ protocols ; replacement_fees_equal_to_threshold ~ protocols ; replacement_fees_above_threshold ~ protocols ; third_operation_fees_below_replacement_threshold ~ protocols ; t... |
type state = { graph : Edges . t ; time : float ; event : int ; connected_components : Agent . SetMap . Set . t Mods . IntMap . t option ; } |
type summary = { unary_distances : ( int * int ) option } |
let init_state ~ with_connected_components = { graph = Edges . empty ~ with_connected_components ; time = 0 . ; event = 0 ; connected_components = if with_connected_components then Some Mods . IntMap . empty else None ; } |
let cc_of_agent ag e work = let rec fold_arity_list f x arity acc = if ( x = arity ) then acc else fold_arity_list f ( succ x ) arity ( f acc x ) in let add_agent a e ( work , morphism , todos ) = let aid = Agent . id a in let atype = Agent . sort a in let arity = Edges . get_sites aid e in let ( w_agent , work ' ) = P... |
let cc_of_state ~ debugMode s env = let cc_of_root agent e ' = let work = Pattern . begin_new e ' in let ( morphism , work ' ) = cc_of_agent agent s . graph work in let ( en , _ , c , i ) = Pattern . finish_new ~ debugMode work ' in ( en , ( List . map ( fun ( cid , ( aid , _ ) ) -> ( cid , aid ) ) morphism ) , c , i )... |
let break_apart_cc graph ccs = function | None -> ccs | Some ( origin_cc , new_cc ) -> let set = Mods . IntMap . find_default Agent . SetMap . Set . empty origin_cc ccs in if Agent . SetMap . Set . is_empty set then ccs else let nset , oset ' = Agent . SetMap . Set . partition ( fun ( x , _ ) -> Edges . get_connected_c... |
let merge_cc ccs = function | None -> ccs | Some ( cc1 , cc2 ) -> let set1 = Mods . IntMap . find_default Agent . SetMap . Set . empty cc1 ccs in match Mods . IntMap . pop cc2 ccs with | None , _ -> ccs | Some set2 , ccs ' -> Mods . IntMap . add cc1 ( Agent . SetMap . Set . union set1 set2 ) ccs ' |
let do_negative_part ( ( a , _ ) , s ) ( graph , ccs ) = match Edges . link_destination a s graph with | None -> ( Edges . remove_free a s graph , ccs ) | Some ( ( a ' , _ ) , s ' ) -> let graph ' , cc_change = Edges . remove_link a s a ' s ' graph in ( graph ' , match ccs with | None -> None | Some ccs -> Some ( break... |
let do_action sigs ( graph , ccs as pack ) = function | Instantiation . Create ( ( id , ty as ag ) , _graphs ) -> ( snd @@ Edges . add_agent ~ id sigs ty graph , Option_util . map ( Mods . IntMap . add id ( Agent . SetMap . Set . singleton ag ) ) ccs ) | Instantiation . Mod_internal ( ( ( a , _ ) , s ) , i ) -> ( Edges... |
let involved_agents l = List_util . map_option ( function | Instantiation . Is_Here a -> Some a | Instantiation . Is_Free _ | Instantiation . Has_Internal _ | Instantiation . Is_Bound _ | Instantiation . Is_Bound_to _ | Instantiation . Has_Binding_type _ -> None ) l |
let store_distances r graph = function | [ ] | [ _ ] | _ :: _ :: _ :: _ -> None | [ cc1 ; cc2 ] -> let cc1_ags = involved_agents cc1 in let cc2_ags = involved_agents cc2 in match Edges . are_connected graph cc1_ags cc2_ags with | None -> None | Some path -> Some ( r , List . length path ) |
let test_pass_on graph = function | Instantiation . Is_Here ag -> Edges . is_agent ag graph | Instantiation . Has_Internal ( ( ag , s ) , st ) -> Edges . is_agent ag graph && Edges . is_internal st ( Agent . id ag ) s graph | Instantiation . Is_Free ( ag , s ) -> Edges . is_agent ag graph && Edges . is_free ( Agent . i... |
let tests_pass_on graph tests = List . for_all ( test_pass_on graph ) ( List . concat tests ) |
let is_step_triggerable_on_edges graph = function | Trace . Subs _ | Trace . Init _ | Trace . Pert _ | Trace . Dummy _ -> true | Trace . Rule ( _r , event , _info ) -> tests_pass_on graph event . Instantiation . tests | Trace . Obs ( _ , tests , _ ) -> tests_pass_on graph tests |
let is_step_triggerable state = is_step_triggerable_on_edges state . graph |
let do_step sigs state = function | Trace . Subs _ -> state , { unary_distances = None } | Trace . Rule ( kind , event , info ) -> let unary_distances = if state . connected_components = None then None else store_distances kind state . graph event . Instantiation . tests in let pregraph , connected_components = List . ... |
type input = { target_epoch_ledgers_state_hash : State_hash . t option [ @ default None ] None ; start_slot_since_genesis : int64 [ @ default 0L ] 0L ; genesis_ledger : Runtime_config . Ledger . t } |
type output = { target_epoch_ledgers_state_hash : State_hash . t ; target_fork_state_hash : State_hash . t ; target_genesis_ledger : Runtime_config . Ledger . t ; target_epoch_data : Runtime_config . Epoch_data . t } |
type command_type = [ ` Internal_command | ` User_command | ` Zkapp_command ] |
module type Get_command_ids = sig val run : Caqti_async . connection -> state_hash : string -> start_slot : int64 -> ( int list , [ > Caqti_error . call_or_retrieve ] ) Deferred . Result . t end |
type balance_block_data = { block_id : int ; block_height : int64 ; sequence_no : int ; secondary_sequence_no : int } |
let error_count = ref 0 |
let json_ledger_hash_of_ledger ledger = Ledger_hash . to_yojson @@ Ledger . merkle_root ledger |
let create_ledger_as_list ledger = List . map ( Ledger . to_list ledger ) ledger ~ f ( : fun acc -> Genesis_ledger_helper . Accounts . Single . of_account acc None ) |
let create_output ~ target_fork_state_hash ~ target_epoch_ledgers_state_hash ~ ledger ~ staking_epoch_ledger ~ staking_seed ~ next_epoch_ledger ~ next_seed ( input_genesis_ledger : Runtime_config . Ledger . t ) t = let genesis_ledger_as_list = create_ledger_as_list ledger in let target_genesis_ledger = { input_genesis_... |
let create_replayer_checkpoint ~ ledger ~ start_slot_since_genesis : input = let accounts = create_ledger_as_list ledger in let genesis_ledger : Runtime_config . Ledger . t = { base = Accounts accounts ; num_accounts = None ; balances = [ ] ; hash = None ; name = None ; add_genesis_winner = Some true } in { target_epoc... |
let global_slot_hashes_tbl : ( Int64 . t , State_hash . t * Ledger_hash . t ) t Hashtbl . t = Int64 . Table . create ( ) |
let get_slot_hashes ~ logger slot = let rec go curr_slot = if Int64 . is_negative curr_slot then ( [ % log fatal ] fatal " Could not find state and ledger hashes for slot % Ld , despite trying \ all predecessor slots " slot ; Core . exit 1 ) ; match Hashtbl . find global_slot_hashes_tbl curr_slot with | None -> [ % log... |
let account_identifier_tbl : ( int , Account_id . t ) t Hashtbl . t = Int . Table . create ( ) |
let account_identifer_of_id pool account_identifier_id : Account_id . t Deferred . t = let open Deferred . Let_syntax in match Hashtbl . find account_identifier_tbl account_identifier_id with | Some acct_id -> return acct_id | None -> let % map acct_id = Load_data . account_identifier_of_id pool account_identifier_id i... |
let internal_command_to_balance_block_data ( internal_cmd : Sql . Internal_command . t ) t = { block_id = internal_cmd . block_id ; block_height = internal_cmd . block_height ; sequence_no = internal_cmd . sequence_no ; secondary_sequence_no = internal_cmd . secondary_sequence_no } |
let user_command_to_balance_block_data ( user_cmd : Sql . User_command . t ) t = { block_id = user_cmd . block_id ; block_height = user_cmd . block_height ; sequence_no = user_cmd . sequence_no ; secondary_sequence_no = 0 } |
let process_block_infos_of_state_hash ~ logger pool state_hash ~ f = match % bind Caqti_async . Pool . use ( fun db -> Sql . Block_info . run db state_hash ) state_hash pool with | Ok block_infos -> f block_infos | Error msg -> [ % log error ] error " Error getting block information for state hash " ~ metadata : [ ( " ... |
let update_epoch_ledger ~ logger ~ name ~ ledger ~ epoch_ledger epoch_ledger_hash = let epoch_ledger_hash = Ledger_hash . of_base58_check_exn epoch_ledger_hash in let curr_ledger_hash = Ledger . merkle_root ledger in if Frozen_ledger_hash . equal epoch_ledger_hash curr_ledger_hash then ( [ % log info ] info " Creating ... |
let update_staking_epoch_data ~ logger pool ~ ledger ~ last_block_id ~ staking_epoch_ledger = let query_db = Mina_caqti . query pool in let % bind state_hash = query_db ~ f ( : fun db -> Sql . Block . get_state_hash db last_block_id ) last_block_id in let % bind staking_epoch_id = query_db ~ f ( : fun db -> Sql . Epoch... |
let update_next_epoch_data ~ logger pool ~ ledger ~ last_block_id ~ next_epoch_ledger = let query_db = Mina_caqti . query pool in let % bind state_hash = query_db ~ f ( : fun db -> Sql . Block . get_state_hash db last_block_id ) last_block_id in let % bind next_epoch_id = query_db ~ f ( : fun db -> Sql . Epoch_data . g... |
module Fee_transfer_key = struct module T = struct type t = int64 * int * int [ @@ deriving hash , sexp , compare ] compare end type t = T . t include Hashable . Make ( T ) T end |
let fee_transfer_tbl : ( Fee_transfer_key . t , Coinbase_fee_transfer . t ) t Hashtbl . t = Fee_transfer_key . Table . create ( ) |
let cache_fee_transfer_via_coinbase pool ( internal_cmd : Sql . Internal_command . t ) t = match internal_cmd . typ with | " fee_transfer_via_coinbase " -> let % map receiver_acct_id = Load_data . account_identifier_of_id pool internal_cmd . receiver_id in let receiver_pk = Account_id . public_key receiver_acct_id in l... |
let account_creation_fee_uint64 = Currency . Fee . to_uint64 constraint_constants . account_creation_fee |
let account_creation_fee_int64 = Currency . Fee . to_int constraint_constants . account_creation_fee |> Int64 . of_int |
let run_internal_command ~ logger ~ pool ~ ledger ( cmd : Sql . Internal_command . t ) t = [ % log info ] info " Applying internal command ( % s ) s with global slot since genesis % Ld , \ sequence number % d , and secondary sequence number % d " cmd . typ cmd . global_slot_since_genesis cmd . sequence_no cmd . seconda... |
let apply_combined_fee_transfer ~ logger ~ pool ~ ledger ( cmd1 : Sql . Internal_command . t ) t ( cmd2 : Sql . Internal_command . t ) t = [ % log info ] info " Applying combined fee transfers with sequence number % d " cmd1 . sequence_no ; let account_identifier_of_id = Load_data . account_identifier_of_id pool in let... |
module User_command_helpers = struct let body_of_sql_user_cmd pool ( { typ ; source_id ; receiver_id ; amount ; global_slot_since_genesis ; _ } : Sql . User_command . t ) : Signed_command_payload . Body . t Deferred . t = let open Signed_command_payload . Body in let open Deferred . Let_syntax in let account_identifier... |
let run_user_command ~ logger ~ pool ~ ledger ( cmd : Sql . User_command . t ) t = [ % log info ] info " Applying user command ( % s ) s with nonce % Ld , global slot since genesis % Ld , \ and sequence number % d " cmd . typ cmd . nonce cmd . global_slot_since_genesis cmd . sequence_no ; let account_identifier_of_id =... |
module Zkapp_helpers = struct let state_view_tbl : ( int , Zkapp_precondition . Protocol_state . View . t ) t Hashtbl . t = Hashtbl . create ( module Int ) Int let get_parent_state_view ~ pool block_id : Zkapp_precondition . Protocol_state . View . t Deferred . t = match Hashtbl . find state_view_tbl block_id with | So... |
let parties_of_zkapp_command ~ pool ( cmd : Sql . Zkapp_command . t ) t : Parties . t Deferred . t = let query_db = Mina_caqti . query pool in let % bind ( fee_payer : Party . Fee_payer . t ) t = let % map ( body : Party . Body . Fee_payer . t ) t = Archive_lib . Load_data . get_fee_payer_body ~ pool cmd . zkapp_fee_pa... |
let run_zkapp_command ~ logger ~ pool ~ ledger ( cmd : Sql . Zkapp_command . t ) t = [ % log info ] info " Applying zkApp command at global slot since genesis % Ld , and sequence \ number % d " cmd . global_slot_since_genesis cmd . sequence_no ; let % bind state_view = Zkapp_helpers . get_parent_state_view ~ pool cmd .... |
let find_canonical_chain ~ logger pool slot = let query_db = Mina_caqti . query pool in let find_state_hash_chain state_hash = match % map query_db ~ f ( : fun db -> Sql . Block . get_chain db state_hash ) state_hash with | [ ] -> [ % log info ] info " Block with state hash % s is not along canonical chain " state_hash... |
let try_slot ~ logger pool slot = let num_tries = 5 in let rec go ~ slot ~ tries_left = if tries_left <= 0 then ( [ % log fatal ] fatal " Could not find canonical chain after trying % d slots " num_tries ; Core_kernel . exit 1 ) ; match % bind find_canonical_chain ~ logger pool slot with | None -> go ~ slot ( : slot - ... |
let unquoted_string_of_yojson json = let s = Yojson . Safe . to_string json in String . sub s ~ pos : 1 ~ len ( : String . length s - 2 ) 2 |
let main ~ input_file ~ output_file_opt ~ archive_uri ~ continue_on_error ( ) = let logger = Logger . create ( ) in let json = Yojson . Safe . from_file input_file in let input = match input_of_yojson json with | Ok inp -> inp | Error msg -> failwith ( sprintf " Could not parse JSON in input file " \% s " \: % s " inpu... |
let ( ) = Command ( . run ( let open Let_syntax in Command . async ~ summary " : Replay transactions from Mina archive database " ( let % map input_file = Param . flag " -- input - file " ~ doc " : file File containing the genesis ledger " Param ( . required string ) string and output_file_opt = Param . flag " -- outpu... |
module Compare = struct module type COMPARABLE = sig type t val compare : t -> t -> int end end |
module Set = struct module type S = sig type ' a error_monad_trace type elt type t val empty : t val is_empty : t -> bool val mem : elt -> t -> bool val add : elt -> t -> t val singleton : elt -> t val remove : elt -> t -> t val union : t -> t -> t val inter : t -> t -> t val disjoint : t -> t -> bool val diff : t -> t... |
module Map = struct module type S = sig type ' a error_monad_trace type key type ' +! a t val empty : ' a t val is_empty : ' a t -> bool val mem : key -> ' a t -> bool val add : key -> ' a -> ' a t -> ' a t val update : key -> ( ' a option -> ' a option ) -> ' a t -> ' a t val singleton : key -> ' a -> ' a t val remove... |
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ " Version " , [ " 2014 - 11 - 01 " ] ; " Action " , [ " ReplicateKey " ] ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . render ( Replicat... |
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " ReplicateKeyResponse " ( snd xml ) ) ( Xml . member " ReplicateKeyResult " ) in try Util . or_error ( Util . option_bind resp ReplicateKeyResponse . parse ) ( let open Error in BadResponse { body ; message = " C... |
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if List . mem var errors && match Errors_internal . to_http_code var with | Some var -> var = code | None -> true then Some var else None | None -> None |
type pos_completion = [ ` PP_211 of string list | ` PP_214 of string list | ` PP_220 of string list | ` PP_221 of string list | ` PP_250 of string list | ` PP_251 of string list | ` PP_252 of string list ] |
type pos_intermediate = [ ` TP_354 of string list ] |
type transient_neg_completion = [ ` TN_421 of string list | ` TN_450 of string list | ` TN_451 of string list | ` TN_452 of string list | ` TN_455 of string list ] |
type permanent_neg_completion = [ ` PN_500 of string list | ` PN_501 of string list | ` PN_502 of string list | ` PN_503 of string list | ` PN_504 of string list | ` PN_550 of string list | ` PN_551 of string list | ` PN_552 of string list | ` PN_553 of string list | ` PN_554 of string list | ` PN_555 of string list ] |
type t = [ pos_completion | pos_intermediate | transient_neg_completion | permanent_neg_completion | ` Other of int * string list ] |
let equal_values a b = try List . for_all2 String . equal a b with _ -> false |
let equal a b = match ( a , b ) with | ` PP_211 a , ` PP_211 b -> equal_values a b | ` PP_214 a , ` PP_214 b -> equal_values a b | ` PP_220 a , ` PP_220 b -> equal_values a b | ` PP_221 a , ` PP_221 b -> equal_values a b | ` PP_250 a , ` PP_250 b -> equal_values a b | ` PP_251 a , ` PP_251 b -> equal_values a b | ` PP_... |
let pp ppf = function | ` PP_211 lines -> Fmt . pf ppf " ( 211 [ @< hov >% a ] ) " @ Fmt . ( Dump . list string ) lines | ` PP_214 lines -> Fmt . pf ppf " ( 214 [ @< hov >% a ] ) " @ Fmt . ( Dump . list string ) lines | ` PP_220 lines -> Fmt . pf ppf " ( 220 [ @< hov >% a ] ) " @ Fmt . ( Dump . list string ) lines | ` ... |
let to_int = function | ` PP_211 _ -> 211 | ` PP_214 _ -> 214 | ` PP_220 _ -> 220 | ` PP_221 _ -> 221 | ` PP_250 _ -> 250 | ` PP_251 _ -> 251 | ` PP_252 _ -> 252 | ` TP_354 _ -> 354 | ` TN_421 _ -> 421 | ` TN_450 _ -> 450 | ` TN_451 _ -> 451 | ` TN_452 _ -> 452 | ` TN_455 _ -> 455 | ` PN_500 _ -> 500 | ` PN_501 _ -> 50... |
let code x = to_int x |
let lines = function | ` PP_211 lines | ` PP_214 lines | ` PP_220 lines | ` PP_221 lines | ` PP_250 lines | ` PP_251 lines | ` PP_252 lines | ` TP_354 lines | ` TN_421 lines | ` TN_450 lines | ` TN_451 lines | ` TN_452 lines | ` TN_455 lines | ` PN_500 lines | ` PN_501 lines | ` PN_502 lines | ` PN_503 lines | ` PN_504... |
let compare a b = to_int a - to_int b |
let v code lines = match code with | 211 -> ` PP_211 lines | 214 -> ` PP_214 lines | 220 -> ` PP_220 lines | 221 -> ` PP_221 lines | 250 -> ` PP_250 lines | 251 -> ` PP_251 lines | 252 -> ` PP_252 lines | 354 -> ` TP_354 lines | 421 -> ` TN_421 lines | 450 -> ` TN_450 lines | 451 -> ` TN_451 lines | 452 -> ` TN_452 lin... |
module Decoder = struct open Decoder type nonrec error = [ ` Invalid_code of int | error ] let pp_error ppf = function | ` Invalid_code code -> Fmt . pf ppf " Invalid code : % 3d " code | # Decoder . error as err -> pp_error ppf err let is_digit = function ' 0 ' . . ' 9 ' -> true | _ -> false external unsafe_get_uint8 ... |
module Encoder = struct open Encoder type nonrec error = error let pp_error = pp_error let crlf encoder = write " \ r \ n " encoder let write_number n encoder = let number = Fmt . fmt " % 03d " in write Fmt . ( to_to_string number n ) encoder let response response k encoder = match lines response with | [ ] -> Fmt . in... |
module Model = struct module Data = struct type t = ( string * string ) list [ @@ deriving yojson ] let to_string data = data |> to_yojson |> Yojson . Safe . to_string let of_string str = str |> Yojson . Safe . from_string |> of_yojson end module Status = struct type t = | Active | Inactive let to_string = function | A... |
module type Sig = sig val lifecycles : Sihl . Container . lifecycle list val register_migration : unit -> unit val register_cleaner : unit -> unit val find : ? ctx ( : string * string ) list -> string -> Model . t Lwt . t val find_opt : ? ctx ( : string * string ) list -> string -> Model . t option Lwt . t val find_by_... |
module MariaDb ( MigrationService : Sihl . Contract . Migration . Sig ) : Sig = struct let lifecycles = [ Database . lifecycle ; MigrationService . lifecycle ] module Model = Model module Sql = struct let find_request = let open Caqti_request . Infix in { sql | SELECT LOWER ( CONCAT ( SUBSTR ( HEX ( uuid ) , 1 , 8 ) , ... |
module PostgreSql ( MigrationService : Sihl . Contract . Migration . Sig ) : Sig = struct let lifecycles = [ Database . lifecycle ; MigrationService . lifecycle ] module Model = Model module Sql = struct let find_request = let open Caqti_request . Infix in { sql | SELECT uuid , token_value , token_data , status , expir... |
let sources_glob = Glob . parse " . <* ml > or . <* mli > or . <* c > or . <* h " ; ; > |
let rec analyze f bt = match bt with | Leaf r -> fprintf f " Ocamlbuild knows of no rules that apply to a target named % a . \ This can happen if you ask Ocamlbuild to build a target with the \ wrong extension ( e . g . . opt instead of . native ) or if the source \ files live in directories that have not been specifie... |
let rec print_backtrace f = function | Target ( name , backtrace ) -> fprintf f " @\ n - [ @< 2 > Failed to build the target % s % a ] " @ name print_backtrace backtrace | Leaf r -> fprintf f " @\ n - [ @< 2 > Building % a ] " @ Resource . print r | Depth ( r , backtrace ) -> fprintf f " @\ n - [ @< v2 > Building % a :... |
let print_backtrace_analyze f bt = ignore ( analyze f bt ) |
let listify suggestions = suggestions |> List . map ( fun sug -> " - ` " ^ sug ^ ) " ` " |> String . concat " \ n " |
let highlightPart ~ color ~ part str = let indexOfPartInStr = Helpers . stringFind str part in highlight ~ color ~ first : indexOfPartInStr ~ last ( : indexOfPartInStr + ( String . length part ) part ) part str |
let report parsedContent = match parsedContent with | Error_CatchAll error -> error | Type_MismatchTypeArguments { typeConstructor ; expectedCount ; actualCount } actualCount -> sp " This needs to be applied to % d argument ( arguments ) arguments , we found % d . " expectedCount actualCount | Type_IncompatibleType { a... |
type who_is_responsible_for_the_error = | User | Developer |
type error = { responsible : who_is_responsible_for_the_error ; msg : User_message . t ; has_embedded_location : bool ; needs_stack_trace : bool } |
let code_error ~ loc ~ dyn_without_loc = let open Pp . O in { responsible = Developer ; msg = User_message . make ? loc [ Pp . tag User_message . Style . Error ( Pp . textf " Internal error , please report upstream including the contents \ of _build / log . " ) ; Pp . text " Description " : ; Pp . box ~ indent : 2 ( Pp... |
let get_error_from_exn = function | Memo . Cycle_error . E raw_cycle -> ( let cycle = Memo . Cycle_error . get raw_cycle |> List . filter_map ~ f : Memo . Stack_frame . human_readable_description in match List . last cycle with | None -> let frames = Memo . Cycle_error . get raw_cycle in code_error ~ loc : None ~ dyn_w... |
let i_must_not_crash = let reported = ref false in fun ( ) -> if ! reported then [ ] else ( reported := true ; [ Pp . nop ; Pp . text " I must not crash . Uncertainty is the mind - killer . Exceptions are \ the little - death that brings total obliteration . I will fully \ express my cases . Execution will pass over me... |
let report_backtraces_flag = ref false |
let report_backtraces b = report_backtraces_flag := b |
let print_memo_stacks = ref false |
let format_memo_stack pps = match pps with | [ ] -> None | _ -> Some ( Pp . vbox ( Pp . concat ~ sep : Pp . cut ( List . map pps ~ f ( : fun pp -> Pp . box ~ indent : 3 ( Pp . seq ( Pp . verbatim " -> " ) ( Pp . seq ( Pp . text " required by " ) pp ) ) ) ) ) ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.