You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
add a start function or similar, which consumes the service and starts it as a background task, returning a "handle" to it
implement a "handle" struct, which stores all channels used to communicate with the service, but no service state
### What Changed?
This PR refactors the BLS Aggregator by separating its interface from
the internal service logic.
- Add new struct `ServiceHandle` to serve as the interface for
communicating with the BLS Aggregator service. This interface provides
two new methods
- `initialize_task`: Sends a message to the BLS Aggregator Service to
initialize a new task.
- `process_signature`: Sends a message to the BLS Aggregator Service to
process a signature.
- Add new struct `AggregateReceiver` to receive the aggregated responses
from the BLS Aggregator Service.
- Remove channels from `BlsAggregatorService`
- Add new methods to `BlsAggregatorService`:
- `start`: Starts the BLS Aggregator Service running the main loop in
background. This method return a tuple with `ServiceHandle` and
`AggregateReceiver`. User can use these methods to interact with the
service.
- `run`: Runs the main loop of the BLS Aggregator Service.
- Remove `initialize_new_task` and `process_new_signature` functions
since their logic is now integrated in `run()`.
Close#257
### Reviewer Checklist
- [ ] New features are tested and documented
- [ ] PR updates the changelog with a description of changes
- [ ] PR has one of the `changelog-X` labels (if applies)
- [ ] Code deprecates any old functionality before removing it
---------
Co-authored-by: Tomás Grüner <[email protected]>
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:
start
function or similar, which consumes the service and starts it as a background task, returning a "handle" to itAn example interface would be:
The text was updated successfully, but these errors were encountered: