text
stringlengths
12
786k
let op2 f a b = LDouble . ( to_float ( f ( of_float a ) ( of_float b ) ) )
let chk_float x y = match classify_float x , classify_float y with | FP_normal , FP_normal | FP_subnormal , FP_subnormal | FP_zero , FP_normal | FP_zero , FP_subnormal | FP_normal , FP_zero | FP_subnormal , FP_zero -> abs_float ( x . - y ) < 1e - 12 | x , y when x = y -> true | _ ...
let chk1 fop lop a = let x = fop a in let y = op1 lop a in chk_float x y
let chk2 fop lop a b = let x = fop a b in let y = op2 lop a b in chk_float x y
let test_op2 _ = let assert_chk2 n f l = List . iter ( fun a -> List . iter ( fun b -> assert_bool n @@ chk2 f l a b ) flts ) flts in assert_chk2 " add " ( . ) + LDouble . add ; assert_chk2 " sub " ( . ) - LDouble . sub ; assert_chk2 " mul " ( . * ) LDouble . ...
let test_op1 _ = let assert_chk1 n f l = List . iter ( fun a -> assert_bool n @@ chk1 f l a ) flts in assert_chk1 " neg " ( fun x -> . - x ) LDouble . neg ; assert_chk1 " sqrt " sqrt LDouble . sqrt ; assert_chk1 " exp " exp LDouble . exp ; assert_chk1 " log " log LDouble ....
let test_opw _ = let chk_frexp a = let x , i = frexp a in let y , j = LDouble . ( frexp ( of_float a ) ) in let y = LDouble . to_float y in assert_bool " frexp " ( chk_float x y && i = j ) in let chk_modf a = let w , x = modf a in let y , z = LDouble . ( modf ( of_float a ) ...
let test_classify _ = assert_bool " min " LDouble . ( classify min_float = FP_normal ) ; assert_bool " max " LDouble . ( classify max_float = FP_normal ) ; assert_bool " epsilon " LDouble . ( classify max_float = FP_normal ) ; assert_bool " nan " LDouble . ( classify nan...
let test_conv _ = List . iter ( fun a -> assert_bool " to / of_float " ( a = LDouble . ( to_float ( of_float a ) ) ) ) flts ; assert_bool " to_int " ( 3 = LDouble . ( to_int ( of_float 3 . 45 ) ) ) ; assert_bool " to_int " ( - 34 = LDouble . ( to_int...
let test_complex _ = let module C = Complex in let cplx = [ { C . re = 2 . 9 ; im = 4 . 26 } ; { C . re = 0 . 32 ; im = - 7 . 6 } ; { C . re = - 35 . 1 ; im = 12 . 3 } ; { C . re = - 0 . 002 ; im = - 9 . 1 } ; ] in let chk_compl...
let test_marshal _ = let same_repr x y = let open Obj in let x = magic x in let y = magic y in is_block x && is_block y && size x = size y && tag x = tag y in let assert_ldouble x = let ( _ , xc , _ ) as x = " foo " , LDouble . of_float x , 1 in let s = Marshal . to_string x [ ] ...
let test_comparisons _ = let open LDouble in begin assert_equal false ( neg_infinity < nan ) ; assert_equal false ( nan < neg_infinity ) ; assert_equal false ( infinity < nan ) ; assert_equal false ( nan < infinity ) ; assert_equal false ( of_float 1 . 0 < nan ) ; assert_equal f...
let test_int_conversions _ = begin assert_equal max_int ( LDouble . to_int ~ printer : string_of_int ; assert_equal min_int ( LDouble . to_int ~ printer : string_of_int ; end
let suite = " LDouble tests " >::: [ " test functions with 2 args " >:: test_op2 ; " test functions with 1 args " >:: test_op1 ; " test functions with weird args " >:: test_opw ; " test classify " >:: test_classify ; " test conversion " >:: test_conv ; " test complex api "...
let _ = run_test_tt_main suite
let count , run_count = let v = ref 0 in let count , send_count = E . create ( ) in let rec run_count ( ) = incr v ; send_count ! v ; ignore ( G . set_timeout ~ ms : 0 run_count ) in count , run_count
let count_value count = let p = El . p [ ] in let count_txt c = [ El . txt Jstr . ( v " Steps : " + of_int c ) ] in let count = S . hold [ ] ( E . map count_txt count ) in Elr . def_children p count ; p
let count_value_nest count = let p = El . p [ ] in let count_txt c = [ El . txt Jstr . ( v " Steps ( nest ) : " + of_int c ) ] in let count = S . hold [ ] ( E . map count_txt count ) in Elr . def_children p count ; El . div [ p ]
let steps ( ) = let steps = El . div [ ] in let children = let counts c = [ count_value count ; count_value_nest count ] in S . hold [ ] ( E . map counts count ) in Elr . def_children steps children ; steps
let main ( ) = let h1 = El . h1 [ El . txt ' " No leaks " ] ! in let i = " Memory usage must be bounded and the counters must not slow down . " in let info = El . p [ El . txt ' i ] in El . set_children ( Document . body G . document ) [ h1 ; info ; steps ( ) ]...
let ( ) = main ( )
let test reg leds = lightLeds leds ; Printf . printf " The pulse mode . . . \ n " ; %! applyRegPulse reg leds 2 . ; Printf . printf " The classic mode . . . \ n " ; %! applyRegAll reg leds ; Unix . sleep 2 ; Printf . printf " Only one led :\ n " ; %! clearLeds le...
let _ = let what = Sys . argv . ( 1 ) in Printf . printf " % s \ n " Sys . argv . ( 1 ) ; ignore ( setupPhys ( ) ) ; let reg = genReg 11 13 15 ~ invert : false in let leds = initReg reg ~ nb_reg : 2 in let t = true and f = false in clearLeds leds ; if what = " g...
let dummy_source_code_position = Source_code_position . { pos_fname = " file_name . ml " ; pos_lnum = 0 ; pos_bol = 0 ; pos_cnum = 0 } ; ;
let run_test ( ~ component : _ Bonsai . Arrow_deprecated . t ) ~ initial_input ~ f = let driver component = Driver . create component ~ initial_input ~ clock : Incr . clock in f ( driver component ) ; ;
module Helpers = struct include Helpers let make ~ driver = Helpers . make ~ driver let make_string ~ driver = Helpers . make_string ~ driver let make_string_with_inject ~ driver = Helpers . make_string_with_inject ~ driver let make_with_inject ~ driver = Helpers . make_with_inject ~ driver end
module Counter_component = struct module Input = Unit module Model = Int module Action = struct type t = | Increment | Decrement [ @@ deriving sexp_of ] end module Result = struct type t = string * ( Action . t -> unit Effect . t ) end let apply_action ~ inject : _ ~ schedule_event : _ ( ...
module _ = struct open Bonsai . Arrow_deprecated . Let_syntax let dummy ( type t ) ( module M : Bonsai . Arrow_deprecated . Model with type t = t ) ~ default = Bonsai . Arrow_deprecated . state_machine ( module M ) ( module M ) [ % here ] ~ default_model : default ~ apply_actio...
let test_create_cycle_eras ( ) = let empty_cycle_eras = Level_repr . create_cycle_eras [ ] |> Environment . wrap_tzresult in Assert . proto_error ~ loc : __LOC__ empty_cycle_eras ( function | Level_repr . Invalid_cycle_eras -> true | _ -> false ) >>=? fun ( ) -> let increasing_first...
let test_case_1 = ( [ Level_repr . { first_level = Raw_level_repr . of_int32_exn 1l ; first_cycle = Cycle_repr . root ; blocks_per_cycle = 8l ; blocks_per_commitment = 2l ; } ; ] , [ ( 1 , ( 1 , 0 , 0 , 0 , false ) ) ; ( 2 , ( 2 , 1 , 0 , 1 ...
let test_case_2 = ( List . rev [ Level_repr . { first_level = Raw_level_repr . of_int32_exn 1l ; first_cycle = Cycle_repr . root ; blocks_per_cycle = 8l ; blocks_per_commitment = 2l ; } ; { first_level = Raw_level_repr . of_int32_exn 17l ; first_cycle = Cycle_repr . of_int32...
let test_case_3 = ( List . rev [ Level_repr . { first_level = Raw_level_repr . of_int32_exn 1l ; first_cycle = Cycle_repr . root ; blocks_per_cycle = 8l ; blocks_per_commitment = 2l ; } ; { first_level = Raw_level_repr . of_int32_exn 17l ; first_cycle = Cycle_repr . of_int32...
let test_level_from_raw ( ) = List . iter_es ( fun ( cycle_eras , test_cases ) -> List . iter_es ( fun ( input_level , ( level , level_position , cycle , cycle_position , expected_commitment ) ) -> let raw_level = Raw_level_repr . of_int32_exn ( Int32 . of_int input_level )...
let test_first_level_in_cycle ( ) = let cycle_eras = fst test_case_3 in let test_cases = [ ( 0l , 1 ) ; ( 1l , 9 ) ; ( 2l , 17 ) ; ( 3l , 33 ) ; ( 4l , 49 ) ; ( 5l , 55 ) ; ( 6l , 61 ) ; ( 7l , 67 ) ; ] in let f ( input_cycle ,...
let tests = [ Tztest . tztest " create_cycle_eras " ` Quick test_create_cycle_eras ; Tztest . tztest " level_from_raw " ` Quick test_level_from_raw ; Tztest . tztest " first_level_in_cycle " ` Quick test_first_level_in_cycle ; ]
let test_lex_single input expected_tok test_ctxt = let tokenized = Lex . lex input in assert_equal 1 ( List . length tokenized ) ; assert_equal ( expected_tok ) ( List . hd tokenized )
let test_lex_multi input expected_toks test_ctxt = let tokenized = Lex . lex input in let rec compare_token_lists a b = match a with | [ ] -> assert_equal b [ ] | head :: tail -> assert_equal ( List . hd b ) head ; compare_token_lists tail ( List . tl b ) in compare_token_lists tokenized...
let test_expect_failure input fail_msg test_ctxt = let f = fun ( ) -> Lex . lex input in assert_raises ( Failure fail_msg ) f
let lex_char_tests = [ " test_lex_char " >:: test_lex_single " ' a ' " ( Char ' a ' ) ; " test_lex_char_esc " >:: test_lex_single " ' \\ n ' " ( Char ' \ n ' ) ; " test_lex_char_backslash " >:: test_lex_single " ' ' " \\\\ ( Char ' ' ) ; \\ " ...
let lex_int_tests = [ " test_lex_int " >:: test_lex_single " 3 " ( Int 3 ) ; " test_lex_zero " >:: test_lex_single " 0 " ( Int 0 ) ; " test_lex_int_max " >:: test_lex_single " 2147483647 " ( Int 2147483647 ) ; " test_lex_int_overflow " >:: test_expect_failure "...
let lex_keyword_tests = [ " test_lex_return_keyword " >:: test_lex_single " return " ReturnKeyword ; " test_lex_char_keyword " >:: test_lex_single " char " CharKeyword ; " test_lex_int_keyword " >:: test_lex_single " int " IntKeyword ; " test_lex_if_keyword " >:: test_lex_single...
let lex_punctuation_tests = [ " test_lex_openbrace " >:: test_lex_single " { " OpenBrace ; " test_lex_closebrace " >:: test_lex_single " } " CloseBrace ; " test_lex_openparen " >:: test_lex_single " ( " OpenParen ; " test_lex_closeparen " >:: test_lex_single " ) " Cl...
let lex_id_tests = [ " test_lex_id_simple " >:: test_lex_single " hello " ( Id " hello " ) ; " test_lex_id_underscore " >:: test_lex_single " _hell_o " ( Id " _hell_o " ) ; " test_lex_id_uppercase " >:: test_lex_single " HELLO " ( Id " HELLO " ) ; " test_l...
let lex_whitespace_tests = [ " test_leading_whitespace " >:: test_lex_single " foo " ( Id " foo " ) ; " test_leading_tab " >:: test_lex_single " \ t foo " ( Id " foo " ) ; " test_trailing_whitespace " >:: test_lex_single " 123 " ( Int 123 ) ; " test_trailing_...
let lex_multi_tests = [ " test_lex_negative " >:: test_lex_multi " - 1 " [ Minus ; Int 1 ] ; " test_lex_positive " >:: test_lex_multi " + 1 " [ Plus ; Int 1 ] ; " test_lex_brace_id " >:: test_lex_multi " } foo " [ CloseBrace ; Id " foo " ] ; " test_lex...
let rec translate = { : lexer | " | current_directory " -> begin print_string ( Sys . getcwd ( ) ) ; translate lexbuf end | _ as c -> begin print_char c ; translate lexbuf ; end | ! -> exit 0 } | ; ;
let num_lines = ref 0
let num_chars = ref 0
let rec count = { : lexer | | ' \ n ' -> ( incr num_lines ; incr num_chars ; count lexbuf ) | _ -> ( incr num_chars ; count lexbuf ) | ! -> ( ) } |
let _ = begin ( count ( Lexing . from_channel ( open_in " testr / test_lexer . ml " ) ) ) ; Format . printf " % d % d \ n " ! num_lines ! num_chars ; end ; ; { : regexp | digit = [ ' 0 ' ' - 9 ' ] ; id = [ ' a ' ' - z ' ] [ ' a ' ' -...
let rec toy_lang = { : lexer | | digit + as inum -> ( printf " integer : % s ( % d ) \ n " inum ( int_of_string inum ) ; toy_lang lexbuf ) | digit + ' . ' digit * as fnum -> ( printf " float : % s ( % f ) \ n " fnum ( float_of_string fnum ) ; toy_lang lexbuf )...
let _ = toy_lang ( Lexing . from_channel ( open_in " testr / test_lexer . ml " ) )
module QRReader : sig type t val create : unit -> t val id : t -> Uuidm . t val handler : t -> ( [ ` QRCode of QRCode . t ] , [ ` QRCode of QRCode . t ] ) Handler . t val use : t -> string -> unit type t = { id : Uuidm . t ; handler : ( [ ` QRCode of QRCode . t ] ,...
module Controller : sig type t val create : int SMap . t -> t val handler : t -> ( [ ` QRCode of QRCode . t ] , [ ` User of User . t ] ) Handler . t val connect_readers : t -> QRReader . t list -> t type t = { id : Uuidm . t ; handler : ( [ ` QRCode of QRCode . t ] ...
module Door : sig type t val create : readers : UuidSet . t -> action ( : Uuidm . t -> string -> unit ) -> t val connect_controller : t -> Controller . t -> t type t = { id : Uuidm . t ; readers : UuidSet . t ; handler : ( [ ` User of User . t ] , [ ` Nil ] ) Handl...
let prepare_library ( ) = project begin fun ( ) -> file " src / foo . ml " [ " let v = 1 " ] ; file " src / optional / bar . ml " [ " let v = Foo . v + 1 " ] ; file " src / optional_bar . ml " [ " include Optional . Bar " ] ; file " src / baz . ...
let depend ( ? optional = false ) code expect = depending begin fun ( ) -> let package = if optional then " test - library . optional " else " test - library " in file " src / main . ml " code ; tags [ " < src / main . *>: package ( " ^ package ^ " ) " ] ; ocam...
let tests = " library " >::: [ test " basic " begin fun ( ) -> prepare_library ( ) ; depend [ " Test_library . Foo . v |> string_of_int |> print_endline " ] 1 end ; test " optional " begin fun ( ) -> prepare_library ( ) ; depend ~ optional : true [ " Test_lib...
let mk_tmpfile contents : string = let ( tmpfile_name , chan ) = Filename . open_temp_file " foo " " txt " in output_string chan contents ; close_out chan ; tmpfile_name
let coatCheck = Coat_check . create ( )
let alloc_uv_fs ( ) = let memory = allocate_n char ~ count : Uv_consts . size_of_uv_fs_t in coerce ( ptr char ) ( ptr C . uv_fs ) memory
let test_expired_callback ( ) = let filename = mk_tmpfile " hello " in let data = alloc_uv_fs ( ) in let _ = begin let cb fs = let _ = Obj . repr data in Printf . printf " XXX Called ' % s ' \ n " ( C . get_uv_fs_t_path fs ) in let tckt = Coat_check . ticket coatCheck in let (...
let test_store_callback_and_data ( ) = let filename = mk_tmpfile " foo " in let data = alloc_uv_fs ( ) in let nameRef = ref " " in let _ = begin let cb fs = nameRef := " XXX " in let safe = ( data , cb ) in let tckt = Coat_check . ticket coatCheck in let ( ) = Coat_check . s...
let test_store_callback_and_data_then_expired ( ) = let filename = mk_tmpfile " foo " in let data = alloc_uv_fs ( ) in let nameRef = ref " " in let _ = begin let cb fs = nameRef := " XXX " in let safe = ( data , cb ) in let tckt = Coat_check . ticket coatCheck in let ( ) = Coa...
let suite = " lifecycle suite " >::: [ " test expired callback " >:: test_expired_callback ; " test store callback & data " >:: test_store_callback_and_data ; " test store callback & data then expired " >:: test_store_callback_and_data_then_expired ; ]
module Common_tests ( S : Cstubs . FOREIGN with type ' a result = ' a and type ' a return = ' a ) = struct module M = Functions . Stubs ( S ) open M let test_object_lifetime _ = let iters = 20000 in let l = [ ( ) ; ( ) ; ( ) ; ( ) ; ( ) ; ( ) ; ( ) ...
let suite = " Lifetime tests " >::: [ " objects persist throughout C calls ( foreign ) " >:: Foreign_tests . test_object_lifetime ; " objects persist throughout C calls ( stubs ) " >:: Stub_tests . test_object_lifetime ; ]
let _ = run_test_tt_main suite
let loc = Loc . ghost in Ast . StExp ( loc , ( Ast . ExLet ( loc , Ast . ReNil , ( Ast . BiEq ( loc , ( Ast . PaId ( loc , ( Ast . IdLid ( loc , " loc ) ) ) ) " , ( Ast . ExId ( loc , ( Ast . IdAcc ( loc , ( Ast . IdUid ( loc , " Loc ) )...
let two_uris = [ " http :// foobar " ; " http :// schplaf " ]
let to_json min_agreement uris : Data_encoding . json = let json_strings = ` A ( List . map ( fun s -> ` String s ) uris ) in ` O [ ( " min_agreement " , ` Float min_agreement ) ; ( " uris " , json_strings ) ]
let to_json_default_agreement uris : Data_encoding . json = let json_strings = ` A ( List . map ( fun s -> ` String s ) uris ) in ` O [ ( " uris " , json_strings ) ]
let test_good_min_agreement_parsing _ = let floats = [ 0 . 1 ; 0 . 9 ; 1 . 0 ] in let results = List . map ( fun f -> to_json f two_uris |> Tezos_proxy . Light . destruct_sources_config |> Result . is_ok ) floats in Alcotest . ( check ( list bool ) ) " All floats are a...
let test_good_min_agreement_parsing_default_agreement _ = let result = to_json_default_agreement two_uris |> Tezos_proxy . Light . destruct_sources_config |> Result . fold ~ ok : Fun . id ~ error ( : fun e -> Alcotest . fail e ) in Alcotest . ( check ( float 0 . ) ) " Default min ...
let test_wrong_min_agreement_parsing _ = let floats = [ - 1 . 0 ; - 0 . 9 ; 0 . 0 ; 1 . 1 ; 9 . ; 99 . ; 500 . 0 ] in let results = List . map ( fun f -> to_json f two_uris |> Tezos_proxy . Light . destruct_sources_config |> Result . is_ok ) floats in Alcot...
let test_wrong_uris_parsing _ = let uris_lists = [ [ ] ; [ " http :// foobar " ] ] in let results = List . map ( fun uris -> to_json 1 . 0 uris |> Tezos_proxy . Light . destruct_sources_config |> Result . is_ok ) uris_lists in Alcotest . ( check ( list bool ) ) " Al...
let test_parse_example_sources _ = let check_parsed = function | Error errmsg -> Alcotest . failf " Parsing should have succeeded , but obtained : % s " errmsg | Ok x -> x in let json = Data_encoding . Json . from_string Tezos_proxy . Light . example_sources |> check_parsed in Tezos_proxy . ...
let ( ) = Alcotest . run " tezos - light " [ ( " light " , [ Alcotest . test_case " test valid min_agreement parsing " ` Quick test_good_min_agreement_parsing ; Alcotest . test_case " test invalid min_agreement parsing " ` Quick test_wrong_min_agreement_parsing ; Alcotest . ...
module Step_test = struct let offset off = Time_ns . add Time_ns . epoch ( Time_ns . Span . of_sec off ) type step = | Take of int * bool | Return_to_hopper of int | Return_to_bucket of int * bool | Generic of { f : unit -> unit ; debug_sexp : Sexp . t } [ @@ deriving sexp ] type ti...
let stabilize = Async_kernel_scheduler . Expert . run_cycles_until_no_jobs_remain ( module ( struct open Limiter module Outcome = Outcome type t = Limiter . t [ @@ deriving sexp_of ] type limiter = t [ @@ deriving sexp_of ] module type Common = Common let fill_if_zero r i = decr r ; if ! r ...
( module struct open Timerfd let % test_unit " unsafe_timerfd_settime returning errno " = let result = Private . unsafe_timerfd_settime ( File_descr . of_int ( - 1 ) ) false ~ initial : Int63 . zero ~ interval : Int63 . zero in if Syscall_result . Unit . is_ok result then failwiths ~...
let with_epoll ~ f = protectx ~ finally : Epoll . close ~ f ( ( Or_error . ok_exn Epoll . create ) ~ num_file_descrs : 1024 ~ max_ready_events : 256 ) ; ;
let make_socket ( ) = Unix . socket ~ domain : Unix . PF_INET ~ kind : Unix . SOCK_DGRAM ~ protocol : 0 ( ) ; ; with_epoll ~ f ( : fun epset -> let sock1 = make_socket ( ) in require_allocation_does_not_exceed ( Minor_words 6 ) [ % here ] ( fun ( ) -> Epoll . set e...
let create = Or_error . ok_exn Eventfd . create let fd = create 1l in [ % test_result : Int64 . t ] ~ expect : 1L ( Eventfd . read fd ) ; let fd = create 10l in [ % test_result : Int64 . t ] ~ expect : 10L ( Eventfd . read fd ) ; ; let fd = create ~ flags : Eventfd . ...
let nonblock_read fd = try Some ( Eventfd . read fd ) with | _ -> None ; ; non - semaphore fd " = let fd = create ~ flags : Eventfd . Flags . nonblock 1l in Eventfd . write fd 10L ; [ % test_result : Int64 . t ] ~ expect : 11L ( Eventfd . read fd ) ; [ % test_result ...
let with_listening_server_unix_socket fname ~ f = let with_cwd dir ~ f = let old = Unix . getcwd ( ) in Unix . chdir dir ; Exn . protect ~ finally ( : fun ( ) -> Unix . chdir old ) ~ f in with_cwd ( Filename . dirname fname ) ~ f ( : fun ( ) -> let fname = Filename . bas...
let generate_init_state ( ) = let cpmm_min_xtz_balance = 10_000_000L in let cpmm_min_tzbtc_balance = 100_000 in let accounts_balances = [ { xtz = 1_000_000L ; tzbtc = 1 ; liquidity = 100 } ; { xtz = 1_000L ; tzbtc = 1000 ; liquidity = 100 } ; { xtz = 40_000_000L ; tzbtc...
let expected_cpmm_hash = Script_expr_hash . of_b58check_exn " exprvEBYbxZruLZ9aUDEC9cUxn5KUj361xsaZXGfCxogFoKQ1er9Np "
let expected_lqt_hash = Script_expr_hash . of_b58check_exn " exprufAK15C2FCbxGLCEVXFe26p3eQdYuwZRk1morJUwy9NBUmEZVB "
let liquidity_baking_origination ( ) = Context . init 1 >>=? fun ( blk , _contracts ) -> Context . get_liquidity_baking_cpmm_address ( B blk ) >>=? fun cpmm_address -> Context . Contract . script_hash ( B blk ) cpmm_address >>=? fun cpmm_hash -> Lwt . return @@ Environment . wrap...
let liquidity_baking_cpmm_address ( ) = Context . init 1 >>=? fun ( blk , _contracts ) -> Context . get_liquidity_baking_cpmm_address ( B blk ) >>=? fun liquidity_baking -> Assert . equal ~ loc : __LOC__ String . equal " CPMM address in storage is incorrect " Format . pp_print_stri...
let liquidity_baking_subsidies n ( ) = Context . init ~ consensus_threshold : 0 1 >>=? fun ( blk , _contracts ) -> Context . get_liquidity_baking_cpmm_address ( B blk ) >>=? fun liquidity_baking -> Context . Contract . balance ( B blk ) liquidity_baking >>=? fun old_balance -> Bloc...
let liquidity_baking_sunset_level n ( ) = Context . init ~ consensus_threshold : 0 1 >>=? fun ( blk , _contracts ) -> Context . get_liquidity_baking_cpmm_address ( B blk ) >>=? fun liquidity_baking -> Context . get_constants ( B blk ) >>=? fun csts -> let sunset = csts . parametri...
let liquidity_baking_escape_hatch n_vote_false n_vote_true escape_level bake_after_escape ( ) = Context . init ~ consensus_threshold : 0 1 >>=? fun ( blk , _contracts ) -> Context . get_liquidity_baking_cpmm_address ( B blk ) >>=? fun liquidity_baking -> Context . Contract . balance ( ...
let liquidity_baking_escape_hatch_100 n ( ) = liquidity_baking_escape_hatch 0 1 812 n ( )
let liquidity_baking_escape_hatch_80 n ( ) = liquidity_baking_escape_hatch 1 4 1079 n ( )
let liquidity_baking_escape_hatch_60 n ( ) = liquidity_baking_escape_hatch 2 3 1624 n ( )
let liquidity_baking_escape_hatch_40 n ( ) = liquidity_baking_escape_hatch 3 2 3590 n ( )
let liquidity_baking_escape_hatch_33 n ( ) = Context . init ~ consensus_threshold : 0 1 >>=? fun ( blk , _contracts ) -> Context . get_liquidity_baking_cpmm_address ( B blk ) >>=? fun liquidity_baking -> Context . get_constants ( B blk ) >>=? fun csts -> let sunset = csts . parame...
let liquidity_baking_escape_ema n_vote_false n_vote_true escape_level bake_after_escape expected_escape_ema ( ) = Context . init ~ consensus_threshold : 0 1 >>=? fun ( blk , _contracts ) -> let rec bake_escaping blk i = if i < escape_level then Block . bake_n n_vote_false blk >>=? fun blk -> B...