Revision daea8ababad0396971bf2c9062c5f177521b051d authored by Ilias Garnier on 21 June 2019, 12:47:37 UTC, committed by Pierre Boutillier on 21 October 2019, 12:25:27 UTC
I. Rescaling step cost - Rescale step_cost by 2^7 to allow finer cost accounting in the interpeter. - Expose new function atomic_step_cost exposing finer resolution step increments. II. Provide facilities for interpreter-specific cost accounting Introduce new functions `Gas.incr_interpreter_cost` and `Gas.bill_interpreter_cost`. - The context stores a new counter 'interpreter_cost' of type Gas_limit_repr.cost - functions are provided to: - increment this counter (incr_interpreter_cost) and - bill for the gas corresponding to this counter and reset this counter. Until bill_interpreter_cost is called, the interpreter_cost is _not_ taken into account into the effectively consumed gas. - Each call to incr_interpreter_cost still checks that we are under the operation and block gas limits. - The interpreter uses these functions instead of the usual Gas.consume. The invariant that has to be respected for this to be transparent to the rest of the protocol is that all continuations of the `step` function to other functions should bill and reset the interpreter_cost beforehand. This concerns calls to interp, calls to the typechecker, calls to read from a big map, calls to the serialization/deserialization mechanism, etc; in short, all calls to other parts of the protocol should have a context in a state where this fine-grained gas bookkeeping has been settled and reset.
1 parent c5bda6c
dune
(env
(dev
(flags (:standard)))
(release
(flags (:standard -O3))))
(alias
(name runtest)
(deps (alias_rec runtest_lint)))
(alias
(name runtest)
(deps (alias_rec runtest_sandbox)))
Computing file changes ...