Skip to content

Feat: implement a signature processor for DMQ #2477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jpraynaud
Copy link
Member

@jpraynaud jpraynaud commented May 14, 2025

Content

This PR includes the implementation of a signature processor for the DMQ in the aggregator:

  • Added a SignatureProcessor trait for continuously consuming signatures and registering them with the certifier service
  • Added a SequentialSignatureProcessor implementation of the SignatureProcessor trait
  • Added a SignatureConsumer trait for receiving the signatures
  • Added a SignatureConsumerNoop implementation of the SignatureConsumer trait (until the DMQ consumer is available)
  • Added constructioon of the SignatureProcessor in the dependency injection
  • Launched the SignatureProcessor in a separate thread of the serve command

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • No new TODOs introduced

Issue(s)

Closes #2470

@jpraynaud jpraynaud self-assigned this May 14, 2025
Copy link

github-actions bot commented May 14, 2025

Test Results

    3 files  ±0     57 suites  ±0   11m 50s ⏱️ +18s
1 908 tests +3  1 908 ✅ +3  0 💤 ±0  0 ❌ ±0 
2 382 runs  +3  2 382 ✅ +3  0 💤 ±0  0 ❌ ±0 

Results for commit 1097177. ± Comparison against base commit 9df5a56.

This pull request removes 9 and adds 12 tests. Note that renamed tests count towards both.
mithril-signer ‑ services::signature_publisher::signature_publisher_delayer::tests::should_call_both_publishers_when_first_succeeds
mithril-signer ‑ services::signature_publisher::signature_publisher_delayer::tests::should_call_second_publisher_even_if_first_fails_and_log_error
mithril-signer ‑ services::signature_publisher::signature_publisher_delayer::tests::should_return_and_log_error_if_second_publisher_fails
mithril-signer ‑ services::signature_publisher::signature_publisher_delayer::tests::should_wait_before_calling_second_publisher
mithril-signer ‑ services::signature_publisher::signature_publisher_retrier::tests::should_call_publish_once_when_no_retry_policy
mithril-signer ‑ services::signature_publisher::signature_publisher_retrier::tests::should_not_retry_when_publish_fails_and_retry_policy_is_never
mithril-signer ‑ services::signature_publisher::signature_publisher_retrier::tests::should_retry_and_return_error_after_max_attempts
mithril-signer ‑ services::signature_publisher::signature_publisher_retrier::tests::should_retry_once_and_succeed_on_second_attempt
mithril-signer ‑ services::signature_publisher::signature_publisher_retrier::tests::should_wait_between_retries_according_to_policy
mithril-aggregator ‑ services::signature_consumer::noop::tests::signature_consumer_noop_never_returns
mithril-aggregator ‑ services::signature_processor::tests::processor_process_signatures_succeeds
mithril-aggregator ‑ services::signature_processor::tests::processor_run_succeeds
mithril-signer ‑ services::signature_publisher::delayer::tests::should_call_both_publishers_when_first_succeeds
mithril-signer ‑ services::signature_publisher::delayer::tests::should_call_second_publisher_even_if_first_fails_and_log_error
mithril-signer ‑ services::signature_publisher::delayer::tests::should_return_and_log_error_if_second_publisher_fails
mithril-signer ‑ services::signature_publisher::delayer::tests::should_wait_before_calling_second_publisher
mithril-signer ‑ services::signature_publisher::retrier::tests::should_call_publish_once_when_no_retry_policy
mithril-signer ‑ services::signature_publisher::retrier::tests::should_not_retry_when_publish_fails_and_retry_policy_is_never
mithril-signer ‑ services::signature_publisher::retrier::tests::should_retry_and_return_error_after_max_attempts
…

♻️ This comment has been updated with latest results.

@jpraynaud jpraynaud requested a review from Copilot May 14, 2025 08:44
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a new signature processor for the DMQ in the aggregator, introducing new traits and implementations to continuously consume signatures and register them with the certifier service.

  • Added the SignatureProcessor and SequentialSignatureProcessor to process signatures sequentially.
  • Added a no-op SignatureConsumer implementation and integrated both components into dependency injection, launching the processor in a separate thread during serve.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mithril-signer/src/services/signature_publisher/mod.rs Renamed and re-exported signature publisher modules for clarity.
mithril-aggregator/src/services/signature_processor.rs Added a new trait and implementation for processing signatures sequentially, including tests.
mithril-aggregator/src/services/signature_consumer/noop.rs Introduced a no-op signature consumer that blocks indefinitely.
mithril-aggregator/src/services/signature_consumer/interface.rs Defined the signature consumer interface.
mithril-aggregator/src/services/mod.rs Updated module exports to include new signature consumer and processor.
mithril-aggregator/src/dependency_injection/builder/enablers/misc.rs Added dependency builder functions for signature consumer and processor.
mithril-aggregator/src/commands/serve_command.rs Integrated the signature processor into the serve command, running it in a separate thread and stopping it during shutdown.
Comments suppressed due to low confidence (1)

mithril-aggregator/src/services/signature_processor.rs:18

  • The run method continuously loops by calling process_signatures even after the stop flag is set. Consider modifying the loop to exit (e.g., using a break statement) when the stop condition is true.
async fn run(&self) -> StdResult<()> { loop { self.process_signatures().await?; } }

impl SignatureProcessor for SequentialSignatureProcessor {
async fn process_signatures(&self) -> StdResult<()> {
if *self.stop.lock().await {
warn!(self.logger, "Stoped signature processor");
Copy link
Preview

Copilot AI May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a spelling mistake in the log message: "Stoped" should be corrected to "Stopped".

Suggested change
warn!(self.logger, "Stoped signature processor");
warn!(self.logger, "Stopped signature processor");

Copilot uses AI. Check for mistakes.

@jpraynaud jpraynaud force-pushed the jpraynaud/2470-signature-processor-dmq branch from 62bcf4f to 1097177 Compare May 14, 2025 08:47
@jpraynaud jpraynaud temporarily deployed to testing-preview May 14, 2025 08:57 — with GitHub Actions Inactive
Copy link
Collaborator

@dlachaume dlachaume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

StdResult,
};

/// A signature consumer which blocks until a messages are available.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A signature consumer which blocks until a messages are available.
/// A signature consumer which blocks until a message is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement a signature processor for DMQ node in aggregator
2 participants