I found the documentation on it rather sparse.
First things first, the docs and the implementation are a bit misaligned: #7113
When you execute a lookupByKey
in DAML, a NodeLookupByKey
is inserted in the transaction graph:
message NodeLookupByKey {
com.daml.lf.value.Identifier template_id = 1;
KeyWithMaintainers key_with_maintainers = 2;
reserved 3; // was contract_id
com.daml.lf.value.ContractId contract_id_struct = 4;
}
message KeyWithMaintainers {
com.daml.lf.value.VersionedValue key = 1;
repeated string maintainers = 2; // the maintainers induced by the key
}
key_with_maintainers.key
and template_id
correspond to the key you looked up. key_with_maintainers.maintainers
are the maintainers of the key. contract_id_struct
is the contract id if it exists. The NoSuchKey
node of the docs is corresponds exactly to a NodeLookupByKey
with an empty contract_id_struct
During validation the validators of that node which in an idealized system are exactly the maintainers, check that key_with_maintainers.key
resolves (or doesn’t resolve) to contract_id_struct
for template template_id
. That’s all there’s to it. Did that answer your question?
This explains the NodeLookupByKey
, but in the original thread a node called NoSuchKey
is mentioned. Looking at the linked issue this node does not actually exist. So that answers my question. Thanks!