Discrepancy in handling addresses without entrypoint
Environment
Current babylonnet.
Summary
Normally, addr and addr% (with empty entrypoint) being passed to CONTRACT instruction will both refer to the default entrypoint of a contract.
However, there is a small difference:
- If
CONTRACTinstruction accepts entrypoint name, then address passed to it should not have%, even with empty entrypoint; - Comparing
addrandaddr%reports that they are not equal (which, probably, naturally follows from (1)).
On the other hand, PACK, for instance, does not distinguish those two, so unpack (pack a) = a may not hold now.
Is it expected behaviour?
Steps to reproduce
Checking CONTRACT behaviour on addresses with empty entrypoint
# ./babylonnet.sh client run script container:test.tz on storage 'Unit' and input 'Unit'
parameter unit;
storage unit;
code { DROP;
PUSH address "KT1Cs32iHq1t6bMmENUaNohW5VRXnBZeUFt9%";
CONTRACT %a nat;
ASSERT_SOME;
DROP;
UNIT;
NIL operation; PAIR
};
This results in failure, but if % in the address is removed then everything is ok.
Checking COMPARE behaviour:
# ./babylonnet.sh client run script container:test.tz on storage '99' and input 'Unit'
parameter unit;
storage int;
code { DROP;
PUSH address "tz1fPTuhC8AP9KuSucubfpGSj8fU88z8bz6c";
PUSH address "tz1fPTuhC8AP9KuSucubfpGSj8fU88z8bz6c%";
COMPARE;
NIL operation; PAIR
};
Results in -1.
Checking PACK behaviour:
./babylonnet.sh client hash data '"tz1g45qspoFNcxXQD31W54Naj735wTEfqM8w"' of type 'address'
0x050a000000160000dfef210b5927434bec7c41fa8dbc37e0591d2d6d
./babylonnet.sh client hash data '"tz1g45qspoFNcxXQD31W54Naj735wTEfqM8w%"' of type 'address'
0x050a000000160000dfef210b5927434bec7c41fa8dbc37e0591d2d6d
I.e. single trailing % does not matter.
History mode
Full.