Skip to content
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

Refactor BLS aggregation service to expose interface via handle #257

Open
MegaRedHand opened this issue Jan 30, 2025 · 0 comments
Open

Refactor BLS aggregation service to expose interface via handle #257

MegaRedHand opened this issue Jan 30, 2025 · 0 comments

Comments

@MegaRedHand
Copy link
Contributor

MegaRedHand commented Jan 30, 2025

Currently, we have a lot of mutexes and shared state in the BLS aggregation service. We could simplify this by splitting the struct into service and interface. To do this, we:

  1. add a start function or similar, which consumes the service and starts it as a background task, returning a "handle" to it
  2. implement a "handle" struct, which stores all channels used to communicate with the service, but no service state
  3. move the current interface to the handle

An example interface would be:

#[derive(Debug, Clone)]
pub struct ServiceHandle {
    task_sender: UnboundedSender<TaskMetadata>,
    response_sender: UnboundedSender<TaskResponseInfo>,
}

#[derive(Debug)]
pub struct AggregateReceiver {
    aggregate_recver: UnboundedReceiver<AggregateSignature>,
}

#[derive(Debug)]
pub struct BlsAggregationService { ... }

impl BlsAggregationService {
    pub fn new() -> Self { ... }

    pub fn start(self) -> (ServiceHandle, AggregateReceiver) { ... }
}
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

No branches or pull requests

1 participant