def sort_public_keys(pub_keys: List[bytes] or List[str]):
        """
        :param pub_keys: a list of public keys in format of bytes.
        :return: sorted public keys.
        """
        for index, key in enumerate(pub_keys):
            if isinstance(key, str):
                pub_keys[index] = bytes.fromhex(key)
        return sorted(pub_keys, key=ProgramBuilder.compare_pubkey)