Skip to content

Commit 42b5f21

Browse files
Renamed Validator ScanClient trustedSvs to svNames (#3620)
Fixes #3496 [ci] Signed-off-by: Pasindu Tennage <[email protected]>
1 parent 09f2bb8 commit 42b5f21

File tree

8 files changed

+24
-25
lines changed

8 files changed

+24
-25
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ class ConfigurationProvidedBftScanConnectionIntegrationTest
3535
Uri("http://127.0.0.1:5012"),
3636
Uri("http://127.0.0.1:5112"),
3737
),
38-
trustedSvs =
39-
NonEmptyList.of(s"${getSvName(1)}", s"${getSvName(2)}", s"${getSvName(3)}"),
38+
svNames = NonEmptyList.of(s"${getSvName(1)}", s"${getSvName(2)}", s"${getSvName(3)}"),
4039
threshold = Some(2),
4140
scansRefreshInterval = NonNegativeFiniteDuration.ofSeconds(5),
4241
)

apps/scan/src/main/scala/org/lfdecentralizedtrust/splice/scan/admin/api/client/BftScanConnection.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ object BftScanConnection {
10921092
}
10931093

10941094
class ConfigurationProvidedScansBft(
1095-
trustedSvs: NonEmptyList[String],
1095+
svNames: NonEmptyList[String],
10961096
threshold: Option[Int],
10971097
override val initialScanConnections: Seq[SingleScanConnection],
10981098
override val initialFailedConnections: Map[Uri, Throwable],
@@ -1105,12 +1105,12 @@ object BftScanConnection {
11051105
)(implicit override val ec: ExecutionContext, tc: TraceContext)
11061106
extends Bft {
11071107

1108-
private val trustedSvsSet = trustedSvs.toList.toSet
1108+
private val svNamesSet = svNames.toList.toSet
11091109

11101110
override protected def filterScans(allScans: Seq[DsoScan]): Seq[DsoScan] = {
1111-
val targetScans = allScans.filter(scan => trustedSvsSet.contains(scan.svName))
1111+
val targetScans = allScans.filter(scan => svNamesSet.contains(scan.svName))
11121112
val foundSvs = targetScans.map(_.svName).toSet
1113-
val missingSvs = trustedSvsSet -- foundSvs
1113+
val missingSvs = svNamesSet -- foundSvs
11141114

11151115
logger.trace(s"Discovered the following trusted scans from the network: ${targetScans
11161116
.map(s => s"Name=${s.svName}, URL=${s.publicUrl}")
@@ -1126,13 +1126,13 @@ object BftScanConnection {
11261126
}
11271127

11281128
override protected def getRequiredConnections(state: BftState): Int = {
1129-
threshold.getOrElse(Thresholds.requiredNumScanThreshold(trustedSvs.size).value)
1129+
threshold.getOrElse(Thresholds.requiredNumScanThreshold(svNames.size).value)
11301130
}
11311131

11321132
override def scanConnections: ScanConnections = {
11331133
val connections = currentConnectionsState
11341134
connections.copy(
1135-
targetTotalNumber = Some(trustedSvs.size),
1135+
targetTotalNumber = Some(svNames.size),
11361136
threshold = threshold,
11371137
)
11381138
}
@@ -1316,7 +1316,7 @@ object BftScanConnection {
13161316
// Use the temporary connection to get a consensus on the full list of scans
13171317
allScans <- Bft.getScansInDsoRules(tempBftConnection)
13181318

1319-
trustedScans = allScans.filter(scan => ts.trustedSvs.toList.contains(scan.svName))
1319+
trustedScans = allScans.filter(scan => ts.svNames.toList.contains(scan.svName))
13201320

13211321
trustedScanDetails = trustedScans
13221322
.map(s => s" - Name: ${s.svName}, URL: ${s.publicUrl}")
@@ -1346,7 +1346,7 @@ object BftScanConnection {
13461346
)
13471347

13481348
scanList = new ConfigurationProvidedScansBft(
1349-
ts.trustedSvs,
1349+
ts.svNames,
13501350
ts.threshold,
13511351
connections,
13521352
failed.toMap,
@@ -1554,7 +1554,7 @@ object BftScanConnection {
15541554
case class BftCustom(
15551555
seedUrls: NonEmptyList[Uri], // by default only one seed_url is provided
15561556
threshold: Option[Int] = None, // default to len(seedUrls)/3+1
1557-
trustedSvs: NonEmptyList[String], // should be at least 1
1557+
svNames: NonEmptyList[String], // should be at least 1
15581558
amuletRulesCacheTimeToLive: NonNegativeFiniteDuration =
15591559
ScanAppClientConfig.DefaultAmuletRulesCacheTimeToLive,
15601560
scansRefreshInterval: NonNegativeFiniteDuration =

cluster/deployment/mock/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ validators:
309309
scanType: "bft-custom"
310310
seedUrls: [ "https://scan.sv-2-eng.test.network.canton.global","https://scan.sv-3-eng.test.network.canton.global" ]
311311
threshold: 2
312-
trustedSvs: [ "Digital-Asset-Eng-2","Digital-Asset-Eng-3" ]
312+
svNames: [ "Digital-Asset-Eng-2","Digital-Asset-Eng-3" ]
313313
additionalEnvVars:
314314
- name: ADDITIONAL_ENV_VAR_VALIDATOR_NAME
315315
value: ADDITIONAL_ENV_VAR_VALIDATOR_NAME

cluster/expected/validator-runbook/expected.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,11 @@
730730
"https://scan.sv-2-eng.test.network.canton.global",
731731
"https://scan.sv-3-eng.test.network.canton.global"
732732
],
733-
"threshold": 2,
734-
"trustedSvs": [
733+
"svNames": [
735734
"Digital-Asset-Eng-2",
736735
"Digital-Asset-Eng-3"
737-
]
736+
],
737+
"threshold": 2
738738
},
739739
"spliceInstanceNames": {
740740
"amuletName": "Amulet",

cluster/helm/splice-validator/templates/validator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ spec:
118118
{{- else if eq .Values.scanClient.scanType "bft-custom"}}
119119
canton.validator-apps.validator_backend.scan-client.type = "bft-custom"
120120
canton.validator-apps.validator_backend.scan-client.seed-urls = {{ .Values.scanClient.seedUrls | toJson }}
121-
canton.validator-apps.validator_backend.scan-client.trusted-svs = {{ .Values.scanClient.trustedSvs | toJson }}
121+
canton.validator-apps.validator_backend.scan-client.sv-names = {{ .Values.scanClient.svNames | toJson }}
122122
canton.validator-apps.validator_backend.scan-client.threshold = {{ .Values.scanClient.threshold }}
123123
{{- else }}
124124
canton.validator-apps.validator_backend.scan-client.type = "bft"

cluster/helm/splice-validator/tests/validator_test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ tests:
158158
path: spec.template.spec.containers[?(@.name=='validator-app')].env[?(@.name=='ADDITIONAL_CONFIG_BFT_SCAN')].value
159159
pattern: 'canton.validator-apps.validator_backend.scan-client.seed-urls = \["https://bft-node-1.url:5003","https://bft-node-2.url:5003"\]'
160160

161-
- it: "configures scan-client for bft-custom mode, including trustedSvs and threshold"
161+
- it: "configures scan-client for bft-custom mode, including svNames and threshold"
162162
set:
163163
scanClient:
164164
scanType: "bft-custom"
165165
seedUrls: [ "https://custom-node-A.com", "https://custom-node-B.com" ]
166-
trustedSvs: [ "custom-sv-1", "custom-sv-2", "custom-sv-3" ]
166+
svNames: [ "custom-sv-1", "custom-sv-2", "custom-sv-3" ]
167167
threshold: 2
168168
documentSelector:
169169
path: kind
@@ -177,7 +177,7 @@ tests:
177177
pattern: 'canton.validator-apps.validator_backend.scan-client.seed-urls = \["https://custom-node-A.com","https://custom-node-B.com"\]'
178178
- matchRegex:
179179
path: spec.template.spec.containers[?(@.name=='validator-app')].env[?(@.name=='ADDITIONAL_CONFIG_BFT_SCAN')].value
180-
pattern: 'canton.validator-apps.validator_backend.scan-client.trusted-svs = \["custom-sv-1","custom-sv-2","custom-sv-3"\]'
180+
pattern: 'canton.validator-apps.validator_backend.scan-client.sv-names = \["custom-sv-1","custom-sv-2","custom-sv-3"\]'
181181
- matchRegex:
182182
path: spec.template.spec.containers[?(@.name=='validator-app')].env[?(@.name=='ADDITIONAL_CONFIG_BFT_SCAN')].value
183183
pattern: "canton.validator-apps.validator_backend.scan-client.threshold = 2"

cluster/helm/splice-validator/values.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"minimum": 0,
6363
"description": "bft-custom threshold. Optional unless scan-type is bft-custom."
6464
},
65-
"trustedSvs": {
65+
"svNames": {
6666
"type": "array",
6767
"items": {
6868
"type": "string"
@@ -134,7 +134,7 @@
134134
"then": {
135135
"properties": {
136136
"scanClient": {
137-
"required": ["threshold", "trustedSvs"]
137+
"required": ["threshold", "svNames"]
138138
}
139139
}
140140
}

cluster/pulumi/common-validator/src/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ export const ScanClientConfigSchema = z
4242
scanType: z.enum(['trust-single', 'bft', 'bft-custom']),
4343
scanAddress: z.string().optional(),
4444
threshold: z.number().default(0),
45-
trustedSvs: z.array(z.string()).default([]),
45+
svNames: z.array(z.string()).default([]),
4646
seedUrls: z.array(z.string()).min(1, 'seedUrls must contain at least one element.').optional(),
4747
})
4848
.refine(
4949
data => {
5050
if (data.scanType === 'bft-custom') {
5151
const threshold = data.threshold;
52-
const trustedSvsSize = data.trustedSvs.length;
52+
const svNamesSize = data.svNames.length;
5353
const seedUrlsSize = data.seedUrls ? data.seedUrls.length : 0;
54-
return trustedSvsSize >= threshold && seedUrlsSize >= threshold;
54+
return svNamesSize >= threshold && seedUrlsSize >= threshold;
5555
} else {
5656
return true;
5757
}
5858
},
5959
{
6060
message:
61-
"For 'bft-custom' scanType, both 'trustedSvs' and 'seedUrls' must have a length greater than or equal to 'threshold'.",
61+
"For 'bft-custom' scanType, both 'svNames' and 'seedUrls' must have a length greater than or equal to 'threshold'.",
6262
path: ['scanType'],
6363
}
6464
);

0 commit comments

Comments
 (0)