https://gitlab.com/tezos/tezos
Raw File
Tip revision: 859ad53d118deb65fda70547abe20731c6e92aba authored by Emma Turner on 09 October 2023, 10:54:43 UTC
nix: disable stackprotector on all platforms
Tip revision: 859ad53
packunpack_rev_cty.tz
parameter (pair key unit signature (option signature) (list unit) (set bool) (pair int int) (or key_hash timestamp) (map int string) (lambda string bytes));
storage unit ;
# for each uncomparable type t (we take an arbitrary parameter for
# parametric data-types e.g. pair, list),
# that is packable (which excludes big_map, operation, and contract)
# this contract receives a parameter v_t.
# it verifies that pack v_t == pack (unpack (pack v_t))
code { CAR;
       # packable uncomparable types
       # checking: key
       DUP; CAR; DIP { UNPAIR; }; PACK; DIP { PACK; UNPACK key; ASSERT_SOME; PACK; }; ASSERT_CMPEQ;
       # checking: unit
       DUP; CAR; DIP { UNPAIR; }; PACK; DIP { PACK; UNPACK unit; ASSERT_SOME; PACK; }; ASSERT_CMPEQ;
       # checking: signature
       DUP; CAR; DIP { UNPAIR; }; PACK; DIP { PACK; UNPACK (signature); ASSERT_SOME; PACK; }; ASSERT_CMPEQ;
       # checking: option signature
       DUP; CAR; DIP { UNPAIR; }; PACK; DIP { PACK; UNPACK (option signature); ASSERT_SOME; PACK; }; ASSERT_CMPEQ;
       # checking: list unit
       DUP; CAR; DIP { UNPAIR; }; PACK; DIP { PACK; UNPACK (list unit); ASSERT_SOME; PACK; }; ASSERT_CMPEQ;
       # checking: set bool
       DUP; CAR; DIP { UNPAIR; }; PACK; DIP { PACK; UNPACK (set bool); ASSERT_SOME; PACK; }; ASSERT_CMPEQ;
       # checking: pair int int
       DUP; CAR; DIP { UNPAIR; }; PACK; DIP { PACK; UNPACK (pair int int); ASSERT_SOME; PACK; }; ASSERT_CMPEQ;
       # checking: or key_hash timestamp
       DUP; CAR; DIP { UNPAIR; }; PACK; DIP { PACK; UNPACK (or key_hash timestamp); ASSERT_SOME; PACK; }; ASSERT_CMPEQ;
       # checking: map int string
       DUP; CAR; DIP { UNPAIR; }; PACK; DIP { PACK; UNPACK (map int string); ASSERT_SOME; PACK; }; ASSERT_CMPEQ;
       # checking: lambda string bytes
       DUP; PACK; DIP { PACK; UNPACK (lambda string bytes); ASSERT_SOME; PACK; }; ASSERT_CMPEQ;

       UNIT ; NIL operation ; PAIR }
back to top