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

Download history 48/week @ 2024-12-23 90/week @ 2024-12-30 302/week @ 2025-01-06 191/week @ 2025-01-13 123/week @ 2025-01-20 163/week @ 2025-01-27 305/week @ 2025-02-03 299/week @ 2025-02-10 502/week @ 2025-02-17 223/week @ 2025-02-24 88/week @ 2025-03-03 147/week @ 2025-03-10 322/week @ 2025-03-17 81/week @ 2025-03-24 65/week @ 2025-03-31 458/week @ 2025-04-07

945 downloads per month
Used in 16 crates (2 directly)

Custom license

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 ID
  • operator_info: Operator info public key
  • stake_per_quorum: Stake per quorum
  • block_num: Block number

QuorumAvsState

Represents the AVS state of a quorum.

  • quorum_num: Quorum number
  • total_stake: Total stake
  • agg_pub_key_g1: Aggregated G1 public key
  • block_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