Skip to content

[TO BE CLOSED] Simplify has_big_map flag

Mehdi Bouaziz requested to merge nomadic-labs/tezos:mehdi@rid_hbm into proto-proposal

cryptiumlabs/tezos!73 tried to add guarantees on the has_big_map flag by encoding it in the GADT but had the disadvantage of making the code more verbose and harder to get into for non-OCaml-experts. Inversely this MR reduces the burden of maintaining it throughout the typer and computes it only when needed, when traversing the initial parameter and storage, the final storage, as well as storage of originate contracts and parameters of called contracts (which are, by the way values of types that are literally written in the code).

The reason we want to have this flag is to avoid traversing the whole values (also extract_big_map_diff not only traverses the value but also reconstruct it, including lists, maps, sets) but only the needed part.

I didn't manage to completely get rid of it as recomputing it on the fly would lead to a O(N^2) worst-case execution time (with N being the size of the type) and I still had to use a GADT to make the whole thing typecheck nicely, but its use is restricted to the two functions collect_big_maps and extract_big_map_diff.

Compared to cryptiumlabs/tezos!73, this MR brings less guarantees (but do we need all of them?) but reduces the size of the code and the use of GADTs instead of increasing them.

Tasks:

  • Comments
  • Fix tests broken by hardcoded gas/fee limits
Edited by Mehdi Bouaziz

Merge request reports