Skip to content

Proto: Use saturated arithmetic in the cost model implementation

This MR replaces metastatedev/tezos!371 (closed).

Context

This MR replaces Z.t by Saturation_repr.t in the implementation of the cost model, optimizing cost computation time.

Following the same idea as in !2329 (merged), 2^62 - 1 seems sufficiently large to represent any gas-related cost because it will eventually be subtracted to gas level limits which are (and will be) smaller than this.

Since Saturation_repr.t are always positive integers, the current unit tests for gas implementation are useless (and removed from the codebase).

Related: #1013 (closed)

Depends on: !2329 (merged)

Manually testing the MR

The fact that the gas levels of the testsuite are unchanged is probably sufficient to witness the observational equivalence between the original and the new gas model (in the domain where saturation does not occur).

Checklist

Reviewers

@igarnier @mbouaziz @rafoo_ @klakplok

Edited by Yann Regis-Gianas

Merge request reports