From 49745f6e47415aa171f8518356ea753cb3cb769c Mon Sep 17 00:00:00 2001 From: fabiotudone-da Date: Wed, 21 Jul 2021 16:16:51 +0200 Subject: [PATCH] Re-add `application_id` to `DamlCommandDedupKey` [KVL-1000] (#10341) * Re-add `application_id` to DamlCommandDedupKey CHANGELOG_BEGIN CHANGELOG_END * Fix test * Merge main * commandDedupKey: reorder calls to proto builder setters according to proto order * Empty commit to set the changelog CHANGELOG_BEGIN [Integration Kit] The command de-duplication key now also includes the daml application ID CHANGELOG_END --- .../ledger/participant/state/kvutils/daml_kvutils.proto | 2 +- .../ledger/participant/state/kvutils/Conversions.scala | 3 ++- .../state/kvutils/KeyValueCommittingSpec.scala | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ledger/participant-state/kvutils/src/main/protobuf/com/daml/ledger/participant/state/kvutils/daml_kvutils.proto b/ledger/participant-state/kvutils/src/main/protobuf/com/daml/ledger/participant/state/kvutils/daml_kvutils.proto index 5e6c2511849d..cfa2b848c5f7 100644 --- a/ledger/participant-state/kvutils/src/main/protobuf/com/daml/ledger/participant/state/kvutils/daml_kvutils.proto +++ b/ledger/participant-state/kvutils/src/main/protobuf/com/daml/ledger/participant/state/kvutils/daml_kvutils.proto @@ -394,7 +394,7 @@ message DamlStateValue { message DamlCommandDedupKey { repeated string submitters = 1; - reserved 2; // was application_id + string application_id = 2; string command_id = 3; } diff --git a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/Conversions.scala b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/Conversions.scala index 79dadf58741b..66c7d7818526 100644 --- a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/Conversions.scala +++ b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/Conversions.scala @@ -87,8 +87,9 @@ private[state] object Conversions { DamlStateKey.newBuilder .setCommandDedup( DamlCommandDedupKey.newBuilder - .setCommandId(subInfo.getCommandId) .addAllSubmitters(sortedUniqueSubmitters) + .setApplicationId(subInfo.getApplicationId) + .setCommandId(subInfo.getCommandId) .build ) .build diff --git a/ledger/participant-state/kvutils/src/test/suite/scala/com/daml/ledger/participant/state/kvutils/KeyValueCommittingSpec.scala b/ledger/participant-state/kvutils/src/test/suite/scala/com/daml/ledger/participant/state/kvutils/KeyValueCommittingSpec.scala index 12c5cdfdfd57..61307a78736b 100644 --- a/ledger/participant-state/kvutils/src/test/suite/scala/com/daml/ledger/participant/state/kvutils/KeyValueCommittingSpec.scala +++ b/ledger/participant-state/kvutils/src/test/suite/scala/com/daml/ledger/participant/state/kvutils/KeyValueCommittingSpec.scala @@ -27,6 +27,7 @@ class KeyValueCommittingSpec extends AnyWordSpec with Matchers { private val alice = Ref.Party.assertFromString("Alice") private val commandId = Ref.CommandId.assertFromString("cmdid") + private val applicationId = Ref.ApplicationId.assertFromString("appid") private def toSubmission(tx: SubmittedTransaction): DamlSubmission = { val timestamp = Time.Timestamp.Epoch @@ -41,7 +42,7 @@ class KeyValueCommittingSpec extends AnyWordSpec with Matchers { ) val submitterInfo = SubmitterInfo( actAs = List(alice), - applicationId = Ref.ApplicationId.assertFromString("appid"), + applicationId = applicationId, commandId = commandId, deduplicateUntil = Instant.EPOCH, ) @@ -57,7 +58,11 @@ class KeyValueCommittingSpec extends AnyWordSpec with Matchers { private val dedupKey = DamlStateKey.newBuilder .setCommandDedup( - DamlCommandDedupKey.newBuilder.addSubmitters(alice).setCommandId(commandId).build + DamlCommandDedupKey.newBuilder + .addSubmitters(alice) + .setApplicationId(applicationId) + .setCommandId(commandId) + .build ) .build