Skip to content

Commit

Permalink
Update Splice from CCI (#113)
Browse files Browse the repository at this point in the history
Signed-off-by: DA Automation <[email protected]>
Co-authored-by: DA Automation <[email protected]>
  • Loading branch information
canton-network-da and DA Automation authored Nov 14, 2024
1 parent 0563158 commit 966891a
Show file tree
Hide file tree
Showing 158 changed files with 2,995 additions and 860 deletions.
4 changes: 4 additions & 0 deletions apps/ans/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export default defineConfig(({ mode }) => {
},
test: {
setupFiles: ['./src/__tests__/setup/setup.ts'],
reporters: [
'default',
['junit', { outputFile: './../target/test-reports/TEST-ans.xml' }], // JUnit XML report
],
},
});
});
3 changes: 2 additions & 1 deletion apps/app-manager/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"common-frontend": "0.1.0",
"mui-file-input": "^2.0.4",
"react": "18.2.0",
"react-dom": "18.2.0"
"react-dom": "18.2.0",
"xunit-viewer": "^10.6.1"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "4.29.4",
Expand Down
4 changes: 4 additions & 0 deletions apps/app-manager/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export default defineConfig(({ mode }) => {
},
test: {
setupFiles: ['./src/__tests__/setup/setup.ts'],
reporters: [
'default',
['junit', { outputFile: './../target/test-reports/TEST-app-manager.xml' }], // JUnit XML report
],
},
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ case class SpliceConfig(

// NOTE: the below is patterned after CantonCommunityConfig.
// In case of changes, recopy from there.
@nowarn("cat=lint-byname-implicit") // https://github.com/scala/bug/issues/12072
object SpliceConfig {

final case class ConfigValidationFailed(reason: String) extends FailureReason {
Expand Down Expand Up @@ -459,9 +458,6 @@ object SpliceConfig {
implicit val sequencerPruningConfig: ConfigReader[SequencerPruningConfig] =
deriveReader[SequencerPruningConfig]
implicit val svSequencerConfig: ConfigReader[SvSequencerConfig] = {
// Somehow the implicit search seems to have trouble finding the sequencer pruning config implicit.
// Redefining it here works though.
@nowarn("cat=unused")
implicit val sequencerPruningConfig2 = sequencerPruningConfig
deriveReader[SvSequencerConfig]
.emap { sequencerConfig =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,8 @@ final class ScanAppBackendReference(
override def httpClientConfig =
NetworkAppClientConfig(s"http://127.0.0.1:${config.clientAdminApi.port}")

val nodes = spliceConsoleEnvironment.environment.scans
val nodes: org.lfdecentralizedtrust.splice.environment.ScanApps =
spliceConsoleEnvironment.environment.scans

@Help.Summary("Return local scan app config")
override def config: ScanAppBackendConfig =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ trait AppReference extends InstanceReference {
@Help.Summary("Health and diagnostic related commands")
@Help.Group("Health")
// Doesn't make sense for splice
override def health = ???
override def health: Nothing = ???

// clear_cache exists to invalidate topology caches which we don't have in our apps.
override def clear_cache(): Unit = ()
Expand All @@ -93,7 +93,7 @@ trait AppReference extends InstanceReference {
): Unit

// Doesn't make sense for Splice
override def adminToken = ???
override def adminToken: Nothing = ???
}

trait HttpAppReference extends AppReference with HttpCommandRunner {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ final class SplitwellAppClientReference(

override def httpClientConfig = config.adminApi

override lazy val ledgerApi =
override lazy val ledgerApi: com.digitalasset.canton.console.ExternalLedgerApiClient =
new ExternalLedgerApiClient(
config.participantClient.ledgerApi.clientConfig.address,
config.participantClient.ledgerApi.clientConfig.port,
Expand All @@ -109,7 +109,7 @@ final class SplitwellAppClientReference(
val connectedDomains = getConnectedDomains(userParty)
val filteredRules = rules.filter(c => connectedDomains.contains(c._1))
filteredRules.toList match {
case Seq((domain, rules)) => (domain, rules)
case Seq((domain, domainRules)) => (domain, domainRules)
case Seq() =>
throw new IllegalStateException(
s"Expected exactly one SplitwellRules contract for user $userParty but got $rules"
Expand Down Expand Up @@ -487,7 +487,8 @@ final class SplitwellAppBackendReference(
s"http://127.0.0.1:${config.clientAdminApi.port}"
)

override val nodes = consoleEnvironment.environment.splitwells
override val nodes: org.lfdecentralizedtrust.splice.environment.SplitwellApps =
consoleEnvironment.environment.splitwells

@Help.Summary(
"Returns the state of this app. May only be called while the app is running."
Expand All @@ -499,7 +500,8 @@ final class SplitwellAppBackendReference(
)
def splitwellAutomation: SplitwellAutomationService = appState.automation

override lazy val ledgerApi = participantClient
override lazy val ledgerApi: SplitwellAppBackendReference.this.participantClient.type =
participantClient

@Help.Summary("Return local splitwell app config")
def config: SplitwellAppBackendConfig =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class SvAppBackendReference(
s"http://127.0.0.1:${config.clientAdminApi.port}"
)

val nodes = consoleEnvironment.environment.svs
val nodes: org.lfdecentralizedtrust.splice.environment.SvApps = consoleEnvironment.environment.svs

@Help.Summary(
"Returns the state of this app. May only be called while the app is running."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,8 @@ final class ValidatorAppBackendReference(
s"http://127.0.0.1:${config.clientAdminApi.port}"
)

val nodes = consoleEnvironment.environment.validators
val nodes: org.lfdecentralizedtrust.splice.environment.ValidatorApps =
consoleEnvironment.environment.validators

@Help.Summary(
"Returns the state of this app. May only be called while the app is running."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class SpliceConsoleEnvironment(
) extends ConsoleEnvironment // TODO(#736): Generalize this.
{

override val errorHandler = ThrowWithDetailsErrorHandler
override val errorHandler: com.digitalasset.canton.console.ThrowWithDetailsErrorHandler.type =
ThrowWithDetailsErrorHandler

val packageSignatures = ResourceTemplateDecoder.loadPackageSignaturesFromResources(
DarResources.splitwell.all ++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ import com.digitalasset.canton.logging.pretty.Pretty
import io.circe.Encoder
import io.circe.generic.semiauto.deriveEncoder

import scala.annotation.nowarn

// TODO(tech-debt): named SpliceStatus as there already exists a org.lfdecentralizedtrust.splice.environment.SpliceStatus -- figure out how to name this better, or merge these two classes
case class SpliceStatus2() extends CantonStatus {
override def pretty: Pretty[SpliceStatus2.this.type] =
Pretty.prettyOfString(_ => "Not implemented")
}

@nowarn("cat=lint-byname-implicit") // https://github.com/scala/bug/issues/12072
class SpliceHealthDumpGenerator(
override val environment: SpliceEnvironment,
override val grpcAdminCommandRunner: GrpcAdminCommandRunner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CometBftNetworkPlugin(
override def afterEnvironmentDestroyed(config: SpliceConfig): Unit = {
val containerConnectionKeys = config.svApps.values
.flatMap(svApp => svApp.cometBftConfig.map(_.connectionUri))
.map(CometBftConnectionConfig)
.map(CometBftConnectionConfig.apply)
containerConnectionKeys.foreach { connectionKey =>
val container = runningContainers(connectionKey)
container.shutdown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ final class ResetDecentralizedNamespace extends ResetTopologyStatePlugin {
.filterNot(_.name.endsWith("Onboarded"))
.map(_.participantClientWithAdminToken)
val usableSvsByNamespace = usableSvs.map(p => p.id.uid.namespace -> p).toMap
(existingDecentralizedNamespace.item.owners + sv1.participantClientWithAdminToken.id.uid.namespace)
existingDecentralizedNamespace.item.owners
.concat(Set(sv1.participantClientWithAdminToken.id.uid.namespace))
.foreach { namespace =>
val sv = usableSvsByNamespace.getOrElse(
namespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class AnsAuth0FrontendIntegrationTest
with AnsFrontendTestUtil
with FrontendLoginUtil {

override def environmentDefinition =
override def environmentDefinition
: org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition =
EnvironmentDefinition
.simpleTopology1Sv(this.getClass.getSimpleName)
.addConfigTransform((_, c) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class AnsFrontendIntegrationTest
with AnsFrontendTestUtil
with FrontendLoginUtil {

override def environmentDefinition =
override def environmentDefinition
: org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition =
EnvironmentDefinition
.simpleTopology1Sv(this.getClass.getSimpleName)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class AppManagerFrontendIntegrationTest
splitwellBundle,
)

override def environmentDefinition =
override def environmentDefinition
: org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition =
EnvironmentDefinition
.simpleTopology1Sv(this.getClass.getSimpleName)
.addConfigTransforms((_, config) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,11 @@ class AppManagerIntegrationTest extends IntegrationTestWithSharedEnvironment wit
.futureValue
inside(response) {
case _ if response.status == StatusCodes.OK =>
inside(Unmarshal(response.entity).to[String].value.value) { case Success(response) =>
response shouldBe s"""{"result":{"primaryParty":"${aliceValidatorBackend
.getValidatorPartyId()
.toProtoPrimitive}","userId":"${aliceValidatorBackend.config.ledgerApiUser}"},"status":200}"""
inside(Unmarshal(response.entity).to[String].value.value) {
case Success(successfullResponse) =>
successfullResponse shouldBe s"""{"result":{"primaryParty":"${aliceValidatorBackend
.getValidatorPartyId()
.toProtoPrimitive}","userId":"${aliceValidatorBackend.config.ledgerApiUser}"},"status":200}"""
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,42 +39,44 @@ class AppUpgradeIntegrationTest
private val splitwellDarPathCurrent =
"daml/splitwell/src/main/resources/dar/splitwell-current.dar"

override def environmentDefinition = EnvironmentDefinition
.simpleTopology4Svs(this.getClass.getSimpleName)
.withManualStart
// We don't currently register the upgrade of splitwell in app manager, just want to test
// that we can actually upgrade splitwell and use the new payment APIs in it.
.withoutInitialManagerApps
// TODO(#8300) Consider removing this once domain config updates are less disruptive, particularly
// to the tests after SVs 2 and 3 have been upgraded
.withSequencerConnectionsFromScanDisabled()
.addConfigTransform((_, config) => {
// Makes the test a bit faster and easier to debug. See #11488
ConfigTransforms.useDecentralizedSynchronizerSplitwell()(config)
})
.addConfigTransform((_, config) => {
config
.focus(_.validatorApps)
.modify(_.updatedWith(InstanceName.tryCreate("splitwellValidatorApp"))(_.map {
splitwellValidator =>
splitwellValidator
.focus(_.appInstances)
.modify(_.map {
case (n @ "splitwell", appInstance) =>
n -> appInstance
.focus(_.dars)
.modify(_.map { darPath =>
Paths.get(
darPath.toString.replace(
"current",
DarResources.splitwell_current.metadata.version.toString(),
override def environmentDefinition
: org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition =
EnvironmentDefinition
.simpleTopology4Svs(this.getClass.getSimpleName)
.withManualStart
// We don't currently register the upgrade of splitwell in app manager, just want to test
// that we can actually upgrade splitwell and use the new payment APIs in it.
.withoutInitialManagerApps
// TODO(#8300) Consider removing this once domain config updates are less disruptive, particularly
// to the tests after SVs 2 and 3 have been upgraded
.withSequencerConnectionsFromScanDisabled()
.addConfigTransform((_, config) => {
// Makes the test a bit faster and easier to debug. See #11488
ConfigTransforms.useDecentralizedSynchronizerSplitwell()(config)
})
.addConfigTransform((_, config) => {
config
.focus(_.validatorApps)
.modify(_.updatedWith(InstanceName.tryCreate("splitwellValidatorApp"))(_.map {
splitwellValidator =>
splitwellValidator
.focus(_.appInstances)
.modify(_.map {
case (n @ "splitwell", appInstance) =>
n -> appInstance
.focus(_.dars)
.modify(_.map { darPath =>
Paths.get(
darPath.toString.replace(
"current",
DarResources.splitwell_current.metadata.version.toString(),
)
)
)
})
case x => x
})
}))
})
})
case x => x
})
}))
})

"A set of Splice apps" should {
"be upgradeable" in { implicit env =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,7 @@ class DecentralizedSynchronizerMigrationIntegrationTest
// TODO (#10859) remove and fix test failures
override def walletAmuletPrice = SpliceUtil.damlDecimal(1.0)

// TODO(#15990) Re-enable this test
"migrate global domain to new nodes with downtime" ignore { implicit env =>
"migrate global domain to new nodes with downtime" in { implicit env =>
import env.environment.scheduler
import env.executionContext
val retryProvider = new RetryProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class DisabledWalletTimeBasedIntegrationTest
loggerFactory.assertLogsSeq(LevelAndAbove(Level.DEBUG))(
startAllSync(sv1Backend, sv1ValidatorBackend, sv1ScanBackend),
logs => {
inside(logs) { case logs =>
logs.exists(log =>
inside(logs) { case _logs =>
_logs.exists(log =>
log.loggerName.matches(
s".*${classOf[TreasuryService].getSimpleName}.*SV=sv1.*"
) || log.loggerName.matches(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class DisasterRecoveryIntegrationTest

override def dbsSuffix = "disaster_recovery"

override def usesDbs = {
override def usesDbs: IndexedSeq[String] = {
(1 to 4)
.map(i =>
Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class DockerComposeValidatorFrontendIntegrationTest
"-w",
"-p",
partyHint,
"-b",
) ++ startFlags).asJava
val builder = new ProcessBuilder(command)
extraEnv.foreach { case (k, v) => builder.environment().put(k, v) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ import scala.jdk.CollectionConverters.*
import scala.jdk.OptionConverters.*

// TODO(#14568) Merge this into ExternallySignedPartyOnboardingTest
// TODO(#15990) Re-enable this test
@org.scalatest.Ignore
class ExternalPartySetupProposalIntegrationTest
extends IntegrationTest
with HasExecutionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import java.util.UUID
import scala.collection.mutable
import scala.sys.process.{Process, ProcessLogger}

// TODO(#15990) Re-enable this test
@org.scalatest.Ignore
class ExternallySignedPartyOnboardingTest
extends IntegrationTest
with HasExecutionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ trait FrontendTestCommon extends TestCommon with WebBrowser with CustomMatchers
val traceParentRegEx =
raw".*\[([0-9a-zA-Z]{2}-[0-9a-zA-Z]{32}-[0-9a-zA-Z]{16}-[0-9a-zA-Z]{2})\]$$".r
msg match {
case traceParentRegEx(value) => TraceContext.fromW3CTraceParent(value)
case traceParentRegEx(traceParent) => TraceContext.fromW3CTraceParent(traceParent)
case _ => traceContext
}
}
Expand Down
Loading

0 comments on commit 966891a

Please sign in to comment.