From 35021b1bd08ce7b1db927cf8668e374d92e7a17c Mon Sep 17 00:00:00 2001 From: Tudor Voicu Date: Wed, 26 Jan 2022 18:15:12 +0100 Subject: [PATCH] Participant-side deduplication compatibility tests exclusions --- compatibility/bazel_tools/testing.bzl | 13 +++++++++++++ .../sandbox/bridge/validate/SequenceImpl.scala | 17 ++++++++++------- .../sandbox/bridge/validate/SequenceSpec.scala | 1 + 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/compatibility/bazel_tools/testing.bzl b/compatibility/bazel_tools/testing.bzl index d4a3e688becb..0c332d40ac6a 100644 --- a/compatibility/bazel_tools/testing.bzl +++ b/compatibility/bazel_tools/testing.bzl @@ -715,6 +715,19 @@ excluded_test_tool_tests = [ }, ], }, + { + # Sandbox-on-X doesn't use participant-side command deduplication starting with next release, + # hence older tests will fail to assert it. + "end": "2.0.0-snapshot.20220126.9029.1", + "platform_ranges": [ + { + "start": "2.0.0-snapshot.20220126.9029.1", + "exclusions": [ + "CommandDeduplicationIT:ParticipantCommandDeduplication", + ], + }, + ], + }, ] def in_range(version, range): diff --git a/ledger/sandbox-on-x/src/main/scala/com/daml/ledger/sandbox/bridge/validate/SequenceImpl.scala b/ledger/sandbox-on-x/src/main/scala/com/daml/ledger/sandbox/bridge/validate/SequenceImpl.scala index 3cfc7d149014..18063c73dcfb 100644 --- a/ledger/sandbox-on-x/src/main/scala/com/daml/ledger/sandbox/bridge/validate/SequenceImpl.scala +++ b/ledger/sandbox-on-x/src/main/scala/com/daml/ledger/sandbox/bridge/validate/SequenceImpl.scala @@ -91,7 +91,6 @@ private[validate] class SequenceImpl( case s: Submission.UploadPackages => Some(packageUploadSuccess(s, timeProvider.getCurrentTimestamp)) case _: Submission.Transaction => - // TODO SoX: Handle gracefully throw new RuntimeException("Unexpected Submission.Transaction") } @@ -156,11 +155,15 @@ private[validate] class SequenceImpl( withErrorLogger(submitterInfo.submissionId) { implicit errorLogger => for { - _ <- checkTimeModel(txSubmission.submission, recordTime, ledgerConfiguration) + _ <- checkTimeModel( + transaction = txSubmission.submission, + recordTime = recordTime, + ledgerConfiguration = ledgerConfiguration, + ) _ <- validateParties( - allocatedParties, - txSubmission.transactionInformees, - completionInfo, + allocatedParties = allocatedParties, + transactionInformees = txSubmission.transactionInformees, + completionInfo = completionInfo, ) _ <- conflictCheckWithInFlight( keysState = sequencerState.keyState, @@ -169,7 +172,7 @@ private[validate] class SequenceImpl( inputContracts = txSubmission.inputContracts, completionInfo = completionInfo, ) - _ <- deduplicate( + _ <- deduplicateAndUpdateState( changeId = ChangeId( submitterInfo.applicationId, submitterInfo.commandId, @@ -237,7 +240,7 @@ private[validate] class SequenceImpl( } } - private def deduplicate( + private def deduplicateAndUpdateState( changeId: ChangeId, deduplicationPeriod: DeduplicationPeriod, completionInfo: CompletionInfo, diff --git a/ledger/sandbox-on-x/src/test/suite/scala/com/daml/ledger/sandbox/bridge/validate/SequenceSpec.scala b/ledger/sandbox-on-x/src/test/suite/scala/com/daml/ledger/sandbox/bridge/validate/SequenceSpec.scala index 9f09b10547da..393dbfd96c4a 100644 --- a/ledger/sandbox-on-x/src/test/suite/scala/com/daml/ledger/sandbox/bridge/validate/SequenceSpec.scala +++ b/ledger/sandbox-on-x/src/test/suite/scala/com/daml/ledger/sandbox/bridge/validate/SequenceSpec.scala @@ -416,6 +416,7 @@ class SequenceSpec extends AnyFlatSpec with MockitoSugar with Matchers with Argu initialAllocatedParties = allocatedInformees, initialLedgerConfiguration = initialLedgerConfiguration, maxDeduplicationDuration = maxDeduplicationDuration, + wallClockTime = () => timeProviderMock.getCurrentTimestamp, ) def exerciseNonConsuming(