Skip to content
Closed
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
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
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
11 changes: 4 additions & 7 deletions apps/sv/frontend/src/__tests__/config-diffs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import {
checkAmuletRulesExpectedConfigDiffsHTML,
checkDsoRulesExpectedConfigDiffsHTML,
} from '@lfdecentralizedtrust/splice-common-test-utils';
import { fireEvent, render, screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { test, expect, describe } from 'vitest';

import App from '../App';
import { SvConfigProvider } from '../utils';
import { svPartyId } from './mocks/constants';
import { changeAction } from './helpers';

const AppWithConfig = () => {
return (
Expand Down Expand Up @@ -56,9 +57,7 @@ describe('SV can see AmuletRules config diffs', () => {
expect(await screen.findByText('Vote Requests')).toBeDefined();
expect(await screen.findByText('Governance')).toBeDefined();

const dropdown = screen.getByTestId('display-actions');
expect(dropdown).toBeDefined();
fireEvent.change(dropdown!, { target: { value: action } });
changeAction(action);

const input = screen.getByTestId('transferConfig.createFee.fee-value');
await userEvent.type(input, '42');
Expand Down Expand Up @@ -121,9 +120,7 @@ describe('SV can see DsoRules config diffs', () => {
expect(await screen.findByText('Vote Requests')).toBeDefined();
expect(await screen.findByText('Governance')).toBeDefined();

const dropdown = screen.getByTestId('display-actions');
expect(dropdown).toBeDefined();
fireEvent.change(dropdown!, { target: { value: action } });
changeAction(action);

const input = screen.getByTestId(
'decentralizedSynchronizer.synchronizers.0.1.acsCommitmentReconciliationInterval-value'
Expand Down
16 changes: 16 additions & 0 deletions apps/sv/frontend/src/__tests__/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
import { screen, fireEvent } from '@testing-library/react';
import { expect } from 'vitest';

export function changeAction(actionName: string = 'SRARC_SetConfig'): void {
const dropdown = screen.getByTestId('display-actions');
expect(dropdown).toBeDefined();
fireEvent.change(dropdown!, { target: { value: actionName } });

const actionChangeDialog = screen.getByTestId('action-change-dialog');
expect(actionChangeDialog).toBeDefined();
const actionChangeDialogProceed = screen.getByTestId('action-change-dialog-proceed');
expect(actionChangeDialogProceed).toBeDefined();
fireEvent.click(actionChangeDialogProceed);
}
21 changes: 7 additions & 14 deletions apps/sv/frontend/src/__tests__/sv.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
import { render, screen, fireEvent } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { rest } from 'msw';
import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils';
Expand All @@ -11,6 +11,7 @@ import App from '../App';
import { SvConfigProvider } from '../utils';
import { svPartyId, voteRequests } from './mocks/constants';
import { server, svUrl } from './setup/setup';
import { changeAction } from './helpers';

const AppWithConfig = () => {
return (
Expand Down Expand Up @@ -65,14 +66,12 @@ describe('An SetConfig request', () => {
expect(await screen.findByText('Vote Requests')).toBeDefined();
expect(await screen.findByText('Governance')).toBeDefined();

const dropdown = screen.getByTestId('display-actions');
expect(dropdown).toBeDefined();
fireEvent.change(dropdown!, { target: { value: 'CRARC_SetConfig' } });
changeAction('CRARC_SetConfig');

expect(await screen.findByText('transferConfig.createFee.fee')).toBeDefined();
expect(await screen.findByDisplayValue('0.03')).toBeDefined();

fireEvent.change(dropdown!, { target: { value: 'SRARC_SetConfig' } });
changeAction('SRARC_SetConfig');

expect(await screen.findByText('numUnclaimedRewardsThreshold')).toBeDefined();
expect(await screen.findByDisplayValue('10')).toBeDefined();
Expand All @@ -91,9 +90,7 @@ describe('An SetConfig request', () => {
expect(await screen.findByText('Vote Requests')).toBeDefined();
expect(await screen.findByText('Governance')).toBeDefined();

const dropdown = screen.getByTestId('display-actions');
expect(dropdown).toBeDefined();
fireEvent.change(dropdown!, { target: { value: 'SRARC_SetConfig' } });
changeAction('SRARC_SetConfig');

const input = screen.getByTestId(
'decentralizedSynchronizer.synchronizers.0.1.acsCommitmentReconciliationInterval-value'
Expand Down Expand Up @@ -134,9 +131,7 @@ describe('An SetConfig request', () => {
expect(await screen.findByText('Vote Requests')).toBeDefined();
expect(await screen.findByText('Governance')).toBeDefined();

const dropdown = screen.getByTestId('display-actions');
expect(dropdown).toBeDefined();
fireEvent.change(dropdown!, { target: { value: 'CRARC_SetConfig' } });
changeAction('CRARC_SetConfig');

const input = screen.getByTestId('transferConfig.createFee.fee-value');
await user.clear(input);
Expand Down Expand Up @@ -181,9 +176,7 @@ describe('An SetConfig request', () => {
expect(await screen.findByText('Vote Requests')).toBeDefined();
expect(await screen.findByText('Governance')).toBeDefined();

const dropdown = screen.getByTestId('display-actions');
expect(dropdown).toBeDefined();
fireEvent.change(dropdown!, { target: { value: 'CRARC_SetConfig' } });
changeAction('CRARC_SetConfig');

const input = screen.getByTestId('transferConfig.createFee.fee-value');
await user.clear(input);
Expand Down
28 changes: 8 additions & 20 deletions apps/sv/frontend/src/__tests__/synchroniser-upgrade.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import App from '../App';
import { SvConfigProvider } from '../utils';
import { svPartyId } from './mocks/constants';
import { server, svUrl } from './setup/setup';
import { changeAction } from './helpers';

dayjs.extend(timezone);

Expand Down Expand Up @@ -80,9 +81,7 @@ describe('SV user can', () => {

await user.click(screen.getByText('Governance'));

const dropdown = screen.getByTestId('display-actions');
expect(dropdown).toBeDefined();
fireEvent.change(dropdown!, { target: { value: 'SRARC_SetConfig' } });
changeAction();

expect(screen.queryByText('nextScheduledSynchronizerUpgrade.time')).toBeNull();
expect(await screen.findByText('nextScheduledSynchronizerUpgrade')).toBeDefined();
Expand Down Expand Up @@ -113,8 +112,7 @@ describe('SV user can', () => {

await user.click(screen.getByText('Governance'));

const dropdown = screen.getByTestId('display-actions');
fireEvent.change(dropdown!, { target: { value: 'SRARC_SetConfig' } });
changeAction();

const synchronizerUpgradeCheckBox = screen.getByTestId(
'enable-next-scheduled-domain-upgrade'
Expand Down Expand Up @@ -168,9 +166,7 @@ describe('SV user can', () => {

await user.click(screen.getByText('Governance'));

const dropdown = screen.getByTestId('display-actions');
fireEvent.change(dropdown!, { target: { value: 'SRARC_SetConfig' } });

changeAction();
await fillOutForm(user);

const disabled = screen
Expand Down Expand Up @@ -201,9 +197,7 @@ describe('SV user can', () => {

await user.click(screen.getByText('Governance'));

const dropdown = screen.getByTestId('display-actions');
fireEvent.change(dropdown!, { target: { value: 'SRARC_SetConfig' } });

changeAction();
await fillOutForm(user);

const effectiveAtThresholdCheckBox = screen.getByTestId(
Expand Down Expand Up @@ -267,9 +261,7 @@ describe('SV user can', () => {

await user.click(screen.getByText('Governance'));

const dropdown = screen.getByTestId('display-actions');
fireEvent.change(dropdown!, { target: { value: 'SRARC_SetConfig' } });

changeAction();
await fillOutForm(user);

const effectiveDateComponent = screen.getByTestId('datetime-picker-vote-request-expiration');
Expand Down Expand Up @@ -334,9 +326,7 @@ describe('SV user can', () => {

await user.click(screen.getByText('Governance'));

const dropdown = screen.getByTestId('display-actions');
fireEvent.change(dropdown!, { target: { value: 'SRARC_SetConfig' } });

changeAction();
await fillOutForm(user);

const synchronizerUpgradeCheckBox = screen.getByTestId(
Expand Down Expand Up @@ -396,9 +386,7 @@ describe('SV user can', () => {

await user.click(screen.getByText('Governance'));

const dropdown = screen.getByTestId('display-actions');
fireEvent.change(dropdown!, { target: { value: 'SRARC_SetConfig' } });

changeAction();
await fillOutForm(user);

const effectiveAtThresholdCheckBox = screen.getByTestId(
Expand Down
Loading
Loading