[go: up one dir, main page]

Michelson: remove legacy code introduced for the Babylon upgrade

Two-step transitions

A common difficulty when developing Michelson (but also other parts of the protocol) is that we don't know at the development time what the chain will contain at activation time. In particular, when we want to remove a feature we have two options:

  • option 1: one-step transition We write very generic code that is supposed to work whatever the chain does in the meantime. This can be hard to write, requires a lot of testing, and can significantly slow down the migration.
  • option 2: two-step transition In a first protocol upgrade, we remove the possibility to originate new bad code but we still support it. In the second upgrade, we have at our disposal the full list of contracts to rewrite. We can write a very specific (and efficient) migration code for the affected contracts and safely remove the feature.

List of legacy features introduced by the Babylon upgrade

The Babylon upgrade was the first step of several two-step transitions for the following changes:

  • removal of the STEPS_TO_QUOTA instruction,
  • removal of some parameters of the CREATE_CONTRACT instruction,
  • removal of the field annotations for the option _ type,
  • the type contract _ is not storable anymore.

The second step is still to do and is the purpose of this issue.

A list of all originated scripts on Mainnet as of March 2020 (so after the Babylon activation and the first step of the transitions) is available here: https://gitlab.com/nomadic-labs/smart-contracts/-/tree/rafoo@michelson_scripts/onchain%2Fmainnet%2Fscripts

This shows that neither STEPS_TO_QUOTA nor CREATE_CONTRACT are used so the legacy code for them can safely be removed.

The two other features are however used; in particular https://gitlab.com/nomadic-labs/smart-contracts/-/blob/rafoo@michelson_scripts/onchain/mainnet/scripts/a718ee7c2300797d353c96968907575ca756ca30c3204ca186f3dc256c846b35.tz use both.

Edited by Sventimir