Skip to content
Closed
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 @@ -200,6 +200,7 @@ object ConfigTransforms {
updateAllAutomationConfigs(
_.copy(rewardOperationRoundsCloseBufferDuration = NonNegativeFiniteDuration.ofMillis(100))
),
disableDevelopmentFund(),
)
}

Expand Down Expand Up @@ -299,6 +300,9 @@ object ConfigTransforms {
def disableZeroFees(): ConfigTransform =
updateAllSvAppFoundDsoConfigs_(c => c.copy(zeroTransferFees = false))

def disableDevelopmentFund(): ConfigTransform =
updateAllSvAppFoundDsoConfigs_(c => c.copy(developmentFundPercentage = Some(0.0)))

def updateAllValidatorAppConfigs(
update: (String, ValidatorAppBackendConfig) => ValidatorAppBackendConfig
): ConfigTransform =
Expand Down Expand Up @@ -718,6 +722,9 @@ object ConfigTransforms {
}
}

def withDevelopmentFundPercentage(percentage: BigDecimal): ConfigTransform =
updateAllSvAppFoundDsoConfigs_(c => c.copy(developmentFundPercentage = Some(percentage)))

private def portTransform(bump: Int, c: AdminServerConfig): AdminServerConfig =
c.copy(internalPort = c.internalPort.map(_ + bump))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class AppUpgradeIntegrationTest
),
java.util.Optional.empty(),
java.util.Optional.empty(),
java.util.Optional.empty(),
)
val upgradeAction = new ARC_AmuletRules(
new CRARC_SetConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ class BootstrapPackageConfigIntegrationTest extends IntegrationTest with Splitwe
),
java.util.Optional.empty(),
java.util.Optional.empty(),
java.util.Optional.empty(),
)

val upgradeAction = new ARC_AmuletRules(
Expand Down Expand Up @@ -368,6 +369,7 @@ class BootstrapPackageConfigIntegrationTest extends IntegrationTest with Splitwe
amuletConfig.packageConfig,
java.util.Optional.empty(),
java.util.Optional.empty(),
java.util.Optional.empty(),
)

val upgradeAction = new ARC_AmuletRules(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package org.lfdecentralizedtrust.splice.integration.tests

import com.digitalasset.canton.config.NonNegativeFiniteDuration
import org.lfdecentralizedtrust.splice.codegen.java.splice.amulet.UnclaimedDevelopmentFundCoupon
import org.lfdecentralizedtrust.splice.config.ConfigTransforms
import org.lfdecentralizedtrust.splice.config.ConfigTransforms.{
ConfigurableApp,
updateAutomationConfig,
}
import org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition
import org.lfdecentralizedtrust.splice.sv.automation.delegatebased.AdvanceOpenMiningRoundTrigger
import org.lfdecentralizedtrust.splice.util.{TriggerTestUtil, WalletTestUtil}

@org.lfdecentralizedtrust.splice.util.scalatesttags.SpliceDsoGovernance_0_1_21
class DevelopmentFundCouponIntegrationTest
extends SvIntegrationTestBase
with TriggerTestUtil
with WalletTestUtil {

private val threshold = 3

override def environmentDefinition
: org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition =
EnvironmentDefinition
.simpleTopology1Sv(this.getClass.getSimpleName)
.addConfigTransforms((_, config) =>
updateAutomationConfig(ConfigurableApp.Sv)(
_.withPausedTrigger[AdvanceOpenMiningRoundTrigger]
)(config)
)
.addConfigTransform((_, config) =>
ConfigTransforms.updateInitialTickDuration(NonNegativeFiniteDuration.ofMillis(500))(config)
)
.addConfigTransforms((_, config) =>
ConfigTransforms.updateAllSvAppConfigs_(
_.copy(
unclaimedDevelopmentFundCouponsThreshold = threshold
)
)(config)
)
.addConfigTransform((_, config) =>
ConfigTransforms.withDevelopmentFundPercentage(0.05)(config)
)

"UnclaimedDevelopmentFundCoupons are merged" in { implicit env =>
val (_, couponAmount) = actAndCheck(
"Advance 5 rounds", {
Range(0, 5).foreach(_ => advanceRoundsByOneTickViaAutomation())
},
)(
"5 UnclaimedDevelopmentFundCoupons are created, and the trigger does not merge the coupons, " +
"as it only acts when the number of coupons is ≥ 2 × threshold",
_ => {
val coupons = sv1Backend.participantClient.ledger_api_extensions.acs
.filterJava(UnclaimedDevelopmentFundCoupon.COMPANION)(dsoParty)
coupons.size shouldBe 5
coupons.head.data.amount
},
)

actAndCheck(
"Advance one round to create one more UnclaimedDevelopmentFundCoupon, reaching 2 × threshold coupons",
advanceRoundsByOneTickViaAutomation(),
)(
"The MergeUnclaimedDevelopmentFundCouponsTrigger is triggered and merges the smallest three coupons (threshold), " +
"while keeping the remaining coupons unchanged.",
_ => {
sv1Backend.participantClient.ledger_api_extensions.acs
.filterJava(UnclaimedDevelopmentFundCoupon.COMPANION)(dsoParty)
.map(_.data.amount)
.sorted shouldBe Seq(
couponAmount,
couponAmount,
couponAmount,
couponAmount.multiply(new java.math.BigDecimal(3)),
)
},
)

actAndCheck(
"Advance two rounds to create two more UnclaimedDevelopmentFundCoupon, " +
"reaching 2 × threshold coupons and triggering a second merge",
Range(0, 2).foreach(_ => advanceRoundsByOneTickViaAutomation()),
)(
"The MergeUnclaimedDevelopmentFundCouponsTrigger merges the `threshold` smallest coupons",
_ => {
sv1Backend.participantClient.ledger_api_extensions.acs
.filterJava(UnclaimedDevelopmentFundCoupon.COMPANION)(dsoParty)
.map(_.data.amount)
.sorted shouldBe Seq(
couponAmount,
couponAmount,
couponAmount.multiply(new java.math.BigDecimal(3)),
couponAmount.multiply(new java.math.BigDecimal(3)),
)
},
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DisabledWalletTimeBasedIntegrationTest
val expectedMinAmount =
BigDecimal(
computeSvRewardInRound0(
defaultIssuanceCurve.initialValue,
defaultIssuanceCurve().initialValue,
defaultTickDuration,
dsoSize = 1,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class ScanWithGradualStartsTimeBasedIntegrationTest
val svRewardPerRound =
BigDecimal(
computeSvRewardInRound0(
defaultIssuanceCurve.initialValue,
defaultIssuanceCurve().initialValue,
defaultTickDuration,
dsoSize = 2,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1422,8 +1422,11 @@ class SvFrontendIntegrationTest
}

"NEW UI: Set Amulet Rules Configuration" in { implicit env =>
assertCreateProposal("CRARC_SetConfig", "set-amulet-config-rules") { _ =>
// Config fields default to current values, no extra form operations needed
assertCreateProposal("CRARC_SetConfig", "set-amulet-config-rules") { implicit webDriver =>
inside(find(testId("config-field-transferConfigCreateFee"))) { case Some(element) =>
element.underlying.clear()
element.underlying.sendKeys("42.0")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class SvReconcileSynchronizerConfigIntegrationTest extends SvIntegrationTestBase
amuletConfig.packageConfig,
java.util.Optional.empty(),
java.util.Optional.empty(),
java.util.Optional.empty(),
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ class SvStateManagementIntegrationTest extends SvIntegrationTestBase with Trigge
initialConfig.packageConfig,
java.util.Optional.empty(),
java.util.Optional.empty(),
java.util.Optional.empty(),
)

val (_, voteRequestCid) = actAndCheck(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class SvTimeBasedRewardCouponIntegrationTest
}

val eachSvGetInRound0 =
computeSvRewardInRound0(defaultIssuanceCurve.initialValue, defaultTickDuration, svs.size)
computeSvRewardInRound0(defaultIssuanceCurve().initialValue, defaultTickDuration, svs.size)
val sv1Party = sv1Backend.getDsoInfo().svParty
val aliceValidatorParty = aliceValidatorBackend.getValidatorPartyId()
val expectedAliceAmount = eachSvGetInRound0.multiply(new java.math.BigDecimal("0.3333"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ trait AmuletConfigUtil extends TestCommon {
existingAmuletConfig.packageConfig,
existingAmuletConfig.transferPreapprovalFee,
existingAmuletConfig.featuredAppActivityMarkerAmount,
existingAmuletConfig.optDevelopmentFundManager,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export function getAmuletRulesConfig(
amuletToIssuePerYear: '40000000000.0',
validatorRewardCap: '0.2',
optValidatorFaucetCap: '2.85',
optDevelopmentFundPercentage: '0.05',
},
futureValues: [
{
Expand All @@ -172,6 +173,7 @@ export function getAmuletRulesConfig(
amuletToIssuePerYear: '20000000000.0',
validatorRewardCap: '0.2',
optValidatorFaucetCap: '2.85',
optDevelopmentFundPercentage: '0.05',
},
},
{
Expand All @@ -186,6 +188,7 @@ export function getAmuletRulesConfig(
amuletToIssuePerYear: '10000000000.0',
validatorRewardCap: '0.2',
optValidatorFaucetCap: '2.85',
optDevelopmentFundPercentage: '0.05',
},
},
{
Expand All @@ -200,6 +203,7 @@ export function getAmuletRulesConfig(
amuletToIssuePerYear: '5000000000.0',
validatorRewardCap: '0.2',
optValidatorFaucetCap: '2.85',
optDevelopmentFundPercentage: '0.05',
},
},
{
Expand All @@ -214,12 +218,14 @@ export function getAmuletRulesConfig(
amuletToIssuePerYear: '2500000000.0',
validatorRewardCap: '0.2',
optValidatorFaucetCap: '2.85',
optDevelopmentFundPercentage: '0.05',
},
},
],
},
transferPreapprovalFee: null,
featuredAppActivityMarkerAmount: null,
optDevelopmentFundManager: null,
};
}

Expand Down Expand Up @@ -306,7 +312,8 @@ export function getExpectedAmuletRulesConfigDiffsHTML(
"validatorRewardCap": "0.2",
"featuredAppRewardCap": "100.0",
"unfeaturedAppRewardCap": "0.6",
"optValidatorFaucetCap": "2.85"
"optValidatorFaucetCap": "2.85",
"optDevelopmentFundPercentage": "0.05"
},
"futureValues": [
{
Expand All @@ -320,7 +327,8 @@ export function getExpectedAmuletRulesConfigDiffsHTML(
"validatorRewardCap": "0.2",
"featuredAppRewardCap": "100.0",
"unfeaturedAppRewardCap": "0.6",
"optValidatorFaucetCap": "2.85"
"optValidatorFaucetCap": "2.85",
"optDevelopmentFundPercentage": "0.05"
}
},
{
Expand All @@ -334,7 +342,8 @@ export function getExpectedAmuletRulesConfigDiffsHTML(
"validatorRewardCap": "0.2",
"featuredAppRewardCap": "100.0",
"unfeaturedAppRewardCap": "0.6",
"optValidatorFaucetCap": "2.85"
"optValidatorFaucetCap": "2.85",
"optDevelopmentFundPercentage": "0.05"
}
},
{
Expand All @@ -348,7 +357,8 @@ export function getExpectedAmuletRulesConfigDiffsHTML(
"validatorRewardCap": "0.2",
"featuredAppRewardCap": "100.0",
"unfeaturedAppRewardCap": "0.6",
"optValidatorFaucetCap": "2.85"
"optValidatorFaucetCap": "2.85",
"optDevelopmentFundPercentage": "0.05"
}
},
{
Expand All @@ -362,12 +372,16 @@ export function getExpectedAmuletRulesConfigDiffsHTML(
"validatorRewardCap": "0.2",
"featuredAppRewardCap": "100.0",
"unfeaturedAppRewardCap": "0.6",
"optValidatorFaucetCap": "2.85"
"optValidatorFaucetCap": "2.85",
"optDevelopmentFundPercentage": "0.05"
}
}
]
}</pre></div></li><li data-key="packageConfig"
}</pre></div></li><li data-key="optDevelopmentFundManager"
class="jsondiffpatch-unchanged"><div
class="jsondiffpatch-property-name">optDevelopmentFundManager</div><div
class="jsondiffpatch-value"><pre>null</pre></div></li><li
data-key="packageConfig" class="jsondiffpatch-unchanged"><div
class="jsondiffpatch-property-name">packageConfig</div><div
class="jsondiffpatch-value"><pre>{
"amulet": "0.1.8",
Expand Down
6 changes: 6 additions & 0 deletions apps/common/frontend/src/__tests__/mocks/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const plannedVoteResult: DsoRules_CloseVoteRequestResult = {
featuredAppRewardCap: '100.0',
unfeaturedAppRewardCap: '0.6',
optValidatorFaucetCap: '2.85',
optDevelopmentFundPercentage: '0.05',
},
futureValues: [
{
Expand All @@ -104,6 +105,7 @@ export const plannedVoteResult: DsoRules_CloseVoteRequestResult = {
featuredAppRewardCap: '100.0',
unfeaturedAppRewardCap: '0.6',
optValidatorFaucetCap: '2.85',
optDevelopmentFundPercentage: '0.05',
},
},
{
Expand All @@ -118,6 +120,7 @@ export const plannedVoteResult: DsoRules_CloseVoteRequestResult = {
featuredAppRewardCap: '100.0',
unfeaturedAppRewardCap: '0.6',
optValidatorFaucetCap: '2.85',
optDevelopmentFundPercentage: '0.05',
},
},
{
Expand All @@ -132,6 +135,7 @@ export const plannedVoteResult: DsoRules_CloseVoteRequestResult = {
featuredAppRewardCap: '100.0',
unfeaturedAppRewardCap: '0.6',
optValidatorFaucetCap: '2.85',
optDevelopmentFundPercentage: '0.05',
},
},
{
Expand All @@ -146,6 +150,7 @@ export const plannedVoteResult: DsoRules_CloseVoteRequestResult = {
featuredAppRewardCap: '100.0',
unfeaturedAppRewardCap: '0.6',
optValidatorFaucetCap: '2.85',
optDevelopmentFundPercentage: '0.05',
},
},
],
Expand Down Expand Up @@ -186,6 +191,7 @@ export const plannedVoteResult: DsoRules_CloseVoteRequestResult = {
},
transferPreapprovalFee: null,
featuredAppActivityMarkerAmount: null,
optDevelopmentFundManager: null,
},
},
},
Expand Down
Loading
Loading