Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,9 @@ class LsuIntegrationTest
inside(sv1ScanBackend.listDsoSequencers()) {
case Seq(DomainSequencers(synchronizerId, sequencers)) =>
synchronizerId shouldBe decentralizedSynchronizerId
sequencers should have size 8
sequencers should have size 4
sequencers.foreach { sequencer =>
sequencer.serial match {
case Some(serial) =>
serial shouldBe 0
sequencer.migrationId shouldBe -1
case None =>
sequencer.migrationId shouldBe 0
}
sequencer.serial shouldBe 0
}
}
}
Expand Down Expand Up @@ -548,22 +542,16 @@ class LsuIntegrationTest
inside(sv1ScanBackend.listDsoSequencers()) {
case Seq(DomainSequencers(synchronizerId, sequencers)) =>
synchronizerId shouldBe decentralizedSynchronizerId
sequencers should have size 11
sequencers should have size 7
sequencers.groupBy(_.svName).foreach { case (sv, sequencers) =>
clue(s"check sequencers for $sv") {
forExactly(1, sequencers) { sequencer =>
sequencer.serial.value shouldBe 0
sequencer.migrationId shouldBe -1
sequencer.serial shouldBe 0
}
if (sv != sv4Backend.config.onboarding.value.name)
forExactly(1, sequencers) { sequencer =>
sequencer.serial.value shouldBe newSynchronizerSerial.value.toLong
sequencer.migrationId shouldBe -1
sequencer.serial shouldBe newSynchronizerSerial.value.toLong
}
forExactly(1, sequencers) { sequencer =>
sequencer.serial should be(empty)
sequencer.migrationId shouldBe 0
}
}
}
}
Expand Down Expand Up @@ -764,11 +752,9 @@ class LsuIntegrationTest
.listDsoSequencers()
.loneElement
.sequencers
.filter(c =>
c.svName == sv1LocalBackend.config.onboarding.value.name && c.serial.isDefined
)
.filter(c => c.svName == sv1LocalBackend.config.onboarding.value.name)
.loneElement
.serial shouldBe Some(2),
.serial shouldBe 2,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,21 +393,15 @@ class RollForwardLsuDRIntegrationTest
inside(sv1ScanLocalBackend.listDsoSequencers()) {
case Seq(DomainSequencers(synchronizerId, sequencers)) =>
synchronizerId shouldBe decentralizedSynchronizerId
sequencers should have size 12
sequencers should have size 8
sequencers.groupBy(_.svName).foreach { case (sv, sequencers) =>
clue(s"check sequencers for $sv") {
sequencers.size shouldBe 3
sequencers.size shouldBe 2
forExactly(1, sequencers) { sequencer =>
sequencer.serial.value shouldBe 0
sequencer.migrationId shouldBe -1
sequencer.serial shouldBe 0
}
forExactly(1, sequencers) { sequencer =>
sequencer.serial.value shouldBe newSynchronizerSerial.value.toLong
sequencer.migrationId shouldBe -1
}
forExactly(1, sequencers) { sequencer =>
sequencer.serial should be(empty)
sequencer.migrationId shouldBe 0
sequencer.serial shouldBe newSynchronizerSerial.value.toLong
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,7 @@ class RollForwardLsuIntegrationTest
synchronizerId shouldBe decentralizedSynchronizerId
sequencers should have size 8
sequencers.foreach { sequencer =>
sequencer.serial match {
case Some(serial) =>
serial shouldBe 0
sequencer.migrationId shouldBe -1
case None =>
sequencer.migrationId shouldBe 0
}
sequencer.serial shouldBe 0
}
}
}
Expand All @@ -211,7 +205,7 @@ class RollForwardLsuIntegrationTest
clue("Topology state contains LSU announcement") {
eventually(3.minutes) {
sv1ScanBackend.participantClient.topology.lsu.announcement
.list(Some(decentralizedSynchronizerId)) should have size (1)
.list(Some(decentralizedSynchronizerId)) should have size 1
}
}
val allSvBackends = Seq(sv1Backend, sv2Backend, sv3Backend, sv4Backend)
Expand Down Expand Up @@ -349,21 +343,15 @@ class RollForwardLsuIntegrationTest
inside(sv1ScanLocalBackend.listDsoSequencers()) {
case Seq(DomainSequencers(synchronizerId, sequencers)) =>
synchronizerId shouldBe decentralizedSynchronizerId
sequencers should have size 12
sequencers should have size 8
sequencers.groupBy(_.svName).foreach { case (sv, sequencers) =>
clue(s"check sequencers for $sv") {
sequencers.size shouldBe 3
forExactly(1, sequencers) { sequencer =>
sequencer.serial.value shouldBe 0
sequencer.migrationId shouldBe -1
}
forExactly(1, sequencers) { sequencer =>
sequencer.serial.value shouldBe newSynchronizerSerial.value.toLong
sequencer.migrationId shouldBe -1
sequencer.serial shouldBe 0
}
forExactly(1, sequencers) { sequencer =>
sequencer.serial should be(empty)
sequencer.migrationId shouldBe 0
sequencer.serial shouldBe newSynchronizerSerial.value.toLong
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,6 @@ class SvInitializationIntegrationTest extends SvIntegrationTestBase {
"http://localhost:5408",
)
}
clue("backwards compatible synchronizers configs is set") {
val allSequencerConfigs = nodeStates.map(_.sequencer.toScala.value)
allSequencerConfigs.size shouldBe 4
allSequencerConfigs.map(_.migrationId).toSeq.distinct.loneElement shouldBe java.lang.Long
.valueOf(0)
allSequencerConfigs.map(_.url) should contain theSameElementsAs Seq(
"http://localhost:5108",
"http://localhost:5208",
"http://localhost:5308",
"http://localhost:5408",
)
}
} finally {
// Remove the sequencer again, otherwise the logic for resetting the namespace to only contain
// sv1 will fail.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import scala.concurrent.{ExecutionContext, Future}
import org.lfdecentralizedtrust.splice.store.AppStoreWithIngestion.SpliceLedgerConnectionPriority.Low
import org.lfdecentralizedtrust.splice.codegen.java.splice.dso.decentralizedsynchronizer.{
PhysicalSynchronizerNodeConfig,
SequencerConfig,
SequencerConnectionConfig,
SynchronizerNodeConfig,
}
Expand Down Expand Up @@ -84,7 +83,7 @@ class ValidatorSequencerConnectionIntegrationTest
val now = env.environment.clock.now
val availableSequencers = for {
domain <- allSequencers
sequencer <- domain.sequencers.filter(_.serial.isDefined)
sequencer <- domain.sequencers
if sequencer.url.nonEmpty && !now.toInstant.isBefore(sequencer.availableAfter)
} yield sequencer
availableSequencers.size shouldBe 4
Expand Down Expand Up @@ -219,24 +218,12 @@ class ValidatorSequencerConnectionIntegrationTest
sys.error(s"No config found for synchronizer $synchronizerId"),
)

existingSequencerConfig = synchronizerNodeConfig.sequencer.toScala
.getOrElse(
sys.error(s"No sequencer config found for synchronizer $synchronizerId")
)

updatedSequencerConfig = new SequencerConfig(
existingSequencerConfig.migrationId,
existingSequencerConfig.sequencerId,
newUrl,
existingSequencerConfig.availableAfter,
)

newNodeConfig = new SynchronizerNodeConfig(
synchronizerNodeConfig.cometBft,
Some(updatedSequencerConfig).toJava,
None.toJava,
synchronizerNodeConfig.mediator,
synchronizerNodeConfig.scan,
synchronizerNodeConfig.legacySequencerConfig,
None.toJava,
synchronizerNodeConfig.sequencerIdentity,
synchronizerNodeConfig.physicalSynchronizers.toScala
.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class RunbookSvSequencerInfoPreflightIntegrationTest extends IntegrationTest {
}
val nodeState: SvNodeState = dsoInfo.svNodeStates.get(dsoInfo.svParty).value.payload
val domainConfig = nodeState.state.synchronizerNodes.asScala.values.headOption.value
val sequencerUrl = domainConfig.physicalSynchronizers.toScala
.flatMap(_.asScala.get(migrationId).flatMap(_.sequencer.toScala.map(_.url)))
.orElse(domainConfig.sequencer.toScala.filter(_.migrationId == migrationId).map(_.url))
.value
sequencerUrl shouldBe s"https://sequencer-$migrationId.sv.${sys.env("NETWORK_APPS_ADDRESS")}"
val sequencerUrls = domainConfig.physicalSynchronizers.toScala.toList
.flatMap(_.asScala.values.flatMap(_.sequencer.toScala.map(_.url)))
sequencerUrls should contain(
s"https://sequencer-$migrationId.sv.${sys.env("NETWORK_APPS_ADDRESS")}"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -464,19 +464,12 @@ abstract class ValidatorPreflightIntegrationTestBase
env.environment.clock.now.toInstant.isAfter(connection.availableAfter.plusSeconds(60))
}

val availableConnections = if (connections.forall(_.serial.isEmpty)) {
val latestMigrationId = connections.map(_.migrationId).max
connections.filter(connection =>
connection.migrationId == latestMigrationId &&
connection.url != "" &&
isAvailable(connection)
)
} else {
connections.filter(connection =>
connection.serial.contains(migrationId) &&
isAvailable(connection)
)
}
val latestSerial = connections.map(_.serial).max
val availableConnections = connections.filter(connection =>
connection.serial == latestSerial &&
connection.url != "" &&
isAvailable(connection)
)
val (expectedSequencerConnections, _) =
Endpoint
.fromUris(NonEmpty.from(availableConnections.map(conn => new URI(conn.url))).value)
Expand Down Expand Up @@ -633,10 +626,12 @@ class RunbookValidatorPreflightIntegrationTest extends ValidatorPreflightIntegra
val synchronizerNodeConfig =
nodeState.state.synchronizerNodes.asScala.values.headOption.value
val svSequencerUrl = synchronizerNodeConfig.physicalSynchronizers.toScala
.flatMap(_.asScala.get(migrationId).flatMap(_.sequencer.map(_.url).toScala))
.getOrElse(
synchronizerNodeConfig.sequencer.toScala.value.url
.flatMap(
_.asScala.toSeq
.maxByOption(_._1.longValue())
.flatMap(_._2.sequencer.map(_.url).toScala)
)
.value
val (svSequencerEndpoint, _) = Endpoint
.fromUris(
NonEmpty.from(Seq(new URI(svSequencerUrl))).value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,6 @@ trait PackageVersionSupport extends NamedLogging {
)
}

// TODO(#564) - ensure the right version is used
def supportsPhysicalSynchronizers(parties: Seq[PartyId], now: CantonTimestamp)(implicit
tc: TraceContext
): Future[FeatureSupport] = {
isDarSupported(
parties,
PackageIdResolver.Package.SpliceDsoGovernance,
now,
DarResources.dsoGovernance,
DarResources.dsoGovernance_0_1_24,
)
}

def supportsTrafficBasedAppRewards(parties: Seq[PartyId], now: CantonTimestamp)(implicit
tc: TraceContext
): Future[FeatureSupport] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,15 +784,16 @@ object HttpScanAppClient {
Codec.decode(Codec.SynchronizerId)(domain.domainId).flatMap { synchronizerId =>
domain.sequencers
.traverse { s =>
Codec.decode(Codec.Sequencer)(s.id).map { sequencerId =>
DsoSequencer(
s.migrationId,
s.synchronizerSerial,
sequencerId,
s.url,
s.svName,
s.availableAfter.toInstant,
)
Codec.decode(Codec.Sequencer)(s.id).flatMap { sequencerId =>
s.synchronizerSerial.toRight("No serial provided").map { serial =>
DsoSequencer(
serial,
sequencerId,
s.url,
s.svName,
s.availableAfter.toInstant,
)
}
}
}
.map { sequencers =>
Expand All @@ -806,8 +807,7 @@ object HttpScanAppClient {
final case class DomainSequencers(synchronizerId: SynchronizerId, sequencers: Seq[DsoSequencer])

final case class DsoSequencer(
migrationId: Long,
serial: Option[Long],
serial: Long,
id: SequencerId,
url: String,
svName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package org.lfdecentralizedtrust.splice.sv.lsu

import cats.implicits.{catsSyntaxOptionId, showInterpolator, toTraverseOps}
import cats.implicits.{showInterpolator, toTraverseOps}
import com.digitalasset.canton.admin.api.client.data.NodeStatus
import com.digitalasset.canton.data.CantonTimestamp
import com.digitalasset.canton.logging.pretty.{Pretty, PrettyPrinting}
Expand Down Expand Up @@ -170,7 +170,7 @@ class LsuTrigger(
Future.unit
}
_ <- reconciler.reconcileSynchronizerNodeConfigIfRequired(
localSynchronizerNodes.some,
localSynchronizerNodes,
currentPsid.logical,
OnboardedImmediately,
)
Expand Down
Loading
Loading