Skip to content

Commit fa5453e

Browse files
committed
[ci] Merge remote-tracking branch 'origin/main' into isegall/version-bumps
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
2 parents 7abe018 + bb81cad commit fa5453e

File tree

50 files changed

+367
-1101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+367
-1101
lines changed

TESTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ There are two types of cluster tests that can be requested on a PR:
8181
- A Hard Migration test, which tests the full hard migration workflow on a scratch cluster.
8282

8383
To request a cluster test to be run on your PR, comment on your pr `/cluster_test` or `/hdm_test`
84-
for a basic test or a hard-migration test respectively. After commenting, reach out to the
85-
[Splice Contributors](CONTRIBUTORS.md) to approve and trigger the actual test on your behalf.
84+
for a basic test or a hard-migration test respectively. After commenting, the job needs to be approved to actually run.
85+
If you're a Digital Asset employee, you can self-approve; otherwise, contact an existing maintainer to approve it.
8686

8787
### Enabling the new Canton bft ordering layer
8888

apps/app/src/main/scala/org/lfdecentralizedtrust/splice/console/ScanAppReference.scala

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,6 @@ abstract class ScanAppReference(
249249
httpCommand(HttpScanAppClient.LookupFeaturedAppRight(providerPartyId))
250250
}
251251

252-
@Help.Summary("Get the total balance of Amulet in the network")
253-
def getTotalAmuletBalance(asOfEndOfRound: Long): Option[BigDecimal] =
254-
consoleEnvironment.run {
255-
httpCommand(HttpScanAppClient.GetTotalAmuletBalance(asOfEndOfRound))
256-
}
257-
258252
@Help.Summary("Get the Amulet config parameters for a given round")
259253
def getAmuletConfigForRound(
260254
round: Long
@@ -616,6 +610,21 @@ abstract class ScanAppReference(
616610
consoleEnvironment.run {
617611
httpCommand(HttpScanAppClient.LookupInstrument(instrumentId))
618612
}
613+
@Help.Summary(
614+
"Get the total amulet balance (total supply), automatically forces a new acs snapshot to get an up2date response"
615+
)
616+
def getTotalAmuletBalance(
617+
amuletName: String = getSpliceInstanceNames().amuletName
618+
): BigDecimal = {
619+
val _ = forceAcsSnapshotNow()
620+
lookupInstrument(amuletName)
621+
.flatMap(_.totalSupply.map(s => BigDecimal(s)))
622+
.getOrElse(
623+
throw new RuntimeException(
624+
s"'$amuletName' instrument not found or total supply not defined"
625+
)
626+
)
627+
}
619628

620629
def listInstruments() =
621630
consoleEnvironment.run {

apps/app/src/test/resources/include/scans/_scan.conf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@
4444
ttl = 1s
4545
max-size = 1
4646
}
47-
total-amulet-balance {
48-
ttl = 1s
49-
max-size = 1
50-
}
5147
amulet-rules {
5248
ttl = 1s
5349
max-size = 1
@@ -64,10 +60,6 @@
6460
ttl = 1s
6561
max-size = 1
6662
}
67-
wallet-balance {
68-
ttl = 1s
69-
max-size = 1
70-
}
7163
amulet-config-for-round {
7264
ttl = 1s
7365
max-size = 1

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/EnvironmentDefinition.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ import org.scalatest.{Inside, Inspectors, OptionValues}
4545
case class EnvironmentDefinition(
4646
override val baseConfig: SpliceConfig,
4747
override val testingConfig: TestingConfigInternal = TestingConfigInternal(),
48+
// preSetup and setup run *after* the apps have started, but before tests run.
49+
// preAppStart runs before the apps are started.
50+
preAppStart: SpliceTestConsoleEnvironment => Unit = _ => (),
4851
val preSetup: SpliceTestConsoleEnvironment => Unit = _ => (),
4952
val setup: SpliceTestConsoleEnvironment => Unit = _ => (),
5053
override val teardown: Unit => Unit = _ => (),
@@ -174,8 +177,7 @@ case class EnvironmentDefinition(
174177
participants: SpliceTestConsoleEnvironment => Seq[ParticipantClientReference]
175178
): EnvironmentDefinition = {
176179
copy(
177-
preSetup = implicit env => {
178-
this.preSetup(env)
180+
preAppStart = implicit env => {
179181
participants(env).foreach { p =>
180182
p.synchronizers.list_connected().foreach { connected =>
181183
val currentVettedPackages = p.topology.vetted_packages.list(
@@ -471,15 +473,17 @@ case class EnvironmentDefinition(
471473
override def createTestConsole(
472474
environment: SpliceEnvironment,
473475
loggerFactory: NamedLoggerFactory,
474-
): TestConsoleEnvironment[SpliceConfig, SpliceEnvironment] =
475-
new SpliceConsoleEnvironment(
476+
): TestConsoleEnvironment[SpliceConfig, SpliceEnvironment] = {
477+
val env = new SpliceConsoleEnvironment(
476478
environment,
477479
new TestConsoleOutput(loggerFactory),
478480
) with TestEnvironment[SpliceConfig] {
479481
override lazy val actorSystem = super[TestEnvironment].actorSystem
480482
override val actualConfig: SpliceConfig = this.environment.config
481-
482483
}
484+
this.preAppStart(env)
485+
env
486+
}
483487
}
484488

485489
object EnvironmentDefinition extends CommonAppInstanceReferences {

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/plugins/UpdateHistorySanityCheckPlugin.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ class UpdateHistorySanityCheckPlugin(
205205
"DEBUG",
206206
"--report-output",
207207
csvTempFile.toString,
208-
"--scan-balance-assertions",
209208
"--stop-at-record-time",
210209
snapshotRecordTime.toInstant.toString,
211210
"--compare-acs-with-snapshot",

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,16 +440,6 @@ class ScanFrontendTimeBasedIntegrationTest
440440
"Wait for round to close in scan",
441441
_ => sv1ScanBackend.getRoundOfLatestData()._1 shouldBe (firstRound + 1),
442442
)
443-
// We do not check the backend computation here, nor do we want to rely on the exact amulet balance created in other tests,
444-
// so here we simply test that:
445-
// The total balance increased as a result of our tap by the tap amount minus some amount to account for holding fees
446-
// The frontend shows the balance from the backend
447-
sv1ScanBackend
448-
.getTotalAmuletBalance(firstRound + 1)
449-
.valueOrFail("Amulet balance not yet computed") should
450-
(be > (sv1ScanBackend
451-
.getTotalAmuletBalance(firstRound)
452-
.valueOrFail("Amulet balance not yet computed") + 99.0))
453443

454444
withFrontEnd("scan-ui") { implicit webDriver =>
455445
actAndCheck(

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

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -689,29 +689,6 @@ class ScanIntegrationTest extends IntegrationTest with WalletTestUtil with TimeT
689689
}
690690
}
691691

692-
"getWalletBalance should return 400 for invalid party ID" in { implicit env =>
693-
implicit val sys = env.actorSystem
694-
registerHttpConnectionPoolsCleanup(env)
695-
696-
val response = Http()
697-
.singleRequest(
698-
Get(
699-
s"${sv1ScanBackend.httpClientConfig.url}/api/scan/v0/wallet-balance?party_id=None&asOfEndOfRound=0"
700-
)
701-
)
702-
.futureValue
703-
704-
inside(response) {
705-
case _ if response.status == StatusCodes.BadRequest =>
706-
inside(Unmarshal(response.entity).to[String].value.value) {
707-
case Success(successfullResponse) =>
708-
successfullResponse should include(
709-
"Invalid unique identifier `None` with missing namespace"
710-
)
711-
}
712-
}
713-
}
714-
715692
"getUpdateHistory should return 400 for invalid after timestamp" in { implicit env =>
716693
import env.{actorSystem, executionContext}
717694
registerHttpConnectionPoolsCleanup(env)

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

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -290,89 +290,6 @@ class ScanTimeBasedIntegrationTest
290290
)
291291
}
292292

293-
"get total amulet balance" in { implicit env =>
294-
val (_, _) = onboardAliceAndBob()
295-
296-
def roundNum() =
297-
sv1ScanBackend.getLatestOpenMiningRound(getLedgerTime).contract.payload.round.number
298-
roundNum() shouldBe (firstRound + 1)
299-
300-
val tapRound1Amount = BigDecimal(500.0)
301-
clue(s"Tap in round ${firstRound + 1}") {
302-
aliceWalletClient.tap(tapRound1Amount)
303-
}
304-
305-
advanceRoundsToNextRoundOpening
306-
307-
roundNum() shouldBe (firstRound + 2)
308-
309-
val tapRound2Amount = BigDecimal(500.0)
310-
clue(s"Tap in round ${firstRound + 2}") {
311-
bobWalletClient.tap(tapRound2Amount)
312-
}
313-
314-
actAndCheck(
315-
s"advance to close round ${firstRound + 2}",
316-
(0 to 4).foreach(_ => advanceRoundsToNextRoundOpening),
317-
)(
318-
s"check round ${firstRound + 2} is closed",
319-
_ => {
320-
sv1ScanBackend.automation.trigger[ScanAggregationTrigger].runOnce().futureValue
321-
sv1ScanBackend.getRoundOfLatestData()._1 shouldBe firstRound + 2
322-
sv1ScanBackend.getAggregatedRounds().value shouldBe ScanAggregator.RoundRange(
323-
firstRound + 0,
324-
firstRound + 2,
325-
)
326-
},
327-
)
328-
329-
clue(
330-
s"Get total balances for round ${firstRound + 0}, ${firstRound + 1} and ${firstRound + 2}"
331-
) {
332-
val total0 =
333-
sv1ScanBackend
334-
.getTotalAmuletBalance(firstRound + 0)
335-
.getOrElse(BigDecimal(0))
336-
val total1 =
337-
sv1ScanBackend
338-
.getTotalAmuletBalance(firstRound + 1)
339-
.getOrElse(BigDecimal(0))
340-
val total2 =
341-
sv1ScanBackend
342-
.getTotalAmuletBalance(firstRound + 2)
343-
.valueOrFail("Amulet balance not yet computed")
344-
345-
val holdingFeeAfterOneRound = 1 * defaultHoldingFeeAmulet
346-
val holdingFeeAfterTwoRounds = 2 * defaultHoldingFeeAmulet
347-
348-
total0 shouldBe 0.0
349-
total1 shouldBe (walletUsdToAmulet(tapRound1Amount) - holdingFeeAfterOneRound)
350-
total2 shouldBe (
351-
walletUsdToAmulet(tapRound1Amount) - holdingFeeAfterTwoRounds +
352-
walletUsdToAmulet(tapRound2Amount) - holdingFeeAfterOneRound
353-
)
354-
sv1ScanBackend.getAggregatedRounds().value shouldBe ScanAggregator.RoundRange(
355-
firstRound + 0,
356-
firstRound + 2,
357-
)
358-
sv1ScanBackend
359-
.listRoundTotals(firstRound + 0, firstRound + 2)
360-
.map(rt => (rt.closedRound, BigDecimal(rt.totalAmuletBalance))) shouldBe List(
361-
firstRound + 0L -> total0,
362-
firstRound + 1L -> total1,
363-
firstRound + 2L -> total2,
364-
)
365-
assertThrowsAndLogsCommandFailures(
366-
sv1ScanBackend.listRoundTotals(firstRound + 1, firstRound + 3),
367-
_.errorMessage should include("is outside of the available rounds range"),
368-
)
369-
assertThrowsAndLogsCommandFailures(
370-
sv1ScanBackend.listRoundPartyTotals(firstRound + 1, firstRound + 3),
371-
_.errorMessage should include("is outside of the available rounds range"),
372-
)
373-
}
374-
}
375-
376293
"Not get aggregates for incorrect ranges" in { implicit env =>
377294
clue("Try to get round totals for negative rounds") {
378295
val startRounds = List(-1L, 0L, -1L, 1L, -1L)

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

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import org.lfdecentralizedtrust.splice.config.ConfigTransforms.{
77
import org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition
88
import org.lfdecentralizedtrust.splice.integration.tests.SpliceTests.IntegrationTest
99
import org.lfdecentralizedtrust.splice.sv.automation.singlesv.LocalSequencerConnectionsTrigger
10-
import org.lfdecentralizedtrust.splice.util.SpliceUtil.defaultIssuanceCurve
1110
import org.lfdecentralizedtrust.splice.util.{SvTestUtil, TimeTestUtil, WalletTestUtil}
1211

1312
import scala.util.Try
@@ -139,39 +138,6 @@ class ScanWithGradualStartsTimeBasedIntegrationTest
139138
}
140139

141140
val validatorLivenessActivityRecordAmount = 2.85
142-
clue("Aggregated total amulet balance on both scan apps should match") {
143-
val svRewardPerRound =
144-
BigDecimal(
145-
computeSvRewardInRound0(
146-
defaultIssuanceCurve().initialValue,
147-
defaultTickDuration,
148-
dsoSize = 2,
149-
)
150-
)
151-
forEvery(
152-
Table(
153-
("round", "total floor", "total ceiling"),
154-
// Alice has 23 USD in Amulet, Bob has 3 USD, all minus holding fees
155-
(2L, walletUsdToAmulet(25.9), walletUsdToAmulet(26.0)),
156-
// sv2 did not start up it's validator app (thus wallet), so it won't claim any coupons.
157-
(
158-
3L,
159-
// validator liveness activity record: SV1, Alice, Bob
160-
walletUsdToAmulet(
161-
26.0 + validatorLivenessActivityRecordAmount * 3 - smallAmount
162-
) + svRewardPerRound,
163-
walletUsdToAmulet(26.0 + validatorLivenessActivityRecordAmount * 3) + svRewardPerRound,
164-
),
165-
)
166-
) { (round, floor, ceil) =>
167-
val total1 =
168-
sv1ScanBackend.getTotalAmuletBalance(round).valueOrFail("Amulet balance not yet computed")
169-
val total2 =
170-
sv2ScanBackend.getTotalAmuletBalance(round).valueOrFail("Amulet balance not yet computed")
171-
total1 shouldBe total2
172-
total1 should beWithin(floor, ceil)
173-
}
174-
}
175141

176142
clue("Aggregated rewards collected on both scan apps should match") {
177143
forEvery(

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,9 @@ class TokenStandardMetadataTimeBasedIntegrationTest
106106
)(
107107
"rounds are defined and include tapped amulet",
108108
_ => {
109-
val (roundNumber, _) = sv1ScanBackend.getRoundOfLatestData()
110-
val totalBalance = sv1ScanBackend
111-
.getTotalAmuletBalance(roundNumber)
112-
.getOrElse(fail("total balance not yet defined"))
109+
val totalBalance =
110+
sv1ScanBackend
111+
.getTotalAmuletBalance("Amulet")
113112
totalBalance should be >= walletUsdToAmulet(99.0)
114113
},
115114
)

0 commit comments

Comments
 (0)