Skip to content

Commit 9e87f2f

Browse files
Merge main into feat/face-performance-optimization-3352
2 parents 49436f2 + 080d5fc commit 9e87f2f

File tree

36 files changed

+3023
-146
lines changed

36 files changed

+3023
-146
lines changed

.config/dictionaries/project.dic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ openapi
266266
opentelemetry
267267
overprovisioned
268268
pageobject
269+
pathlib
269270
Pbkdf2
270271
pbxproj
271272
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
) {
@@ -344,9 +373,10 @@ class _ProposalBuilderBodyState extends State<_ProposalBuilderBody>
344373
}
345374

346375
Future<void> _showPublishException(ProposalBuilderPublishException error) {
347-
return PublishProposalErrorDialog.show(
376+
return ProposalErrorDialog.show(
348377
context: context,
349-
exception: error,
378+
title: error.title(context),
379+
message: error.message(context),
350380
);
351381
}
352382

@@ -380,9 +410,10 @@ class _ProposalBuilderBodyState extends State<_ProposalBuilderBody>
380410
}
381411

382412
Future<void> _showSubmitException(ProposalBuilderSubmitException error) {
383-
return SubmitProposalErrorDialog.show(
413+
return ProposalErrorDialog.show(
384414
context: context,
385-
exception: error,
415+
title: error.title(context),
416+
message: error.message(context),
386417
);
387418
}
388419

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
@@ -801,9 +801,21 @@ final class ProposalBuilderBloc extends Bloc<ProposalBuilderEvent, ProposalBuild
801801
versions: updatedVersions,
802802
);
803803
emitSignal(const PublishedProposalBuilderSignal());
804+
} on ProposalLimitReachedException {
805+
_logger.info('publishProposal: limit reached');
806+
emitError(const ProposalBuilderLimitReachedException());
807+
} on DocumentSignException catch (error, stackTrace) {
808+
_logger.severe('publishProposal: failed to sign the document', error, stackTrace);
809+
emitError(const ProposalBuilderDocumentSignException());
804810
} catch (error, stackTrace) {
805-
_logger.severe('PublishProposal', error, stackTrace);
806-
emitError(const ProposalBuilderPublishException());
811+
_logger.severe('publishProposal', error, stackTrace);
812+
813+
emitError(
814+
LocalizedException.create(
815+
error,
816+
fallback: () => const ProposalBuilderPublishException(),
817+
),
818+
);
807819
} finally {
808820
emit(state.copyWith(isChanging: false));
809821
}
@@ -1115,9 +1127,21 @@ final class ProposalBuilderBloc extends Bloc<ProposalBuilderEvent, ProposalBuild
11151127
// already submitted, do nothing
11161128
break;
11171129
}
1130+
} on ProposalLimitReachedException {
1131+
_logger.info('SubmitProposalForReview: limit reached');
1132+
emitError(const ProposalBuilderLimitReachedException());
1133+
} on DocumentSignException catch (error, stackTrace) {
1134+
_logger.severe('publishProposal: failed to sign the document', error, stackTrace);
1135+
emitError(const ProposalBuilderDocumentSignException());
11181136
} catch (error, stackTrace) {
11191137
_logger.severe('SubmitProposalForReview', error, stackTrace);
1120-
emitError(const ProposalBuilderSubmitException());
1138+
1139+
emitError(
1140+
LocalizedException.create(
1141+
error,
1142+
fallback: () => const ProposalBuilderSubmitException(),
1143+
),
1144+
);
11211145
} finally {
11221146
emit(state.copyWith(isChanging: false));
11231147
}

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
@@ -2251,6 +2251,22 @@
22512251
"@proposalEditorDeleteDialogTitle": {
22522252
"description": "A title for the dialog to confirm proposal deletion."
22532253
},
2254+
"proposalEditorDocumentSignErrorMessage": "We couldn't sign the proposal, please try again later.",
2255+
"@proposalEditorDocumentSignErrorMessage": {
2256+
"description": "Dialog message in proposal editor when user couldn't sign the proposal."
2257+
},
2258+
"proposalEditorDocumentSignErrorTitle": "Unable to Sign the Proposal",
2259+
"@proposalEditorDocumentSignErrorTitle": {
2260+
"description": "Dialog title in proposal editor when user couldn't sign the proposal."
2261+
},
2262+
"proposalEditorLimitReachedErrorMessage": "You have reached the maximum number of proposals allowed.",
2263+
"@proposalEditorLimitReachedErrorMessage": {
2264+
"description": "Dialog message in proposal editor when user has reached the max proposals limit."
2265+
},
2266+
"proposalEditorLimitReachedErrorTitle": "Unable to Publish Proposal",
2267+
"@proposalEditorLimitReachedErrorTitle": {
2268+
"description": "Dialog title in proposal editor when user has reached the max proposals limit."
2269+
},
22542270
"proposalEditorNotAnswered": "Not Answered",
22552271
"@proposalEditorNotAnswered": {
22562272
"description": "Placeholder text when a property has been not filled."

0 commit comments

Comments
 (0)