package tezos-protocol-017-PtNairob
Tezos protocol 017-PtNairob package
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/tezos_raw_protocol_017_PtNairob/michelson_v1_gas_costs.ml.html
Source file michelson_v1_gas_costs.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
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* Copyright (c) 2019-2022 Nomadic Labs <contact@nomadic-labs.com> *) (* Copyright (c) 2020 Metastate AG <hello@metastate.dev> *) (* Copyright (c) 2022 DaiLambda, Inc. <contact@dailambda.jp> *) (* *) (* 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. *) (* *) (*****************************************************************************) include Michelson_v1_gas_costs_generated module S = Saturation_repr (* This file contains functions saved from the original michelson_v1_gas_costs.ml. These functions couldn't be generated by the snoop tool. *) (* N_IMul_nattez / N_IMul_teznat These functions are benchmarked with the affine model. However, empirically, the coefficient is ignorably small. *) (* model N_IMul_nattez *) let cost_N_IMul_nattez = S.safe_int 50 (* model N_IMul_teznat *) let cost_N_IMul_teznat = S.safe_int 50 (* N_IEdiv_teznat This function is modeled with `division_cost` model, which takes two arguments, divisor and dividend. *) (* model N_IEdiv_teznat *) let cost_N_IEdiv_teznat = S.safe_int 70 (* N_ISapling_verify_update This function depends on another cost function cost_N_IBlake2b. Such code can't be generated by the current Snoop. *) (* model N_ISapling_verify_update *) (* Inferred cost (without cost_N_IBlake2b) is: fun size1 -> fun size2 -> ((432200.469784 + (5738377.05148 * size1)) + (4634026.28586 * size2)) *) let cost_N_ISapling_verify_update size1 size2 bound_data = let open S.Syntax in let v1 = S.safe_int size1 in let v2 = S.safe_int size2 in cost_N_IBlake2b bound_data + S.safe_int 432_500 + (S.safe_int 5_740_000 * v1) + (S.safe_int 4_635_000 * v2) (* N_IApply The current generated model receives int as a flag, but it should receive bool. *) (* model N_IApply *) let cost_N_IApply rec_flag = if rec_flag then S.safe_int 220 else S.safe_int 140 (* N_KIter / N_KMap_enter_body The empty_branch_model are used as the models. However, the defined cost functions receive nothing. *) (* model N_KIter *) let cost_N_KIter = S.safe_int 10 (* model N_KMap_enter_body *) let cost_N_KMap_enter_body = S.safe_int 80 (* N_KList_enter_body The generated model receives the length of `xs` as the first argument and branches on whether it is 0 or not. However, calculating the length makes the performance worse. The model should be changed to receive `xs_is_nil` as the first argument. *) (* model N_KList_enter_body *) (* Approximating 1.797068 x term *) let cost_N_KList_enter_body xs size_ys = match xs with | [] -> let open S.Syntax in let v0 = S.safe_int size_ys in S.safe_int 30 + (v0 + (v0 lsr 1) + (v0 lsr 2) + (v0 lsr 4)) | _ :: _ -> S.safe_int 30 (* TY_EQ / PARSE_TYPE / UNPARSE_TYPE / TYPECHECKING_CODE / UNPARSING_CODE TYPECHECKING_DATA / UNPARSING_DATA / FIND_ENTRYPOINT Following functions are commented to indicate that they were manually modified. *) (* model TY_EQ This is the estimated cost of one iteration of ty_eq, extracted and copied manually from the parameter fit for the TY_EQ benchmark (the model is parametric on the size of the type, which we don't have access to in O(1)). *) let cost_TY_EQ = S.safe_int 60 (* model PARSE_TYPE This is the cost of one iteration of parse_ty, extracted by hand from the parameter fit for the PARSE_TYPE benchmark. *) let cost_PARSE_TYPE = S.safe_int 60 (* model UNPARSE_TYPE This is the cost of one iteration of unparse_ty, extracted by hand from the parameter fit for the UNPARSE_TYPE benchmark. *) let cost_UNPARSE_TYPE type_size = S.mul (S.safe_int 20) type_size (* model TYPECHECKING_CODE This is the cost of one iteration of parse_instr, extracted by hand from the parameter fit for the TYPECHECKING_CODE benchmark. *) let cost_TYPECHECKING_CODE = S.safe_int 220 (* model UNPARSING_CODE This is the cost of one iteration of unparse_instr, extracted by hand from the parameter fit for the UNPARSING_CODE benchmark. *) let cost_UNPARSING_CODE = S.safe_int 115 (* model TYPECHECKING_DATA This is the cost of one iteration of parse_data, extracted by hand from the parameter fit for the TYPECHECKING_DATA benchmark. *) let cost_TYPECHECKING_DATA = S.safe_int 100 (* model UNPARSING_DATA This is the cost of one iteration of unparse_data, extracted by hand from the parameter fit for the UNPARSING_DATA benchmark. *) let cost_UNPARSING_DATA = S.safe_int 65 (* TODO: https://gitlab.com/tezos/tezos/-/issues/2264 Benchmark. Currently approximated by 2 comparisons of the longest entrypoint. *) let cost_FIND_ENTRYPOINT = cost_N_ICompare 31 31 (* SAPLING_TRANSACTION_ENCODING / SAPLING_DIFF_ENCODING These functions are missing model definitions. *) (* model SAPLING_TRANSACTION_ENCODING *) let cost_SAPLING_TRANSACTION_ENCODING ~inputs ~outputs ~bound_data = S.safe_int (1500 + (inputs * 160) + (outputs * 320) + (bound_data lsr 3)) (* model SAPLING_DIFF_ENCODING *) let cost_SAPLING_DIFF_ENCODING ~nfs ~cms = S.safe_int ((nfs * 22) + (cms * 215))
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>