- A contract can have more than one
big_map, they can be placed anywhere in the storage.
- Big maps can be transferred from a contract to another, either as parameter (transactions) or storage (originations). In this case, they are morally duplicated (as opposed to shared) from the contract point of view. In the implementation, sharing happens.
- Big maps can be created with
EMPTY_BIG_MAP tand cleared on the fly.
Known limitations that persist :
big_maptype still cannot appear as argument of
- When you duplicate a big map, you are charged with the full storage cost, as if it were really duplicated under the hood (it is shared though). It is a brutal over approximation, but the only one I was sure is safe.
Other things to now before reading :
- This MR moves the big maps outside of the contracts in the storage, in their own directory.
- Big maps are indexed by naturals, and big_map literals in Michelson expressions are now either the same as maps or integers.
For instance if a contract that receives a big_map as parameter receives
3, that means "see if the big_map number 3 in the sotrage is of the right type, and if so, make a copy if needed". If it receives a map literal, then if means "initialize a fresh big_map with these values".
- A temporary zone is introduced, necessary to make sure that we don't spuriously clear or create dangling big_maps during big_map transfers in internal operations. These are represented by negative indexes (we may change that if it feels to much like a hack).
- A few other fixes are included in the patch, I'll refactor the history later.
- A stitching is needed, that is not yet implemented but should be straightforward.
I did some tests manually, some Michelson examples are included in this MR, but there are to automated tests yet.