Skip to content
Merged
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
@@ -0,0 +1,99 @@
package org.lfdecentralizedtrust.splice.integration.tests

import org.lfdecentralizedtrust.splice.config.ConfigTransforms
import org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition
import org.lfdecentralizedtrust.splice.integration.tests.SpliceTests.IntegrationTestWithSharedEnvironment
import org.lfdecentralizedtrust.splice.sv.automation.singlesv.ReceiveSvRewardCouponTrigger
import org.lfdecentralizedtrust.splice.sv.config.BeneficiaryConfig
import org.lfdecentralizedtrust.splice.util.{TriggerTestUtil, WalletTestUtil}
import com.digitalasset.canton.config.RequireTypes.NonNegativeLong
import com.digitalasset.canton.logging.SuppressionRule
import com.digitalasset.canton.topology.PartyId
import monocle.macros.syntax.lens.*
import org.lfdecentralizedtrust.splice.config.ConfigTransforms.{
ConfigurableApp,
updateAutomationConfig,
}
import org.slf4j.event.Level

import scala.math.Ordering.Implicits.*

class SvTimeBasedRewardCouponMissingPartyIntegrationTest
extends IntegrationTestWithSharedEnvironment
with SvTimeBasedIntegrationTestUtil
with WalletTestUtil
with WalletTxLogTestUtil
with TriggerTestUtil {

override protected def runUpdateHistorySanityCheck: Boolean = false
override protected def runTokenStandardCliSanityCheck: Boolean = false
val badPartyHint = "badpartyhint"

override def environmentDefinition: EnvironmentDefinition =
EnvironmentDefinition
.simpleTopology1SvWithSimTime(this.getClass.getSimpleName)
.addConfigTransforms((_, config) =>
updateAutomationConfig(ConfigurableApp.Sv)(
_.withPausedTrigger[ReceiveSvRewardCouponTrigger]
)(config)
)
.addConfigTransform((_, config) => {
config
.focus(_.svApps)
.modify(_.map { case (name, svConfig) =>
// Setting the beneficiary party ID to a value that will never be in the party to participant mapping
val newConfig = if (name.unwrap == "sv1") {
val aliceParticipant =
ConfigTransforms
.getParticipantIds(config.parameters.clock)("alice_validator_user")

val alicePartyId = PartyId
.tryFromProtoPrimitive(
s"$badPartyHint::${aliceParticipant.split("::").last}"
)
svConfig
.copy(extraBeneficiaries =
Seq(BeneficiaryConfig(alicePartyId, NonNegativeLong.tryCreate(3333L)))
)
} else svConfig

name -> newConfig
})
})

"SVs" should {
"filter out beneficiaries that were not found in party to participant mapping" in {
implicit env =>
val sv1RewardCouponTrigger = sv1Backend.dsoAutomation.trigger[ReceiveSvRewardCouponTrigger]
loggerFactory.assertEventuallyLogsSeq(SuppressionRule.LevelAndAbove(Level.WARN))(
within = {

eventually() {
clue("No SvRewardCoupon should be issued") {
advanceRoundsByOneTick
sv1RewardCouponTrigger.runOnce().futureValue
eventually() {
val openRounds = sv1ScanBackend
.getOpenAndIssuingMiningRounds()
._1
.filter(_.payload.opensAt <= env.environment.clock.now.toInstant)
openRounds should not be empty
}
}
}
},
lines => {
forAtLeast(1, lines) { entry =>
entry.message should include("Beneficiaries did not vet the latest packages")
}
forAtLeast(1, lines) { entry =>
entry.message should include(
"Party to participant mapping not found for synchronizer"
)
entry.message should include(badPartyHint)
}
},
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import org.lfdecentralizedtrust.splice.sv.util.SvUtil
import org.lfdecentralizedtrust.splice.util.{AmuletConfigSchedule, AssignedContract}
import com.digitalasset.canton.logging.pretty.{Pretty, PrettyPrinting}
import com.digitalasset.canton.topology.ParticipantId
import com.digitalasset.canton.topology.store.TopologyStoreId
import com.digitalasset.canton.tracing.TraceContext
import io.opentelemetry.api.trace.Tracer
import org.apache.pekko.stream.Materializer
Expand Down Expand Up @@ -66,16 +67,27 @@ class ReceiveSvRewardCouponTrigger(
DarResources.amulet.getPackageIdWithVersion(packages.amulet)
)
beneficiariesWithLatestVettedPackages <- extraBeneficiaries.filterA { beneficiary =>
val filterParty = beneficiary.beneficiary.filterString
participantAdminConnection
.getPartyToParticipant(
dsoRules.domain,
beneficiary.beneficiary,
.listPartyToParticipant(
store = Some(TopologyStoreId.SynchronizerStore(dsoRules.domain)),
filterParty = filterParty,
)
.flatMap(partyToParticipant =>
isVettingLatestPackages(
partyToParticipant.mapping.participantIds,
svLatestVettedPackages.flatMap(_.toList),
)
.map { txs =>
txs.headOption
}
.flatMap(partyToParticipantO =>
partyToParticipantO.fold({
logger.warn(
s"Party to participant mapping not found for synchronizer = ${dsoRules.domain}, party = $filterParty."
)
Future.successful(false)
}) { partyToParticipant =>
isVettingLatestPackages(
partyToParticipant.mapping.participantIds,
svLatestVettedPackages.flatMap(_.toList),
)
}
)
}
result <- retrieveNextRoundToClaim(beneficiariesWithLatestVettedPackages).value.map(_.toList)
Expand Down
16 changes: 16 additions & 0 deletions nix/extra-pulumi-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.2.1/pulumi-resource-gcp-v7.2.1-linux-amd64.tar.gz";
sha256 = "2c5f29ac9bc058bb9377b906e7630947add587b69040c63af5a8fd4ff95c9e52";
}
{
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.38.0/pulumi-resource-gcp-v7.38.0-linux-amd64.tar.gz";
sha256 = "1acca6e3b5b8bc673889333ddc7e22ad3b7c54c12feb612bfb1f85605bebd2ce";
}
{
url = "https://github.com/pulumiverse/pulumi-grafana/releases/download/v0.4.2/pulumi-resource-grafana-v0.4.2-linux-amd64.tar.gz";
sha256 = "ad6675574e75c6984ab79a2ff9f4ee6c4859d46a41a7d73ef35c84f05a00b407";
Expand Down Expand Up @@ -81,6 +85,10 @@
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.2.1/pulumi-resource-gcp-v7.2.1-darwin-amd64.tar.gz";
sha256 = "08ee93595be215736c834d75012704713738b6a1452cc21813a84612c950e424";
}
{
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.38.0/pulumi-resource-gcp-v7.38.0-darwin-amd64.tar.gz";
sha256 = "09f7ccc14c2c968536404d222038d8ec0dd0e5cfa65a56ababfd4f447338c8bd";
}
{
url = "https://github.com/pulumiverse/pulumi-grafana/releases/download/v0.4.2/pulumi-resource-grafana-v0.4.2-darwin-amd64.tar.gz";
sha256 = "f4d065bd98b30b0f1ea2185ccb2f4c447c80f71992779ad820fc524f011d403d";
Expand Down Expand Up @@ -135,6 +143,10 @@
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.2.1/pulumi-resource-gcp-v7.2.1-linux-arm64.tar.gz";
sha256 = "4cddd536e4e28caba68919ba2d051442595ef0c0c139a7779108b579bf596901";
}
{
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.38.0/pulumi-resource-gcp-v7.38.0-linux-arm64.tar.gz";
sha256 = "d442eff25b9ec56a19e604ccedcaba6c1072108b448970b019b59856180d9265";
}
{
url = "https://github.com/pulumiverse/pulumi-grafana/releases/download/v0.4.2/pulumi-resource-grafana-v0.4.2-linux-arm64.tar.gz";
sha256 = "dbf59982dcd94e50b9241e9501dc531bad2a9faac47aa5ecce8e5bb1bfc2e9ff";
Expand Down Expand Up @@ -189,6 +201,10 @@
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.2.1/pulumi-resource-gcp-v7.2.1-darwin-arm64.tar.gz";
sha256 = "4bb52f6d510772d53e0ed88153bd237703610cb1ff7b4e40558c493c45405991";
}
{
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.38.0/pulumi-resource-gcp-v7.38.0-darwin-arm64.tar.gz";
sha256 = "44883ff3b848c2a8ce19531586967f096b6f803398842cbaa6b9b900f0e20cc5";
}
{
url = "https://github.com/pulumiverse/pulumi-grafana/releases/download/v0.4.2/pulumi-resource-grafana-v0.4.2-darwin-arm64.tar.gz";
sha256 = "76ff2462fa5b85023948f5e7139b28a08af4a50ae80077e3c24ff8723203a603";
Expand Down
3 changes: 2 additions & 1 deletion nix/generate_pulumi_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ plugins=(
"pulumi/kubernetes=4.11.0"
"pulumi/kubernetes=4.21.1"
"pulumi/random=4.14.0"
"pulumi/gcp=7.2.1"
"pulumi/gcp=7.2.1" # TODO (#19680) move above when unused
"pulumi/gcp=7.38.0"
"pulumi/auth0=3.3.2"
"pulumi/std=1.7.3"
"pulumiverse/grafana=0.4.2"
Expand Down
1 change: 1 addition & 0 deletions test-full-class-names-sim-time.log
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedBootstrappingRoundI
org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedOnboardingIntegrationTest
org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedPruneAmuletConfigScheduleIntegrationTest
org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedRewardCouponIntegrationTest
org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedRewardCouponMissingPartyIntegrationTest
org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedRoundMgmtIntegrationTest
org.lfdecentralizedtrust.splice.integration.tests.TimeBasedTestNetPreviewIntegrationTest
org.lfdecentralizedtrust.splice.integration.tests.TimeBasedTreasuryIntegrationTest
Expand Down
Loading