Skip to content

Commit

Permalink
Update Splice from CCI (#257)
Browse files Browse the repository at this point in the history
Signed-off-by: DA Automation <[email protected]>
Co-authored-by: DA Automation <[email protected]>
  • Loading branch information
canton-network-da and DA Automation authored Jan 17, 2025
1 parent d5f9f82 commit 607437f
Show file tree
Hide file tree
Showing 11 changed files with 381 additions and 275 deletions.
2 changes: 1 addition & 1 deletion .circleci/canton-scripts/check-sbt-output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ read_sbt_output() {
}

filter_errors() {
grep -i -w -e error -e severe -e warn -e warning -e exception -e critical -e fatal || true
grep -i -e error -e severe -e warn -e warning -e exception -e critical -e fatal || true
}

# Read ignore patterns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,6 @@ class SvAppBackendReference(
httpCommand(HttpSvAdminAppClient.GetMediatorNodeStatus())
}

def signSynchronizerBootstrappingState(domainIdPrefix: String): Unit =
consoleEnvironment.run {
httpCommand(
HttpSvSoftDomainMigrationPocAppClient.SignSynchronizerBootstrappingState(domainIdPrefix)
)
}

def initializeSynchronizer(domainIdPrefix: String): Unit =
consoleEnvironment.run {
httpCommand(HttpSvSoftDomainMigrationPocAppClient.InitializeSynchronizer(domainIdPrefix))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,17 @@ class SoftDomainMigrationIntegrationTest
val dsoRules = sv1Backend.getDsoInfo().dsoRules

clue("Bootstrap new domain") {
clue("Sign bootstrapping state") {
val signed = env.svs.local.map { sv =>
Future { sv.signSynchronizerBootstrappingState(prefix) }
clue("Wait for signed topology state to appear") {
env.svs.local.map { sv =>
eventually() {
sv.participantClient.topology.domain_parameters
.list(filterDomain = "global-domain-new") should not be empty
}
}
signed.foreach(_.futureValue)
val initialized = env.svs.local.map { sv =>
Future { sv.initializeSynchronizer(prefix) }
}
initialized.foreach(_.futureValue)
}
clue("Initialize synchronizer nodes") {
val initialized = env.svs.local.map { sv =>
Expand Down
43 changes: 18 additions & 25 deletions apps/sv/frontend/src/components/votes/VoteRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const CreateVoteRequest: React.FC = () => {
const [actionName, setActionName] = useState('SRARC_OffboardSv');
const [summary, setSummary] = useState<string>('');
const [url, setUrl] = useState<string>('');
const [expiration, setExpiration] = useState<Dayjs | null>(null);
const [expiration, setExpiration] = useState<Dayjs>(dayjs());
const [confirmDialogOpen, setConfirmDialogOpen] = useState(false);

// States related to constraints from vote requests
Expand All @@ -79,34 +79,28 @@ export const CreateVoteRequest: React.FC = () => {
const dsoInfosQuery = useDsoInfos();
const listVoteRequestsQuery = useListDsoRulesVoteRequests();

function getDefaultExpiration(): Dayjs {
switch (actionName) {
case 'CRARC_RemoveFutureAmuletConfigSchedule':
case 'CRARC_UpdateFutureAmuletConfigSchedule':
case 'CRARC_AddFutureAmuletConfigSchedule': {
return dayjs();
}
default: {
const microseconds =
parseInt(dsoInfosQuery.data?.dsoRules.payload.config.voteRequestTimeout.microseconds!) /
1000;
return dayjs().add(Math.floor(microseconds), 'milliseconds');
}
}
}
const expirationFromVoteRequestTimeout = dayjs().add(
Math.floor(
parseInt(dsoInfosQuery.data?.dsoRules.payload.config.voteRequestTimeout.microseconds!) / 1000
),
'milliseconds'
);

useEffect(() => {
setExpiration(getDefaultExpiration);
setExpiration(expirationFromVoteRequestTimeout);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [dsoInfosQuery.isSuccess]);
}, [dsoInfosQuery.isInitialLoading]);

useEffect(() => {
setExpiration(getDefaultExpiration);
const handleExpirationDateChange = (newDate: Dayjs | null) => {
setExpiration(newDate ?? dayjs());
};

const handleActionNameChange = (newActionName: string) => {
setMaxDateTimeIfAddFutureAmuletConfigSchedule(undefined);
setUrl('');
setSummary('');
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [actionName, setActionName]); // same than above
setActionName(newActionName);
};

const actionNameOptions = [
{ name: 'Offboard Member', value: 'SRARC_OffboardSv' },
Expand Down Expand Up @@ -223,7 +217,6 @@ export const CreateVoteRequest: React.FC = () => {
.then(() => setSummary(''))
.then(() => setActionName('SRARC_OffboardSv'))
.then(() => setAction(undefined))
.then(() => setExpiration(getDefaultExpiration))
.then(() => setMaxDateTimeIfAddFutureAmuletConfigSchedule(undefined))
.then(() => setAlertMessage({}));
}
Expand Down Expand Up @@ -267,7 +260,7 @@ export const CreateVoteRequest: React.FC = () => {
'data-testid': 'display-actions',
}}
value={actionName}
onChange={e => setActionName(e.target.value)}
onChange={e => handleActionNameChange(e.target.value)}
>
{actionNameOptions.map((actionName, index) => (
<option key={'action-option-' + index} value={actionName.value}>
Expand All @@ -289,7 +282,7 @@ export const CreateVoteRequest: React.FC = () => {
minDateTime={dayjs()}
maxDateTime={maxDateTimeIfAddFutureAmuletConfigSchedule}
readOnly={false}
onChange={(newValue: Dayjs | null) => setExpiration(newValue)}
onChange={d => handleExpirationDateChange(d)}
slotProps={{
textField: {
id: 'datetime-picker-vote-request-expiration',
Expand Down
16 changes: 0 additions & 16 deletions apps/sv/src/main/openapi/sv-internal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -587,22 +587,6 @@ paths:
schema:
"$ref": "../../../../common/src/main/openapi/common-internal.yaml#/components/schemas/GetDsoInfoResponse"

# TODO(#13301) Replace by automation
/v0/synchronizer/{domain_id_prefix}/sign_bootstrapping_state:
post:
tags: [sv]
x-jvm-package: sv_soft_domain_migration_poc
operationId: "signSynchronizerBootstrappingState"
parameters:
- name: "domain_id_prefix"
in: path
required: true
schema:
type: string
responses:
"200":
description: ok

# TODO(#13301) Replace by automation
/v0/synchronizer/{domain_id_prefix}/initialize:
post:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ class SvApp(
Seq(
new HttpSvSoftDomainMigrationPocHandler(
dsoAutomation,
localSynchronizerNode,
extraSynchronizerNodes,
participantAdminConnection,
config.domainMigrationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,6 @@ object HttpSvSoftDomainMigrationPocAppClient {
)
}

case class SignSynchronizerBootstrappingState(domainIdPrefix: String)
extends BaseCommand[http.SignSynchronizerBootstrappingStateResponse, Unit] {
override def submitRequest(
client: Client,
headers: List[HttpHeader],
): EitherT[Future, Either[
Throwable,
HttpResponse,
], http.SignSynchronizerBootstrappingStateResponse] =
client.signSynchronizerBootstrappingState(domainIdPrefix, headers = headers)
override def handleOk()(implicit decoder: TemplateJsonDecoder) = {
case http.SignSynchronizerBootstrappingStateResponse.OK => Right(())
}
}

case class InitializeSynchronizer(domainIdPrefix: String)
extends BaseCommand[http.InitializeSynchronizerResponse, Unit] {
override def submitRequest(
Expand Down
Loading

0 comments on commit 607437f

Please sign in to comment.