Skip to content

Commit a30125c

Browse files
committed
Restrict amulet configs to not allow fees
[ci] Signed-off-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
1 parent 46b6bfa commit a30125c

File tree

114 files changed

+1979
-4250
lines changed

Some content is hidden

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

114 files changed

+1979
-4250
lines changed

apps/app/src/main/scala/org/lfdecentralizedtrust/splice/config/ConfigTransforms.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ object ConfigTransforms {
196196
disableOnboardingParticipantPromotionDelay(),
197197
setDefaultGrpcDeadlineForBuyExtraTraffic(),
198198
setDefaultGrpcDeadlineForTreasuryService(),
199-
disableZeroFees(),
200199
updateAllAutomationConfigs(
201200
_.copy(rewardOperationRoundsCloseBufferDuration = NonNegativeFiniteDuration.ofMillis(100))
202201
),
@@ -297,9 +296,6 @@ object ConfigTransforms {
297296
)
298297
)
299298

300-
def disableZeroFees(): ConfigTransform =
301-
updateAllSvAppFoundDsoConfigs_(c => c.copy(zeroTransferFees = false))
302-
303299
def disableDevelopmentFund(): ConfigTransform =
304300
updateAllSvAppFoundDsoConfigs_(c => c.copy(developmentFundPercentage = Some(0.0)))
305301

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ class UpdateHistorySanityCheckPlugin(
234234
}
235235
if (lines.nonEmpty) {
236236
val message = s"${this.getClass} contains errors: $lines, exiting test."
237+
readLines.foreach(logger.warn(_))
237238
logger.error(message)
238239
System.err.println(message)
239240
sys.exit(1)

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class BootstrapPackageConfigIntegrationTest extends IntegrationTest with Splitwe
6161
override implicit val patienceConfig: PatienceConfig = PatienceConfig(scaled(Span(1, Minute)))
6262

6363
// Factored out so we can reuse it in the test
64-
val initialAmulet: DarResource = DarResources.amulet_0_1_10
64+
val initialAmulet: DarResource = DarResources.amulet_0_1_14
6565

6666
private val initialPackageConfig = InitialPackageConfig.minimumInitialPackageConfig
6767

@@ -227,8 +227,8 @@ class BootstrapPackageConfigIntegrationTest extends IntegrationTest with Splitwe
227227
DarResources.wallet.bootstrap.metadata.version.toString(),
228228
DarResources.walletPayments.bootstrap.metadata.version.toString(),
229229
),
230-
java.util.Optional.empty(),
231-
java.util.Optional.empty(),
230+
amuletConfig.transferPreapprovalFee,
231+
amuletConfig.featuredAppActivityMarkerAmount,
232232
java.util.Optional.empty(),
233233
)
234234

@@ -361,14 +361,13 @@ class BootstrapPackageConfigIntegrationTest extends IntegrationTest with Splitwe
361361
SpliceUtil.defaultTransferConfig(
362362
amuletConfig.transferConfig.maxNumInputs.toInt,
363363
amuletConfig.transferConfig.holdingFee.rate,
364-
zeroTransferFees = true,
365364
),
366365
amuletConfig.issuanceCurve,
367366
amuletConfig.decentralizedSynchronizer,
368367
amuletConfig.tickDuration,
369368
amuletConfig.packageConfig,
370-
java.util.Optional.empty(),
371-
java.util.Optional.empty(),
369+
amuletConfig.transferPreapprovalFee,
370+
amuletConfig.featuredAppActivityMarkerAmount,
372371
java.util.Optional.empty(),
373372
)
374373

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class BootstrapTest extends IntegrationTest {
2727
// We reduce the polling interval here primarily for the top-up trigger to ensure that a top-up happens as soon as
2828
// possible during the validator setup and other txs do not get throttled for want of traffic.
2929
.addConfigTransform((_, config) => ConfigTransforms.reducePollingInterval(config))
30-
.addConfigTransform((_, config) => ConfigTransforms.disableZeroFees()(config))
3130

3231
"Bootstrap script should pass" in { implicit env =>
3332
// the script logs errors when a ANS name check fails but then recovers from this

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

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class ExternalPartySetupProposalIntegrationTest
6666
override lazy val sanityChecksIgnoredRootCreates = Seq(
6767
TransferPreapproval.TEMPLATE_ID_WITH_PACKAGE_ID,
6868
amuletCodegen.AppRewardCoupon.TEMPLATE_ID_WITH_PACKAGE_ID,
69+
amuletCodegen.ValidatorRewardCoupon.TEMPLATE_ID_WITH_PACKAGE_ID,
6970
)
7071

7172
override def environmentDefinition: EnvironmentDefinition = {
@@ -282,9 +283,10 @@ class ExternalPartySetupProposalIntegrationTest
282283
aliceValidatorBackend
283284
.getExternalPartyBalance(aliceParty)
284285
.totalUnlockedCoin
285-
) should beAround(
286-
BigDecimal(2000 - 1000 - 16.0 - 6.0 /* 16 output fees, 6.0 sender change fees */ ) +
287-
BigDecimal(issuingRound.issuancePerUnfeaturedAppRewardCoupon) * appRewardAmount
286+
) should be(
287+
BigDecimal(1000) + BigDecimal(
288+
issuingRound.issuancePerUnfeaturedAppRewardCoupon
289+
) * appRewardAmount
288290
)
289291
bobValidatorBackend
290292
.getExternalPartyBalance(bobParty)
@@ -335,16 +337,26 @@ class ExternalPartySetupProposalIntegrationTest
335337
val update = eventuallySucceeds() {
336338
sv1ScanBackend.getUpdate(updateId, encoding = CompactJson)
337339
}
338-
val rewardRound =
339-
aliceValidatorBackend.participantClientWithAdminToken.ledger_api_extensions.acs
340-
.filterJava(amuletCodegen.ValidatorRewardCoupon.COMPANION)(
341-
aliceParty,
342-
c => c.data.user == aliceParty.toProtoPrimitive,
343-
)
344-
.loneElement
345-
.data
346-
.round
347-
.number
340+
// Create a validator reward to test reward minting
341+
val (_, rewardRound) = actAndCheck(
342+
"Create validator reward",
343+
createRewards(
344+
appRewards = Seq.empty,
345+
validatorRewards = Seq((aliceParty, BigDecimal(1.0))),
346+
),
347+
)(
348+
"reward is observable",
349+
_ =>
350+
aliceValidatorBackend.participantClientWithAdminToken.ledger_api_extensions.acs
351+
.filterJava(amuletCodegen.ValidatorRewardCoupon.COMPANION)(
352+
aliceParty,
353+
c => c.data.user == aliceParty.toProtoPrimitive,
354+
)
355+
.loneElement
356+
.data
357+
.round
358+
.number,
359+
)
348360

349361
actAndCheck(
350362
s"Advance rounds until $rewardRound is issuing", {
@@ -423,10 +435,10 @@ class ExternalPartySetupProposalIntegrationTest
423435
aliceValidatorBackend
424436
.getExternalPartyBalance(aliceParty)
425437
.totalUnlockedCoin
426-
) should beAround(
438+
) should be(
427439
BigDecimal(
428-
2000 - 1000 - 500 - 34.0 /* last number is fees from the prior transfer and this combined */
429-
)
440+
2000 - 1000 - 500
441+
) + BigDecimal(issuingRound.issuancePerUnfeaturedAppRewardCoupon) * appRewardAmount
430442
)
431443
bobValidatorBackend
432444
.getExternalPartyBalance(bobParty)
@@ -457,7 +469,7 @@ class ExternalPartySetupProposalIntegrationTest
457469
transfer.description shouldBe Some("transfer-command-description")
458470
forExactly(1, transfer.balanceChanges) { change =>
459471
change.party shouldBe aliceParty.toProtoPrimitive
460-
BigDecimal(change.changeToInitialAmountAsOfRoundZero) should beAround(BigDecimal(-517))
472+
BigDecimal(change.changeToInitialAmountAsOfRoundZero) should beAround(BigDecimal(-500))
461473
}
462474
forExactly(1, transfer.balanceChanges) { change =>
463475
change.party shouldBe bobParty.toProtoPrimitive

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class MultiHostValidatorOperatorIntegrationTest
193193
"The send succeeds despite alice's validator being disconnected and stopped",
194194
_ => {
195195
// Fees eat up quite a bit
196-
splitwellWalletClient.balance().unlockedQty should beWithin(47, 48)
196+
splitwellWalletClient.balance().unlockedQty should be(60)
197197
// Alice's wallet is stopped, so we confirm the transaction via scan
198198
sv1ScanBackend
199199
.listTransactions(

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,7 @@ class RecoverExternalPartyIntegrationTest
242242
bobValidatorBackend
243243
.getExternalPartyBalance(aliceParty)
244244
.totalUnlockedCoin
245-
) should beAround(
246-
BigDecimal(2000 - 1000 - 16.0 - 6.0 /* 16 output fees, 6.0 sender change fees */ )
247-
)
245+
) should be(BigDecimal(1000))
248246
},
249247
)
250248
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ class RewardExpiryIntegrationTest extends IntegrationTest with TriggerTestUtil {
4949

5050
// Exact config does not matter all that much, just want one that is older than the default versions
5151
// for at least the amulet package.
52-
val initialAmuletPackage = DarResources.amulet_0_1_10
52+
val initialAmuletPackage = DarResources.amulet_0_1_14
5353
private val initialPackageConfig = InitialPackageConfig(
5454
amuletVersion = initialAmuletPackage.metadata.version.toString,
5555
amuletNameServiceVersion = initialAmuletPackage.metadata.version.toString,
56-
dsoGovernanceVersion = "0.1.14",
57-
validatorLifecycleVersion = "0.1.4",
56+
dsoGovernanceVersion = "0.1.19",
57+
validatorLifecycleVersion = "0.1.5",
5858
walletVersion = initialAmuletPackage.metadata.version.toString,
5959
walletPaymentsVersion = initialAmuletPackage.metadata.version.toString,
6060
)

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

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import org.lfdecentralizedtrust.splice.codegen.java.splice.amuletrules.{
88
AmuletRules,
99
AmuletRules_SetConfig,
1010
}
11+
import org.lfdecentralizedtrust.splice.codegen.java.splice.amulet.{
12+
AppRewardCoupon,
13+
ValidatorRewardCoupon,
14+
}
1115
import org.lfdecentralizedtrust.splice.codegen.java.splice.dsorules.actionrequiringconfirmation.ARC_AmuletRules
1216
import org.lfdecentralizedtrust.splice.codegen.java.splice.dsorules.amuletrules_actionrequiringconfirmation.CRARC_SetConfig
1317
import org.lfdecentralizedtrust.splice.config.ConfigTransforms.{
@@ -23,7 +27,6 @@ import spray.json.DefaultJsonProtocol.StringJsonFormat
2327

2428
import java.time.{Duration, Instant}
2529
import scala.concurrent.Future
26-
import scala.jdk.CollectionConverters.*
2730

2831
class ScanFrontendTimeBasedIntegrationTest
2932
extends FrontendIntegrationTestWithSharedEnvironment("scan-ui")
@@ -58,9 +61,15 @@ class ScanFrontendTimeBasedIntegrationTest
5861

5962
private def stripTrailingZeros(num: BigDecimal) = BigDecimal(num.bigDecimal.stripTrailingZeros())
6063

64+
override protected lazy val sanityChecksIgnoredRootCreates = Seq(
65+
AppRewardCoupon.TEMPLATE_ID_WITH_PACKAGE_ID,
66+
ValidatorRewardCoupon.TEMPLATE_ID_WITH_PACKAGE_ID,
67+
)
68+
6169
"A scan UI" should {
6270
"see expected rewards leaderboards" in { implicit env =>
63-
val (_, bobUserParty) = onboardAliceAndBob()
71+
val (aliceUserParty, bobUserParty) = onboardAliceAndBob()
72+
val aliceValidatorParty = aliceValidatorBackend.getValidatorPartyId()
6473

6574
waitForWalletUser(aliceValidatorWalletClient)
6675
waitForWalletUser(bobValidatorWalletClient)
@@ -69,19 +78,20 @@ class ScanFrontendTimeBasedIntegrationTest
6978
// right in the transfer contexts of its submissions. We leave it here to test that it has no effect.
7079
grantFeaturedAppRight(aliceValidatorWalletClient)
7180

72-
clue("Tap to get some amulets") {
73-
aliceWalletClient.tap(500.0)
74-
aliceValidatorWalletClient.tap(100.0)
75-
}
76-
7781
clue(
78-
s"Feature alice's validator and transfer some Amulet, to generate reward coupons"
82+
s"Create some rewards"
7983
)({
80-
p2pTransfer(aliceWalletClient, bobWalletClient, bobUserParty, 40.0)
84+
createRewards(
85+
appRewards = Seq((aliceValidatorParty, 0.415, false)),
86+
validatorRewards = Seq((aliceUserParty, 0.415)),
87+
)
8188
advanceRoundsToNextRoundOpening
8289
advanceRoundsToNextRoundOpening
8390
advanceRoundsToNextRoundOpening
84-
p2pTransfer(aliceValidatorWalletClient, bobWalletClient, bobUserParty, 10.0)
91+
createRewards(
92+
appRewards = Seq((aliceValidatorParty, 0.115, false)),
93+
validatorRewards = Seq((aliceValidatorParty, 0.115)),
94+
)
8595
})
8696

8797
clue("Advance rounds to collect rewards") {
@@ -239,32 +249,15 @@ class ScanFrontendTimeBasedIntegrationTest
239249
actAndCheck("Go to Scan UI main page", go to s"http://localhost:${scanUIPort}")(
240250
"Check the initial amulet config matches the defaults",
241251
_ => {
242-
find(id("base-transfer-fee")).value.text should matchText(
243-
s"${SpliceUtil.defaultCreateFee.fee.doubleValue()} USD"
244-
)
245-
246252
find(id("holding-fee")).value.text should matchText(
247253
s"${SpliceUtil.defaultHoldingFee.rate} USD/Round"
248254
)
249255

250-
find(id("lock-holder-fee")).value.text should matchText(
251-
s"${SpliceUtil.defaultLockHolderFee.fee.doubleValue()} USD"
252-
)
253-
254256
find(id("round-tick-duration")).value.text should matchText {
255257
// the `.toMinutes` method rounds down to 0
256258
val minutes = BigDecimal(defaultTickDuration.duration.toSeconds) / 60
257259
s"${minutes.bigDecimal.stripTrailingZeros.toPlainString} Minutes"
258260
}
259-
260-
findAll(className("transfer-fee-row")).toList
261-
.map(_.text)
262-
.zip(SpliceUtil.defaultTransferFee.steps.asScala.toList)
263-
.foreach({
264-
case (txFeeRow, defaultStep) => {
265-
txFeeRow should include(defaultStep._1.setScale(0).toString)
266-
}
267-
})
268261
},
269262
)
270263
}

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import org.lfdecentralizedtrust.splice.codegen.java.splice.round.OpenMiningRound
1717
import org.lfdecentralizedtrust.splice.config.ConfigTransforms
1818
import org.lfdecentralizedtrust.splice.config.ConfigTransforms.{
1919
ConfigurableApp,
20-
updateAllSvAppFoundDsoConfigs_,
2120
updateAutomationConfig,
2221
}
2322
import org.lfdecentralizedtrust.splice.http.v0.definitions.{
@@ -51,11 +50,6 @@ class ScanIntegrationTest extends IntegrationTest with WalletTestUtil with TimeT
5150
override def environmentDefinition: SpliceEnvironmentDefinition =
5251
EnvironmentDefinition
5352
.simpleTopology1Sv(this.getClass.getSimpleName)
54-
.addConfigTransforms((_, config) =>
55-
updateAllSvAppFoundDsoConfigs_(
56-
_.copy(zeroTransferFees = true)
57-
)(config)
58-
)
5953
.addConfigTransforms((_, config) =>
6054
(updateAutomationConfig(ConfigurableApp.Validator)(
6155
_.withPausedTrigger[CollectRewardsAndMergeAmuletsTrigger]
@@ -638,7 +632,7 @@ class ScanIntegrationTest extends IntegrationTest with WalletTestUtil with TimeT
638632
// TODO(DACH-NY/canton-network-node#13038) Add asserts back for listValidatorRewardCoupons
639633
// replace _ with validatorRewardAmount
640634
val (appRewardAmount, _) =
641-
getRewardCouponsValue(appRewardCoupons, validatorRewardCoupons, featured = false)
635+
getRewardCouponsValue(appRewardCoupons, validatorRewardCoupons)
642636

643637
clue("Checking app and validator reward and faucet amounts") {
644638
eventually() {

0 commit comments

Comments
 (0)