text stringlengths 0 601k |
|---|
let e12 = Sci . plus_1024 Sci . sci_1 ( Sci . expm1_1024 Sci . sci_1 ) ; ; |
let e13 = Sci . minus_1024 e12 [ | Data . Classical . num_e_1024 ; Sci . num_0 ; Sci . num_0 ] | ; ; |
let ml2 = Sci . agm_log_1024 Sci . sci_05 ; ; |
let ml2a = Sci . plus ml2 Sci . log_2_1024 ; ; |
let z0 = Sci . mult_1024 c10 ( Sci . plus Sci . sci_1 Sci . sci_i ) ; ; |
let l0 = Sci . agm_log_1024 z0 ; ; |
let l00 = Sci . complex_of_sci l0 ; ; |
let t2 = Sci . exp_1024 Sci . sci_1 ; ; |
let t20 = Sci . minus_1024 t2 Sci . e_1024 ; ; |
let t3 = Sci . exp_1024 Sci . log_10_1024 ; ; |
let t30 = Sci . minus_1024 t3 Sci . sci_10 ; ; |
let t4 = Sci . exp_1024 Sci . log_2_1024 ; ; |
let t40 = Sci . minus_1024 t4 Sci . sci_2 ; ; |
let l20 = Sci . direct_log_1024 ( - 100 . ) Sci . sci_2 ; ; |
let l20a = Sci . log_1024 Sci . sci_2 ; ; |
let l20b = Sci . minus_1024 l20 Sci . log_2_1024 ; ; |
let l20c = Sci . minus_1024 l20a Sci . log_2_1024 ; ; |
let l10 = Sci . log_1024 Sci . sci_10 ; ; |
let t1 = Sci . exp_1024 l10 ; ; |
let l100 = Sci . direct_log_1024 ( - 100 . ) Sci . sci_10 ; ; |
let l100a = Sci . minus_1024 l100 Sci . log_10_1024 ; ; |
let l10a = Sci . minus_1024 l10 Sci . log_10_1024 ; ; |
let le = Sci . direct_log_1024 ( - 100 . ) Sci . e_1024 ; ; |
let lea = Sci . log_1024 Sci . e_1024 ; ; |
let leb = Sci . minus_1024 le Sci . sci_1 ; ; |
let lec = Sci . minus_1024 lea Sci . sci_1 ; ; |
let a00 = Sci . arccos_1024 Sci . sci_05 ; ; |
let c12 = Sci . cos_1024 a00 ; ; |
let a01 = Sci . argch_1024 Sci . sci_1 ; ; |
let a01a = Sci . ch_1024 ( Sci . argch_1024 Sci . sci_2 ) ; ; |
let a01a0 = Sci . minus_1024 a01a Sci . sci_2 ; ; |
let a02 = Sci . arccos_1024 Sci . sci_1 ; ; |
let a03 = Sci . arccos_1024 c10 ; ; |
let c13 = Sci . cos_1024 a03 ; ; |
let a04 = Sci . arcsin_1024 Sci . sci_05 ; ; |
let s10 = Sci . sin_1024 a04 ; ; |
let s10a = Sci . minus_1024 s10 Sci . sci_05 ; ; |
let u0 = Sci . cos_1024 Sci . pi_1024 ; ; |
let u1 = Sci . exp_1024 Sci . ipi_1024 ; ; |
let u2 = Sci . sin_1024 Sci . pi_1024 ; ; |
let u0a = Sci . plus_1024 u0 Sci . sci_1 ; ; |
let u1a = Sci . plus_1024 u1 Sci . sci_1 ; ; |
let u3 = Sci . exp_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_16 ] | ; ; |
let u4 = Sci . log_1024 u3 ; ; |
let u5 = Sci . exp_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_128 ] | ; ; |
let u6 = Sci . log_1024 u5 ; ; |
let u7 = Sci . sin_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_16 ] | ; ; |
let u8 = Sci . direct_sin_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_128 ] | ; ; |
let u7a = Sci . sh_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_16 ] | ; ; |
let u7b = Sci . th_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_16 ] | ; ; |
let u7c = Sci . tan_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_16 ] | ; ; |
let u8a = Sci . sh_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_128 ] | ; ; |
let u9 = Sci . arcsin_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_16 ] | ; ; |
let u10 = Sci . arcsin_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_128 ] | ; ; |
let u9a = Sci . argsh_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_16 ] | ; ; |
let u9b = Sci . direct_argsh_1024 3 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_16 ] | ; ; |
let u10a = Sci . argsh_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_128 ] | ; ; |
let u10b = Sci . direct_argsh_1024 3 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_128 ] | ; ; |
let c14 = Sci . plus_1024 Sci . half_pi_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_16 ] | ; ; |
let c15 = Sci . cos_1024 c14 ; ; |
let c16 = Sci . plus_1024 Sci . half_ipi_1024 [ | Sci . num_1 ; Sci . num_0 ; Sci . num_minus_16 ] | ; ; |
let c17 = Sci . ch_1024 c16 ; ; |
let u11 = Sci . tan_1024 ( Sci . plus_1024 Sci . half_pi_1024 Sci . sci_i ) ; ; |
let u12 = Sci . th_1024 ( Sci . plus_1024 Sci . sci_1 Sci . half_ipi_1024 ) ; ; |
let u13 = Sci . plus_1024 u12 ( Sci . mult_1024 Sci . sci_i u11 ) ; ; |
let u14 = Sci . exp_1024 ( Sci . mult_1024 ( Sci . sci_of_int 17 ) Sci . ipi_1024 ) ; ; |
let u15 = Sci . exp_1024 ( Sci . mult_1024 ( Sci . sci_of_int 99999999 ) Sci . ipi_1024 ) ; ; |
let u16 = Sci . log_1024 Sci . sci_minus_1 ; ; |
let u17 = Sci . argth_1024 Sci . sci_2 ; ; |
let u18 = Sci . th_1024 u17 ; ; |
let f29 = Sci . fact 10 29 ; ; |
let f170 = Sci . fact 100 170 ; ; |
let ( tr , r ) = let a = Sys . time ( ) in let s = Sci . complete_sieve 100 2_000 in let b = Sys . time ( ) in ( b . - a , s ) ; ; |
let ( tf , f ) = let a = Sys . time ( ) in let s = Sci . factorial_sieve 100 2_000 in let b = Sys . time ( ) in ( b . - a , s ) ; ; |
let ( tp , p ) = let a = Sys . time ( ) in let s = Sci . sieve 50_000 in let b = Sys . time ( ) in ( b . - a , s ) ; ; |
let ( tx , x ) = let a = Sys . time ( ) in let s = Sci . factors 444_444_444_444 in let b = Sys . time ( ) in ( b . - a , s ) ; ; |
let ( ty , y ) = let a = Sys . time ( ) in let s = Sci . factors 444_444_444 in let b = Sys . time ( ) in ( b . - a , s ) ; ; |
let ( tz , z ) = let a = Sys . time ( ) in let s = Sci . factors 2294011 in let b = Sys . time ( ) in ( b . - a , s ) ; ; |
let err x = Exn ( Script_cache_test_error x ) |
let liquidity_baking_contract = Contract . of_b58check " KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5 " |> function | Ok x -> x | _ -> assert false |
let make_block block f = Incremental . begin_construction block >>=? fun incr -> f ( Incremental . alpha_ctxt incr ) >>=? fun ( ret , ctxt ) -> let incr = Incremental . set_alpha_ctxt incr ctxt in Incremental . finalize_block incr >>=? fun block -> Block . bake block >>=? fun next_block -> return ( ret , next_block ) |
let ( @! ) f g = f @@ fun ctxt -> g ctxt >>=? fun ret -> return ( ret , ctxt ) |
let throw_block_away ( x , _block ) = return x |
let equal_scripts ( s1 : Script . t ) ( s2 : Script . t ) = Script_repr . ( force_bytes s1 . code >>? fun code1 -> force_bytes s2 . code >>? fun code2 -> force_bytes s1 . storage >>? fun storage1 -> force_bytes s2 . storage >>? fun storage2 -> ok ( Bytes . equal code1 code2 && Bytes . equal storage1 storage2 ) ) |> Env... |
let find ctxt addr = Script_cache . find ctxt addr >|= Environment . wrap_tzresult >>=? fun ( ctxt , identifier , result ) -> match result with | None -> assert false | Some ( script , Ex_script ir ) -> return ( ctxt , identifier , script , Ex_script ir ) |
let value_as_int : type a . a Script_typed_ir . ty -> a -> Script_int_repr . z Script_int_repr . num = fun ty v -> match ty with Int_t -> v | _ -> Stdlib . failwith " value_as_int " |
let add_some_contracts k src block baker = ( make_block block @@ fun ctxt -> find ctxt liquidity_baking_contract >>=? fun ( ctxt , id , _ , _ ) -> return ( id , ctxt ) ) >>=? fun ( liquidity_baking_contract_id , block ) -> List . fold_left_es ( fun ( rev_contracts , block ) _ -> originate_contract " contracts / int - s... |
let assert_cache_size expected_size ctxt = fail_unless ( Script_cache . size ctxt = expected_size ) ( err ( Printf . sprintf " Invalid script cache size , expecting % d , got % d " expected_size ( Script_cache . size ctxt ) ) ) |
let test_size_of_liquidity_baking_contract ( ) = init ( ) >>=? fun ( block , _ , _ , _ ) -> make_block block @! assert_cache_size liquidity_baking_contract_size >>=? throw_block_away |
let test_size_of_int_store_contract ( ) = init ( ) >>=? fun ( block , baker , src , _ ) -> originate_contract " contracts / int - store . tz " " 31 " src block baker >>=? fun ( addr , block ) -> ( make_block block @! fun ctxt -> Script_cache . find ctxt addr >|= Environment . wrap_tzresult >>=? fun ( ctxt , _ , _ ) -> ... |
let test_find_correctly_looks_up ( ) = init ( ) >>=? fun ( block , baker , src , _ ) -> originate_contract " contracts / sapling_contract . tz " " { } " src block baker >>=? fun ( addr , block ) -> ( make_block block @! fun ctxt -> Script_cache . find ctxt addr >|= Environment . wrap_tzresult >>=? fun ( _ , _ , result ... |
let test_update_modifies_cached_contract ( ) = init ( ) >>=? fun ( block , baker , src , _ ) -> originate_contract " contracts / int - store . tz " " 36 " src block baker >>=? fun ( addr , block ) -> ( make_block block @! fun ctxt -> find ctxt addr >>=? fun ( ctxt , identifier , script , Ex_script ir ) -> match ir . st... |
let test_entries_returns_the_list_in_correct_order ( ) = let ncontracts = 10 in init ( ) >>=? fun ( block , baker , src , _ ) -> add_some_contracts ncontracts src block baker >>=? fun ( contracts , block ) -> let addrs = snd @@ List . split contracts in ( make_block block @! fun ctxt -> Script_cache . entries ctxt |> E... |
let test_contract_rank_is_lru_rank ( ) = let ncontracts = 10 in init ( ) >>=? fun ( block , baker , src , _ ) -> add_some_contracts ncontracts src block baker >>=? fun ( contracts , block ) -> let addrs = snd @@ List . split contracts in ( make_block block @! fun ctxt -> let rec check_rank k = function | [ ] -> return ... |
let test_size_adds_entries_sizes ( ) = let ncontracts = 10 in init ( ) >>=? fun ( block , baker , src , _ ) -> add_some_contracts ncontracts src block baker >>=? fun ( _ , block ) -> ( make_block block @! fun ctxt -> let expected_size = liquidity_baking_contract_size + ( ncontracts * int_store_contract_size ) in fail_u... |
let defined_size_limit = Tezos_protocol_alpha_parameters . Default_parameters . constants_mainnet . cache_script_size |
let test_size_limit_is_in_constants_repr ( ) = init ( ) >>=? fun ( block , _baker , _src , _ ) -> ( make_block block @! fun ctxt -> fail_unless ( Script_cache . size_limit ctxt = defined_size_limit ) ( err ( Printf . sprintf " Invalid size limit , expecting % d , got % d " defined_size_limit ( Script_cache . size_limit... |
let test_entries_shows_lru ( ) = let ncontracts = 10 in init ( ) >>=? fun ( block , baker , src , _ ) -> add_some_contracts ncontracts src block baker >>=? fun ( contracts , block ) -> let new_size = 2 * defined_size_limit / ncontracts in ( make_block block @@ fun ctxt -> List . fold_left_es ( fun ctxt ( _ , addr ) -> ... |
let tests = let open Tztest in [ tztest " assumption about size of liquidity baking holds " ` Quick test_size_of_liquidity_baking_contract ; tztest " assumption about size of ' int_store ' contract holds " ` Quick test_size_of_int_store_contract ; tztest " find correctly looks up " ` Quick test_find_correctly_looks_up ... |
let normalize_compare c = let open Compare . Int in if c > 0 then 1 else if c < 0 then - 1 else 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.