Skip to content

Commit b622eb0

Browse files
canton-network-daDA Automation
authored andcommitted
[ci] Update Splice from CCI (#439)
Signed-off-by: DA Automation <[email protected]> Co-authored-by: DA Automation <[email protected]> Signed-off-by: Le Hoang Anh <[email protected]>
1 parent 3bbbed5 commit b622eb0

File tree

69 files changed

+990
-487
lines changed

Some content is hidden

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

69 files changed

+990
-487
lines changed

.github/actions/tests/pre_scala_test/action.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
description: "Skip the test if the commit messages on the branch match this regex"
1212
required: false
1313
default: ""
14+
run_if_commit_tag:
15+
description: "Run the job only if the commit message contains this tag"
16+
required: false
17+
default: ""
1418
skip_if_files_changed:
1519
description: "Skip the test if any of the given files was changed since the last release"
1620
required: false
@@ -52,6 +56,18 @@ runs:
5256
echo "Commit message ($msg) does not match regex (${{ inputs.skip_if_regex }}), not skipping"
5357
fi
5458
59+
- name: Check if include commit message tag matches
60+
if: ${{ inputs.run_if_commit_tag != '' }}
61+
shell: bash
62+
run: |
63+
last_commit_msg=$(git log -1 --pretty=%B)
64+
if [[ $last_commit_msg =~ "[${{ inputs.run_if_commit_tag }}]" ]]; then
65+
echo "Commit message ($last_commit_msg) includes tag (${{ inputs.run_if_commit_tag }}), running"
66+
else
67+
echo "Commit message ($last_commit_msg) does not include tag (${{ inputs.run_if_commit_tag }}), skipping"
68+
echo "skip=true" >> "$GITHUB_ENV"
69+
fi
70+
5571
- name: Check if skip files changed
5672
if: ${{ inputs.skip_if_files_changed != '' }}
5773
shell: bash

.github/workflows/build.scala_test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ on:
3030
type: string
3131
required: false
3232
default: ""
33+
run_if_commit_tag:
34+
type: string
35+
required: false
36+
default: ""
3337
skip_if_files_changed:
3438
type: string
3539
required: false
@@ -72,6 +76,7 @@ jobs:
7276
test_names_file: ${{ inputs.test_names_file }}
7377
skip_if_regex: ${{ inputs.skip_if_regex }}
7478
skip_if_files_changed: ${{ inputs.skip_if_files_changed }}
79+
run_if_commit_tag: ${{ inputs.run_if_commit_tag }}
7580

7681
scala_test:
7782
runs-on: ${{ inputs.runs_on }}

.github/workflows/build.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,19 @@ jobs:
136136
commit_sha: ${{ inputs.commit_sha }}
137137
secrets: inherit
138138

139+
scala_test_wall_clock_time_bft:
140+
uses: ./.github/workflows/build.scala_test.yml
141+
with:
142+
runs_on: self-hosted-k8s-large
143+
test_names_file: 'test-full-class-names.log'
144+
start_canton_options: -we
145+
parallelism: 10
146+
test_name: wall-clock-time-bft
147+
with_gcp_creds: true
148+
pre_sbt_cmd: "export SPLICE_USE_BFT_SEQUENCER=1"
149+
run_if_commit_tag: 'bft'
150+
secrets: inherit
151+
139152
scala_test_frontend_wall_clock_time:
140153
uses: ./.github/workflows/build.scala_test.yml
141154
with:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ repos:
4444
# ignore external sources
4545
args: [-e, SC1091]
4646
types: [shell]
47-
exclude: '^canton/'
47+
exclude: '(^canton/|\.envrc)'
4848
- id: typescriptfmt
4949
name: typescriptfmt
5050
language: system

TESTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ To request a cluster test to be run on your PR, comment on your pr `/cluster_tes
7272
for a basic test or a hard-migration test respectively. After commenting, reach out to the
7373
[Splice Contributors](CONTRIBUTORS.md) to approve and trigger the actual test on your behalf.
7474

75+
### Enabling the new Canton bft ordering layer
76+
77+
If you want to run the integration tests with the new Canton bft, you can do so by including the message `[bft]` in your commit message.
78+
7579
## Running Tests Locally
7680

7781
### Managing Canton for Tests
@@ -210,6 +214,17 @@ No installation of `lnav` is required, as it is provided by default by our `dire
210214
Documentation about common pitfalls when writing new integration tests and debugging existing ones can be found [here](/apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/README.md).
211215
If you wish to extend our testing topology please also consult [this README](/apps/app/src/test/resources/README.md) about name and port allocation.
212216

217+
### Enabling the new Canton bft ordering layer
218+
219+
If you want to run the integration tests locally with the new Canton bft, canton must be started with the `-e` flag.
220+
This can be done by running `./start-canton.sh -we`.
221+
Furthermore the integration test must run with the `SPLICE_USE_BFT_SEQUENCER` environment variable set to `true`.
222+
Eg of test run:
223+
224+
```bash
225+
SPLICE_USE_BFT_SEQUENCER=1 sbt 'apps-app/ testOnly org.lfdecentralizedtrust.splice.integration.tests.SvDevNetReonboardingIntegrationTest'
226+
```
227+
213228
### Testing App Behaviour Outside of Tests Without Running Bundle
214229

215230
Sometimes, you may need to debug startup behaviour of the Splice apps that is causing issues for the
@@ -382,6 +397,7 @@ They are meant to provide a quick feedback loop and to offer additional protecti
382397
We use [helm-unittest](https://github.com/helm-unittest/helm-unittest/) for some of our Helm charts.
383398
To run all Helm chart tests locally run `make cluster/helm/test`.
384399
To run only the tests for a specific chart `CHART`, run `helm unittest cluster/helm/CHART`.
400+
If this produces an error: "### Error: Chart.yaml file is missing", please run `make cluster/helm/build`.
385401

386402
Refer to the documentation of `helm-unittest` for more information on how to extend our Helm tests.
387403
When writing or debugging Helm tests, it is often useful to run `helm unittest` with the `-d` flag.

apps/app/src/main/scala/org/lfdecentralizedtrust/splice/config/ConfigTransforms.scala

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package org.lfdecentralizedtrust.splice.config
55

66
import org.lfdecentralizedtrust.splice.auth.AuthUtil
7-
import org.lfdecentralizedtrust.splice.scan.config.ScanAppBackendConfig
7+
import org.lfdecentralizedtrust.splice.scan.config.{BftSequencerConfig, ScanAppBackendConfig}
88
import org.lfdecentralizedtrust.splice.splitwell.config.{
99
SplitwellAppBackendConfig,
1010
SplitwellAppClientConfig,
@@ -27,6 +27,7 @@ import com.digitalasset.canton.config.*
2727
import com.digitalasset.canton.config.RequireTypes.Port
2828
import monocle.macros.syntax.lens.*
2929
import org.apache.pekko.http.scaladsl.model.Uri
30+
import org.lfdecentralizedtrust.splice.sv.automation.singlesv.SvBftSequencerPeerOffboardingTrigger
3031

3132
import scala.collection.mutable
3233
import scala.collection.parallel.CollectionConverters.ImmutableMapIsParallelizable
@@ -35,6 +36,8 @@ import scala.io.Source
3536

3637
object ConfigTransforms {
3738

39+
val IsTheCantonSequencerBFTEnabled: Boolean = sys.env.contains("SPLICE_USE_BFT_SEQUENCER")
40+
3841
sealed abstract class ConfigurableApp extends Product with Serializable
3942

4043
object ConfigurableApp {
@@ -207,6 +210,7 @@ object ConfigTransforms {
207210
updateAutomationConfig(ConfigurableApp.Sv)(
208211
_.withPausedTrigger[SvOffboardingMediatorTrigger]
209212
.withPausedTrigger[SvOffboardingSequencerTrigger]
213+
.withPausedTrigger[SvBftSequencerPeerOffboardingTrigger]
210214
)
211215

212216
def withPausedSvOffboardingMediatorAndPartyToParticipantTriggers(): ConfigTransform =
@@ -215,6 +219,14 @@ object ConfigTransforms {
215219
.withPausedTrigger[SvOffboardingPartyToParticipantProposalTrigger]
216220
)
217221

222+
def withResumedOffboardingTriggers(): ConfigTransform = {
223+
updateAutomationConfig(ConfigurableApp.Sv)(
224+
_.withResumedTrigger[SvOffboardingMediatorTrigger]
225+
.withResumedTrigger[SvOffboardingSequencerTrigger]
226+
.withResumedTrigger[SvBftSequencerPeerOffboardingTrigger]
227+
)
228+
}
229+
218230
def setAmuletPrice(price: BigDecimal): ConfigTransform =
219231
config =>
220232
Seq(
@@ -357,7 +369,9 @@ object ConfigTransforms {
357369
})
358370

359371
def bumpCantonDomainPortsBy(bump: Int): ConfigTransform =
360-
bumpSvAppCantonDomainPortsBy(bump) compose bumpValidatorAppCantonDomainPortsBy(bump)
372+
bumpSvAppCantonDomainPortsBy(bump) compose bumpValidatorAppCantonDomainPortsBy(
373+
bump
374+
) compose bumpScanCantonDomainPortsBy(bump)
361375

362376
def bumpSvAppCantonDomainPortsBy(bump: Int): ConfigTransform = {
363377
updateAllSvAppConfigs_(
@@ -368,13 +382,27 @@ object ConfigTransforms {
368382
_.map(d =>
369383
d.copy(
370384
sequencer = d.sequencer
371-
.copy(externalPublicApiUrl = bumpUrl(bump, d.sequencer.externalPublicApiUrl))
385+
.copy(
386+
externalPublicApiUrl = bumpUrl(bump, d.sequencer.externalPublicApiUrl)
387+
)
372388
)
373389
)
374390
)
375391
)
376392
}
377393

394+
def bumpScanCantonDomainPortsBy(bump: Int) = {
395+
updateAllScanAppConfigs_(
396+
_.focus(_.bftSequencers).modify(
397+
_.map(
398+
_.focus(_.p2pUrl).modify(
399+
bumpUrl(bump, _)
400+
)
401+
)
402+
)
403+
)
404+
}
405+
378406
def bumpValidatorAppCantonDomainPortsBy(bump: Int): ConfigTransform = {
379407
def bumpUrl(s: String): String = {
380408
val uri = Uri(s)
@@ -400,7 +428,14 @@ object ConfigTransforms {
400428
.focus(_.localSynchronizerNode)
401429
.modify(_.map(portTransform(bump, _)))
402430
),
403-
updateAllScanAppConfigs_(_.focus(_.participantClient).modify(portTransform(bump, _))),
431+
updateAllScanAppConfigs_(
432+
_.focus(_.participantClient)
433+
.modify(portTransform(bump, _))
434+
.focus(_.sequencerAdminClient)
435+
.modify(portTransform(bump, _))
436+
.focus(_.bftSequencers)
437+
.modify(_.map(_.focus(_.sequencerAdminClient).modify(portTransform(bump, _))))
438+
),
404439
updateAllValidatorConfigs_(
405440
_.focus(_.participantClient)
406441
.modify(portTransform(bump, _))
@@ -528,6 +563,8 @@ object ConfigTransforms {
528563
.modify(_.map(setPortPrefix(range)))
529564
.focus(_.sequencerAdminClient.port)
530565
.modify(setPortPrefix(range))
566+
.focus(_.bftSequencers)
567+
.modify(_.map(_.focus(_.sequencerAdminClient.port).modify(setPortPrefix(range))))
531568
} else {
532569
config
533570
}
@@ -608,6 +645,34 @@ object ConfigTransforms {
608645
transforms.foldLeft((c: SpliceConfig) => c)((f, tf) => f compose tf)
609646
}
610647

648+
def withBftSequencers(): ConfigTransform = {
649+
updateAllSvAppConfigs_(appConfig =>
650+
appConfig
651+
.focus(_.localSynchronizerNode)
652+
.modify(
653+
_.map(
654+
_.focus(_.sequencer).modify(
655+
_.copy(
656+
isBftSequencer = true
657+
)
658+
)
659+
)
660+
)
661+
) compose {
662+
updateAllScanAppConfigs((scan, config) =>
663+
config.copy(
664+
bftSequencers = Seq(
665+
BftSequencerConfig(
666+
0,
667+
config.sequencerAdminClient,
668+
s"http://localhost:${5010 + Integer.parseInt(scan.stripPrefix("sv").take(1)) * 100}",
669+
)
670+
)
671+
)
672+
)
673+
}
674+
}
675+
611676
private def portTransform(bump: Int, c: AdminServerConfig): AdminServerConfig =
612677
c.copy(internalPort = c.internalPort.map(_ + bump))
613678

apps/app/src/test/resources/bft-sequencer-global-domain-overrides.conf

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
_sequencer_bft_template {
2-
type = "BFT"
3-
config = {
4-
storage=${_shared.storage}
5-
initial-network {
6-
server-endpoint {
7-
address="0.0.0.0"
8-
external-address = "localhost"
9-
external-tls-config.enabled=false
10-
}
11-
peer-endpoints = []
12-
}
13-
}
14-
}
151
canton {
162
sequencers {
173
globalSequencerSv1.sequencer = ${_sequencer_bft_template}

apps/app/src/test/resources/include/nodes/sv4-node.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ canton {
1111
}
1212
}
1313

14+
scan-apps {
15+
sv4Scan { include required("../scans/sv4-scan") }
16+
}
17+
1418
validator-apps {
1519
sv4Validator { include required("../validators/sv4-validator") }
1620
}

apps/app/src/test/resources/include/sequencers.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
include required("storage-postgres.conf")
22

3+
_sequencer_bft_template {
4+
type = "BFT"
5+
config = {
6+
storage=${_shared.storage}
7+
initial-network {
8+
server-endpoint {
9+
address="0.0.0.0"
10+
external-address = "localhost"
11+
external-tls-config.enabled=false
12+
}
13+
peer-endpoints = []
14+
}
15+
}
16+
}
17+
318
_sequencer_reference_template {
419
init {
520
# In Splice, the node identifier is always set by the application controlling the canton node.

apps/app/src/test/resources/include/svs/sv4.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
private-key = "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgxED/gH8AeSwNujZAVLhBRSN55Hx0ntC6FKKhgn+7h92hRANCAARkw2wMmvW5PAxMgiXNRmlR7FMupUYywPtxHhjyyphgViGV1Ux4cbnNK5t/6n5ZlssTIxQJPmcEIIGHSiJRj1ys"
3131
}
3232

33+
scan {
34+
public-url = "http://localhost:5312"
35+
internal-url = "http://localhost:5312"
36+
}
37+
38+
3339
approved-sv-identities = [
3440
{
3541
include required("_sv2-id")

apps/app/src/test/resources/include/validators/sv3-validator.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
sv-validator = true
1212
sv-user = "sv3"
1313

14+
// Override to use own scan
15+
scan-client.url="http://127.0.0.1:"${canton.scan-apps.sv3Scan.admin-api.port}
16+
scan-client.url=${?SV3_SCAN_URL}
17+
1418
contact-point = "[email protected]"
1519
canton-identifier-config = {
1620
participant = "sv3"

apps/app/src/test/resources/include/validators/sv4-validator.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
sv-user = "sv4"
1313

1414
// We only have two scans, so we point to SV-2's
15-
scan-client.url="http://127.0.0.1:"${?canton.scan-apps.sv2Scan.admin-api.port}
15+
scan-client.url="http://127.0.0.1:"${?canton.scan-apps.sv4Scan.admin-api.port}
1616
scan-client.url=${?SV2_SCAN_URL}
1717

1818
contact-point = "[email protected]"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
include required("include/canton-basic.conf")
2+
include required("include/sequencers.conf")
3+
4+
canton {
5+
sequencers {
6+
7+
sv4StandaloneSequencer.sequencer = ${_sequencer_bft_template}
8+
sv4StandaloneSequencer.sequencer.config.initial-network.server-endpoint.port = 27410
9+
sv4StandaloneSequencer.sequencer.config.initial-network.server-endpoint.external-port = 27410
10+
sv4StandaloneSequencer.sequencer.config.storage.config.properties.databaseName = "sequencer_sv4_standalone_bft"
11+
sv4StandaloneSequencer.sequencer.config.storage.config.properties.databaseName = ${?SV4_SEQUENCER_DB_BFT}
12+
}
13+
14+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
include required("include/canton-basic.conf")
2+
include required("include/sequencers.conf")
3+
4+
canton {
5+
sequencers {
6+
7+
sv1StandaloneSequencer.sequencer = ${_sequencer_bft_template}
8+
sv1StandaloneSequencer.sequencer.config.initial-network.server-endpoint.port = 27110
9+
sv1StandaloneSequencer.sequencer.config.initial-network.server-endpoint.external-port = 27110
10+
sv1StandaloneSequencer.sequencer.config.storage.config.properties.databaseName = "sequencer_sv1_standalone_bft"
11+
sv1StandaloneSequencer.sequencer.config.storage.config.properties.databaseName = ${?SV1_SEQUENCER_DB_BFT}
12+
13+
sv2StandaloneSequencer.sequencer = ${_sequencer_bft_template}
14+
sv2StandaloneSequencer.sequencer.config.initial-network.server-endpoint.port = 27210
15+
sv2StandaloneSequencer.sequencer.config.initial-network.server-endpoint.external-port = 27210
16+
sv2StandaloneSequencer.sequencer.config.storage.config.properties.databaseName = "sequencer_sv2_standalone_bft"
17+
sv2StandaloneSequencer.sequencer.config.storage.config.properties.databaseName = ${?SV2_SEQUENCER_DB_BFT}
18+
19+
sv3StandaloneSequencer.sequencer = ${_sequencer_bft_template}
20+
sv3StandaloneSequencer.sequencer.config.initial-network.server-endpoint.port = 27310
21+
sv3StandaloneSequencer.sequencer.config.initial-network.server-endpoint.external-port = 27310
22+
sv3StandaloneSequencer.sequencer.config.storage.config.properties.databaseName = "sequencer_sv3_standalone_bft"
23+
sv3StandaloneSequencer.sequencer.config.storage.config.properties.databaseName = ${?SV3_SEQUENCER_DB_BFT}
24+
25+
}
26+
27+
}

0 commit comments

Comments
 (0)