Michelson: allow non-comb comparable pairs
Lift the restriction on comparable pairs
Allows to use any type of records as keys of sets/maps/big_maps, and not only comb pairs.
There was a problem with comparable_ty_of_ty
, because it would unshare things (e.g. DUP PAIR DUP PAIR ...
) leading to gas-uncontrolled explosion, which was used in 2 places:
-
UPDATE
for sets, where I replaced it byty_of_comparable_ty
which is bounded by the size of the comparable type, but all comparable types appear in the code. -
COMPARE
where gas for the types is already counted by the type comparison.
See @igarnier's great explanations below!
Side effects:
- simplified code
- set
UPDATE
costs a bit more gas at typechecking - changed error message for set
UPDATE
wrong type - changed size of comparable comb pair types which may reach the limit faster
This is a redo of this first part of nomadic-labs/tezos!131. Solves the first part of nomadic-labs/tezos#31
TODO:
-
merge !63 (merged) first -
add test for DUP PAIR DUP PAIR ...
Edited by Mehdi Bouaziz