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
5 changes: 4 additions & 1 deletion .github/workflows/cluster_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
sha:
type: string
required: true
splice_url:
type: string
required: false

outputs:
result:
Expand Down Expand Up @@ -39,5 +42,5 @@ jobs:
run: |
set -euo pipefail
result=$(curl -sSfL -H "Authorization: Bearer ${{ steps.auth.outputs.id_token }}" \
"${{ secrets.CLUSTER_TEST_INVOKER_URL }}?workflow=${{ inputs.workflow }}&splice-git-ref=${{ inputs.sha }}")
"${{ secrets.CLUSTER_TEST_INVOKER_URL }}?workflow=${{ inputs.workflow }}&splice-git-ref=${{ inputs.sha }}&splice-url=${{ inputs.splice_url }}")
echo "result=$result" >> "$GITHUB_OUTPUT"
21 changes: 0 additions & 21 deletions .github/workflows/post_merge.yml

This file was deleted.

36 changes: 23 additions & 13 deletions .github/workflows/pr_cluster_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,60 @@ permissions:

jobs:

get_sha:
get_head:
runs-on: self-hosted-docker-tiny
outputs:
sha: ${{ steps.comment-branch.outputs.head_sha }}
sha: ${{ steps.get_head.outputs.sha }}
repo: ${{ steps.get_head.outputs.repo }}
steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@e8b8daa837e8ea7331c0003c9c316a64c6d8b0b1 # v3.0.0
id: comment-branch
- name: Get head SHA & repo
id: get_head
run: |
set -euo pipefail
query='query pullRequestDetails { repository(name: \"${{ github.event.repository.name }}\", owner: \"${{ github.repository_owner }}\") { pullRequest(number: ${{ github.event.issue.number }}) { headRef { target { oid } } headRepository { sshUrl } } } }'
result=$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -X POST -d " { \"query\": \"$query\" } " https://api.github.com/graphql)
sha=$(echo "$result" | jq -r '.data.repository.pullRequest.headRef.target.oid')
repo=$(echo "$result" | jq -r '.data.repository.pullRequest.headRepository.sshUrl')
echo "sha=$sha" >> "$GITHUB_OUTPUT"
echo "repo=$repo" >> "$GITHUB_OUTPUT"

trigger_cluster_test_basic:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/cluster_test')
needs: get_sha
needs: get_head
uses: ./.github/workflows/cluster_tests.yml
secrets: inherit
with:
workflow: cluster_test
sha: ${{ needs.get_sha.outputs.sha }}
sha: ${{ needs.get_head.outputs.sha }}
splice_url: ${{ needs.get_head.outputs.repo }}

result:
runs-on: self-hosted-docker-tiny
needs:
- trigger_cluster_test_basic
- get_sha
- get_head
steps:
- run: |
number=$(echo '${{ needs.trigger_cluster_test_basic.outputs.result }}' | jq -r '.number')
echo "Deploy scratchnet pipeline triggered for [PR as of ${{ needs.get_sha.outputs.sha }}](https://github.com/${{ github.repository }}/pull/${{ github.event.issue.number }}/files/${{ needs.get_sha.outputs.sha }}), please approve it in CircleCI: https://app.circleci.com/pipelines/github/DACH-NY/canton-network-internal/${number}"
echo "Deploy scratchnet pipeline triggered for [Commit ${{ needs.get_head.outputs.sha }} in ${{ needs.get_head.outputs.repo }}](https://github.com/${{ github.repository }}/pull/${{ github.event.issue.number }}/files/${{ needs.get_head.outputs.sha }}), please approve it in CircleCI: https://app.circleci.com/pipelines/github/DACH-NY/canton-network-internal/${number}"


trigger_cluster_test_hdm:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/hdm_test')
needs: get_sha
needs: get_head
uses: ./.github/workflows/cluster_tests.yml
secrets: inherit
with:
workflow: hdm_test
sha: ${{ needs.get_sha.outputs.sha }}
sha: ${{ needs.get_head.outputs.sha }}
splice_url: ${{ needs.get_head.outputs.repo }}

result_hdm:
runs-on: self-hosted-docker-tiny
needs:
- trigger_cluster_test_hdm
- get_sha
- get_head
steps:
- run: |
number=$(echo '${{ needs.trigger_cluster_test_hdm.outputs.result }}' | jq -r '.number')
echo "Deploy scratchnet HDM pipeline triggered for [PR as of ${{ needs.get_sha.outputs.sha }}](https://github.com/${{ github.repository }}/pull/${{ github.event.issue.number }}/files/${{ needs.get_sha.outputs.sha }}), please approve it in CircleCI: https://app.circleci.com/pipelines/github/DACH-NY/canton-network-internal/${number}"
echo "Deploy scratchnet HDM pipeline triggered for [Commit ${{ needs.get_head.outputs.sha }} in ${{ needs.get_head.outputs.repo }}](https://github.com/${{ github.repository }}/pull/${{ github.event.issue.number }}/files/${{ needs.get_head.outputs.sha }}), please approve it in CircleCI: https://app.circleci.com/pipelines/github/DACH-NY/canton-network-internal/${number}"
2 changes: 1 addition & 1 deletion LATEST_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.21
0.4.0
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.0
0.4.1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import com.digitalasset.canton.topology.admin.grpc.TopologyStoreId.Authorized
import com.digitalasset.canton.topology.store.TimeQuery.HeadState
import monocle.macros.syntax.lens.*
import org.lfdecentralizedtrust.splice.console.ParticipantClientReference
import com.digitalasset.canton.config.NonNegativeFiniteDuration

import scala.jdk.CollectionConverters.*
import java.time.Instant
Expand Down Expand Up @@ -75,6 +76,14 @@ class AppUpgradeIntegrationTest
// Makes the test a bit faster and easier to debug. See #11488
ConfigTransforms.useDecentralizedSynchronizerSplitwell()(config)
)
.addConfigTransform((_, conf) =>
ConfigTransforms.updateAllValidatorAppConfigs_(c =>
// Reduce the cache TTL so package upgrades are picked up quickly.
c.copy(scanClient =
c.scanClient.setAmuletRulesCacheTimeToLive(NonNegativeFiniteDuration.ofSeconds(1))
)
)(conf)
)
.addConfigTransform((_, config) => {
config
.focus(_.validatorApps)
Expand Down Expand Up @@ -362,7 +371,7 @@ class AppUpgradeIntegrationTest

actAndCheck(
"Bob taps after upgrade",
eventually() {
eventuallySucceeds() {
bobWalletClient.tap(20)
},
)(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition
import org.lfdecentralizedtrust.splice.integration.tests.SpliceTests.IntegrationTest
import org.lfdecentralizedtrust.splice.scan.config.BftSequencerConfig

// TODO(#19679) consider renaming to BftManualStartIntegrationTest
class BFTManualStartIntegrationTest extends IntegrationTest {
class BftManualStartIntegrationTest extends IntegrationTest {

override def environmentDefinition: SpliceEnvironmentDefinition = {
EnvironmentDefinition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,7 @@ class SvFrontendIntegrationTest

val (_, (createdVoteRequestAction, createdVoteRequestRequester)) = actAndCheck(
"sv1 operator can create a new vote request", {
val dropDownAction = new Select(webDriver.findElement(By.id("display-actions")))
dropDownAction.selectByValue(action)
changeAction(action)

fillUpForm(webDriver)

Expand Down Expand Up @@ -672,8 +671,7 @@ class SvFrontendIntegrationTest

actAndCheck(
"sv1 operator can create a new vote request", {
val dropDownAction = new Select(webDriver.findElement(By.id("display-actions")))
dropDownAction.selectByValue("SRARC_GrantFeaturedAppRight")
changeAction("SRARC_GrantFeaturedAppRight")

inside(find(id("set-application-provider"))) { case Some(element) =>
element.underlying.sendKeys(requestProviderParty)
Expand Down Expand Up @@ -728,8 +726,7 @@ class SvFrontendIntegrationTest
"sv1 operator can create a new vote request to revoke the featured app right", {
go to s"http://localhost:$sv1UIPort/votes"

val dropDownAction = new Select(webDriver.findElement(By.id("display-actions")))
dropDownAction.selectByValue("SRARC_RevokeFeaturedAppRight")
changeAction("SRARC_RevokeFeaturedAppRight")

inside(find(id("set-application-rightcid"))) { case Some(element) =>
element.underlying.sendKeys(rightCid)
Expand Down Expand Up @@ -775,9 +772,7 @@ class SvFrontendIntegrationTest
// The `eventually` guards against `StaleElementReferenceException`s
// eventually() must contain clickVoteRequestSubmitButtonOnceEnabled() to retry the whole process
eventually() {
find(id("display-actions")) should not be empty
val dropDownAction = new Select(webDriver.findElement(By.id("display-actions")))
dropDownAction.selectByValue("SRARC_SetConfig")
changeAction("SRARC_SetConfig")

inside(find(id("checkbox-set-effective-at-threshold"))) { case Some(element) =>
element.underlying.click()
Expand Down Expand Up @@ -1127,6 +1122,17 @@ class SvFrontendIntegrationTest
}
}

def changeAction(actionName: String)(implicit webDriver: WebDriverType) = {
find(id("display-actions")) should not be empty
val dropDownAction = new Select(webDriver.findElement(By.id("display-actions")))
dropDownAction.selectByValue(actionName)

if (actionName != "SRARC_OffboardSv") {
val proceedButton = webDriver.findElement(By.id("action-change-dialog-proceed"))
proceedButton.click()
}
}

def getVoteRequestsInProgressSize()(implicit webDriver: WebDriverType) = {
val tbodyInProgress = find(id("sv-voting-in-progress-table-body"))
tbodyInProgress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ abstract class ValidatorPreflightIntegrationTestBase
// we can't test a specific amulet price as the amulet price on a live network can change
val rateR =
raw"""^\s*(\d+(?:\.\d+)?)\s*${amuletNameAcronym}/USD\s*$$""".r
inside(transaction.rate) { case rateR(rate) =>
inside(transaction.rate.value) { case rateR(rate) =>
BigDecimal(rate) should be > BigDecimal(0)
transaction.usdAmount should beWithin(
transaction.ccAmount / BigDecimal(rate) - smallAmount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ trait WalletFrontendTestUtil extends WalletTestUtil { self: FrontendTestCommon =
.text,
unit = "USD",
),
rate = transactionRow.childElement(className("tx-amount-rate")).text,
rate = transactionRow.findChildElement(className("tx-amount-rate")).map(_.text),
appRewardsUsed = parseAmountText(
transactionRow
.childElement(className("tx-row-cell-rewards"))
Expand Down Expand Up @@ -207,9 +207,15 @@ trait WalletFrontendTestUtil extends WalletTestUtil { self: FrontendTestCommon =
expectedAmountUSD._1,
expectedAmountUSD._2,
)
transaction.rate should matchText(
s"${BigDecimal(1) / amuletPrice} ${spliceInstanceNames.amuletNameAcronym}/USD"
)

transaction.rate match {
case Some(rate) =>
rate should matchText(
s"${BigDecimal(1) / amuletPrice} ${spliceInstanceNames.amuletNameAcronym}/USD"
)
// Rate text should be missing iff the price is zero
case None => amuletPrice shouldBe BigDecimal(0)
}
}

protected def createTransferOffer(
Expand Down Expand Up @@ -314,7 +320,7 @@ object WalletFrontendTestUtil {
partyDescription: Option[String],
ccAmount: BigDecimal,
usdAmount: BigDecimal,
rate: String,
rate: Option[String],
appRewardsUsed: BigDecimal,
validatorRewardsUsed: BigDecimal,
svRewardsUsed: BigDecimal,
Expand Down
7 changes: 3 additions & 4 deletions apps/scan/src/main/openapi/scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,11 @@ paths:
schema:
"$ref": "#/components/schemas/ListDsoSequencersResponse"

# TODO(#19679) reconsider naming; "bft sequencers" is a bit overloaded
/v0/sv-bft-sequencers:
get:
tags: [internal, scan]
x-jvm-package: scan
operationId: "listSvBFTSequencers"
operationId: "listSvBftSequencers"
description: |
Retrieve Canton BFT sequencer configuration for this SV, for each configured Synchronizer
responses:
Expand All @@ -153,7 +152,7 @@ paths:
content:
application/json:
schema:
"$ref": "#/components/schemas/ListSvBFTSequencersResponse"
"$ref": "#/components/schemas/ListSvBftSequencersResponse"


/v0/domains/{domain_id}/parties/{party_id}/participant-id:
Expand Down Expand Up @@ -1766,7 +1765,7 @@ components:
lastPurchasedInRound:
type: integer
format: int64
ListSvBFTSequencersResponse:
ListSvBftSequencersResponse:
type: object
required: ["bftSequencers"]
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package org.lfdecentralizedtrust.splice.scan.config

import com.digitalasset.canton.config.FullClientConfig

// TODO(#19679) rename me perhaps; something ordering and/or scan and also bft sequencer is overloaded
case class BftSequencerConfig(
migrationId: Long,
sequencerAdminClient: FullClientConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.lfdecentralizedtrust.splice.store.db

import com.daml.ledger.javaapi.data.Unit as damlUnit
import com.daml.ledger.javaapi.data.codegen.ContractId
import org.lfdecentralizedtrust.splice.environment.DarResources
import org.lfdecentralizedtrust.splice.environment.ledger.api.TransactionTreeUpdate
Expand Down Expand Up @@ -211,7 +212,7 @@ class AcsSnapshotStoreTest
"exercises remove from the ACS" in {
// t1 -> create
// t2 -> archives
// t3 -> creates a different one
// t3 -> creates a different one and exercises a non-consuming choice on it
val toArchive = openMiningRound(dsoParty, 1L, 1.0)
val alwaysThere = openMiningRound(dsoParty, 0L, 1.0) // without it there's no snapshots
val toCreateT3 = openMiningRound(dsoParty, 3L, 1.0)
Expand All @@ -226,7 +227,8 @@ class AcsSnapshotStoreTest
_ <- ingestArchive(updateHistory, toArchive, timestamp2.minusSeconds(2L))
_ <- store.insertNewSnapshot(None, DefaultMigrationId, timestamp2)
// t3
_ <- ingestCreate(updateHistory, toCreateT3, timestamp3.minusSeconds(1L))
_ <- ingestCreate(updateHistory, toCreateT3, timestamp3.minusSeconds(2L))
_ <- ingestNonConsuming(updateHistory, toCreateT3, timestamp3.minusSeconds(1L))
_ <- store.insertNewSnapshot(None, DefaultMigrationId, timestamp3)
// querying at the end to prove anything happening in between doesn't matters
afterT1 <- queryAll(store, timestamp1)
Expand Down Expand Up @@ -765,6 +767,34 @@ class AcsSnapshotStoreTest
)
}

private def ingestNonConsuming[TCid <: ContractId[T], T](
updateHistory: UpdateHistory,
contract: Contract[TCid, T],
recordTime: CantonTimestamp,
): Future[Unit] = {
updateHistory.ingestionSink.ingestUpdate(
dummyDomain,
TransactionTreeUpdate(
mkTx(
nextOffset(),
Seq(
exercisedEvent(
contractId = contract.contractId.contractId,
templateId = contract.identifier,
interfaceId = None,
choice = "nonConsumingChoice",
consuming = false,
argument = damlUnit.getInstance(),
result = damlUnit.getInstance(),
)
),
dummyDomain,
recordTime = recordTime.toInstant,
)
),
)
}

private def ingestAcs[TCid <: ContractId[T], T](
updateHistory: UpdateHistory,
acs: Seq[Contract[TCid, T]],
Expand Down
Loading
Loading