Skip to content

Commit

Permalink
Fix build after rebase.
Browse files Browse the repository at this point in the history
Some of the transactions with disclosures now fail with a trailing none
error.
  • Loading branch information
paulbrauner-da committed Oct 18, 2024
1 parent 56b55c3 commit fa0c498
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
1 change: 1 addition & 0 deletions sdk/daml-lf/model-test-lib/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ da_scala_library(
deps = [
"//bazel_tools/runfiles:scala_runfiles",
"//canton:bindings-java",
"//canton:community_ledger_ledger-api-core",
"//canton:community_ledger_ledger-common",
"//canton:community_util-logging",
"//canton:ledger_api_proto_scala",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.stream.Materializer
import org.scalacheck.{Gen, Prop}

import scala.annotation.nowarn
//import scala.annotation.nowarn
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext}
import scala.util.{Failure, Success, Try}

object Demo {

Expand Down Expand Up @@ -86,29 +87,43 @@ object Demo {

// val workers = ExecutionContext.fromExecutorService(Executors.newFixedThreadPool(1))

@nowarn("cat=unused")
// @nowarn("cat=unused")
val bad = Parser.parseScenario("""
|Scenario
| Topology
| Participant 0 pkgs={0} parties={1}
| Participant 2 pkgs={0} parties={5}
| Ledger
| Commands participant=0 actAs={1} disclosures={}
| Create 0 sigs={1} obs={}
| Commands participant=0 actAs={1} disclosures={}
| Exercise NonConsuming 0 ctl={1} cobs={}
| Exercise NonConsuming 0 pkg=1 ctl={1} cobs={}
| Commands participant=2 actAs={5} disclosures={}
| Create 0 sigs={5} obs={}
| Commands participant=0 actAs={1} disclosures={0}
| Create 1 sigs={1} obs={}
|""".stripMargin)

validSymScenarios
// List(bad)
implicit val pretty: Ledgers.Scenario => org.scalacheck.util.Pretty =
(s: Ledgers.Scenario) => org.scalacheck.util.Pretty(_ => Pretty.prettyScenario(s))
// validSymScenarios
List(bad)
.foreach(scenario => {
// workers.execute(() =>
if (scenario.ledger.nonEmpty) {
println("\n==== ledger ====")
println(Pretty.prettyScenario(scenario))
assert(SymbolicSolver.valid(scenario, numPackages, numParties))
ideLedgerRunner.runAndProject(scenario) match {
case Left(error) =>
Try(ideLedgerRunner.runAndProject(scenario)) match {
case Failure(e) =>
println("INVALID LEDGER!")
println(Pretty.prettyScenario(scenario))
e.printStackTrace()
println(scenario)
println("shrinking")
Prop
.forAllShrink(Gen.const(scenario), Shrinkers.shrinkScenario.shrink)(s =>
ideLedgerRunner.runAndProject(s).isRight
)
.check()
System.exit(1)
case Success(Left(error)) =>
println("INVALID LEDGER!")
println(Pretty.prettyScenario(scenario))
println(error.pretty)
Expand All @@ -120,7 +135,7 @@ object Demo {
)
.check()
System.exit(1)
case Right(ideProjections) =>
case Success(Right(ideProjections)) =>
println("==== ide ledger ====")
println("VALID!")
// ideProjections.foreach { case (partyId, projections) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import com.digitalasset.canton.ledger.client.configuration.{
LedgerClientConfiguration,
}
import com.digitalasset.canton.logging.NamedLoggerFactory
import com.digitalasset.canton.platform.ApiOffset
import com.digitalasset.canton.tracing.TraceContext
import com.digitalasset.daml.lf.PureCompiledPackages
import com.google.protobuf.ByteString
Expand Down Expand Up @@ -220,7 +221,7 @@ private class CantonLedgerRunner(
ledgerClientsForProjections(participantId).getTransactionsClient
.getTransactionsTrees(
"",
ledgerEnd,
ApiOffset.fromLong(ledgerEnd.get()),
javaapi.data.TransactionFilter.fromProto(
proto.TransactionFilter
.newBuilder()
Expand Down

0 comments on commit fa0c498

Please sign in to comment.