9 releases (4 breaking)
new 1.0.0-rc.0 | Apr 11, 2025 |
---|---|
0.5.0 | Mar 18, 2025 |
0.4.0 | Feb 20, 2025 |
0.3.0 | Feb 11, 2025 |
0.1.0 | Sep 30, 2024 |
#5 in #verifiable-computing
827 downloads per month
Used in 15 crates
(via eigensdk)
520KB
8K
SLoC
BLS Aggregation Service
Please check lib.rs for the full documentation.
lib.rs
:
BLS Agreggation Service crate.
BLS Aggregation Service
Introduction
The BLS Aggregation Service provides functionality to aggregate BLS signatures from multiple operators into a single aggregated signature. This is used by the Aggregator to verify the signatures of the operators and send the aggregated response once the quorum is reached or time expires. AVS developers can use it to define and manage tasks, set quorum requirements and integrate aggregated results into their smart contracts.
Key Features
- BLS Signature Aggregation: Combines multiple individual signatures into a single verifiable aggregated signature.
- Quorum Verification: Ensures that the required participation threshold is reached for each quorum.
- Task Management: Allows initializing tasks and processing signatures for those tasks.
- Configurable Time Window: Allows defining waiting periods for signature collection.
Main Components
TaskMetadata
: Defines task parameters, including quorums and thresholds.TaskSignature
: Contains an individual BLS signature for a specific task.ServiceHandle
: Interface for sending tasks and signatures to the service.AggregateReceiver
: Channel for receiving aggregated responses.BlsAggregatorService
: The main service that manages tasks and aggregates signatures.
Usage
When you initialize the BLS Aggregation Service, it returns a tuple of ServiceHandle
and AggregateReceiver
. The ServiceHandle
is used to interact with the service. The available messages to send to the service are:
initialize_task(metadata: TaskMetadata)
: Initializes a new task. If you want to set a time to expiry for the task, you can use thewith_window_duration()
method in a builder pattern.process_signature(task_signature: TaskSignature)
: Processes a signature for a task
The AggregateReceiver
is used to receive aggregated responses from the service. To get the aggregated response, you can use the receive_aggregated_response()
method.
Once a task is initialized, the service will start processing the task in a loop in the background. The service will wait for the quorum to be reached or the time to expire. Once the quorum is reached or the time expires, the service will aggregate the signatures and send the aggregated response to the AggregateReceiver
.
Initialize the Service
#
#
let (service_handle, mut aggregate_receiver) =
BlsAggregatorService::new(avs_registry_service, logger).start();
Initialize a Task
#
#
#
#
let metadata = TaskMetadata::new(
task_index,
block_number,
quorum_numbers,
quorum_threshold_percentages,
time_to_expiry,
);
service_handle.initialize_task(metadata).await.unwrap();
Process a Signature
#
#
#
#
let task_signature = TaskSignature::new(
task_index,
task_response_digest,
bls_signature,
operator_id,
);
service_handle.process_signature(task_signature).await.unwrap();
Receive an Aggregated Response
#
#
#
match aggregate_receiver.receive_aggregated_response().await {
Ok(aggregated_response) => {
// Handle the aggregated response
}
Err(e) => {
// Handle the error
}
}
Example Diagram
The following diagram shows the sequence of events when a user creates the BLS Aggregator Service, starts the service, and then initializes a task. The service processes two signatures from the operators and then aggregates them into a single aggregated signature.
Testing
To run the integration tests, you can use the following command:
cargo test --package eigen-services-blsaggregation --lib -- bls_agg_test::integration_test --show-output
Dependencies
~104MB
~2M SLoC