Pointer-key with multiple values?

according to the protocol docs it might be possible to define multiple values for a certain pointer-key. is that correct???

see: https://github.com/aeternity/protocol/blob/master/serializations.md#spend-transaction

If multiple pointer entries are present for such key, then the first of such entries is used.

You can define multiple pointer keys under a Name.

Protocol and reference implementation recognizes couple well known ones: e.g. account_pubkey

So, if in a spend transaction you use a Name, then the implementation tries to find account_pubkey pointer. It iterates over list of pointers and stops on the first match.

So, the documentation is correct(!);).

For me the sentence in the protocol sounds like the pointer-key account_pubkey could have multiple values.

But maybe I am just misinterpreting :sweat_smile:

Can you shortly confirm that this is not possible? Or is it possible? Isn’t it a key-value map?

It is key-val map. However we don’t validate if keys are unique.
So, it is possible that we have:

account_pubkey: ak_1
account_pubkey: ak_2
random_key: some_val

The ak_2 is not reachable.

I don’t mind rephrasing the sentence in clearer way.

As far as I am concerned, this wasn’t intended. It seems like I implicitly assumed it to be a map/dictionary the way it is implemented in Sophia, where keys only appear once but the spec was actually changed to a SHOULD NOT instead of a MUST NOT. This is also what the JSON spec does but I’d say not very intuitive—also most JSON parser will actually complain about it.

2 Likes