Skip to content

Commit 0123286

Browse files
Merge branch 'feat/face-performance-optimization-3352' into feat/co-proposers-3677
2 parents e063a68 + 9e87f2f commit 0123286

File tree

45 files changed

+3304
-157
lines changed

Some content is hidden

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

45 files changed

+3304
-157
lines changed

.config/dictionaries/project.dic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ openapi
267267
opentelemetry
268268
overprovisioned
269269
pageobject
270+
pathlib
270271
Pbkdf2
271272
pbxproj
272273
Pdart

catalyst-gateway/bin/src/settings/admin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use super::str_env_var::StringEnvVar;
1010
/// Configuration for the Admin functionality.
1111
#[derive(Clone)]
1212
pub(crate) struct EnvVars {
13-
/// The Catalyst Signed Document Admin Catalyst ID from the `SIGNED_DOC_ADMIN_KEY`
13+
/// The Catalyst Signed Document Admin Catalyst ID from the `ADMIN_CATALYST_ID`
1414
/// env.
1515
admin_key: Option<catalyst_signed_doc::CatalystId>,
1616
}
@@ -19,7 +19,7 @@ impl EnvVars {
1919
/// Create a config for Catalyst Signed Document validation configuration.
2020
pub(super) fn new() -> Self {
2121
let admin_key = string_to_catalyst_id(
22-
&StringEnvVar::new_optional("SIGNED_DOC_ADMIN_KEY", false)
22+
&StringEnvVar::new_optional("ADMIN_CATALYST_ID", false)
2323
.map(|v| v.as_string())
2424
.unwrap_or_default(),
2525
)

catalyst-gateway/blueprint.cue

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -80,39 +80,33 @@ project: {
8080
}
8181
}
8282
"EVENT_DB_URL": {
83-
secret: {
84-
name: "db-url"
85-
key: "url"
86-
}
87-
}
88-
"EVENT_DB_MAX_CONNECTIONS_SIZE": {
8983
secret: {
9084
name: "gateway"
91-
key: "db-max-connections"
85+
key: "event-db-url"
9286
}
9387
}
94-
"EVENT_DB_MAX_LIFETIME": {
95-
secret: {
96-
name: "gateway"
97-
key: "db-max-lifetime"
98-
}
88+
"EVENT_DB_MAX_CONNECTIONS": {
89+
value: string | *"150"
9990
}
100-
"EVENT_DB_MIN_IDLE": {
101-
secret: {
102-
name: "gateway"
103-
key: "db-min-idle"
104-
}
91+
"EVENT_DB_CONN_TIMEOUT": {
92+
value: string | *"5s"
93+
}
94+
"EVENT_DB_SLOT_WAIT_TIMEOUT": {
95+
value: string | *"5s"
10596
}
106-
"EVENT_DB_CONNECTION_TIMEOUT": {
97+
"EVENT_DB_CONN_RECYCLE_TIMEOUT": {
98+
value: string | *"5s"
99+
}
100+
"INTERNAL_API_KEY": {
107101
secret: {
108102
name: "gateway"
109-
key: "db-connection-timeout"
103+
key: "api-key"
110104
}
111105
}
112-
"INTERNAL_API_KEY": {
106+
"ADMIN_CATALYST_ID": {
113107
secret: {
114108
name: "gateway"
115-
key: "api-key"
109+
key: "admin-catalyst-id"
116110
}
117111
}
118112
}

catalyst-gateway/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ services:
5858
- SIGNED_DOC_SK=0x6455585b5dcc565c8975bc136e215d6d4dd96540620f37783c564da3cb3686dd
5959
- INTERNAL_API_KEY=123
6060
# cspell: disable
61-
- SIGNED_DOC_ADMIN_KEY=admin.catalyst://preprod.cardano/zbau8Us8jfPciQAgL_pGToBSFEuilGfEzFq7JWx0Z-s
61+
- ADMIN_CATALYST_ID=admin.catalyst://preprod.cardano/zbau8Us8jfPciQAgL_pGToBSFEuilGfEzFq7JWx0Z-s
6262
# cspell: enable
6363
# - LOG_LEVEL=error
6464
# - RUST_LOG="error,cat_gateway=debug,cardano_chain_follower=debug,mithril-client=debug"

catalyst-gateway/tests/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ services:
101101
- SERVICE_LIVE_COUNTER_THRESHOLD=100
102102
- SERVICE_LIVE_TIMEOUT_INTERVAL=30
103103
# cspell: disable
104-
- SIGNED_DOC_ADMIN_KEY=admin.catalyst://preprod.cardano/zbau8Us8jfPciQAgL_pGToBSFEuilGfEzFq7JWx0Z-s
104+
- ADMIN_CATALYST_ID=admin.catalyst://preprod.cardano/zbau8Us8jfPciQAgL_pGToBSFEuilGfEzFq7JWx0Z-s
105105
# cspell: enable
106106
# - LOG_LEVEL=error
107107
# - RUST_LOG="error,cat_gateway=debug,cardano_chain_follower=debug,mithril-client=debug"

catalyst_voices/apps/voices/lib/pages/proposal_builder/proposal_builder_page.dart

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ import 'package:catalyst_voices/pages/workspace/submission_closing_warning_dialo
1515
import 'package:catalyst_voices/routes/routes.dart';
1616
import 'package:catalyst_voices/routes/routing/proposal_builder_route.dart';
1717
import 'package:catalyst_voices/widgets/modals/comment/submit_comment_error_dialog.dart';
18+
import 'package:catalyst_voices/widgets/modals/proposals/proposal_error_dialog.dart';
1819
import 'package:catalyst_voices/widgets/modals/proposals/proposal_limit_reached_dialog.dart';
19-
import 'package:catalyst_voices/widgets/modals/proposals/publish_proposal_error_dialog.dart';
2020
import 'package:catalyst_voices/widgets/modals/proposals/publish_proposal_iteration_dialog.dart';
21-
import 'package:catalyst_voices/widgets/modals/proposals/submit_proposal_error_dialog.dart';
2221
import 'package:catalyst_voices/widgets/modals/proposals/submit_proposal_for_review_dialog.dart';
2322
import 'package:catalyst_voices/widgets/modals/proposals/unlock_edit_proposal.dart';
2423
import 'package:catalyst_voices/widgets/snackbar/common_snackbars.dart';
@@ -142,8 +141,14 @@ class _ProposalBuilderBodyState extends State<_ProposalBuilderBody>
142141
unawaited(_showPublishException(error));
143142
case ProposalBuilderSubmitException():
144143
unawaited(_showSubmitException(error));
144+
case ProposalBuilderLimitReachedException():
145+
unawaited(_showLimitReachedException(error));
146+
case ProposalBuilderDocumentSignException():
147+
unawaited(_showDocumentSignException(error));
145148
case LocalizedUnknownPublishCommentException():
146149
unawaited(_showCommentException(error));
150+
case LocalizedException():
151+
unawaited(_showGenericException(error));
147152
default:
148153
super.handleError(error);
149154
}
@@ -277,6 +282,14 @@ class _ProposalBuilderBodyState extends State<_ProposalBuilderBody>
277282
);
278283
}
279284

285+
Future<void> _showDocumentSignException(ProposalBuilderDocumentSignException error) {
286+
return ProposalErrorDialog.show(
287+
context: context,
288+
title: error.title(context),
289+
message: error.message(context),
290+
);
291+
}
292+
280293
Future<void> _showEmailNotVerifiedDialog() async {
281294
final openAccount = await EmailNotVerifiedDialog.show(context);
282295

@@ -317,6 +330,22 @@ class _ProposalBuilderBodyState extends State<_ProposalBuilderBody>
317330
});
318331
}
319332

333+
Future<void> _showGenericException(LocalizedException error) {
334+
return ProposalErrorDialog.show(
335+
context: context,
336+
title: context.l10n.somethingWentWrong,
337+
message: error.message(context),
338+
);
339+
}
340+
341+
Future<void> _showLimitReachedException(ProposalBuilderLimitReachedException error) {
342+
return ProposalErrorDialog.show(
343+
context: context,
344+
title: error.title(context),
345+
message: error.message(context),
346+
);
347+
}
348+
320349
Future<void> _showProposalLimitReachedDialog(
321350
MaxProposalsLimitReachedSignal signal,
322351
) {
@@ -345,9 +374,10 @@ class _ProposalBuilderBodyState extends State<_ProposalBuilderBody>
345374
}
346375

347376
Future<void> _showPublishException(ProposalBuilderPublishException error) {
348-
return PublishProposalErrorDialog.show(
377+
return ProposalErrorDialog.show(
349378
context: context,
350-
exception: error,
379+
title: error.title(context),
380+
message: error.message(context),
351381
);
352382
}
353383

@@ -381,9 +411,10 @@ class _ProposalBuilderBodyState extends State<_ProposalBuilderBody>
381411
}
382412

383413
Future<void> _showSubmitException(ProposalBuilderSubmitException error) {
384-
return SubmitProposalErrorDialog.show(
414+
return ProposalErrorDialog.show(
385415
context: context,
386-
exception: error,
416+
title: error.title(context),
417+
message: error.message(context),
387418
);
388419
}
389420

catalyst_voices/apps/voices/lib/widgets/modals/proposals/submit_proposal_error_dialog.dart renamed to catalyst_voices/apps/voices/lib/widgets/modals/proposals/proposal_error_dialog.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ import 'package:catalyst_voices/widgets/modals/voices_info_dialog.dart';
44
import 'package:catalyst_voices_assets/catalyst_voices_assets.dart';
55
import 'package:catalyst_voices_brands/catalyst_voices_brands.dart';
66
import 'package:catalyst_voices_localization/catalyst_voices_localization.dart';
7-
import 'package:catalyst_voices_view_models/catalyst_voices_view_models.dart';
87
import 'package:flutter/material.dart';
98

10-
/// Error dialog when submitting proposal for review fails.
11-
class SubmitProposalErrorDialog {
9+
/// Generic error dialog related to proposal errors.
10+
class ProposalErrorDialog {
1211
static Future<void> show({
1312
required BuildContext context,
14-
required ProposalBuilderSubmitException exception,
13+
required String title,
14+
required String message,
1515
}) {
1616
return VoicesDialog.show(
1717
context: context,
1818
routeSettings: const RouteSettings(
19-
name: '/proposal-builder/submit-error',
19+
name: '/proposal-builder/error',
2020
),
2121
builder: (context) {
2222
return VoicesInfoDialog(
2323
icon: VoicesAssets.icons.exclamation.buildIcon(
2424
color: Theme.of(context).colors.iconsWarning,
2525
),
26-
title: Text(exception.title(context)),
27-
message: Text(exception.message(context)),
26+
title: Text(title),
27+
message: Text(message),
2828
action: VoicesFilledButton(
2929
onTap: () => Navigator.of(context).pop(),
3030
child: Text(context.l10n.okay),

catalyst_voices/apps/voices/lib/widgets/modals/proposals/publish_proposal_error_dialog.dart

Lines changed: 0 additions & 36 deletions
This file was deleted.

catalyst_voices/packages/internal/catalyst_voices_blocs/lib/src/proposal_builder/proposal_builder_bloc.dart

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,21 @@ final class ProposalBuilderBloc extends Bloc<ProposalBuilderEvent, ProposalBuild
803803
versions: updatedVersions,
804804
);
805805
emitSignal(const PublishedProposalBuilderSignal());
806+
} on ProposalLimitReachedException {
807+
_logger.info('publishProposal: limit reached');
808+
emitError(const ProposalBuilderLimitReachedException());
809+
} on DocumentSignException catch (error, stackTrace) {
810+
_logger.severe('publishProposal: failed to sign the document', error, stackTrace);
811+
emitError(const ProposalBuilderDocumentSignException());
806812
} catch (error, stackTrace) {
807-
_logger.severe('PublishProposal', error, stackTrace);
808-
emitError(const ProposalBuilderPublishException());
813+
_logger.severe('publishProposal', error, stackTrace);
814+
815+
emitError(
816+
LocalizedException.create(
817+
error,
818+
fallback: () => const ProposalBuilderPublishException(),
819+
),
820+
);
809821
} finally {
810822
emit(state.copyWith(isChanging: false));
811823
}
@@ -1119,9 +1131,21 @@ final class ProposalBuilderBloc extends Bloc<ProposalBuilderEvent, ProposalBuild
11191131
// already submitted, do nothing
11201132
break;
11211133
}
1134+
} on ProposalLimitReachedException {
1135+
_logger.info('SubmitProposalForReview: limit reached');
1136+
emitError(const ProposalBuilderLimitReachedException());
1137+
} on DocumentSignException catch (error, stackTrace) {
1138+
_logger.severe('publishProposal: failed to sign the document', error, stackTrace);
1139+
emitError(const ProposalBuilderDocumentSignException());
11221140
} catch (error, stackTrace) {
11231141
_logger.severe('SubmitProposalForReview', error, stackTrace);
1124-
emitError(const ProposalBuilderSubmitException());
1142+
1143+
emitError(
1144+
LocalizedException.create(
1145+
error,
1146+
fallback: () => const ProposalBuilderSubmitException(),
1147+
),
1148+
);
11251149
} finally {
11261150
emit(state.copyWith(isChanging: false));
11271151
}

catalyst_voices/packages/internal/catalyst_voices_localization/lib/l10n/intl_en.arb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,6 +2423,22 @@
24232423
"@proposalEditorDeleteDialogTitle": {
24242424
"description": "A title for the dialog to confirm proposal deletion."
24252425
},
2426+
"proposalEditorDocumentSignErrorMessage": "We couldn't sign the proposal, please try again later.",
2427+
"@proposalEditorDocumentSignErrorMessage": {
2428+
"description": "Dialog message in proposal editor when user couldn't sign the proposal."
2429+
},
2430+
"proposalEditorDocumentSignErrorTitle": "Unable to Sign the Proposal",
2431+
"@proposalEditorDocumentSignErrorTitle": {
2432+
"description": "Dialog title in proposal editor when user couldn't sign the proposal."
2433+
},
2434+
"proposalEditorLimitReachedErrorMessage": "You have reached the maximum number of proposals allowed.",
2435+
"@proposalEditorLimitReachedErrorMessage": {
2436+
"description": "Dialog message in proposal editor when user has reached the max proposals limit."
2437+
},
2438+
"proposalEditorLimitReachedErrorTitle": "Unable to Publish Proposal",
2439+
"@proposalEditorLimitReachedErrorTitle": {
2440+
"description": "Dialog title in proposal editor when user has reached the max proposals limit."
2441+
},
24262442
"proposalEditorNotAnswered": "Not Answered",
24272443
"@proposalEditorNotAnswered": {
24282444
"description": "Placeholder text when a property has been not filled."

0 commit comments

Comments
 (0)