Proto: update the gas cost of Sapling_verify_update
Context
A Rust library has been updated in !7618 (merged). Consequently, the efficiency of some functions and thus their related gas costs have changed, which was shown by an alert thrown after the latest benchmark run on the reference machine. The raw output used by the alert system is this file: reference__11_.csv.
In this file, the impacted values are:
-
proto/alpha/interpreter/N_ISapling_verify_update_const
, going from about 298140 to 432200; -
proto/alpha/interpreter/N_ISapling_verify_update_inputs
, going from about 5535029 to 5738377; -
proto/alpha/interpreter/N_ISapling_verify_update_ouputs
, going from about 5049098 to 4634026.
This values are used to generate the cost function cost_N_ISapling_verify_update.
The code committed in this request is an adjustment of this cost function as generated from the solution file produced by Snoop: inferred_interpreter.sol.
$ cat /tmp/codegen_params.json
{ "precision": 5, "max_relative_error": 0.1, "cast_mode": "Round", "inverse_scaling": 3, "resolution": 5 }
$ ./octez-snoop generate code using solution inferred_interpreter.sol and model proto/alpha/interpreter/N_ISapling_verify_update --fixed-point /tmp/codegen_params.json
(* model model_proto/alpha/interpreter/N_ISapling_verify_update *)
(* fun size1 -> fun size2 -> ((432200.469784 + (5738377.05148 * size1)) + (4634026.28586 * size2)) *)
let model_proto/alpha/interpreter/N_ISapling_verify_update size1 size2 =
let open S.Syntax in
let size1 = S.safe_int size1 in
let size2 = S.safe_int size2 in
let v1 = size1 in
let v0 = size2 in
((S.safe_int 432500) +
((((v1 lsl 22) + (v1 lsl 20)) + (v1 lsl 18)) + (v1 lsl 17)))
+ (((v0 lsl 22) + (v0 lsl 18)) + (v0 lsl 17))
Note that this apparently has no impact on regression traces.
The values of the gas parameters below will also be changed accordingly for the reference run:
-
proto/alpha/interpreter/N_ISapling_verify_update_const
: 432200; -
proto/alpha/interpreter/N_ISapling_verify_update_inputs
: 5738377; -
proto/alpha/interpreter/N_ISapling_verify_update_ouputs
: 4634026.
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rst
for the protocol and the environment,CHANGES.rst
at the root of the repository for everything else). -
Select suitable reviewers using the Reviewers
field below. -
Select as Assignee
the next person who should take action on that MR
Edited by Nicolas Ayache