Skip to content

Commit 54c26e5

Browse files
canton-network-daDA Automation
andauthored
[ci] Update Splice from CCI (#446)
Signed-off-by: DA Automation <[email protected]> Co-authored-by: DA Automation <[email protected]>
1 parent edb2291 commit 54c26e5

File tree

35 files changed

+2518
-272
lines changed

35 files changed

+2518
-272
lines changed

.github/actions/sbt/upload_logs/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ runs:
2222
pigz -r log/* || true
2323
fi
2424
25+
- name: Move potential additional debugging artifacts to log directory
26+
shell: bash
27+
run: |
28+
mkdir -p log
29+
# When Java crashes, it sometimes saves an error report such as hs_err_pid*.log to the working directory.
30+
mv *.log log/ || true
31+
# Possible locations of core dumps (/ is apparently a default, but who knows)
32+
mv core* log/ || true
33+
mv /core* log/ || true
34+
2535
# Certain characters are disallowed in artifact filenames in GHA, so we need to sanitize them
2636
- name: Sanitize filenames
2737
# Runs in nix to have access to `rename`

LATEST_RELEASE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.0
1+
0.4.1

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.1
1+
0.4.2

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/AppUpgradeIntegrationTest.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ class AppUpgradeIntegrationTest
201201
spliceProcs.stopBundledSplice("sv2-node")
202202
startAllSync(sv2Backend, sv2ScanBackend, sv2ValidatorBackend)
203203
spliceProcs.stopBundledSplice("sv3-node")
204-
// No scan for sv3
205204
startAllSync(sv3Backend, sv3ScanBackend, sv3ValidatorBackend)
206205
}
207206

@@ -435,7 +434,7 @@ class AppUpgradeIntegrationTest
435434

436435
// SV4 can join after the upgrade.
437436
clue("SV4 can join after upgrade") {
438-
startAllSync(sv4Backend, sv4ValidatorBackend)
437+
startAllSync(sv4Backend, sv4ScanBackend, sv4ValidatorBackend)
439438
}
440439

441440
clue("Splitwell works") {
@@ -657,7 +656,8 @@ object AppUpgradeIntegrationTest {
657656
"SV1_URL" -> "http://127.0.0.1:5114",
658657
"SV1_SCAN_URL" -> "http://127.0.0.1:5012",
659658
"SV2_SCAN_URL" -> "http://127.0.0.1:5112",
660-
"SV3_SCAN_URL" -> "http://127.0.0.1:5112",
659+
"SV3_SCAN_URL" -> "http://127.0.0.1:5212",
660+
"SV4_SCAN_URL" -> "http://127.0.0.1:5312",
661661
).!
662662
if (result != 0) {
663663
throw new RuntimeException(s"Command $cmd returned: $result")

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/DecentralizedSynchronizerMigrationIntegrationTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ class DecentralizedSynchronizerMigrationIntegrationTest
10721072

10731073
val backfilledUpdates =
10741074
sv1ScanLocalBackend.appState.store.updateHistory
1075-
.getUpdates(None, includeImportUpdates = true, PageLimit.tryCreate(1000))
1075+
.getAllUpdates(None, PageLimit.tryCreate(1000))
10761076
.futureValue
10771077
backfilledUpdates.collect {
10781078
case TreeUpdateWithMigrationId(tree, migrationId)

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/ScanHistoryBackfillingIntegrationTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class ScanHistoryBackfillingIntegrationTest
284284

285285
sv2ScanBackend.appState.store.updateHistory
286286
.getBackfillingState()
287-
.futureValue should be(BackfillingState.InProgress)
287+
.futureValue should be(BackfillingState.InProgress(false, false))
288288
sv2ScanBackend.getBackfillingStatus().complete shouldBe false
289289
assertThrowsAndLogsCommandFailures(
290290
readUpdateHistoryFromScan(sv2ScanBackend),
@@ -500,7 +500,7 @@ class ScanHistoryBackfillingIntegrationTest
500500
private def allUpdatesFromScanBackend(scanBackend: ScanAppBackendReference) = {
501501
// Need to use the store directly, as the HTTP endpoint refuses to return data unless it's completely backfilled
502502
scanBackend.appState.store.updateHistory
503-
.getUpdates(None, includeImportUpdates = true, PageLimit.tryCreate(1000))
503+
.getAllUpdates(None, PageLimit.tryCreate(1000))
504504
.futureValue
505505
}
506506

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/SvTimeBasedRewardCouponIntegrationTest.scala

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import com.digitalasset.canton.topology.transaction.VettedPackage
3030
import com.digitalasset.daml.lf.data.Ref.PackageId
3131
import monocle.macros.syntax.lens.*
3232
import org.lfdecentralizedtrust.splice.integration.plugins.TokenStandardCliSanityCheckPlugin
33+
import org.lfdecentralizedtrust.splice.sv.config.SvOnboardingConfig.InitialPackageConfig
3334
import org.slf4j.event.Level
3435

3536
import scala.math.Ordering.Implicits.*
@@ -53,7 +54,7 @@ class SvTimeBasedRewardCouponIntegrationTest
5354
config
5455
.focus(_.svApps)
5556
.modify(_.map { case (name, svConfig) =>
56-
// sv4 gives part of its reward to alice
57+
// sv4 gives part of its reward to aliceValidator
5758
val newConfig = if (name.unwrap == "sv4") {
5859
val aliceParticipant =
5960
ConfigTransforms
@@ -82,13 +83,41 @@ class SvTimeBasedRewardCouponIntegrationTest
8283
_.withPausedTrigger[ReceiveFaucetCouponTrigger]
8384
)(config)
8485
)
86+
.addConfigTransforms((_, config) =>
87+
updateAutomationConfig(ConfigurableApp.Sv)(
88+
// needs to be disabled until alice has vetted the latest packages (to be checked at the beginning of the test)
89+
_.withPausedTrigger[ReceiveSvRewardCouponTrigger]
90+
)(config)
91+
)
8592
.withTrafficTopupsDisabled
8693

8794
private val feesUpperBoundCC = walletUsdToAmulet(smallAmount)
8895

8996
"SVs" should {
9097

9198
"receive and claim SvRewardCoupons" in { implicit env =>
99+
// ensure alice has vetted the latest packages
100+
val expectedVettedPackages = ReceiveSvRewardCouponTrigger.svLatestVettedPackages(
101+
InitialPackageConfig.defaultInitialPackageConfig.toPackageConfig
102+
)
103+
eventually() {
104+
val vettedByAlice =
105+
aliceValidatorBackend.participantClientWithAdminToken.topology.vetted_packages
106+
.list()
107+
.flatMap(
108+
_.item.packages.map(_.packageId)
109+
)
110+
forAll(expectedVettedPackages) { expectedPackage =>
111+
vettedByAlice should contain(expectedPackage)
112+
}
113+
}
114+
// now that we know that alice has vetted the latest packages, we can resume the trigger for the rest of the test
115+
Seq(sv1Backend, sv2Backend, sv3Backend, sv4Backend).foreach(
116+
_.dsoAutomation
117+
.trigger[ReceiveSvRewardCouponTrigger]
118+
.resume()
119+
)
120+
92121
val openRounds = eventually() {
93122
val openRounds = sv1ScanBackend
94123
.getOpenAndIssuingMiningRounds()

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/util/UpdateHistoryTestUtil.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ trait UpdateHistoryTestUtil extends TestCommon {
9595
updateHistoryFromParticipant(ledgerBegin, updateHistory.updateStreamParty, participant)
9696

9797
val recordedUpdates = updateHistory
98-
.getUpdates(
98+
.getAllUpdates(
9999
Some(
100100
(
101101
0L,
@@ -104,7 +104,6 @@ trait UpdateHistoryTestUtil extends TestCommon {
104104
actualUpdates.head.update.recordTime.addMicros(-1L),
105105
)
106106
),
107-
includeImportUpdates = true,
108107
PageLimit.tryCreate(actualUpdates.size),
109108
)
110109
.futureValue
@@ -139,9 +138,8 @@ trait UpdateHistoryTestUtil extends TestCommon {
139138
scanClient: ScanAppClientReference,
140139
): Assertion = {
141140
val historyFromStore = scanBackend.appState.store.updateHistory
142-
.getUpdates(
141+
.getAllUpdates(
143142
None,
144-
includeImportUpdates = true,
145143
PageLimit.tryCreate(1000),
146144
)
147145
.futureValue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- Only SVs that joined the network at any point in the initial migration have all import updates
2+
-- This statement was already part of the migration script V036__backfilling_import_updates.sql.
3+
-- It needs to be executed again because Scala code for backfilling import updates
4+
-- was reverted and re-applied between these two migrations.
5+
update update_history_backfilling as bf
6+
set import_updates_complete = true
7+
where
8+
bf.complete = true and
9+
bf.joining_migration_id = (
10+
select min(migration_id)
11+
from update_history_transactions as tx
12+
where bf.history_id = tx.history_id
13+
);

apps/common/src/main/scala/org/lfdecentralizedtrust/splice/store/HistoryBackfilling.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,20 @@ object HistoryBackfilling {
285285
* None if the given migration id is the beginning of known history.
286286
* @param recordTimeRange All domains that produced history items in the given migration id,
287287
* along with the record time of the newest and oldest history item associated with each domain.
288+
* @param lastImportUpdateId The id of the last import update (where import updates are sorted by update id)
289+
* for the given migration id, if any.
288290
* @param complete True if the backfilling for the given migration id is complete,
289291
* i.e., the history knows the first item for each domain in the given migration id.
290292
* We need this to decide when the backfilling is complete, because it might be difficult to
291293
* identify the first item of a migration otherwise.
294+
* @param importUpdatesComplete True if the import updates for the given migration id are complete.
292295
*/
293296
final case class SourceMigrationInfo(
294297
previousMigrationId: Option[Long],
295298
recordTimeRange: Map[SynchronizerId, DomainRecordTimeRange],
299+
lastImportUpdateId: Option[String],
296300
complete: Boolean,
301+
importUpdatesComplete: Boolean,
297302
)
298303

299304
/** Information about the point at which backfilling is currently inserting data.

apps/common/src/main/scala/org/lfdecentralizedtrust/splice/store/HistoryMetrics.scala

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,39 @@ class HistoryMetrics(metricsFactory: LabeledMetricsFactory)(implicit
102102
)(metricsContext)
103103
}
104104

105+
object ImportUpdatesBackfilling {
106+
private val importUpdatesBackfillingPrefix: MetricName = prefix :+ "import-updates-backfilling"
107+
108+
val latestMigrationId: Gauge[Long] =
109+
metricsFactory.gauge(
110+
MetricInfo(
111+
name = importUpdatesBackfillingPrefix :+ "latest-record-time",
112+
summary = "The migration id of the latest backfilled import update",
113+
Traffic,
114+
),
115+
initial = -1L,
116+
)(metricsContext)
117+
118+
val contractCount: Counter =
119+
metricsFactory.counter(
120+
MetricInfo(
121+
name = importUpdatesBackfillingPrefix :+ "contract-count",
122+
summary = "The number of contracts that have been backfilled",
123+
Traffic,
124+
)
125+
)(metricsContext)
126+
127+
val completed: Gauge[Int] =
128+
metricsFactory.gauge(
129+
MetricInfo(
130+
name = importUpdatesBackfillingPrefix :+ "completed",
131+
summary = "Whether it was completed (1) or not (0)",
132+
Debug,
133+
),
134+
initial = 0,
135+
)(metricsContext)
136+
}
137+
105138
object UpdateHistory {
106139
private val updateHistoryPrefix: MetricName = prefix :+ "updates"
107140

0 commit comments

Comments
 (0)