From 5bcd861ac0328771fb76f553cb0a25942cbdc478 Mon Sep 17 00:00:00 2001 From: Tjemmmic Date: Tue, 24 Sep 2024 18:55:08 -0500 Subject: [PATCH] Fixes: Cleanup after merging in Main --- blueprint-metadata/src/lib.rs | 2 +- blueprint-test-utils/src/test_ext.rs | 2 +- .../incredible-squaring/src/eigenlayer.rs | 104 ++++++++---------- .../src/eigenlayer/event_listener.rs | 1 - 4 files changed, 45 insertions(+), 64 deletions(-) diff --git a/blueprint-metadata/src/lib.rs b/blueprint-metadata/src/lib.rs index b1c3d45c..65c9fab0 100644 --- a/blueprint-metadata/src/lib.rs +++ b/blueprint-metadata/src/lib.rs @@ -15,7 +15,7 @@ use rustdoc_types::{Crate, Id, Item, ItemEnum, Module}; /// Generate `blueprint.json` to the current crate working directory next to `build.rs` file. pub fn generate_json() { - // Config::builder().build().generate_json(); + Config::builder().build().generate_json(); } #[derive(Debug, Clone, Default, typed_builder::TypedBuilder)] diff --git a/blueprint-test-utils/src/test_ext.rs b/blueprint-test-utils/src/test_ext.rs index d66202ba..fe984c24 100644 --- a/blueprint-test-utils/src/test_ext.rs +++ b/blueprint-test-utils/src/test_ext.rs @@ -45,7 +45,7 @@ pub const NAME_IDS: [&str; 5] = ["Alice", "Bob", "Charlie", "Dave", "Eve"]; /// - `N`: number of nodes /// - `K`: Number of networks accessible per node (should be equal to the number of services in a given blueprint) -/// - `D`: Any data that you want to pass to pass with NodeInput. +/// - `D`: Any data that you want to pass with NodeInput. /// - `F`: A function that generates a service's execution via a series of shells. Each shell executes a subset of the service, /// as each service may have a set of operations that are executed in parallel, sequentially, or concurrently. #[allow(clippy::async_yields_async)] diff --git a/blueprints/incredible-squaring/src/eigenlayer.rs b/blueprints/incredible-squaring/src/eigenlayer.rs index a4e1aac6..f003f8e9 100644 --- a/blueprints/incredible-squaring/src/eigenlayer.rs +++ b/blueprints/incredible-squaring/src/eigenlayer.rs @@ -1,52 +1,54 @@ #![allow(dead_code)] +use std::{convert::Infallible, ops::Deref, sync::OnceLock}; + use alloy_contract::ContractInstance; -use alloy_network::Ethereum; -use alloy_network::EthereumWallet; -use alloy_primitives::{Address, ChainId, FixedBytes}; -use alloy_primitives::{Bytes, U256}; -use alloy_provider::Provider; -use alloy_provider::ProviderBuilder; -use alloy_signer::k256::ecdsa::SigningKey; -use alloy_signer::k256::elliptic_curve::SecretKey; +use alloy_network::{Ethereum, EthereumWallet}; +use alloy_primitives::{Address, Bytes, ChainId, FixedBytes, U256}; +use alloy_provider::{Provider, ProviderBuilder}; +use alloy_signer::k256::{ecdsa::SigningKey, elliptic_curve::SecretKey}; use alloy_signer_local::PrivateKeySigner; -use alloy_sol_types::private::alloy_json_abi::JsonAbi; -use alloy_sol_types::sol; -// use alloy_transport::Transport; -use color_eyre::{eyre::eyre, eyre::OptionExt, Result}; -use gadget_sdk::job; +use alloy_sol_types::{private::alloy_json_abi::JsonAbi, sol}; + +use color_eyre::{ + eyre::{eyre, OptionExt}, + Result, +}; + +use eigensdk_rs::{ + eigen_utils::{ + types::{operator_id_from_key_pair, OperatorPubkeys}, + *, + }, + incredible_squaring_avs::operator::*, +}; + use gadget_sdk::{ + config::GadgetConfiguration, events_watcher::evm::{Config, EventWatcher}, - keystore::Backend, - network::setup::{start_p2p_network, NetworkConfig}, + info, job, + keystore::{sp_core_subxt::Pair as SubxtPair, Backend}, + network::{ + gossip::GossipHandle, + setup::{start_p2p_network, NetworkConfig}, + }, run::GadgetRunner, - info + tangle_subxt::{ + subxt::tx::Signer, + tangle_testnet_runtime::api, + tangle_testnet_runtime::api::runtime_types::{ + sp_core::ecdsa, tangle_primitives::services, tangle_primitives::services::PriceTargets, + }, + }, + tx, }; -use std::convert::Infallible; -use std::ops::Deref; -use std::sync::OnceLock; + +use sp_core::Pair; + use IBLSSignatureChecker::NonSignerStakesAndSignature; use IIncredibleSquaringTaskManager::{Task, TaskResponse}; use IncredibleSquaringTaskManager::respondToTaskCall; use BN254::{G1Point, G2Point}; -use eigensdk_rs::eigen_utils::types::{operator_id_from_key_pair, OperatorPubkeys}; -use eigensdk_rs::eigen_utils::*; -use eigensdk_rs::incredible_squaring_avs::operator::*; -use gadget_sdk::{ - tangle_subxt::tangle_testnet_runtime::api::runtime_types::{ - sp_core::ecdsa, tangle_primitives::services, - }, - tx, -}; -use sp_core::Pair; -// use subxt_signer::ecdsa::SecretKeyBytes; -use gadget_sdk::config::GadgetConfiguration; -use gadget_sdk::keystore::sp_core_subxt::Pair as SubxtPair; -use gadget_sdk::network::gossip::GossipHandle; -use gadget_sdk::tangle_subxt::subxt::tx::Signer; -use gadget_sdk::tangle_subxt::tangle_testnet_runtime::api; -use gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::PriceTargets; - // Codegen from ABI file to interact with the contract. sol!( #[allow(missing_docs)] @@ -223,7 +225,8 @@ impl GadgetRunner for EigenlayerGadgetRunner { eth_ws_url: ws_endpoint.to_string(), bls_private_key_store_path: "./../eigensdk-rs/test-utils/keystore/bls".to_string(), ecdsa_private_key_store_path: "./../eigensdk-rs/test-utils/keystore/ecdsa".to_string(), - incredible_squaring_service_manager_addr: "0DCd1Bf9A1b36cE34237eEaFef220932846BCD82".to_string(), + incredible_squaring_service_manager_addr: "0DCd1Bf9A1b36cE34237eEaFef220932846BCD82" + .to_string(), avs_registry_coordinator_addr: "0B306BF915C4d645ff596e518fAf3F9669b97016".to_string(), operator_state_retriever_addr: "3Aa5ebB10DC797CAC828524e59A333d0A371443c".to_string(), eigen_metrics_ip_port_address: "127.0.0.1:9100".to_string(), @@ -366,9 +369,7 @@ impl GadgetRunner for EigenlayerGadgetRunner { let _network: GossipHandle = start_p2p_network(network_config).map_err(|e| eyre!(e.to_string()))?; - let x_square_eigen = XsquareEigenEventHandler { - logger, - }; + let x_square_eigen = XsquareEigenEventHandler {}; let operator: Operator = self.operator.clone().ok_or(eyre!("Operator is None"))?; @@ -386,28 +387,9 @@ impl GadgetRunner for EigenlayerGadgetRunner { let event_watcher: EigenlayerEventWatcher = EigenlayerEventWatcher::new(); event_watcher - .run( - instance, - vec!( - Box::new(x_square_eigen) - ), - ) + .run(instance, vec![Box::new(x_square_eigen)]) .await?; - // self.operator.unwrap().start().await?; - // if let Some(operator) = &self.operator { - // operator.start().await?; - // } else { - // return Err(eyre!("Run Error - No Operator Found")); - // } - - // self.operator.unwrap().start().await?; - // if let Some(operator) = &self.operator { - // operator.start().await?; - // } else { - // return Err(eyre!("Run Error - No Operator Found")); - // } - Ok(()) } } diff --git a/macros/blueprint-proc-macro/src/eigenlayer/event_listener.rs b/macros/blueprint-proc-macro/src/eigenlayer/event_listener.rs index 0a8f5c2a..b913ac84 100644 --- a/macros/blueprint-proc-macro/src/eigenlayer/event_listener.rs +++ b/macros/blueprint-proc-macro/src/eigenlayer/event_listener.rs @@ -25,7 +25,6 @@ pub(crate) fn generate_eigenlayer_event_handler( #[doc = #fn_name_string] #[doc = "`]"] pub struct #struct_name { - pub logger: gadget_sdk::logger::Logger, #(#additional_params)* }