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

bls-aggregation integration test #7

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
594ecdb
WIP create avs clients
TomasArrachea Aug 19, 2024
077041a
add integration test implementation
TomasArrachea Aug 20, 2024
c38ce02
fix chaincaller bug on key aggregation
TomasArrachea Aug 20, 2024
b79659a
Merge branch 'bls_aggregation' into bls_aggregation_integration_test
TomasArrachea Aug 20, 2024
26cff9b
Merge branch 'bls_aggregation' into bls_aggregation_integration_test
TomasArrachea Aug 20, 2024
dbbd878
Merge branch 'bls_aggregation' into bls_aggregation_integration_test
TomasArrachea Aug 21, 2024
c739e50
fix registry g2 point to affine bug and add test
TomasArrachea Aug 21, 2024
fa5456c
update integration test to start start operators info service
TomasArrachea Aug 21, 2024
ef10008
Merge branch 'bls_aggregation' into bls_aggregation_integration_test
TomasArrachea Aug 21, 2024
08705ac
fix bls aggregation response bug
TomasArrachea Aug 21, 2024
d01c9cd
Merge branch 'bls_aggregation' into bls_aggregation_integration_test
TomasArrachea Aug 21, 2024
c99c06a
add signature check to integration test
TomasArrachea Aug 21, 2024
853bc1f
remove new_unchecked
TomasArrachea Aug 21, 2024
5542455
add error handling for process_new_signature
TomasArrachea Aug 21, 2024
038e42f
add 2 quorum integration test
TomasArrachea Aug 22, 2024
9950999
add serial_test dependency
TomasArrachea Aug 22, 2024
36dba99
add second operator to integration test
TomasArrachea Aug 22, 2024
792e68b
add anvil mine to advance block number
TomasArrachea Aug 22, 2024
217595c
add erc20 mock strategy to quorum
TomasArrachea Aug 22, 2024
b1c27d9
removed operator from test
TomasArrachea Aug 23, 2024
454ed03
add test 1 quorum 2 operators
TomasArrachea Aug 23, 2024
f251924
add sleep to fix operators registration
TomasArrachea Aug 23, 2024
783d8e8
add test for 2 quorums 1 operator
TomasArrachea Aug 23, 2024
618a9d5
add test for 2 quorums 2 operators
TomasArrachea Aug 23, 2024
e3f2283
update anvil initialization scripts
TomasArrachea Aug 23, 2024
e1abc89
update logger msg
TomasArrachea Aug 23, 2024
df8c897
ignore failing tests
TomasArrachea Aug 26, 2024
a233101
remove comments and clean code
TomasArrachea Aug 26, 2024
b2743d3
Merge branch 'bls_aggregation' into bls_aggregation_integration_test
TomasArrachea Aug 26, 2024
eb5c8ac
fix merge
TomasArrachea Aug 26, 2024
3865e03
remove anvil output when running tests
TomasArrachea Aug 26, 2024
ab73c38
fix make pr
TomasArrachea Aug 26, 2024
702276d
remove prints
TomasArrachea Aug 26, 2024
8652e4b
remove extra test
TomasArrachea Aug 26, 2024
2d455cc
feat: BLS aggregation (#81)
ricomateo Aug 27, 2024
7310e6c
improve error handling
pablodeymo Aug 27, 2024
b426902
Merge branch 'main' into bls_aggregation_integration_test
TomasArrachea Aug 27, 2024
eae23be
remove duplicate definitions
TomasArrachea Aug 28, 2024
535af49
cargo-abc (#87)
supernovahs Aug 28, 2024
1920cb4
update make fireblocks-tests
TomasArrachea Aug 28, 2024
dfb1022
elcontracts writer tests (#88)
pablodeymo Aug 28, 2024
76971ad
avs registry service chain caller tests (#90)
ricomateo Aug 28, 2024
92146bc
update comments
TomasArrachea Aug 28, 2024
615fad2
Merge branch 'main' into bls_aggregation_integration_test
TomasArrachea Aug 28, 2024
478adb1
Tests and code improvement in avs registry writer (#85)
pablodeymo Aug 29, 2024
4b707d6
Merge branch 'main' into bls_aggregation_integration_test
TomasArrachea Aug 29, 2024
a56ae68
Nits from incredible squaring rs (#84)
supernovahs Aug 29, 2024
3d33c07
Merge branch 'main' into bls_aggregation_integration_test
TomasArrachea Aug 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ __CONTRACTS__: ##
start-anvil-chain-with-contracts-deployed: ##
./crates/contracts/anvil/start-anvil-chain-with-el-and-avs-deployed.sh

deploy-contracts-to-anvil-and-save-state: ##
deploy-contracts-to-anvil-and-save-state: ##
./crates/contracts/anvil/deploy-contracts-save-anvil-state.sh

__TESTING__: ##
Expand All @@ -14,15 +14,18 @@ reset-anvil:
-docker stop anvil
-docker rm anvil

pr: reset-anvil ##
$(MAKE) start-anvil-chain-with-contracts-deployed
docker start anvil
pr: reset-anvil ##
$(MAKE) start-anvil-chain-with-contracts-deployed > /dev/null &
sleep 4 # needed to wait for anvil setup to finish
cargo test --workspace
cargo clippy --workspace --lib --examples --tests --benches --all-features
cargo +nightly fmt -- --check
docker stop anvil

fireblocks-tests:
$(MAKE) start-anvil-chain-with-contracts-deployed
docker start anvil
$(MAKE) start-anvil-chain-with-contracts-deployed > /dev/null &
cargo test --workspace --features fireblock-tests

start-anvil: reset-anvil ##
$(MAKE) start-anvil-chain-with-contracts-deployed
docker start anvil
18 changes: 11 additions & 7 deletions crates/chainio/clients/avsregistry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ repository.workspace = true
license-file.workspace = true

[dependencies]
alloy-contract.workspace = true
alloy-network.workspace = true
alloy-primitives.workspace = true
alloy-provider.workspace = true
alloy-transport-http.workspace = true
alloy-rpc-types.workspace = true
alloy-signer.workspace = true
alloy-signer-local.workspace = true
async-trait.workspace = true
alloy-transport-http.workspace = true
num-bigint = "0.4.4"
reqwest.workspace = true
eigen-types.workspace = true
Expand All @@ -23,14 +28,13 @@ eigen-utils.workspace = true
eigen-logging.workspace = true
thiserror.workspace = true
tracing.workspace = true
alloy-network.workspace = true
alloy-signer.workspace = true
alloy-signer-local.workspace = true
alloy-contract.workspace = true

[lints]
workspace = true

[dev-dependencies]
tokio = {version = "1.37.0" , features = ["test-util", "full","sync"] }
alloy-node-bindings.workspace = true
eigen-testing-utils.workspace = true
hex = "0.4.3"
once_cell.workspace = true
once_cell.workspace = true
tokio = { version = "1.37.0", features = ["test-util", "full", "sync"] }
6 changes: 3 additions & 3 deletions crates/chainio/clients/avsregistry/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# AvsRegistry

Reader , writer and subscribing methods to interact with avs registry contracts
Reader , writer and subscribing methods to interact with avs registry contracts

## Example
## Example

- [get_operator_from_id](https://github.com/Layr-Labs/eigensdk-rs/blob/main/examples/avsregistry-read/examples/get_operator_from_id.rs)
- [get_operator_id](https://github.com/Layr-Labs/eigensdk-rs/blob/main/examples/avsregistry-read/examples/get_operator_id.rs)
- [get_operator_stake_in_quorums_of_operator_at_current_block](https://github.com/Layr-Labs/eigensdk-rs/blob/main/examples/avsregistry-read/examples/get_operator_stake_in_quorums_of_operator_at_current_block.rs)
- [get_operators_stake_in_quorums_at_block](https://github.com/Layr-Labs/eigensdk-rs/blob/main/examples/avsregistry-read/examples/get_operators_stake_in_quorums_at_block.rs)
- [get_quorum_count](https://github.com/Layr-Labs/eigensdk-rs/blob/main/examples/avsregistry-read/examples/get_quorum_count.rs)
- [query_existing_registered_operator_pub_keys](https://github.com/Layr-Labs/eigensdk-rs/blob/main/examples/avsregistry-read/examples/query_existing_registered_operator_pub_keys.rs)
- [query_existing_registered_operator_pub_keys](https://github.com/Layr-Labs/eigensdk-rs/blob/main/examples/avsregistry-read/examples/query_existing_registered_operator_pub_keys.rs)
4 changes: 4 additions & 0 deletions crates/chainio/clients/avsregistry/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ pub enum AvsRegistryError {
#[error("Get Operator from Id")]
GetOperatorFromId,

/// Get Operator from Id
#[error("Get Operator Info")]
GetOperatorInfo,

/// Get Operator Status
#[error("Get Operator Status")]
GetOperatorStatus,
Expand Down
67 changes: 67 additions & 0 deletions crates/chainio/clients/avsregistry/src/fake_reader.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
use crate::{error::AvsRegistryError, reader::AvsRegistryReader};
use alloy_primitives::{Address, Bytes, FixedBytes};
use async_trait::async_trait;
use eigen_crypto_bls::BlsKeyPair;
use eigen_types::test::TestOperator;
use eigen_utils::binding::OperatorStateRetriever;

const OPERATOR_STAKE: u128 = 123;

/// This struct is used to test AvsRegistryServiceChainCaller methods.
#[derive(Debug)]
pub struct FakeAvsRegistryReader {
operator_address: Address,
operator_pubkeys: BlsKeyPair,
operator_id: FixedBytes<32>,
}

impl FakeAvsRegistryReader {
/// Creates a FakeAvsRegistryReader
///
/// # Arguments
///
/// * `operator` - A TestOperator.
/// * `operator_address` - The operator address.
///
/// # Returns
///
/// A FakeAvsRegistryReader
pub fn new(operator: TestOperator, operator_address: Address) -> Self {
Self {
operator_address,
operator_id: operator.operator_id,
operator_pubkeys: operator.bls_keypair,
}
}
}

#[async_trait]
impl AvsRegistryReader for FakeAvsRegistryReader {
async fn get_operators_stake_in_quorums_at_block(
&self,
_block_number: u32,
_quorum_numbers: Bytes,
) -> Result<Vec<Vec<OperatorStateRetriever::Operator>>, AvsRegistryError> {
Ok(vec![vec![OperatorStateRetriever::Operator {
operator: self.operator_address,
operatorId: self.operator_id,
stake: OPERATOR_STAKE,
}]])
}

async fn get_check_signatures_indices(
&self,
_reference_block_number: u32,
_quorum_numbers: Vec<u8>,
_non_signer_operator_ids: Vec<FixedBytes<32>>,
) -> Result<OperatorStateRetriever::CheckSignaturesIndices, AvsRegistryError> {
unimplemented!()
}

async fn get_operator_from_id(
&self,
_operator_id: [u8; 32],
) -> Result<Address, AvsRegistryError> {
Ok(self.operator_address)
}
}
4 changes: 4 additions & 0 deletions crates/chainio/clients/avsregistry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ pub mod writer;

/// Avs registry error message
pub mod error;

#[allow(dead_code)]
/// Fake avs registry module
pub mod fake_reader;
Loading