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 |
#477 in Magic Beans
945 downloads per month
Used in 16 crates
(2 directly)
19MB
341K
SLoC
Services AvsRegistry
Example
lib.rs
:
AVS Registry Service
This service is used to get the AVS state of the operators and the quorums.
Introduction
The AvsRegistryServiceChainCaller
allows to get the AVS state of the operators and the quorums at any block.
This service is used by the BLS Aggregator service
and use under the hood the OperatorInfoService
to get the operator info.
Main Components
OperatorAvsState
Represents the AVS state of an operator.
operator_id
: Operator IDoperator_info
: Operator info public keystake_per_quorum
: Stake per quorumblock_num
: Block number
QuorumAvsState
Represents the AVS state of a quorum.
quorum_num
: Quorum numbertotal_stake
: Total stakeagg_pub_key_g1
: Aggregated G1 public keyblock_num
: Block number
Usage
Initialize the service
To initialize the service, you need to provide an AvsRegistryReader
and an OperatorInfoService
and call the new
method.
#
let avs_registry_service =
AvsRegistryServiceChainCaller::new(avs_registry, operator_info_service);
Get the AVS state of the operators and the quorums at a specific block
To get the state of the operator in a specific quorum at a specific block, you can use the get_operators_avs_state_at_block
method.
The list of quorum nums and the list of operators stakes in quorums should have the same length.
The method returns a hashmap with the operator ID as the key and the OperatorAvsState
as the value.
#
#
let operator_avs_state = avs_registry_service
.get_operators_avs_state_at_block(block_num, &quorum_nums)
.await
.unwrap();
To get the state of the quorum at a specific block, you can use the get_quorums_avs_state_at_block
method.
The method returns a hashmap with the quorum number as the key and the QuorumAvsState
as the value.
#
#
let quorum_state_per_number = avs_registry_service
.get_quorums_avs_state_at_block(&quorum_nums, block_num)
.await
.unwrap();
Get the signatures indices of quorum members for a specific block
To get the signatures indices of quorum members for a specific block, you can use the get_check_signatures_indices
method.
#
#
let check_signatures_indices = avs_registry_service
.get_check_signatures_indices(block_num, quorum_nums, non_signer_operator_ids)
.await
.unwrap();
Dependencies
~85MB
~1.5M SLoC