Skip to content

Commit 4f8d2c3

Browse files
canton-network-daDA Automation
andauthored
[ci] Update Splice from CCI (#423)
Signed-off-by: DA Automation <splice-maintainers@digitalasset.com> Co-authored-by: DA Automation <splice-maintainers@digitalasset.com>
1 parent ad713f5 commit 4f8d2c3

File tree

5 files changed

+138
-9
lines changed

5 files changed

+138
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package org.lfdecentralizedtrust.splice.integration.tests
2+
3+
import org.lfdecentralizedtrust.splice.config.ConfigTransforms
4+
import org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition
5+
import org.lfdecentralizedtrust.splice.integration.tests.SpliceTests.IntegrationTestWithSharedEnvironment
6+
import org.lfdecentralizedtrust.splice.sv.automation.singlesv.ReceiveSvRewardCouponTrigger
7+
import org.lfdecentralizedtrust.splice.sv.config.BeneficiaryConfig
8+
import org.lfdecentralizedtrust.splice.util.{TriggerTestUtil, WalletTestUtil}
9+
import com.digitalasset.canton.config.RequireTypes.NonNegativeLong
10+
import com.digitalasset.canton.logging.SuppressionRule
11+
import com.digitalasset.canton.topology.PartyId
12+
import monocle.macros.syntax.lens.*
13+
import org.lfdecentralizedtrust.splice.config.ConfigTransforms.{
14+
ConfigurableApp,
15+
updateAutomationConfig,
16+
}
17+
import org.slf4j.event.Level
18+
19+
import scala.math.Ordering.Implicits.*
20+
21+
class SvTimeBasedRewardCouponMissingPartyIntegrationTest
22+
extends IntegrationTestWithSharedEnvironment
23+
with SvTimeBasedIntegrationTestUtil
24+
with WalletTestUtil
25+
with WalletTxLogTestUtil
26+
with TriggerTestUtil {
27+
28+
override protected def runUpdateHistorySanityCheck: Boolean = false
29+
override protected def runTokenStandardCliSanityCheck: Boolean = false
30+
val badPartyHint = "badpartyhint"
31+
32+
override def environmentDefinition: EnvironmentDefinition =
33+
EnvironmentDefinition
34+
.simpleTopology1SvWithSimTime(this.getClass.getSimpleName)
35+
.addConfigTransforms((_, config) =>
36+
updateAutomationConfig(ConfigurableApp.Sv)(
37+
_.withPausedTrigger[ReceiveSvRewardCouponTrigger]
38+
)(config)
39+
)
40+
.addConfigTransform((_, config) => {
41+
config
42+
.focus(_.svApps)
43+
.modify(_.map { case (name, svConfig) =>
44+
// Setting the beneficiary party ID to a value that will never be in the party to participant mapping
45+
val newConfig = if (name.unwrap == "sv1") {
46+
val aliceParticipant =
47+
ConfigTransforms
48+
.getParticipantIds(config.parameters.clock)("alice_validator_user")
49+
50+
val alicePartyId = PartyId
51+
.tryFromProtoPrimitive(
52+
s"$badPartyHint::${aliceParticipant.split("::").last}"
53+
)
54+
svConfig
55+
.copy(extraBeneficiaries =
56+
Seq(BeneficiaryConfig(alicePartyId, NonNegativeLong.tryCreate(3333L)))
57+
)
58+
} else svConfig
59+
60+
name -> newConfig
61+
})
62+
})
63+
64+
"SVs" should {
65+
"filter out beneficiaries that were not found in party to participant mapping" in {
66+
implicit env =>
67+
val sv1RewardCouponTrigger = sv1Backend.dsoAutomation.trigger[ReceiveSvRewardCouponTrigger]
68+
loggerFactory.assertEventuallyLogsSeq(SuppressionRule.LevelAndAbove(Level.WARN))(
69+
within = {
70+
71+
eventually() {
72+
clue("No SvRewardCoupon should be issued") {
73+
advanceRoundsByOneTick
74+
sv1RewardCouponTrigger.runOnce().futureValue
75+
eventually() {
76+
val openRounds = sv1ScanBackend
77+
.getOpenAndIssuingMiningRounds()
78+
._1
79+
.filter(_.payload.opensAt <= env.environment.clock.now.toInstant)
80+
openRounds should not be empty
81+
}
82+
}
83+
}
84+
},
85+
lines => {
86+
forAtLeast(1, lines) { entry =>
87+
entry.message should include("Beneficiaries did not vet the latest packages")
88+
}
89+
forAtLeast(1, lines) { entry =>
90+
entry.message should include(
91+
"Party to participant mapping not found for synchronizer"
92+
)
93+
entry.message should include(badPartyHint)
94+
}
95+
},
96+
)
97+
}
98+
}
99+
}

apps/sv/src/main/scala/org/lfdecentralizedtrust/splice/sv/automation/singlesv/ReceiveSvRewardCouponTrigger.scala

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import org.lfdecentralizedtrust.splice.sv.util.SvUtil
2727
import org.lfdecentralizedtrust.splice.util.{AmuletConfigSchedule, AssignedContract}
2828
import com.digitalasset.canton.logging.pretty.{Pretty, PrettyPrinting}
2929
import com.digitalasset.canton.topology.ParticipantId
30+
import com.digitalasset.canton.topology.store.TopologyStoreId
3031
import com.digitalasset.canton.tracing.TraceContext
3132
import io.opentelemetry.api.trace.Tracer
3233
import org.apache.pekko.stream.Materializer
@@ -66,16 +67,27 @@ class ReceiveSvRewardCouponTrigger(
6667
DarResources.amulet.getPackageIdWithVersion(packages.amulet)
6768
)
6869
beneficiariesWithLatestVettedPackages <- extraBeneficiaries.filterA { beneficiary =>
70+
val filterParty = beneficiary.beneficiary.filterString
6971
participantAdminConnection
70-
.getPartyToParticipant(
71-
dsoRules.domain,
72-
beneficiary.beneficiary,
72+
.listPartyToParticipant(
73+
store = Some(TopologyStoreId.SynchronizerStore(dsoRules.domain)),
74+
filterParty = filterParty,
7375
)
74-
.flatMap(partyToParticipant =>
75-
isVettingLatestPackages(
76-
partyToParticipant.mapping.participantIds,
77-
svLatestVettedPackages.flatMap(_.toList),
78-
)
76+
.map { txs =>
77+
txs.headOption
78+
}
79+
.flatMap(partyToParticipantO =>
80+
partyToParticipantO.fold({
81+
logger.warn(
82+
s"Party to participant mapping not found for synchronizer = ${dsoRules.domain}, party = $filterParty."
83+
)
84+
Future.successful(false)
85+
}) { partyToParticipant =>
86+
isVettingLatestPackages(
87+
partyToParticipant.mapping.participantIds,
88+
svLatestVettedPackages.flatMap(_.toList),
89+
)
90+
}
7991
)
8092
}
8193
result <- retrieveNextRoundToClaim(beneficiariesWithLatestVettedPackages).value.map(_.toList)

nix/extra-pulumi-packages.nix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.2.1/pulumi-resource-gcp-v7.2.1-linux-amd64.tar.gz";
2828
sha256 = "2c5f29ac9bc058bb9377b906e7630947add587b69040c63af5a8fd4ff95c9e52";
2929
}
30+
{
31+
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.38.0/pulumi-resource-gcp-v7.38.0-linux-amd64.tar.gz";
32+
sha256 = "1acca6e3b5b8bc673889333ddc7e22ad3b7c54c12feb612bfb1f85605bebd2ce";
33+
}
3034
{
3135
url = "https://github.com/pulumiverse/pulumi-grafana/releases/download/v0.4.2/pulumi-resource-grafana-v0.4.2-linux-amd64.tar.gz";
3236
sha256 = "ad6675574e75c6984ab79a2ff9f4ee6c4859d46a41a7d73ef35c84f05a00b407";
@@ -81,6 +85,10 @@
8185
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.2.1/pulumi-resource-gcp-v7.2.1-darwin-amd64.tar.gz";
8286
sha256 = "08ee93595be215736c834d75012704713738b6a1452cc21813a84612c950e424";
8387
}
88+
{
89+
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.38.0/pulumi-resource-gcp-v7.38.0-darwin-amd64.tar.gz";
90+
sha256 = "09f7ccc14c2c968536404d222038d8ec0dd0e5cfa65a56ababfd4f447338c8bd";
91+
}
8492
{
8593
url = "https://github.com/pulumiverse/pulumi-grafana/releases/download/v0.4.2/pulumi-resource-grafana-v0.4.2-darwin-amd64.tar.gz";
8694
sha256 = "f4d065bd98b30b0f1ea2185ccb2f4c447c80f71992779ad820fc524f011d403d";
@@ -135,6 +143,10 @@
135143
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.2.1/pulumi-resource-gcp-v7.2.1-linux-arm64.tar.gz";
136144
sha256 = "4cddd536e4e28caba68919ba2d051442595ef0c0c139a7779108b579bf596901";
137145
}
146+
{
147+
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.38.0/pulumi-resource-gcp-v7.38.0-linux-arm64.tar.gz";
148+
sha256 = "d442eff25b9ec56a19e604ccedcaba6c1072108b448970b019b59856180d9265";
149+
}
138150
{
139151
url = "https://github.com/pulumiverse/pulumi-grafana/releases/download/v0.4.2/pulumi-resource-grafana-v0.4.2-linux-arm64.tar.gz";
140152
sha256 = "dbf59982dcd94e50b9241e9501dc531bad2a9faac47aa5ecce8e5bb1bfc2e9ff";
@@ -189,6 +201,10 @@
189201
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.2.1/pulumi-resource-gcp-v7.2.1-darwin-arm64.tar.gz";
190202
sha256 = "4bb52f6d510772d53e0ed88153bd237703610cb1ff7b4e40558c493c45405991";
191203
}
204+
{
205+
url = "https://github.com/pulumi/pulumi-gcp/releases/download/v7.38.0/pulumi-resource-gcp-v7.38.0-darwin-arm64.tar.gz";
206+
sha256 = "44883ff3b848c2a8ce19531586967f096b6f803398842cbaa6b9b900f0e20cc5";
207+
}
192208
{
193209
url = "https://github.com/pulumiverse/pulumi-grafana/releases/download/v0.4.2/pulumi-resource-grafana-v0.4.2-darwin-arm64.tar.gz";
194210
sha256 = "76ff2462fa5b85023948f5e7139b28a08af4a50ae80077e3c24ff8723203a603";

nix/generate_pulumi_packages.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ plugins=(
2323
"pulumi/kubernetes=4.11.0"
2424
"pulumi/kubernetes=4.21.1"
2525
"pulumi/random=4.14.0"
26-
"pulumi/gcp=7.2.1"
26+
"pulumi/gcp=7.2.1" # TODO (#19680) move above when unused
27+
"pulumi/gcp=7.38.0"
2728
"pulumi/auth0=3.3.2"
2829
"pulumi/std=1.7.3"
2930
"pulumiverse/grafana=0.4.2"

test-full-class-names-sim-time.log

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedBootstrappingRoundI
88
org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedOnboardingIntegrationTest
99
org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedPruneAmuletConfigScheduleIntegrationTest
1010
org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedRewardCouponIntegrationTest
11+
org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedRewardCouponMissingPartyIntegrationTest
1112
org.lfdecentralizedtrust.splice.integration.tests.SvTimeBasedRoundMgmtIntegrationTest
1213
org.lfdecentralizedtrust.splice.integration.tests.TimeBasedTestNetPreviewIntegrationTest
1314
org.lfdecentralizedtrust.splice.integration.tests.TimeBasedTreasuryIntegrationTest

0 commit comments

Comments
 (0)