Proto: expand constants before typecheck and normalization
Context
@arvidnl discovered a bug (described in #1709 (closed)) where typechecking and normalization don't work with global constants. This MR fixes the issue.
Manually testing the MR
Repeat the steps in #1709 (closed) - they will work. Specifically:
Create a file ./contract.tz
with the following contents:
parameter (constant "exprvKFFbc7SnPjkPZgyhaHewQhmrouNjNae3DpsQ8KuADn9i2WuJ8");
storage (constant "exprvKFFbc7SnPjkPZgyhaHewQhmrouNjNae3DpsQ8KuADn9i2WuJ8");
code {
DROP;
PUSH unit (constant "expruJpGVgueH6vjZDZQRjgXUuHBi4Y6UQ3cbz6swP2FMVybvnDjm5");
NIL operation;
PAIR;
}
Then the following shell code:
# setup
create_mockup () {
if [[ ! -d /tmp/mockup ]]; then
tezos-client \
--protocol ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK \
--base-dir /tmp/mockup \
--mode mockup \
create mockup
fi
}
alias client = "create_mockup && tezos-client --mode mockup --base-dir /tmp/mockup"
client register global constant unit from bootstrap1 --burn-cap 3
client register global constant Unit from bootstrap1 --burn-cap 3
# test
client typecheck script ./contract.tz
client normalize script ./contract.tz
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. -
Select as Assignee
the next person who should take action on that MR
Edited by Mehdi Bouaziz