Skip to content

Commit

Permalink
fix: update import paths and use new alloy version
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaRedHand committed Jan 9, 2025
1 parent 9746ba8 commit bc5ed5c
Show file tree
Hide file tree
Showing 20 changed files with 202 additions and 614 deletions.
678 changes: 136 additions & 542 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ metrics = "0.24.0"
reqwest = "0.12.9"
serde_json = "1.0.120"
#alloy
alloy = { version = "0.5.3", features = ["full", "signer-keystore", "reqwest"] }
alloy-provider = "0.5.3"
alloy = { version = "0.9", features = ["full", "signer-keystore", "reqwest"] }
alloy-provider = "0.9"
serde = "1.0.203"
tracing = "0.1.40"
tempfile = "3"
Expand All @@ -75,6 +75,7 @@ incredible-operator-2 = { path = "crates/operator_2/", features = ["default"] }

# eigensdk-rs

eigen-common = { git = "https://github.com/Layr-Labs/eigensdk-rs", rev = "834b9c7" }
eigen-client-avsregistry = { git = "https://github.com/Layr-Labs/eigensdk-rs", rev = "834b9c7" }
eigen-testing-utils = { git = "https://github.com/Layr-Labs/eigensdk-rs", rev = "834b9c7" }
eigen-crypto-bls = { git = "https://github.com/Layr-Labs/eigensdk-rs", rev = "834b9c7" }
Expand Down
1 change: 1 addition & 0 deletions bin/incredible-squaring-avs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ rust-bls-bn254.workspace = true
eigen-crypto-bls.workspace = true
metrics-util = "0.17.0"
# eigen-rs
eigen-common.workspace = true
eigen-testing-utils.workspace = true
eigen-logging.workspace = true
eigen-utils.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bin/incredible-squaring-avs/src/commands/avs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use clap::{Args, Parser};
use eigen_client_avsregistry::writer::AvsRegistryChainWriter;
use eigen_client_elcontracts::reader::ELChainReader;
use eigen_client_elcontracts::{error::ElContractsError, writer::ELChainWriter};
use eigen_common::get_provider;
use eigen_crypto_bls::BlsKeyPair;
use eigen_logging::{get_logger, init_logger, log_level::LogLevel};
use eigen_metrics::prometheus::init_registry;
Expand All @@ -14,7 +15,6 @@ use eigen_testing_utils::anvil_constants::{
ANVIL_HTTP_URL,
};
use eigen_types::operator::Operator;
use eigen_utils::get_provider;
use incredible_avs::builder::{AvsBuilder, DefaultAvsLauncher, LaunchAvs};
use incredible_config::IncredibleConfig;
use incredible_testing_utils::{
Expand Down
1 change: 1 addition & 0 deletions crates/aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ eyre.workspace = true
incredible-chainio.workspace = true
incredible-config.workspace = true
incredible-metrics.workspace = true
eigen-common.workspace = true
eigen-services-operatorsinfo.workspace = true
eigen-logging.workspace = true
eigen-client-avsregistry.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/aggregator/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloy::transports::{RpcError, TransportErrorKind};
use eigen_client_avsregistry::error::AvsRegistryError;
use eigen_crypto_bls::error::BlsError;
use eigen_services_blsaggregation::bls_agg::BlsAggregationServiceError;
use eigen_services_blsaggregation::bls_aggregation_service_error::BlsAggregationServiceError;
use eigen_services_operatorsinfo::operatorsinfo_inmemory::OperatorInfoServiceError;
use incredible_chainio::error::ChainIoError;
use incredible_config::error::ConfigError;
Expand Down
13 changes: 7 additions & 6 deletions crates/aggregator/src/fake_aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ use alloy::providers::{ProviderBuilder, WsConnect};
use alloy::rpc::types::Filter;
use alloy::sol_types::SolEvent;
use eigen_client_avsregistry::reader::AvsRegistryChainReader;
use eigen_common::get_ws_provider;
use eigen_crypto_bls::{convert_to_g1_point, convert_to_g2_point};
use eigen_logging::get_test_logger;
use eigen_logging::{get_logger, get_test_logger};
use eigen_services_avsregistry::chaincaller::AvsRegistryServiceChainCaller;
use eigen_services_blsaggregation::bls_agg::{
BlsAggregationServiceError, BlsAggregationServiceResponse, BlsAggregatorService,
};
use eigen_services_blsaggregation::bls_agg::BlsAggregatorService;
use eigen_services_blsaggregation::bls_aggregation_service_error::BlsAggregationServiceError;
use eigen_services_blsaggregation::bls_aggregation_service_response::BlsAggregationServiceResponse;
use eigen_services_operatorsinfo::operatorsinfo_inmemory::OperatorInfoServiceInMemory;
use eigen_types::avs::TaskResponseDigest;
use eigen_utils::get_ws_provider;
use futures_util::StreamExt;
use incredible_bindings::incrediblesquaringtaskmanager::IBLSSignatureChecker::NonSignerStakesAndSignature;
use incredible_bindings::incrediblesquaringtaskmanager::IIncredibleSquaringTaskManager::{
Expand Down Expand Up @@ -95,7 +95,8 @@ impl FakeAggregator {
.await;
});

let bls_aggregation_service = BlsAggregatorService::new(avs_registry_service_chaincaller);
let bls_aggregation_service =
BlsAggregatorService::new(avs_registry_service_chaincaller, get_logger());

Self {
port_address: config.aggregator_ip_addr(),
Expand Down
11 changes: 6 additions & 5 deletions crates/aggregator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ use alloy::providers::{ProviderBuilder, WsConnect};
use alloy::rpc::types::Filter;
use alloy::sol_types::SolEvent;
use eigen_client_avsregistry::reader::AvsRegistryChainReader;
use eigen_common::get_ws_provider;
use eigen_crypto_bls::{convert_to_g1_point, convert_to_g2_point};
use eigen_logging::get_logger;
use eigen_services_avsregistry::chaincaller::AvsRegistryServiceChainCaller;
use eigen_services_blsaggregation::bls_agg::{
BlsAggregationServiceError, BlsAggregationServiceResponse, BlsAggregatorService,
};
use eigen_services_blsaggregation::bls_agg::BlsAggregatorService;
use eigen_services_blsaggregation::bls_aggregation_service_error::BlsAggregationServiceError;
use eigen_services_blsaggregation::bls_aggregation_service_response::BlsAggregationServiceResponse;
use eigen_services_operatorsinfo::operatorsinfo_inmemory::OperatorInfoServiceInMemory;
use eigen_types::avs::TaskResponseDigest;
use eigen_utils::get_ws_provider;
pub use error::AggregatorError;
use futures_util::StreamExt;
use incredible_bindings::incrediblesquaringtaskmanager::IBLSSignatureChecker::NonSignerStakesAndSignature;
Expand Down Expand Up @@ -107,7 +107,8 @@ impl Aggregator {
.await;
});

let bls_aggregation_service = BlsAggregatorService::new(avs_registry_service_chaincaller);
let bls_aggregation_service =
BlsAggregatorService::new(avs_registry_service_chaincaller, get_logger());

Ok(Self {
port_address: config.aggregator_ip_addr(),
Expand Down
1 change: 1 addition & 0 deletions crates/chainio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ tracing.workspace = true
reqwest.workspace = true

#eigen-rs
eigen-common.workspace = true
eigen-client-avsregistry.workspace = true
eigen-types.workspace = true
eigen-utils.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/chainio/src/fake_avs_writer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::error::ChainIoError;
use alloy::primitives::{Address, TxHash};
use eigen_utils::get_signer;
use eigen_common::get_signer;
use incredible_bindings::incrediblesquaringtaskmanager::{
IBLSSignatureChecker::NonSignerStakesAndSignature,
IIncredibleSquaringTaskManager::{Task, TaskResponse, TaskResponseMetadata},
Expand Down
6 changes: 3 additions & 3 deletions crates/chainio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use alloy::{
primitives::{Address, U256},
rpc::types::TransactionReceipt,
};
use eigen_common::{get_provider, get_signer};
use eigen_types::operator::{QuorumNum, QuorumThresholdPercentage};
use eigen_utils::{
get_provider, get_signer,
registrycoordinator::RegistryCoordinator::{self, serviceManagerReturn},
use eigen_utils::middleware::registrycoordinator::RegistryCoordinator::{
self, serviceManagerReturn,
};
use error::ChainIoError;
use incredible_bindings::incrediblesquaringtaskmanager::IIncredibleSquaringTaskManager::{
Expand Down
5 changes: 3 additions & 2 deletions crates/challenger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rust-version.workspace = true
repository.workspace = true
license.workspace = true
description = "incredible squaring challenger "

[lints]
workspace = true

Expand All @@ -26,7 +26,8 @@ incredible-testing-utils.workspace = true
incredible-chainio.workspace = true

#eigen-rs
eigen-common.workspace = true
eigen-utils.workspace = true

[dev-dependencies]
incredible-task-generator.workspace = true
incredible-task-generator.workspace = true
59 changes: 23 additions & 36 deletions crates/challenger/src/fake_challenger.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
use crate::{error::ChallengerError, TaskResponseData};
use alloy::primitives::Bytes;
use alloy::rpc::types::Log;
use alloy::sol_types::SolCall;
use alloy::{
hex::FromHex,
primitives::TxHash,
rpc::types::{AccessList, Transaction},
};
use alloy::{hex::FromHex, primitives::TxHash};
use incredible_bindings::incrediblesquaringtaskmanager::IIncredibleSquaringTaskManager::Task;
use incredible_bindings::incrediblesquaringtaskmanager::IncredibleSquaringTaskManager::{
respondToTaskCall, TaskResponded,
Expand Down Expand Up @@ -51,9 +48,10 @@ impl FakeChallenger {
}
}

fn fake_transaction(&self) -> Result<Option<Transaction>, ChallengerError> {
Ok(Some(Transaction { hash: alloy::primitives::FixedBytes::from_hex("0x7c26ddc3ed0f8ce05be3c5046fd72e7d3493b4e08ee33d03c8d791621183ee55").unwrap(), nonce: 6, block_hash: Some(alloy::primitives::FixedBytes::from_hex("0xc9781943aedf7d3040c117b515b9e94af34e564976cf4ddd309a1febfcf4fdb8").unwrap()), block_number: Some(108), transaction_index: Some(0), from: "0xa0ee7a142d267c1f36714e4a8f75612f20a79720".parse().unwrap(), to: Some("0x22753e4264fddc6181dc7cce468904a80a363e44".parse().unwrap()), value: "0".parse().unwrap(), gas_price: Some(829), gas: 266275, max_fee_per_gas: Some(1657), max_priority_fee_per_gas: Some(1), max_fee_per_blob_gas: None, input: alloy::primitives::Bytes::from_hex("0x5baec9a000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006b0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c0225554388e71f9eb5b46bd3813aabe8f3e2de4b965ff3727ada663f39b01f6e70f1c11ddf2169ba7b050f0cdc44223363a8912f0f3a9362d1d7ce0aa78fe864a2bb844ee415b8941017bd0f88d1f4e98a33ffaf917fdce5430ba36dbc5dfc1fe10d6ada6d8aa5fa3a4309df678bf6f370301f78e514b842ae50fea2afc54585c07aad5855f9e9f70a9076612ec3898ecb82d70cb0169b2ee59bbd44526914c7d117eaf682b217e97c383748202bc08091cf63f22da67328d10c185a39ab916d80000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001009d50828897fe208275d989abddcad762bf1bb1a089d5ad40ca5dc78e20faac256c79f6817fd79f3a4898e41b5212ccae66d5e9441c9c76f239a2966f24ba5e0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000").unwrap(), signature: Some(alloy::rpc::types::Signature { r:"36092271394955227026066375671804293921269183503734447794392882514684700159256".parse().unwrap(), s: "38481798096538394877966506194726302078101524385780537082725235490898795594893".parse().unwrap(), v: "1".parse().unwrap(), y_parity: None }), chain_id: Some(31337), blob_versioned_hashes: None, access_list: Some(AccessList([].to_vec())), transaction_type: Some(2), authorization_list: None }))
fn fake_calldata(&self) -> Bytes {
Bytes::from_hex("0x5baec9a000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006b0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c0225554388e71f9eb5b46bd3813aabe8f3e2de4b965ff3727ada663f39b01f6e70f1c11ddf2169ba7b050f0cdc44223363a8912f0f3a9362d1d7ce0aa78fe864a2bb844ee415b8941017bd0f88d1f4e98a33ffaf917fdce5430ba36dbc5dfc1fe10d6ada6d8aa5fa3a4309df678bf6f370301f78e514b842ae50fea2afc54585c07aad5855f9e9f70a9076612ec3898ecb82d70cb0169b2ee59bbd44526914c7d117eaf682b217e97c383748202bc08091cf63f22da67328d10c185a39ab916d80000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001009d50828897fe208275d989abddcad762bf1bb1a089d5ad40ca5dc78e20faac256c79f6817fd79f3a4898e41b5212ccae66d5e9441c9c76f239a2966f24ba5e0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000").unwrap()
}

/// Process task response log
pub(crate) async fn process_task_response_log(
&mut self,
Expand Down Expand Up @@ -96,40 +94,29 @@ impl FakeChallenger {
if let Some(task_responded) = decoded_event {
let tx_hash_result = task_responded.transaction_hash;
if let Some(_tx_hash) = tx_hash_result {
let transaction_data_result = self.fake_transaction();
match transaction_data_result {
Ok(transaction_data_option) => {
if let Some(transaction_data) = transaction_data_option {
let calldata = transaction_data.input;
let decoded = respondToTaskCall::abi_decode(&calldata, false);
let calldata = self.fake_calldata();
let decoded = respondToTaskCall::abi_decode(&calldata, false);

match decoded {
Ok(decoded) => {
let non_signer_stakes_and_signature =
decoded.nonSignerStakesAndSignature;
match decoded {
Ok(decoded) => {
let non_signer_stakes_and_signature = decoded.nonSignerStakesAndSignature;

let mut non_signing_operator_pub_keys: Vec<G1Point> = vec![];
let mut non_signing_operator_pub_keys: Vec<G1Point> = vec![];

for (i, pub_key) in non_signer_stakes_and_signature
.nonSignerPubkeys
.iter()
.enumerate()
{
non_signing_operator_pub_keys[i] = G1Point {
X: pub_key.X,
Y: pub_key.Y,
};
}
Ok(non_signing_operator_pub_keys)
}

Err(e) => Err(ChallengerError::AlloySolType(e)),
}
} else {
Err(ChallengerError::TaskResponseNotFound)
for (i, pub_key) in non_signer_stakes_and_signature
.nonSignerPubkeys
.iter()
.enumerate()
{
non_signing_operator_pub_keys[i] = G1Point {
X: pub_key.X,
Y: pub_key.Y,
};
}
Ok(non_signing_operator_pub_keys)
}
Err(e) => Err(e),

Err(e) => Err(ChallengerError::AlloySolType(e)),
}
} else {
Err(ChallengerError::TransactionHashNotFound)
Expand Down
5 changes: 3 additions & 2 deletions crates/challenger/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Challenger crate
use eigen_utils::{get_provider, get_ws_provider};
use alloy::consensus::Transaction;
use eigen_common::{get_provider, get_ws_provider};
use incredible_bindings::incrediblesquaringtaskmanager::IIncredibleSquaringTaskManager::{
Task, TaskResponse, TaskResponseMetadata,
};
Expand Down Expand Up @@ -241,7 +242,7 @@ impl Challenger {
match transaction_data_result {
Ok(transaction_data_option) => {
if let Some(transaction_data) = transaction_data_option {
let calldata = transaction_data.input;
let calldata = transaction_data.inner.input();
let decoded = respondToTaskCall::abi_decode(&calldata, false);

match decoded {
Expand Down
4 changes: 2 additions & 2 deletions crates/operator/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl OperatorBuilder {
let encoded_response = TaskResponse::abi_encode(&task_response);
let hash_msg = keccak256(encoded_response);

let signed_msg = self.key_pair.sign_message(hash_msg.as_slice());
let signed_msg = self.key_pair.sign_message(&hash_msg);
let signed_task_response =
SignedTaskResponse::new(task_response, signed_msg, self.operator_id);
Ok(signed_task_response)
Expand Down Expand Up @@ -302,7 +302,7 @@ mod tests {
let hash_msg = keccak256(encoded_response);
assert!(verify_message(
bls_key_pair.public_key_g2().g2(),
hash_msg.as_slice(),
&hash_msg,
signed_task_response.signature().g1_point().g1()
));
}
Expand Down
4 changes: 2 additions & 2 deletions crates/operator_2/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl OperatorBuilder {
let encoded_response = TaskResponse::abi_encode(&task_response);
let hash_msg = keccak256(encoded_response);

let signed_msg = self.key_pair.sign_message(hash_msg.as_slice());
let signed_msg = self.key_pair.sign_message(&hash_msg);
let signed_task_response =
SignedTaskResponse::new(task_response, signed_msg, self.operator_id);
Ok(signed_task_response)
Expand Down Expand Up @@ -308,7 +308,7 @@ mod tests {
let hash_msg = keccak256(encoded_response);
assert!(verify_message(
bls_key_pair.public_key_g2().g2(),
hash_msg.as_slice(),
&hash_msg,
signed_task_response.signature().g1_point().g1()
));
}
Expand Down
4 changes: 2 additions & 2 deletions crates/task_generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rust-version.workspace = true
repository.workspace = true
license.workspace = true
description = "eigen layer operator"

[lints]
rust.missing_docs = "allow"
rust.missing_debug_implementations = "warn"
Expand All @@ -30,4 +30,4 @@ reqwest.workspace = true

# eigen-rs
eigen-utils.workspace = true

eigen-common.workspace = true
2 changes: 1 addition & 1 deletion crates/task_generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use alloy::{
rpc::types::TransactionReceipt,
signers::local::PrivateKeySigner,
};
use eigen_utils::get_signer;
use eigen_common::get_signer;
use incredible_bindings::incrediblesquaringtaskmanager::IIncredibleSquaringTaskManager::{
Task, TaskResponse,
};
Expand Down
5 changes: 3 additions & 2 deletions crates/testing-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ rust-version.workspace = true
repository.workspace = true
license.workspace = true
description = "eigen layer operator"

[lints]
workspace = true

[dependencies]
eigen-common.workspace = true
eigen-utils.workspace = true
eigen-testing-utils.workspace = true
alloy.workspace = true
tracing.workspace = true
tracing.workspace = true
Loading

0 comments on commit bc5ed5c

Please sign in to comment.