Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ledger-api-test-tool: Govern ContractIdIT test runs through a feature. [KVL-1261] #12454

Merged
11 commits merged into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions compatibility/bazel_tools/testing.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,18 @@ excluded_test_tool_tests = [
},
],
},
{
# Contract ID tests are governed by feature descriptors.
"start": "1.17.0-snapshot.20210831.7702.0.f058c2f1",
"platform_ranges": [
{
"end": "2.0.0-snapshot.20220110.8812.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make sure, ContractIdIT is not going to be run with any ledger-api-test-tool version against platform versions older than the next snapshot. Is that what you want?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this reproduces the old behavior, where these tests were optional and therefore not run.

"exclusions": [
"ContractIdIT",
],
},
],
},
]

def in_range(version, range):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ message ExperimentalFeatures {
ExperimentalStaticTime static_time = 2;
CommandDeduplicationFeatures command_deduplication = 3;
ExperimentalOptionalLedgerId optional_ledger_id = 4;
ExperimentalContractIds contract_ids = 5;
}

// GRPC self-service error codes are returned by the Ledger API.
Expand Down Expand Up @@ -72,3 +73,24 @@ enum CommandDeduplicationType {
// Duplicate commands are always reported synchronously via a synchronous gRPC error on the command submission.
SYNC_ONLY = 2;
}

// See `daml-lf/spec/contract-id.rst` for more information on contract ID formats.
message ExperimentalContractIds {
ContractIdV0Support v0 = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not really need a feature for V0. V0 should be rejected by all supported ledgers.
I think what @cocreature want is that we check that V0 is always rejected, but we can drop the tests that check V0 is supported.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently Sandbox-on-X supports v0. Should we change this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I would prefer not to change this as part of this PR.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should but agreed, let’s do it in a separate PR.

ContractIdV1Support v1 = 2;

enum ContractIdV0Support {
NOT_SUPPORTED = 0;
SUPPORTED = 1;
}

enum ContractIdV1Support {
// Contract IDs must be suffixed.
// Distributed ledger implementations must reject non-suffixed contract IDs.
SUFFIXED = 0;
// Contract IDs do not need to be suffixed.
// This can be useful for shorter contract IDs in centralized committer implementations.
// Suffixed contract IDs must also be supported.
NON_SUFFIXED = 1;
}
}
1 change: 0 additions & 1 deletion ledger/daml-on-sql/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ conformance_test(
"--additional=CommandDeduplicationPeriodValidationIT",
"--additional=CompletionDeduplicationInfoITCommandService",
"--additional=CompletionDeduplicationInfoITCommandSubmissionService",
"--additional=ContractIdIT:Accept",
],
)

Expand Down
24 changes: 13 additions & 11 deletions ledger/ledger-api-test-tool-on-canton/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ conformance_test(
",CompletionDeduplicationInfoITCommandService" +
",CompletionDeduplicationInfoITCommandSubmissionService" +
",CommandDeduplicationParallelIT" +
",ContractIdIT" +
",MultiPartySubmissionIT" +
",ParticipantPruningIT" +
",TLSOnePointThreeIT" +
Expand Down Expand Up @@ -163,16 +162,19 @@ conformance_test(
server = ":canton-test-runner-with-dependencies",
test_tool_args = [
"--verbose",
"--include=ContractIdIT:RejectV0,ContractIdIT:RejectNonSuffixedV1Cid,ContractIdIT:AcceptSuffixedV1Cid" +
",MultiPartySubmissionIT" +
#",CommandDeduplicationParallelIT" + - can be re-enabled once canton exposes the feature descriptors
",CompletionDeduplicationInfoITCommandService,CompletionDeduplicationInfoITCommandSubmissionService" +
",CommandDeduplicationPeriodValidationIT",
"--exclude=MultiPartySubmissionIT:MPSLookupOtherByKeyInvisible" + # Enable once error parsing more permissive
",MultiPartySubmissionIT:MPSCreateInsufficientAuthorization" + # canton returns INTERNAL instead of INVALID_ARGUMENT
",ContractIdIT:AcceptSuffixedV1CidExerciseTarget", # Racy with: ABORTED: CONTRACT_NOT_FOUND(14,0): Contract could not be found with id
# Needs SDK upgrade
"--exclude=CommandDeduplicationPeriodValidationIT:InvalidOffset",
"--include=" + ",".join([
"CompletionDeduplicationInfoITCommandService",
"CompletionDeduplicationInfoITCommandSubmissionService",
# ",CommandDeduplicationParallelIT", - can be re-enabled once canton exposes the feature descriptors
"CommandDeduplicationPeriodValidationIT",
"MultiPartySubmissionIT",
]),
"--exclude=" + ",".join([
"CommandDeduplicationPeriodValidationIT:InvalidOffset", # Needs SDK upgrade
"ContractIdIT:AcceptSuffixedV1CidExerciseTarget", # Racy with: ABORTED: CONTRACT_NOT_FOUND(14,0): Contract could not be found with id
"MultiPartySubmissionIT:MPSCreateInsufficientAuthorization", # Canton returns INTERNAL instead of INVALID_ARGUMENT
"MultiPartySubmissionIT:MPSLookupOtherByKeyInvisible", # Enable once error parsing more permissive
]),
],
) if not is_windows else None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,41 @@

package com.daml.ledger.api.testtool.infrastructure.participant

import com.daml.ledger.api.v1.experimental_features.CommandDeduplicationFeatures
import com.daml.ledger.api.v1.experimental_features.{
CommandDeduplicationFeatures,
ExperimentalContractIds,
}
import com.daml.ledger.api.v1.version_service.GetLedgerApiVersionResponse

final case class Features(
selfServiceErrorCodes: Boolean = false,
userManagement: Boolean = false,
userManagement: Boolean,
selfServiceErrorCodes: Boolean,
staticTime: Boolean,
commandDeduplicationFeatures: CommandDeduplicationFeatures,
staticTime: Boolean = false,
optionalLedgerId: Boolean = false,
contractIds: ExperimentalContractIds,
)

object Features {
val defaultFeatures =
Features(commandDeduplicationFeatures = CommandDeduplicationFeatures.defaultInstance)
val defaultFeatures: Features = Features(
userManagement = false,
selfServiceErrorCodes = false,
staticTime = false,
commandDeduplicationFeatures = CommandDeduplicationFeatures.defaultInstance,
contractIds = ExperimentalContractIds.defaultInstance,
)

def fromApiVersionResponse(response: GetLedgerApiVersionResponse): Features = {
val features = response.getFeatures
val experimental = features.getExperimental

Features(
selfServiceErrorCodes = experimental.selfServiceErrorCodes.isDefined,
userManagement = features.getUserManagement.supported,
selfServiceErrorCodes = experimental.selfServiceErrorCodes.isDefined,
staticTime = experimental.getStaticTime.supported,
commandDeduplicationFeatures = experimental.getCommandDeduplication,
optionalLedgerId = experimental.optionalLedgerId.isDefined,
contractIds = experimental.getContractIds,
)
}
}
Loading