Proto: Global Table of Constants
Context
This MR implements the table of constants feature described in the corresponding TZIP. The TZIP discusses the motivations for the change. The succeeds the previous one at !2474 (closed)
Design
There are three main contributions in the MR:
- A new
Global_constants
module toStorage.ml
that represents a table mapping hashes of Micheline values asScript_expr_hash.t
to actual Micheline values. - A new manager operation
register_global_constant
is added for setting values in this table. - Three new Michelson primitives for referencing constants are added
D_Constant
,T_constant
, andI_CONSTANT
. - A function
substitute : Alpha_context.t -> Script.expr -> Script.expr tzresult Lwt.t
is added for transforming a Michelson expressions with constants into their fully expanded form. - Before transactions are applied,
substitute
is called on a contract's script, ensuring is fully expanded before type elaboration.
Manually testing the MR
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rst
for the protocol and the environment, theDevelopment Version
section ofCHANGES.md
for everything else). -
Select suitable reviewers using the Reviewers
field below.