Skip to content

Commit b93c2cf

Browse files
committed
Restrict amulet configs to not allow fees
[ci] Signed-off-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org> remove more unused code Signed-off-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
1 parent 22ed2d7 commit b93c2cf

File tree

59 files changed

+261
-761
lines changed

Some content is hidden

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

59 files changed

+261
-761
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
),
@@ -296,9 +295,6 @@ object ConfigTransforms {
296295
)
297296
)
298297

299-
def disableZeroFees(): ConfigTransform =
300-
updateAllSvAppFoundDsoConfigs_(c => c.copy(zeroTransferFees = false))
301-
302298
def updateAllValidatorAppConfigs(
303299
update: (String, ValidatorAppBackendConfig) => ValidatorAppBackendConfig
304300
): ConfigTransform =

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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ class BootstrapPackageConfigIntegrationTest extends IntegrationTest with Splitwe
360360
SpliceUtil.defaultTransferConfig(
361361
amuletConfig.transferConfig.maxNumInputs.toInt,
362362
amuletConfig.transferConfig.holdingFee.rate,
363-
zeroTransferFees = true,
364363
),
365364
amuletConfig.issuanceCurve,
366365
amuletConfig.decentralizedSynchronizer,

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/ScanFrontendTimeBasedIntegrationTest.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,15 @@ class ScanFrontendTimeBasedIntegrationTest
240240
"Check the initial amulet config matches the defaults",
241241
_ => {
242242
find(id("base-transfer-fee")).value.text should matchText(
243-
s"${SpliceUtil.defaultCreateFee.fee.doubleValue()} USD"
243+
s"0.0 USD"
244244
)
245245

246246
find(id("holding-fee")).value.text should matchText(
247247
s"${SpliceUtil.defaultHoldingFee.rate} USD/Round"
248248
)
249249

250250
find(id("lock-holder-fee")).value.text should matchText(
251-
s"${SpliceUtil.defaultLockHolderFee.fee.doubleValue()} USD"
251+
s"0.0 USD"
252252
)
253253

254254
find(id("round-tick-duration")).value.text should matchText {
@@ -259,7 +259,7 @@ class ScanFrontendTimeBasedIntegrationTest
259259

260260
findAll(className("transfer-fee-row")).toList
261261
.map(_.text)
262-
.zip(SpliceUtil.defaultTransferFee.steps.asScala.toList)
262+
.zip(SpliceUtil.zeroTransferFee.steps.asScala.toList)
263263
.foreach({
264264
case (txFeeRow, defaultStep) => {
265265
txFeeRow should include(defaultStep._1.setScale(0).toString)

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

Lines changed: 0 additions & 6 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]

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

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ import org.lfdecentralizedtrust.splice.console.WalletAppClientReference
1313
import org.lfdecentralizedtrust.splice.http.v0.definitions
1414
import org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition
1515
import org.lfdecentralizedtrust.splice.integration.tests.SpliceTests.IntegrationTest
16-
import org.lfdecentralizedtrust.splice.scan.admin.api.client.commands.HttpScanAppClient
1716
import org.lfdecentralizedtrust.splice.scan.automation.ScanAggregationTrigger
1817
import org.lfdecentralizedtrust.splice.scan.store.db.ScanAggregator
1918
import org.lfdecentralizedtrust.splice.store.UpdateHistory.BackfillingState
2019
import org.lfdecentralizedtrust.splice.util.*
2120
import org.lfdecentralizedtrust.splice.util.SpliceUtil.defaultAnsConfig
2221

2322
import java.time.Duration
24-
import scala.jdk.CollectionConverters.*
2523

2624
class ScanTimeBasedIntegrationTest
2725
extends IntegrationTest
@@ -80,26 +78,15 @@ class ScanTimeBasedIntegrationTest
8078
val cfg = eventuallySucceeds() {
8179
sv1ScanBackend.getAmuletConfigForRound(firstRound + 3)
8280
}
83-
cfg.amuletCreateFee.bigDecimal.setScale(10) should be(
84-
SpliceUtil.defaultCreateFee.fee divide walletAmuletPrice setScale 10
85-
)
81+
cfg.amuletCreateFee.bigDecimal.setScale(10) should be(BigDecimal(0).bigDecimal.setScale(10))
8682
cfg.holdingFee.bigDecimal.setScale(10) should be(
8783
SpliceUtil.defaultHoldingFee.rate divide walletAmuletPrice setScale 10
8884
)
89-
cfg.lockHolderFee.bigDecimal.setScale(10) should be(
90-
SpliceUtil.defaultLockHolderFee.fee divide walletAmuletPrice setScale 10
91-
)
85+
cfg.lockHolderFee.bigDecimal.setScale(10) should be(BigDecimal(0).bigDecimal.setScale(10))
9286
cfg.transferFee.initial.bigDecimal.setScale(10) should be(
93-
SpliceUtil.defaultTransferFee.initialRate.setScale(10)
94-
)
95-
cfg.transferFee.steps shouldBe (
96-
SpliceUtil.defaultTransferFee.steps.asScala.toSeq.map(step =>
97-
HttpScanAppClient.RateStep(
98-
step._1 divide walletAmuletPrice,
99-
step._2,
100-
)
101-
)
87+
SpliceUtil.zeroTransferFee.initialRate.setScale(10)
10288
)
89+
cfg.transferFee.steps shouldBe empty
10390
}
10491

10592
clue(s"Try to get config for round ${firstRound + 4} which does not yet exist") {

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,6 @@ class SvFrontendIntegrationTest
904904
// If we try to create two vote requests for identical configs,
905905
// the second request will be rejected with "This vote request has already been created."
906906
def submitSetAmuletConfigRequestViaBackend(
907-
createFee: String,
908907
holdingFee: String = "0.001",
909908
expiresSoon: Boolean,
910909
): Unit = {
@@ -918,7 +917,6 @@ class SvFrontendIntegrationTest
918917
defaultTickDuration,
919918
1000,
920919
holdingFee = BigDecimal(holdingFee),
921-
createFee = BigDecimal(createFee),
922920
)
923921
val setAmuletConfigAction: ActionRequiringConfirmation = new ARC_AmuletRules(
924922
new CRARC_SetConfig(
@@ -978,7 +976,7 @@ class SvFrontendIntegrationTest
978976

979977
actAndCheck(
980978
"sv1 operator creates a new vote request with a short expiration time", {
981-
submitSetAmuletConfigRequestViaBackend(createFee = "41", expiresSoon = true)
979+
submitSetAmuletConfigRequestViaBackend(expiresSoon = true)
982980
},
983981
)(
984982
"sv1 can see the new vote request in the progress tab",
@@ -988,7 +986,6 @@ class SvFrontendIntegrationTest
988986
val (_, requestId) = actAndCheck(
989987
"sv1 operator creates a new vote request with a long expiration time", {
990988
submitSetAmuletConfigRequestViaBackend(
991-
createFee = "0.03",
992989
holdingFee = "42",
993990
expiresSoon = false,
994991
)

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import org.lfdecentralizedtrust.splice.codegen.java.splice.api.token.metadatav1
88
import org.lfdecentralizedtrust.splice.codegen.java.splice.api.token.transferinstructionv1.TransferInstruction
99
import org.lfdecentralizedtrust.splice.config.ConfigTransforms.{
1010
ConfigurableApp,
11-
updateAllSvAppFoundDsoConfigs_,
1211
updateAutomationConfig,
1312
}
1413
import org.lfdecentralizedtrust.splice.http.v0.definitions.TransferInstructionResultOutput.members
@@ -51,11 +50,6 @@ class TokenStandardTransferIntegrationTest
5150
_.withPausedTrigger[CollectRewardsAndMergeAmuletsTrigger]
5251
)(config)
5352
)
54-
.addConfigTransforms((_, config) =>
55-
updateAllSvAppFoundDsoConfigs_(
56-
_.copy(zeroTransferFees = true)
57-
)(config)
58-
)
5953
}
6054

6155
"Token Standard Transfers should" should {

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ trait AmuletConfigUtil extends TestCommon {
3636
tickDuration: NonNegativeFiniteDuration,
3737
maxNumInputs: Int = 100,
3838
holdingFee: BigDecimal = SpliceUtil.defaultHoldingFee.rate,
39-
createFee: BigDecimal = SpliceUtil.defaultCreateFee.fee,
4039
)(implicit
4140
env: SpliceTests.SpliceTestConsoleEnvironment
4241
): splice.amuletconfig.AmuletConfig[splice.amuletconfig.USD] = {
@@ -45,9 +44,7 @@ trait AmuletConfigUtil extends TestCommon {
4544
val existingTransferConfig = existingAmuletConfig.transferConfig
4645
new splice.amuletconfig.AmuletConfig(
4746
new splice.amuletconfig.TransferConfig(
48-
new splice.fees.FixedFee(
49-
createFee.bigDecimal.setScale(10, BigDecimal.RoundingMode.HALF_EVEN).bigDecimal
50-
),
47+
existingTransferConfig.createFee,
5148
new splice.fees.RatePerRound(
5249
holdingFee.bigDecimal.setScale(10, BigDecimal.RoundingMode.HALF_EVEN).bigDecimal
5350
),

0 commit comments

Comments
 (0)