input-output-hk / mithril

Stake-based threshold multi-signatures protocol
https://mithril.network
Apache License 2.0
115 stars 36 forks source link

Refactor timepoint retrieval & conversion to signed entities #1736

Closed Alenar closed 1 month ago

Alenar commented 1 month ago

Content

Following changes introduced in #1727 the conversion of time points to signed entities became more cumbersome. Instead of only using a CardanoNetwork it also needed now the newly introduced CardanoTransactionsSigningConfig.

This PR make this easier by delegating the configuration to a new in memory type: SignedEntityConfig, that is created at configuration time and is in the application dependency container.

This type also takes responsibility, previously in the aggregator Configuration, to list allowed signed entity types from a time point. It also hold statically the list of default types that should always be allowed.

Also in this PR: Rename TimePointProvider to TickerService and remove the conflicting service, named the same, from the aggregator. Those two were doing the same things and comments were in the code to remove the TimePointProvider in favor of the TickerService, but the former continued to evolved even if the later api & naming were preferred. So this PR fixes this contradiction by "fusing" them together.

Pre-submit checklist

Issue(s)

Relates to #1697 and #1727

github-actions[bot] commented 1 month ago

Test Results

    3 files  ±0     43 suites  ±0   8m 36s :stopwatch: -1s 1 028 tests +6  1 028 :white_check_mark: +6  0 :zzz: ±0  0 :x: ±0  1 126 runs  +6  1 126 :white_check_mark: +6  0 :zzz: ±0  0 :x: ±0 

Results for commit 179f66dc. ± Comparison against base commit 2ebb8c40.

This pull request removes 13 and adds 19 tests. Note that renamed tests count towards both. ``` mithril-aggregator ‑ configuration::test::test_list_allowed_signed_entity_types_discriminant_should_not_duplicate_a_signed_entity_discriminant_type_already_in_default_ones mithril-aggregator ‑ configuration::test::test_list_allowed_signed_entity_types_discriminant_should_not_return_unknown_signed_entity_types_in_configuration mithril-aggregator ‑ configuration::test::test_list_allowed_signed_entity_types_discriminant_without_specific_configuration mithril-aggregator ‑ configuration::test::test_list_allowed_signed_entity_types_discriminants_should_add_signed_entity_types_in_configuration_at_the_end mithril-aggregator ‑ configuration::test::test_list_allowed_signed_entity_types_discriminants_with_multiple_identical_signed_entity_types_in_configuration_should_not_be_added_several_times mithril-aggregator ‑ configuration::test::test_list_allowed_signed_entity_types_with_specific_configuration mithril-aggregator ‑ services::ticker::tests::get_epoch mithril-aggregator ‑ services::ticker::tests::get_immutable_beacon mithril-aggregator ‑ services::ticker::tests::no_beacon_error mithril-common ‑ entities::signed_entity_type::tests::computing_block_number_to_be_signed … ``` ``` mithril-common ‑ entities::signed_entity_config::tests::computing_block_number_to_be_signed mithril-common ‑ entities::signed_entity_config::tests::computing_block_number_to_be_signed_round_step_to_a_block_range_start mithril-common ‑ entities::signed_entity_config::tests::given_discriminant_convert_to_signed_entity mithril-common ‑ entities::signed_entity_config::tests::test_list_allowed_signed_entity_types_discriminant_should_not_duplicate_a_signed_entity_discriminant_type_already_in_default_ones mithril-common ‑ entities::signed_entity_config::tests::test_list_allowed_signed_entity_types_discriminant_without_specific_configuration mithril-common ‑ entities::signed_entity_config::tests::test_list_allowed_signed_entity_types_discriminants_should_add_configured_discriminants mithril-common ‑ entities::signed_entity_config::tests::test_list_allowed_signed_entity_types_discriminants_with_multiple_identical_signed_entity_types_in_configuration_should_not_be_added_several_times mithril-common ‑ entities::signed_entity_config::tests::test_list_allowed_signed_entity_types_with_specific_configuration mithril-common ‑ entities::signed_entity_type::tests::parse_list_error_format_to_an_useful_message mithril-common ‑ entities::signed_entity_type::tests::parse_signed_entity_types_discriminants_discriminant_without_values … ```

:recycle: This comment has been updated with latest results.