Shaul
August 2, 2022, 2:16pm
1
Do ACS commitments between two Canton participant nodes commit to?
The full shared state between two nodes, including all observed (but not witnessed or divulged) contract, or
Only the shared-signatory state, or
Something else?
The commitments are computed for the stakeholder-group of each contract:
def concatenate(contractHash: LfHash, contractId: LfContractId): Array[Byte] =
(contractHash.bytes.toByteString // hash always 32 bytes long per lf.crypto.Hash.underlyingLength
concat contractId.encodeDeterministically).toByteArray
import com.digitalasset.canton.lfPartyOrdering
blocking {
lock.synchronized {
this.rt = rt
change.activations.foreach { case (cid, WithContractHash(metadata, hash)) =>
val sortedStakeholders = SortedSet(metadata.stakeholders.toSeq: _*)
val h = commitments.getOrElseUpdate(sortedStakeholders, LtHash16())
h.add(concatenate(hash, cid))
deltaB += sortedStakeholders -> h
}
change.deactivations.foreach { case (cid, WithContractHash(stakeholders, hash)) =>
val sortedStakeholders = SortedSet(stakeholders.toSeq: _*)
val h = commitments.getOrElseUpdate(sortedStakeholders, LtHash16())
h.remove(concatenate(hash, cid))
deltaB += sortedStakeholders -> h
A stakeholder is the union of signatories and observers:
https://docs.daml.com/daml/stdlib/Prelude.html#function-da-internal-template-functions-stakeholder-47883
As the party to participant mappings can change over time, the participant P1 will compute then in regular intervals the stakeholder groups that it shares with P2 (so where they each host at least one party) and include the hash of that group in the commitment.
So the answer is #1 .
I hope that helps!
2 Likes