Skip to content
Discussions/App Development/What shared state do ACS commitments cover?Forum ↗

What shared state do ACS commitments cover?

App Development2 posts374 views2 likesLast activity Aug 2022
SH
ShaulOP
Aug 2022

Do ACS commitments between two Canton participant nodes commit to?

  1. The full shared state between two nodes, including all observed (but not witnessed or divulged) contract, or
  2. Only the shared-signatory state, or
  3. Something else?
RA
Ratko_Veprek
Aug 2022

The commitments are computed for the stakeholder-group of each contract:

github.com

digital-asset/canton/blob/9e5ec309ad5fe229e53ab668b6b180db67b555bc/community/participant/src/main/scala/com/digitalasset/canton/participant/pruning/AcsCommitmentProcessor.scala#L850


      
  1. def concatenate(contractHash: LfHash, contractId: LfContractId): Array[Byte] =
  2. (contractHash.bytes.toByteString // hash always 32 bytes long per lf.crypto.Hash.underlyingLength
  3. concat contractId.encodeDeterministically).toByteArray
  4. import com.digitalasset.canton.lfPartyOrdering
  5. blocking {
  6. lock.synchronized {
  7. this.rt = rt
  8. change.activations.foreach { case (cid, WithContractHash(metadata, hash)) =>
  9. val sortedStakeholders = SortedSet(metadata.stakeholders.toSeq: _*)
  10. val h = commitments.getOrElseUpdate(sortedStakeholders, LtHash16())
  11. h.add(concatenate(hash, cid))
  12. deltaB += sortedStakeholders -> h
  13. }
  14. change.deactivations.foreach { case (cid, WithContractHash(stakeholders, hash)) =>
  15. val sortedStakeholders = SortedSet(stakeholders.toSeq: _*)
  16. val h = commitments.getOrElseUpdate(sortedStakeholders, LtHash16())
  17. h.remove(concatenate(hash, cid))
  18. 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!

← Back to Discussions