diff --git a/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Runner.scala b/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Runner.scala index b8d544efeeed..e849c37a4532 100644 --- a/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Runner.scala +++ b/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Runner.scala @@ -7,7 +7,7 @@ import akka.NotUsed import akka.stream._ import akka.stream.scaladsl._ import com.daml.api.util.TimeProvider -import com.daml.ledger.api.refinements.ApiTypes.ApplicationId +import com.daml.ledger.api.refinements.ApiTypes.{ApplicationId, Party} import com.daml.ledger.api.v1.command_submission_service.SubmitRequest import com.daml.ledger.api.v1.commands.{Command, Commands} import com.daml.ledger.api.v1.completion.Completion @@ -19,6 +19,7 @@ import com.daml.ledger.client.LedgerClient import com.daml.ledger.client.services.commands.CompletionStreamElement._ import com.daml.lf.archive.Dar import com.daml.lf.data.ImmArray +import com.daml.lf.data.Ref import com.daml.lf.data.Ref._ import com.daml.lf.data.ScalazEqual._ import com.daml.lf.data.Time.Timestamp @@ -219,7 +220,7 @@ class Runner( client: LedgerClient, timeProviderType: TimeProviderType, applicationId: ApplicationId, - party: String, + party: Party, )(implicit loggingContext: LoggingContextOf[Trigger]) { import Runner.{SeenMsgs, alterF} @@ -232,7 +233,7 @@ class Runner( // message, or both. private[this] var pendingCommandIds: Map[UUID, SeenMsgs] = Map.empty private val transactionFilter: TransactionFilter = - TransactionFilter(Seq((party, trigger.filters)).toMap) + TransactionFilter(Seq((party.unwrap, trigger.filters)).toMap) private[this] def logger = ContextualizedLogger get getClass @@ -260,7 +261,7 @@ class Runner( ledgerId = client.ledgerId.unwrap, applicationId = applicationId.unwrap, commandId = commandUUID.toString, - party = party, + party = party.unwrap, commands = commands, ) logger.debug( @@ -321,7 +322,7 @@ class Runner( client: LedgerClient, offset: LedgerOffset, heartbeat: Option[FiniteDuration], - party: String, + party: Party, filter: TransactionFilter, ): Flow[SingleCommandFailure, TriggerMsg, NotUsed] = { @@ -361,7 +362,7 @@ class Runner( submissionFailureQueue .merge( client.commandClient - .completionSource(List(party), offset) + .completionSource(List(party.unwrap), offset) .mapConcat { case CheckpointElement(_) => List() case CompletionElement(c) => List(c) @@ -403,7 +404,10 @@ class Runner( val createdValue: SValue = converter.fromACS(acs).orConverterException // Setup an application expression of initialState on the ACS. val initialState: SExpr = - makeApp(getInitialState, Array(SParty(Party.assertFromString(party)), createdValue)) + makeApp( + getInitialState, + Array(SParty(Ref.Party.assertFromString(party.unwrap)), createdValue), + ) // Prepare a speedy machine for evaluating expressions. val machine: Speedy.Machine = Speedy.Machine.fromPureSExpr(compiledPackages, initialState) @@ -716,7 +720,7 @@ object Runner extends StrictLogging { client: LedgerClient, timeProviderType: TimeProviderType, applicationId: ApplicationId, - party: String, + party: Party, config: Compiler.Config, )(implicit materializer: Materializer, executionContext: ExecutionContext): Future[SValue] = { val darMap = dar.all.toMap diff --git a/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/RunnerConfig.scala b/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/RunnerConfig.scala index e39cf09702cf..1a36371a030b 100644 --- a/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/RunnerConfig.scala +++ b/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/RunnerConfig.scala @@ -6,7 +6,7 @@ package com.daml.lf.engine.trigger import java.nio.file.{Path, Paths} import java.time.Duration -import com.daml.ledger.api.refinements.ApiTypes.ApplicationId +import com.daml.ledger.api.refinements.ApiTypes.{ApplicationId, Party} import com.daml.ledger.api.tls.TlsConfiguration import com.daml.ledger.api.tls.TlsConfigurationCli import com.daml.platform.services.time.TimeProviderType @@ -19,7 +19,7 @@ case class RunnerConfig( triggerIdentifier: String, ledgerHost: String, ledgerPort: Int, - ledgerParty: String, + ledgerParty: Party, maxInboundMessageSize: Int, // optional so we can detect if both --static-time and --wall-clock-time are passed. timeProviderType: Option[TimeProviderType], @@ -59,7 +59,7 @@ object RunnerConfig { .text("Ledger port") opt[String]("ledger-party") - .action((t, c) => c.copy(ledgerParty = t)) + .action((t, c) => c.copy(ledgerParty = Party(t))) .text("Ledger party") opt[Int]("max-inbound-message-size") @@ -162,7 +162,7 @@ object RunnerConfig { triggerIdentifier = null, ledgerHost = null, ledgerPort = 0, - ledgerParty = null, + ledgerParty = Party(""), maxInboundMessageSize = DefaultMaxInboundMessageSize, timeProviderType = None, commandTtl = Duration.ofSeconds(30L), diff --git a/triggers/service/src/main/scala/com/digitalasset/daml/lf/engine/trigger/TriggerRunnerImpl.scala b/triggers/service/src/main/scala/com/digitalasset/daml/lf/engine/trigger/TriggerRunnerImpl.scala index 647a8da3fdf8..4789131679e8 100644 --- a/triggers/service/src/main/scala/com/digitalasset/daml/lf/engine/trigger/TriggerRunnerImpl.scala +++ b/triggers/service/src/main/scala/com/digitalasset/daml/lf/engine/trigger/TriggerRunnerImpl.scala @@ -187,7 +187,7 @@ object TriggerRunnerImpl { client, config.ledgerConfig.timeProvider, config.applicationId, - config.party.unwrap, + config.party, ) (acs, offset) <- runner.queryACS() } yield QueriedACS(runner, acs, offset) diff --git a/triggers/tests/src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractTriggerTest.scala b/triggers/tests/src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractTriggerTest.scala index 55faa1189c07..c9e7edfc616e 100644 --- a/triggers/tests/src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractTriggerTest.scala +++ b/triggers/tests/src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractTriggerTest.scala @@ -10,7 +10,7 @@ import java.util.UUID import akka.stream.scaladsl.Sink import com.daml.bazeltools.BazelRunfiles -import com.daml.ledger.api.refinements.ApiTypes.ApplicationId +import com.daml.ledger.api.refinements.ApiTypes.{ApplicationId, Party} import com.daml.ledger.api.v1.command_service.SubmitAndWaitRequest import com.daml.ledger.api.v1.commands.{Command, CreateCommand, ExerciseCommand, _} import com.daml.ledger.api.v1.event.CreatedEvent @@ -76,7 +76,7 @@ trait AbstractTriggerTest extends SandboxFixture with TestCommands { client, config.timeProviderType.get, applicationId, - party, + Party(party), ) } }