update canton to 20240410.13059.vaa7f9dde (#18971)

tell-slack: canton

Co-authored-by: Azure Pipelines Daml Build <support@digitalasset.com>
This commit is contained in:
azure-pipelines[bot] 2024-04-10 17:14:58 +02:00 committed by GitHub
parent 0b4f060244
commit f813d79a34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
47 changed files with 82 additions and 55 deletions

View File

@ -26,6 +26,7 @@ message SerializableContract {
message GlobalKey {
bytes template_id = 1;
bytes key = 2;
string package_name = 3;
}
message AggregationRule {

View File

@ -187,7 +187,7 @@ message ActionDescription {
bytes node_seed = 6;
bool failed = 8;
optional string interface_id = 9;
optional string template_id = 10;
string template_id = 10;
repeated string package_preference = 11;
}

View File

@ -138,7 +138,7 @@ object ActionDescription extends HasProtocolVersionedCompanion[ActionDescription
seed <- seedO.toRight(InvalidActionDescription("No seed for an Exercise node given"))
actionDescription <- ExerciseActionDescription.create(
inputContract,
Some(templateId),
templateId,
choice,
interfaceId,
packagePreference,
@ -225,7 +225,7 @@ object ActionDescription extends HasProtocolVersionedCompanion[ActionDescription
) = e
for {
inputContractId <- ProtoConverter.parseLfContractId(inputContractIdP)
templateId <- templateIdP.traverse(RefIdentifierSyntax.fromProtoPrimitive)
templateId <- RefIdentifierSyntax.fromProtoPrimitive(templateIdP)
packagePreference <- packagePreferenceP.traverse(ProtoConverter.parsePackageId).map(_.toSet)
choice <- choiceFromProto(choiceP)
interfaceId <- interfaceIdP.traverse(RefIdentifierSyntax.fromProtoPrimitive)
@ -335,7 +335,7 @@ object ActionDescription extends HasProtocolVersionedCompanion[ActionDescription
/** @throws InvalidActionDescription if the `chosen_value` cannot be serialized */
final case class ExerciseActionDescription private (
inputContractId: LfContractId,
templateId: Option[LfTemplateId],
templateId: LfTemplateId,
choice: LfChoiceName,
interfaceId: Option[LfInterfaceId],
packagePreference: Set[LfPackageId],
@ -359,7 +359,7 @@ object ActionDescription extends HasProtocolVersionedCompanion[ActionDescription
v30.ActionDescription.Description.Exercise(
v30.ActionDescription.ExerciseActionDescription(
inputContractId = inputContractId.toProtoPrimitive,
templateId = templateId.map(i => new RefIdentifierSyntax(i).toProtoPrimitive),
templateId = new RefIdentifierSyntax(templateId).toProtoPrimitive,
packagePreference = packagePreference.toSeq,
choice = choice,
interfaceId = interfaceId.map(i => new RefIdentifierSyntax(i).toProtoPrimitive),
@ -386,7 +386,7 @@ object ActionDescription extends HasProtocolVersionedCompanion[ActionDescription
object ExerciseActionDescription {
def tryCreate(
inputContractId: LfContractId,
templateId: Option[LfTemplateId],
templateId: LfTemplateId,
choice: LfChoiceName,
interfaceId: Option[LfInterfaceId],
packagePreference: Set[LfPackageId],
@ -412,7 +412,7 @@ object ActionDescription extends HasProtocolVersionedCompanion[ActionDescription
def create(
inputContractId: LfContractId,
templateId: Option[LfTemplateId],
templateId: LfTemplateId,
choice: LfChoiceName,
interfaceId: Option[LfInterfaceId],
packagePreference: Set[LfPackageId],

View File

@ -177,7 +177,7 @@ final case class ViewParticipantData private (
case ExerciseActionDescription(
inputContractId,
commandTemplateId,
templateId,
choice,
interfaceId,
packagePreference,
@ -194,12 +194,6 @@ final case class ViewParticipantData private (
),
)
// commandTemplateId is not populated prior to ProtocolVersion.v5
val templateId = commandTemplateId match {
case Some(templateId) => templateId
case _ => inputContract.contract.contractInstance.unversioned.template
}
val cmd = if (byKey) {
val key = inputContract.contract.metadata.maybeKey
.map(_.key)

View File

@ -4,6 +4,7 @@
package com.digitalasset.canton.protocol
import cats.syntax.either.*
import com.daml.lf.data.Ref
import com.daml.lf.value.{ValueCoder, ValueOuterClass}
import com.digitalasset.canton.serialization.ProtoConverter
import com.digitalasset.canton.serialization.ProtoConverter.ParsingResult
@ -19,7 +20,11 @@ object GlobalKeySerialization {
keyP <- ValueCoder
.encodeVersionedValue(globalKey.map(_.key))
.leftMap(_.errorMessage)
} yield v30.GlobalKey(templateId = templateIdP.toByteString, key = keyP.toByteString)
} yield v30.GlobalKey(
templateId = templateIdP.toByteString,
key = keyP.toByteString,
globalKey.unversioned.packageName,
)
}
def assertToProto(key: LfVersioned[LfGlobalKey]): v30.GlobalKey =
@ -30,7 +35,7 @@ object GlobalKeySerialization {
)
def fromProtoV30(globalKeyP: v30.GlobalKey): ParsingResult[LfVersioned[LfGlobalKey]] = {
val v30.GlobalKey(templateIdBytes, keyBytes) = globalKeyP
val v30.GlobalKey(templateIdBytes, keyBytes, packageNameP) = globalKeyP
for {
templateIdP <- ProtoConverter.protoParser(ValueOuterClass.Identifier.parseFrom)(
templateIdBytes
@ -51,12 +56,15 @@ object GlobalKeySerialization {
ProtoDeserializationError.ValueDeserializationError("GlobalKey.proto", err.toString)
)
globalKey <-
LfGlobalKey
.build(templateId, versionedKey.unversioned)
.leftMap(err =>
ProtoDeserializationError.ValueDeserializationError("GlobalKey.key", err.toString)
)
packageName <- Ref.PackageName
.fromString(packageNameP)
.leftMap(err => ProtoDeserializationError.ValueDeserializationError("GlobalKey.proto", err))
globalKey <- LfGlobalKey
.build(templateId, versionedKey.unversioned, packageName)
.leftMap(err =>
ProtoDeserializationError.ValueDeserializationError("GlobalKey.key", err.toString)
)
} yield LfVersioned(versionedKey.version, globalKey)
}

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --target=2.1
name: CantonExamples

View File

@ -33,7 +33,7 @@ class ActionDescriptionTest extends AnyWordSpec with BaseTest {
"the choice argument cannot be serialized" in {
ExerciseActionDescription.create(
suffixedId,
templateId = Some(defaultTemplateId),
templateId = defaultTemplateId,
choiceName,
None,
Set.empty,
@ -58,6 +58,7 @@ class ActionDescriptionTest extends AnyWordSpec with BaseTest {
.build(
LfTransactionBuilder.defaultTemplateId,
ExampleTransactionFactory.veryDeepValue,
ExampleTransactionFactory.packageName,
)
.value,
),

View File

@ -138,7 +138,7 @@ final class GeneratorsData(
for {
inputContractId <- Arbitrary.arbitrary[LfContractId]
templateId <- Gen.option(Arbitrary.arbitrary[LfTemplateId])
templateId <- Arbitrary.arbitrary[LfTemplateId]
choice <- Arbitrary.arbitrary[LfChoiceName]

View File

@ -36,6 +36,7 @@ class TransactionViewTest extends AnyWordSpec with BaseTest with HasExecutionCon
.build(
LfTransactionBuilder.defaultTemplateId,
Value.ValueInt64(100L),
LfTransactionBuilder.defaultPackageName,
)
.value

View File

@ -111,10 +111,11 @@ object ExampleTransactionFactory {
def globalKey(
templateId: LfTemplateId,
value: LfValue,
packageName: LfPackageName = packageName,
): Versioned[LfGlobalKey] =
LfVersioned(
transactionVersion,
LfGlobalKey.assertBuild(templateId, value),
LfGlobalKey.assertBuild(templateId, value, packageName),
)
def globalKeyWithMaintainers(

View File

@ -283,6 +283,7 @@ class WellFormedTransactionTest extends AnyWordSpec with BaseTest with HasExecut
templateId,
contractInst.unversioned.arg,
Set.empty,
packageName,
)
),
),

View File

@ -33,6 +33,7 @@ object LfTransactionBuilder {
val defaultGlobalKey: LfGlobalKey = LfGlobalKey.assertBuild(
defaultTemplateId,
Value.ValueUnit,
defaultPackageName,
)
def allocateNodeId[M[_]](implicit monadInstance: Monad[M]): StateT[M, NodeIdState, LfNodeId] =

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --target=2.1
name: ai-analysis

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --target=2.1
name: bank

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --target=2.1
name: doctor

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --target=2.1
name: health-insurance

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --target=2.1
name: medical-records

View File

@ -252,7 +252,7 @@ private[platform] object InMemoryStateUpdater {
arg = createdEvent.createArgument,
),
globalKey = createdEvent.contractKey.map(k =>
Key.assertBuild(createdEvent.templateId, k.unversioned)
Key.assertBuild(createdEvent.templateId, k.unversioned, createdEvent.packageName)
),
ledgerEffectiveTime = createdEvent.ledgerEffectiveTime,
stakeholders = createdEvent.flatEventWitnesses.map(Party.assertFromString),
@ -266,7 +266,11 @@ private[platform] object InMemoryStateUpdater {
ContractStateEvent.Archived(
contractId = exercisedEvent.contractId,
globalKey = exercisedEvent.contractKey.map(k =>
Key.assertBuild(exercisedEvent.templateId, k.unversioned)
Key.assertBuild(
exercisedEvent.templateId,
k.unversioned,
exercisedEvent.packageName,
)
),
stakeholders = exercisedEvent.flatEventWitnesses.map(Party.assertFromString),
eventOffset = exercisedEvent.eventOffset,

View File

@ -88,6 +88,7 @@ private[dao] sealed class ContractsReader(
GlobalKey.assertBuild(
contract.unversioned.template,
value.unversioned,
contract.unversioned.packageName,
)
}

View File

@ -282,7 +282,7 @@ final class LfValueTranslation(
globalKey <- createKey
.traverse(key =>
GlobalKey
.build(templateId, key.unversioned)
.build(templateId, key.unversioned, packageName)
.left
.map(_.msg)
)
@ -406,7 +406,7 @@ final class LfValueTranslation(
globalKey <- createKey
.traverse(key =>
GlobalKey
.build(templateId, key.unversioned)
.build(templateId, key.unversioned, createdEvent.packageName)
.left
.map(_.msg)
)

View File

@ -275,6 +275,7 @@ object ValidateDisclosedContractsTest {
),
),
api.keyMaintainers,
Ref.PackageName.assertFromString(api.packageName),
)
private val keyHash: Hash = keyWithMaintainers.globalKey.hash

View File

@ -65,6 +65,7 @@ object DisclosedContractCreator {
),
),
api.keyMaintainers,
Ref.PackageName.assertFromString(api.packageName),
)
val fatContractInstance: FatContractInstance = FatContractInstance.fromCreateNode(

View File

@ -118,7 +118,8 @@ class CommandSubmissionServiceImplSpec
LfError.Interpretation(
LfError.Interpretation.DamlException(
LfInterpretationError.DuplicateContractKey(
GlobalKey.assertBuild(tmplId, Value.ValueUnit)
GlobalKey
.assertBuild(tmplId, Value.ValueUnit, PackageName.assertFromString("pkg-name"))
)
),
None,

View File

@ -295,7 +295,7 @@ class UpdateToDbDtoSpec extends AnyWordSpec with Matchers {
create_key_maintainers = Some(Set("signatory2", "signatory3")),
create_key_hash = Some(
GlobalKey
.assertBuild(contractTemplate, keyValue)
.assertBuild(contractTemplate, keyValue, createNode.packageName)
.hash
.bytes
.toHexString

View File

@ -171,6 +171,7 @@ class ContractStateCachesSpec
GlobalKey.assertBuild(
Identifier.assertFromString(s"some:template:name"),
ValueInt64(id.toLong),
Ref.PackageName.assertFromString("pkg-name"),
)
private def contract(id: Int): Contract = {

View File

@ -227,6 +227,7 @@ private object MutableCacheBackedContractStoreRaceTests {
keyIdx -> GlobalKey.assertBuild(
Identifier.assertFromString("pkgId:module:entity"),
ValueInt64(keyIdx),
Ref.PackageName.assertFromString("pkg-name"),
)
}.toMap

View File

@ -397,6 +397,7 @@ object MutableCacheBackedContractStoreSpec {
GlobalKey.assertBuild(
Identifier.assertFromString(s"some:template:$desc"),
ValueText(desc),
Ref.PackageName.assertFromString("pkg-name"),
)
private def offset(idx: Long) = Offset.fromByteArray(BigInt(idx).toByteArray)

View File

@ -80,6 +80,7 @@ private[dao] trait JdbcLedgerDaoContractsSpec extends LoneElement with Inside wi
someTemplateId,
aTextValue,
Set(alice, bob),
somePackageName,
)
for {

View File

@ -21,6 +21,7 @@ private[dao] trait JdbcLedgerDaoEventsSpec extends LoneElement with Inside with
GlobalKey.assertBuild(
someTemplateId,
someContractKey(alice, value),
somePackageName,
),
Set(alice),
)

View File

@ -342,7 +342,7 @@ private[dao] trait JdbcLedgerDaoSuite extends JdbcLedgerDaoBackend with OptionVa
maintainers: Set[Party]
): GlobalKeyWithMaintainers = {
val aTextValue = ValueText(scala.util.Random.nextString(10))
GlobalKeyWithMaintainers.assertBuild(someTemplateId, aTextValue, maintainers)
GlobalKeyWithMaintainers.assertBuild(someTemplateId, aTextValue, maintainers, somePackageName)
}
protected final def createAndStoreContract(

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --enable-interfaces=yes
name: carbonv1-tests

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --enable-interfaces=yes
name: carbonv2-tests

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
name: experimental-tests
source: .
version: 3.1.0

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --enable-interfaces=yes
name: model-tests

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
name: package-management-tests
source: .
version: 3.1.0

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --enable-interfaces=yes
name: semantic-tests

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
name: upgrade-tests
source: .
version: 1.0.0

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
name: upgrade-tests
source: .
version: 2.0.0

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
name: upgrade-tests
source: .
version: 3.0.0

View File

@ -272,6 +272,7 @@ object CommandExecutionErrors extends CommandExecutionErrorGroup {
Seq(
(ErrorResource.TemplateId, key.templateId.toString),
(ErrorResource.ContractKey, encodedKey),
(ErrorResource.PackageName, key.packageName),
)
}
}
@ -323,6 +324,7 @@ object CommandExecutionErrors extends CommandExecutionErrorGroup {
(ErrorResource.ContractId, err.coid.coid),
(ErrorResource.ContractKey, encodedKey),
(ErrorResource.ContractKeyHash, err.declaredHash.toString),
(ErrorResource.PackageName, err.key.packageName),
)
}
}

View File

@ -146,6 +146,7 @@ object ConsistencyErrors extends ConsistencyErrorGroup {
// If the key is big, it can force chunking other resources.
(ErrorResource.TemplateId, key.templateId.toString),
(ErrorResource.ContractKey, encodedKey),
(ErrorResource.PackageName, key.packageName),
)
}
}
@ -203,6 +204,7 @@ object ConsistencyErrors extends ConsistencyErrorGroup {
// If the key is big, it can force chunking other resources.
(ErrorResource.TemplateId, key.templateId.toString),
(ErrorResource.ContractKey, encodedKey),
(ErrorResource.PackageName, key.packageName),
)
}
}

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --target=2.1
name: JsonEncodingTest

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --target=2.dev
name: JsonEncodingTestDev

View File

@ -1,4 +1,4 @@
sdk-version: 3.1.0-snapshot.20240405.12988.0.vc3194058
sdk-version: 3.1.0-snapshot.20240408.12992.0.v0ec87985
build-options:
- --target=2.1
name: AdminWorkflows

View File

@ -13,7 +13,7 @@ import com.digitalasset.canton.protocol.*
import com.digitalasset.canton.sequencing.protocol.MediatorsOfDomain
import com.digitalasset.canton.topology.MediatorGroup.MediatorGroupIndex
import com.digitalasset.canton.topology.{DomainId, UniqueIdentifier}
import com.digitalasset.canton.util.LfTransactionBuilder.defaultTemplateId
import com.digitalasset.canton.util.LfTransactionBuilder.{defaultPackageName, defaultTemplateId}
import com.digitalasset.canton.{BaseTest, LfPackageName, LfPartyId, protocol}
import org.scalatest.Assertion
import org.scalatest.wordspec.AnyWordSpec
@ -172,6 +172,7 @@ class SerializableContractAuthenticatorImplTest extends AnyWordSpec with BaseTes
key = LfGlobalKey.assertBuild(
defaultTemplateId,
Value.ValueInt64(0),
defaultPackageName,
),
maintainers = maintainers,
)

View File

@ -11,6 +11,7 @@ import com.digitalasset.canton.participant.store.memory.InMemoryContractStore
import com.digitalasset.canton.protocol.ExampleTransactionFactory.{
asSerializable,
contractInstance,
packageName,
transactionId,
}
import com.digitalasset.canton.protocol.*
@ -97,12 +98,12 @@ class ExtendedContractLookupTest extends AsyncWordSpec with BaseTest {
val transactionId1 = transactionId(1)
val transactionId2 = transactionId(2)
val key00: LfGlobalKey =
LfGlobalKey.build(instance0Template, ValueUnit).value
LfGlobalKey.build(instance0Template, ValueUnit, packageName).value
val key1: LfGlobalKey =
LfGlobalKey.build(instance0Template, ValueText("abc")).value
LfGlobalKey.build(instance0Template, ValueText("abc"), packageName).value
val forbiddenKey: LfGlobalKey =
LfGlobalKey
.build(instance0Template, ValueText("forbiddenKey"))
.build(instance0Template, ValueText("forbiddenKey"), packageName)
.value
val alice = LfPartyId.assertFromString("alice")
val bob = LfPartyId.assertFromString("bob")

View File

@ -1 +1 @@
20240409.13054.v4f1ad842
20240410.13059.vaa7f9dde