Proto: updates the gas code for Michelson_v1_gas
This MR updates gas definitions for Michelson_v1_gas.
./octez-snoop generate code for solutions src/proto_alpha/lib_protocol/gas_parameters.json --split-to _tempdir
- FP config of !10054 (merged) is used.
- Several gas cost functions are replaced by auto-generated versions:
- Some of the original functions use parameters not grid-fitted or rounded in the ways Snoop does:
cost_N_IParing_check_bls12_381cost_CHECK_PRINTABLEcost_N_ISapling_verify_update
- Some of the original functions use different models. Their models are updated but the codes are never updated until now:
cost_N_IComparecost_N_IMap_getcost_N_IMap_get_and_updatecost_N_IMap_updatecost_N_IMap_memcost_N_ISet_memcost_N_ISet_updatecost_N_IMul_intcost_N_IMul_nat
- Some of the original functions use parameters not grid-fitted or rounded in the ways Snoop does:
-
gas_parameters.jsonnow has the latest parameters ofcost_TY_EQ. Now the function is auto-generatable. - Unified the gas costs of map and big_map accesses. They use the same models
interpreter/N_IMap_*for but somehow used different cost functions of slightly different parameters.- Note that
cost_N_IBig_map_*inmichelson_v1_gas_costs_generated.mlare not usable for big_map accesses, since they include partially carbonated costs.
- Note that
- We do not auto-generate
cost_N_ILsl_natandcost_N_ILsl_bytesin this MR since they have comments about the memory allocation.
They change the gas costs slightly:
% git-gas-diff % ./git-gas-diff.sh HEAD^ HEAD
-- LINE NUMBERS REFER TO TEMPORARY FILE /var/folders/9b/w8_sb0_n4c302lstxnfcskgh0000gn/T/tmp.Lines with `Consumed gas: `:
(Better means the value must decrease.)
Accumulated value before: 238730.608
Accumulated value now: 238730.228
Total gain: ~0%
Maximum loss on a line: 0.200 (~0%, line 1690)
Maximum gain on a line: 0.352 (~0%, line 1847)
Number of lines with a change: 77
Number of lines with a degradation: 72
Lines with `Estimated gas: `:
(Better means the value must decrease.)
Accumulated value before: 264611.877
Accumulated value now: 264611.577
Total gain: ~0%
Maximum loss on a line: 0.323 (~0%, line 1684)
Maximum gain on a line: 0.352 (~0%, line 1844)
Number of lines with a change: 67
Number of lines with a degradation: 62
Lines with `Gas remaining: `:
(Better means the value must increase.)
Accumulated value before: 77997549.668
Accumulated value now: 77997556.574
Total gain: ~0%
Maximum loss on a line: 0.016 (~0%, line 1314)
Maximum gain on a line: 4.145 (~0%, line 1449)
Number of lines with a change: 75
Number of lines with a degradation: 67
Lines with `just consumed gas: `:
(Better means the value must decrease.)
Accumulated value before: 2680.552
Accumulated value now: 2673.684
Total gain: ~0%
Maximum loss on a line: 0.020 (~0%, line 1208)
Maximum gain on a line: 0.480 (~8%, line 1052)
Number of lines with a change: 213
Number of lines with a degradation: 111
Total number of lines with a change: 432.
Total number of lines with a degradation: 312.
Edited by Jun Furuse