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 tests #91

Merged
merged 159 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 152 commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
e12d3c6
cids_multiplication
Aug 6, 2024
16e6439
wip
Aug 6, 2024
da6914e
latest
Aug 7, 2024
9c50a07
bls crate working
Aug 8, 2024
0ab90dd
bls crate and readme
Aug 8, 2024
88fb0c2
delete post.key file
Aug 8, 2024
bfe95ca
Merge branch 'main' into supernovahs/bls
supernovahs Aug 8, 2024
f579335
nits , delete keystore crate which is replaced by new bls keystore re…
Aug 8, 2024
defdaf3
change to https for rust bls bn254 dependency , and some clippy
Aug 8, 2024
6781f1f
Merge branch 'main' into supernovahs/bls
supernovahs Aug 9, 2024
52d6c85
merge nits
Aug 9, 2024
df90ecf
fix : mapto curve function
Aug 11, 2024
902b14e
complete sign message, verify message
Aug 12, 2024
30e22cc
move verify message and map to curve to bn254, nits
Aug 12, 2024
2a982b6
Merge branch 'main' into supernovahs/bls
supernovahs Aug 12, 2024
7693f67
update rust-bls-bn254 rev
Aug 12, 2024
1441538
add failing bls aggregator and chaincaller
TomasArrachea Aug 12, 2024
524d047
fix chaincaller pubkey addition
TomasArrachea Aug 12, 2024
425b168
refactor chaincaller and add bls utils
TomasArrachea Aug 13, 2024
924f983
WIP bls aggregation
TomasArrachea Aug 13, 2024
417b142
add affine point parse
TomasArrachea Aug 13, 2024
804370c
wip fixes
pablodeymo Aug 13, 2024
750eb3c
remove unused imports
TomasArrachea Aug 13, 2024
cda4770
remove unused crate
TomasArrachea Aug 13, 2024
b188ace
change aggregation quorum into bls point
TomasArrachea Aug 13, 2024
5ee156c
refactor verify signature
TomasArrachea Aug 13, 2024
dba5dc8
refactor check stake threshold
TomasArrachea Aug 13, 2024
e8cd3b8
format
TomasArrachea Aug 13, 2024
98bcc5e
add TestOperator struct
ricomateo Aug 14, 2024
98e6dcf
add FakeAvsRegistryService struct
ricomateo Aug 14, 2024
7622585
add AvsRegistryService trait + update BlsAggregatorService + add test…
ricomateo Aug 14, 2024
71c3ee8
add partial implementation of the AvsRegistryService trait for FakeAv…
ricomateo Aug 14, 2024
ce951a3
add the first bls aggregation test (not working yet)
ricomateo Aug 15, 2024
054b552
remove arc from aggregated_response_sender
ricomateo Aug 15, 2024
90277a9
change aggregated_response_receiver to mutex
ricomateo Aug 15, 2024
e83c5e4
change bls aggregator to pass reference in initialize_new_task
ricomateo Aug 15, 2024
f399efd
fix merge conflicts
ricomateo Aug 15, 2024
9e0b735
replace select macro for busy wait
ricomateo Aug 15, 2024
65f6c53
fix single_task_aggregator to match test output
TomasArrachea Aug 16, 2024
ee8c81c
implement aggregation for existing task
TomasArrachea Aug 16, 2024
4f340e1
add assert to the test
ricomateo Aug 16, 2024
6073702
add 2 tests and fix error with loops and channels
ricomateo Aug 16, 2024
cd778b1
add select! macro and add more tests
ricomateo Aug 16, 2024
d952e8b
fix bug in non_signers_operators_id
ricomateo Aug 16, 2024
edd00a1
fix test and remove prints
TomasArrachea Aug 16, 2024
5158a2f
fix tests agg signature g1
TomasArrachea Aug 16, 2024
922e565
fix small details on one of the tests
ricomateo Aug 16, 2024
807c554
test function with an example of timeout in the receive
pablodeymo Aug 16, 2024
d64bbf6
add timeout to the single_task_aggregator loop
ricomateo Aug 16, 2024
8c51bcf
remove timeout test
ricomateo Aug 16, 2024
ab2457b
refactor check stake threshold
TomasArrachea Aug 16, 2024
12cd989
fix conflicts
ricomateo Aug 16, 2024
a955e4f
Merge branch 'bls_aggregation' of github.com:lambdaclass/eigen-rs int…
ricomateo Aug 16, 2024
c9b6839
fix test
ricomateo Aug 16, 2024
6c770d3
add new test
ricomateo Aug 16, 2024
af85dcb
fix total stake per quorum bug
TomasArrachea Aug 16, 2024
2efa77a
add new test
ricomateo Aug 16, 2024
a14c172
doc for initialize_new_task
pablodeymo Aug 16, 2024
b7858bf
add test and timeout error response
TomasArrachea Aug 16, 2024
eaf0500
more doc functions
pablodeymo Aug 16, 2024
1be6489
add assert to one of the tests
ricomateo Aug 19, 2024
dea29f3
add new test (not working)
ricomateo Aug 19, 2024
2c8ba8d
fix error in g1point conversion
ricomateo Aug 19, 2024
dd38b82
add task not found error and test
TomasArrachea Aug 19, 2024
02e17a9
add new test
ricomateo Aug 19, 2024
575c21f
add test and rename task expired error
TomasArrachea Aug 19, 2024
894e32f
clippy
TomasArrachea Aug 19, 2024
cd271b6
Merge branch 'main' into bls_aggregation
TomasArrachea Aug 19, 2024
f38aa41
add errors to verify_signature
ricomateo Aug 19, 2024
ccf2ae9
clippy
TomasArrachea Aug 19, 2024
52891c0
unused comment removed
pablodeymo Aug 19, 2024
15638b9
Adding docs and refactoring functions
pablodeymo Aug 19, 2024
341d331
fix merge main
TomasArrachea Aug 19, 2024
21c49df
add test
TomasArrachea Aug 19, 2024
3d79735
docs added
pablodeymo Aug 19, 2024
d157e2c
fixing errors
pablodeymo Aug 19, 2024
f6bae37
fixing bug in non_signers_operators_ids
pablodeymo Aug 19, 2024
fe4a50d
add signature verification error handling
ricomateo Aug 19, 2024
d3fba43
remove unused method from AvsRegistryService trait
TomasArrachea Aug 19, 2024
98d81b6
fix wrong assert in test
ricomateo Aug 19, 2024
876653b
add integration test skeleton
TomasArrachea Aug 19, 2024
a03499f
add error handling and remove some cloning
ricomateo Aug 19, 2024
437ff17
fix merge main
TomasArrachea Aug 19, 2024
0bd346d
then_some
pablodeymo Aug 19, 2024
23f7887
clippy
pablodeymo Aug 19, 2024
d62779a
clippy
pablodeymo Aug 19, 2024
215218d
concurrency problem fixed
pablodeymo Aug 19, 2024
3940bf2
change how non_signer_pubkeys vector is obtained
ricomateo Aug 19, 2024
118e729
add error handling
ricomateo Aug 19, 2024
594ecdb
WIP create avs clients
TomasArrachea Aug 19, 2024
e680698
add aggregation functions to the tests
ricomateo Aug 20, 2024
ec2429e
add constants for the private keys used in tests
ricomateo Aug 20, 2024
bb8a48b
add function to aggregate operators
ricomateo Aug 20, 2024
1939b10
remove BlsAggregatorService cloning
ricomateo Aug 20, 2024
d413361
remove unnecessary generic from initialize_new_task
ricomateo Aug 20, 2024
09c230c
add error handling
ricomateo Aug 20, 2024
5eda51c
add build_aggregated_response function
ricomateo Aug 20, 2024
fecee48
fix clippy warnings
ricomateo Aug 20, 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
fbc9199
change variable to be immutable
ricomateo Aug 20, 2024
b440efd
update docs
ricomateo Aug 20, 2024
c3f360b
remove comment
TomasArrachea Aug 20, 2024
26cff9b
Merge branch 'bls_aggregation' into bls_aggregation_integration_test
TomasArrachea Aug 20, 2024
34c8061
add more docs
ricomateo Aug 20, 2024
80259b7
mini comment added
pablodeymo Aug 20, 2024
360938e
improving quorum_threshold_percentage_map creation
pablodeymo Aug 20, 2024
8e75a40
changing loop to while let
pablodeymo Aug 20, 2024
0bb8202
digest_aggregated_operators improved
pablodeymo 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
c371f4d
fix registry g2 point to affine bug and add test
TomasArrachea Aug 21, 2024
7cd9f95
remove new_unchecked
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
7207750
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
87f354d
add error handling for process_new_signature
TomasArrachea Aug 21, 2024
d240f49
typo
pablodeymo Aug 21, 2024
45e8c45
Add error return in get_operators_avs_state_at_block
pablodeymo Aug 21, 2024
18ea704
docs and unwrap removed in get_operator_info
pablodeymo Aug 21, 2024
8dea82d
fix chaincaller bug on key aggregation
TomasArrachea Aug 20, 2024
cfc3d51
docs added in AvsRegistryServiceChainCaller
pablodeymo 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
1c40fbc
fix conflicts
ricomateo Aug 23, 2024
454ed03
add test 1 quorum 2 operators
TomasArrachea Aug 23, 2024
674e2d0
add error handling
ricomateo 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
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
1920cb4
update make fireblocks-tests
TomasArrachea Aug 28, 2024
92146bc
update comments
TomasArrachea Aug 28, 2024
615fad2
Merge branch 'main' into bls_aggregation_integration_test
TomasArrachea Aug 28, 2024
4b707d6
Merge branch 'main' into bls_aggregation_integration_test
TomasArrachea Aug 29, 2024
3d33c07
Merge branch 'main' into bls_aggregation_integration_test
TomasArrachea Aug 29, 2024
1ab3119
update operator id in integration test
TomasArrachea Aug 30, 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
6 changes: 6 additions & 0 deletions Cargo.lock

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

8 changes: 4 additions & 4 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,9 +14,9 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion crates/chainio/clients/avsregistry/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl AvsRegistryChainWriter {

match tx_result {
Ok(tx) => {
info!(tx_hash = ?tx,"Succesfully deregistered operator with the AVS's registry coordinator" );
info!(tx_hash = ?tx,"Sent transaction to deregister operator in the AVS's registry coordinator" );
Ok(*tx.tx_hash())
}
Err(e) => Err(AvsRegistryError::AlloyContractError(e)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ cd ../../contracts
cast rpc anvil_mine 200 --rpc-url http://localhost:8545 > /dev/null
echo "Anvil is ready. Advanced chain to block-number:" $(cast block-number)

docker attach anvil
184 changes: 140 additions & 44 deletions crates/crypto/bls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ use ark_bn254::{Fq, Fr, G1Affine, G1Projective, G2Affine, G2Projective};
use ark_ec::{AffineRepr, CurveGroup};
use ark_ff::{fields::PrimeField, BigInt, BigInteger256, Fp2};
use eigen_crypto_bn254::utils::map_to_curve;
use eigen_utils::binding::IBLSSignatureChecker::{
G1Point as G1PointChecker, G2Point as G2PointChecker,
};
use eigen_utils::binding::{
BLSApkRegistry,
RegistryCoordinator::{self},
Expand Down Expand Up @@ -66,17 +69,12 @@ pub struct BlsKeyPair {
impl BlsKeyPair {
/// Input [`Fr`] as a [`String`]
pub fn new(fr: String) -> Result<Self, BlsError> {
let sk_result = Fr::from_str(&fr);
match sk_result {
Ok(sk) => {
let pk = G1Projective::from(G1Affine::generator()) * sk;
Ok(Self {
priv_key: sk,
pub_key: BlsG1Point::new(pk.into_affine()),
})
}
Err(_) => Err(BlsError::InvalidBlsPrivateKey),
}
let sk = Fr::from_str(&fr).map_err(|_| BlsError::InvalidBlsPrivateKey)?;
let pk = G1Projective::from(G1Affine::generator()) * sk;
Ok(Self {
priv_key: sk,
pub_key: BlsG1Point::new(pk.into_affine()),
})
}

/// Get public key on G1
Expand Down Expand Up @@ -118,20 +116,69 @@ pub fn convert_to_g1_point(g1: G1Affine) -> Result<G1Point, BlsError> {
let x_point_result = g1.x();
let y_point_result = g1.y();

if let (Some(x_point), Some(y_point)) = (x_point_result, y_point_result) {
let x = BigInt::new(x_point.into_bigint().0);
let y = BigInt::new(y_point.into_bigint().0);
let (Some(x_point), Some(y_point)) = (x_point_result, y_point_result) else {
return Err(BlsError::InvalidG1Affine);
};

let x_u256 = U256::from_limbs(x.0);
let y_u256 = U256::from_limbs(y.0);
let x = BigInt::new(x_point.into_bigint().0);
let y = BigInt::new(y_point.into_bigint().0);

Ok(G1Point {
X: x_u256,
Y: y_u256,
})
} else {
Err(BlsError::InvalidG1Affine)
}
let x_u256 = U256::from_limbs(x.0);
let y_u256 = U256::from_limbs(y.0);

Ok(G1Point {
X: x_u256,
Y: y_u256,
})
}

/// Convert [`G1Affine`] to Alloy [`G1Point`]
TomasArrachea marked this conversation as resolved.
Show resolved Hide resolved
pub fn convert_to_bls_checker_g1_point(g1: G1Affine) -> Result<G1PointChecker, BlsError> {
let x_point_result = g1.x();
let y_point_result = g1.y();

let (Some(x_point), Some(y_point)) = (x_point_result, y_point_result) else {
return Err(BlsError::InvalidG1Affine);
};
let x = BigInt::new(x_point.into_bigint().0);
let y = BigInt::new(y_point.into_bigint().0);

let x_u256 = U256::from_limbs(x.0);
let y_u256 = U256::from_limbs(y.0);

Ok(G1PointChecker {
X: x_u256,
Y: y_u256,
})
}

/// Convert [`G1Affine`] to Alloy [`G1Point`]
TomasArrachea marked this conversation as resolved.
Show resolved Hide resolved
pub fn convert_to_bls_checker_g2_point(g2: G2Affine) -> Result<G2PointChecker, BlsError> {
let x_point_result = g2.x();
let y_point_result = g2.y();

let (Some(x_point), Some(y_point)) = (x_point_result, y_point_result) else {
return Err(BlsError::InvalidG2Affine);
};
let x_point_c0 = x_point.c0;
let x_point_c1 = x_point.c1;
let y_point_c0 = y_point.c0;
let y_point_c1 = y_point.c1;

let x_0 = BigInt::new(x_point_c0.into_bigint().0);
let x_1 = BigInt::new(x_point_c1.into_bigint().0);
let y_0 = BigInt::new(y_point_c0.into_bigint().0);
let y_1 = BigInt::new(y_point_c1.into_bigint().0);

let x_u256_0 = U256::from_limbs(x_0.0);
let x_u256_1 = U256::from_limbs(x_1.0);
let y_u256_0 = U256::from_limbs(y_0.0);
let y_u256_1 = U256::from_limbs(y_1.0);

Ok(G2PointChecker {
X: [x_u256_1, x_u256_0],
Y: [y_u256_1, y_u256_0],
})
}

/// Convert [`G2Affine`] to [`G2Point`]
Expand All @@ -142,29 +189,79 @@ pub fn convert_to_g2_point(g2: G2Affine) -> Result<G2Point, BlsError> {
let y_point_result = g2.y();
// let y_point_c1 = g2.y().unwrap().c1;

if let (Some(x_point), Some(y_point)) = (x_point_result, y_point_result) {
let x_point_c0 = x_point.c0;
let x_point_c1 = x_point.c1;
let y_point_c0 = y_point.c0;
let y_point_c1 = y_point.c1;
let (Some(x_point), Some(y_point)) = (x_point_result, y_point_result) else {
return Err(BlsError::InvalidG2Affine);
};
let x_point_c0 = x_point.c0;
let x_point_c1 = x_point.c1;
let y_point_c0 = y_point.c0;
let y_point_c1 = y_point.c1;

let x_0 = BigInt::new(x_point_c0.into_bigint().0);
let x_1 = BigInt::new(x_point_c1.into_bigint().0);
let y_0 = BigInt::new(y_point_c0.into_bigint().0);
let y_1 = BigInt::new(y_point_c1.into_bigint().0);

let x_u256_0 = U256::from_limbs(x_0.0);
let x_u256_1 = U256::from_limbs(x_1.0);
let y_u256_0 = U256::from_limbs(y_0.0);
let y_u256_1 = U256::from_limbs(y_1.0);

Ok(G2Point {
X: [x_u256_1, x_u256_0],
Y: [y_u256_1, y_u256_0],
})
}

let x_0 = BigInt::new(x_point_c0.into_bigint().0);
let x_1 = BigInt::new(x_point_c1.into_bigint().0);
let y_0 = BigInt::new(y_point_c0.into_bigint().0);
let y_1 = BigInt::new(y_point_c1.into_bigint().0);
/// Convert [`G1Point`] to [`G1Affine`]
pub fn alloy_registry_g1_point_to_g1_affine(g1_point: G1PointRegistry) -> G1Affine {
let x_point = g1_point.X.into_limbs();
let x = Fq::new(BigInteger256::new(x_point));
let y_point = g1_point.Y.into_limbs();
let y = Fq::new(BigInteger256::new(y_point));
G1Affine::new(x, y)
}

let x_u256_0 = U256::from_limbs(x_0.0);
let x_u256_1 = U256::from_limbs(x_1.0);
let y_u256_0 = U256::from_limbs(y_0.0);
let y_u256_1 = U256::from_limbs(y_1.0);
/// Convert [`G1Point`] to [`G1Affine`]
TomasArrachea marked this conversation as resolved.
Show resolved Hide resolved
pub fn alloy_registry_g2_point_to_g2_affine(g2_point: G2PointRegistry) -> G2Affine {
let x_fp2 = Fp2::new(
BigInteger256::new(g2_point.X[1].into_limbs()).into(),
BigInteger256::new(g2_point.X[0].into_limbs()).into(),
);
let y_fp2 = Fp2::new(
BigInteger256::new(g2_point.Y[1].into_limbs()).into(),
BigInteger256::new(g2_point.Y[0].into_limbs()).into(),
);
G2Affine::new(x_fp2, y_fp2)
}

Ok(G2Point {
X: [x_u256_1, x_u256_0],
Y: [y_u256_1, y_u256_0],
})
} else {
Err(BlsError::InvalidG2Affine)
}
/// Convert [`G2Affine`] to [`G2Point`]
TomasArrachea marked this conversation as resolved.
Show resolved Hide resolved
pub fn convert_to_registry_g2_point(g2: G2Affine) -> Result<G2PointRegistry, BlsError> {
let x_point_result = g2.x();
let y_point_result = g2.y();

let (Some(x_point), Some(y_point)) = (x_point_result, y_point_result) else {
return Err(BlsError::InvalidG2Affine);
};
let x_point_c0 = x_point.c0;
let x_point_c1 = x_point.c1;
let y_point_c0 = y_point.c0;
let y_point_c1 = y_point.c1;

let x_0 = BigInt::new(x_point_c0.into_bigint().0);
let x_1 = BigInt::new(x_point_c1.into_bigint().0);
let y_0 = BigInt::new(y_point_c0.into_bigint().0);
let y_1 = BigInt::new(y_point_c1.into_bigint().0);

let x_u256_0 = U256::from_limbs(x_0.0);
let x_u256_1 = U256::from_limbs(x_1.0);
let y_u256_0 = U256::from_limbs(y_0.0);
let y_u256_1 = U256::from_limbs(y_1.0);

Ok(G2PointRegistry {
X: [x_u256_1, x_u256_0],
Y: [y_u256_1, y_u256_0],
})
}

/// Convert [`G1Point`] to [`G1Affine`]
Expand Down Expand Up @@ -239,7 +336,6 @@ impl Signature {

#[cfg(test)]
mod tests {

use super::*;
use ark_bn254::Fq2;
use eigen_crypto_bn254::utils::verify_message;
Expand Down
7 changes: 6 additions & 1 deletion crates/services/avsregistry/src/chaincaller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ impl AvsRegistryService for AvsRegistryServiceChainCaller {
let mut pub_key_g1 = G1Projective::from(PublicKey::identity());
let mut total_stake: U256 = U256::from(0);
for operator in operators_avs_state.values() {
if !operator.stake_per_quorum[quorum_num].is_zero() {
if !operator
.stake_per_quorum
.get(quorum_num)
.unwrap_or(&U256::ZERO)
.is_zero()
{
if let Some(pub_keys) = &operator.operator_info.pub_keys {
pub_key_g1 += pub_keys.g1_pub_key.g1();
total_stake += operator.stake_per_quorum[quorum_num];
Expand Down
5 changes: 5 additions & 0 deletions crates/services/bls_aggregation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ tokio = { workspace = true, features = ["full"] }
[dev-dependencies]
alloy-node-bindings.workspace = true
eigen-logging.workspace = true
eigen-testing-utils.workspace = true
eigen-utils.workspace = true
eigen-services-operatorsinfo.workspace = true
alloy-provider.workspace = true
serial_test = "3.1"
sha2 = "0.10.8"
20 changes: 10 additions & 10 deletions crates/services/bls_aggregation/src/bls_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ use tokio::time::{timeout, Duration};
#[allow(unused)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BlsAggregationServiceResponse {
task_index: TaskIndex,
task_response_digest: TaskResponseDigest,
non_signers_pub_keys_g1: Vec<BlsG1Point>,
quorum_apks_g1: Vec<BlsG1Point>,
signers_apk_g2: BlsG2Point,
signers_agg_sig_g1: Signature,
non_signer_quorum_bitmap_indices: Vec<u32>,
quorum_apk_indices: Vec<u32>,
total_stake_indices: Vec<u32>,
non_signer_stake_indices: Vec<Vec<u32>>,
pub task_index: TaskIndex,
pub task_response_digest: TaskResponseDigest,
pub non_signers_pub_keys_g1: Vec<BlsG1Point>,
pub quorum_apks_g1: Vec<BlsG1Point>,
pub signers_apk_g2: BlsG2Point,
pub signers_agg_sig_g1: Signature,
pub non_signer_quorum_bitmap_indices: Vec<u32>,
pub quorum_apk_indices: Vec<u32>,
pub total_stake_indices: Vec<u32>,
pub non_signer_stake_indices: Vec<Vec<u32>>,
}

/// Possible errors raised in BLS aggregation
Expand Down
Loading
Loading