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

[DRAFT] Eigen Incredible Squaring Blueprint Integration Test #304

Closed
wants to merge 80 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
5d55fd2
Move executor to SDK
drewstone Aug 26, 2024
4bfe7bd
nit: make struct var public
drewstone Aug 26, 2024
9d035db
fix: fix crate paths for executor, change incredible-squaring avs
drewstone Aug 26, 2024
83972eb
fmt
drewstone Aug 26, 2024
c4fb791
Fix eigen event macro
drewstone Aug 26, 2024
603fe8b
Fix: SDK build fix, blueprint WIP
Tjemmmic Aug 27, 2024
bfe6cd0
Merge remote-tracking branch 'origin/drew/move-executor-to-sdk' into …
Tjemmmic Aug 27, 2024
275ed88
Fix: Blueprint build fixes and WIP
Tjemmmic Aug 28, 2024
a82ed1e
Merge branch 'refs/heads/main' into drew/move-executor-to-sdk
Tjemmmic Aug 28, 2024
3e62221
Deps: Cleanup and reorganize
Tjemmmic Aug 28, 2024
26d15cf
Fix: incredible-squaring-blueprint fixes WIP
Tjemmmic Aug 29, 2024
fe6f739
Fix: Blueprint Fix WIP
Tjemmmic Aug 29, 2024
5568658
Incredible Squaring Fixes
Tjemmmic Aug 30, 2024
545d3fb
WIP: EL Incredible Squaring and Tangle AVS Blueprints
Tjemmmic Sep 4, 2024
844d3e3
WIP: Adding BLS BN254 to Keystore and some refactoring
Tjemmmic Sep 4, 2024
f5e8690
Feat: Bls Bn254 added to keystore
Tjemmmic Sep 5, 2024
4f9f920
WIP: Getting Eigenlayer Incredible Squaring Blueprint working
Tjemmmic Sep 6, 2024
be5b9ef
WIP: Eigen IS AVS Blueprint
Tjemmmic Sep 11, 2024
06a12d9
Merge branch 'refs/heads/main' into drew/move-executor-to-sdk
Tjemmmic Sep 11, 2024
ee827b0
Debugging, post-merge Cleanup, and fixes
Tjemmmic Sep 11, 2024
390dfc0
Fixing merge conflicts and pulling in blueprint testing logic
Tjemmmic Sep 12, 2024
3f896b1
More cleanup and fixes
Tjemmmic Sep 12, 2024
684892d
Work on getting testing passing with testnet (#239)
tbraun96 Sep 12, 2024
0043c0b
Keystore and blueprint fixes for Eigen IS
Tjemmmic Sep 12, 2024
e070cba
Merge remote-tracking branch 'origin/drew/move-executor-to-sdk' into …
Tjemmmic Sep 12, 2024
6c649cd
fmt
Tjemmmic Sep 12, 2024
93db9fe
Cleanup and refactor
tbraun96 Sep 13, 2024
06e6328
pass proper args
tbraun96 Sep 13, 2024
5976ce3
WIP: Getting Eigen IS Blueprint Compiling
Tjemmmic Sep 13, 2024
dbbc1a8
continue debugging
tbraun96 Sep 13, 2024
a4e6bcd
Merge branch 'drew/move-executor-to-sdk' of https://github.com/webb-t…
tbraun96 Sep 13, 2024
d8e2b1a
pull in origin/HEAD
tbraun96 Sep 13, 2024
d0a6d0b
Sync
tbraun96 Sep 13, 2024
35afe91
Fix the test, it passes
tbraun96 Sep 13, 2024
cbe6186
Fix: Builds without errors
Tjemmmic Sep 13, 2024
c805443
Fix: Merge, cleanup, and addressing PR comments
Tjemmmic Sep 13, 2024
7461ad5
Merge remote-tracking branch 'origin/drew/move-executor-to-sdk' into …
Tjemmmic Sep 13, 2024
68c107e
Merge branch 'refs/heads/main' into drew/move-executor-to-sdk
Tjemmmic Sep 13, 2024
528a0fb
Fix: Pull in changes from main, resolve conflicts
Tjemmmic Sep 13, 2024
2c64dd1
Fix: Add Forge to Workflow
Tjemmmic Sep 14, 2024
e913725
Merge in Main and pull generic blueprint code into SDK
Tjemmmic Sep 16, 2024
abed344
Merge branch 'refs/heads/main' into drew/move-executor-to-sdk
Tjemmmic Sep 16, 2024
2feaf6d
Fix: Workflow fix
Tjemmmic Sep 16, 2024
ca3cb14
Fix: Additional Workflow Fix
Tjemmmic Sep 16, 2024
c4b4a2f
Fix: Workflow debugging
Tjemmmic Sep 16, 2024
f2ace9c
Fix: Workflow debugging
Tjemmmic Sep 16, 2024
c8f8cd9
Fix: More debugging of workflow
Tjemmmic Sep 16, 2024
5f1d93f
Debugging Foundry workflow installation
Tjemmmic Sep 16, 2024
92ec028
Fix: Forge install path fix
Tjemmmic Sep 16, 2024
0a219b6
Fix: Final workflow fix
Tjemmmic Sep 16, 2024
a7cb57b
Fix: Fix feature-related errors
Tjemmmic Sep 17, 2024
298bab8
Merge branch 'refs/heads/main' into drew/move-executor-to-sdk
Tjemmmic Sep 17, 2024
64d7975
Fix: no-std fixes and cleanup
Tjemmmic Sep 17, 2024
d0d3d58
Starting Eigen IS Blueprint Test
Tjemmmic Sep 17, 2024
d4ed6fd
Merge branch 'refs/heads/main' into donovan/eigen-blueprint-test
Tjemmmic Sep 18, 2024
843aba2
Debugging Eigen Incredible Squaring
Tjemmmic Sep 19, 2024
a9cb990
Fixes: Updating from alloy and eigensdk-rs, fixing configs for eigen
Tjemmmic Sep 24, 2024
fdd4a8a
nit: make struct var public
drewstone Aug 26, 2024
92b2805
Fix: Blueprint build fixes and WIP
Tjemmmic Aug 28, 2024
b63e6b2
Deps: Cleanup and reorganize
Tjemmmic Aug 28, 2024
ab42d53
Incredible Squaring Fixes
Tjemmmic Aug 30, 2024
0bf59bf
WIP: Adding BLS BN254 to Keystore and some refactoring
Tjemmmic Sep 4, 2024
1755edb
Debugging, post-merge Cleanup, and fixes
Tjemmmic Sep 11, 2024
4102b55
Fixing merge conflicts and pulling in blueprint testing logic
Tjemmmic Sep 12, 2024
a8561e8
More cleanup and fixes
Tjemmmic Sep 12, 2024
2639e31
Keystore and blueprint fixes for Eigen IS
Tjemmmic Sep 12, 2024
3c28aa0
Work on getting testing passing with testnet (#239)
tbraun96 Sep 12, 2024
3c92968
Fix: Merge, cleanup, and addressing PR comments
Tjemmmic Sep 13, 2024
0c59449
Sync
tbraun96 Sep 13, 2024
dffb5c4
Fix: Pull in changes from main, resolve conflicts
Tjemmmic Sep 13, 2024
47bd3c0
Merge in Main and pull generic blueprint code into SDK
Tjemmmic Sep 16, 2024
c4e5227
Fix: Fix feature-related errors
Tjemmmic Sep 17, 2024
aa2cc2b
Fix: no-std fixes and cleanup
Tjemmmic Sep 17, 2024
20360b8
Starting Eigen IS Blueprint Test
Tjemmmic Sep 17, 2024
0184814
Debugging Eigen Incredible Squaring
Tjemmmic Sep 19, 2024
5566d62
Merge remote-tracking branch 'origin/donovan/eigen-blueprint-test' in…
Tjemmmic Sep 24, 2024
ec5ff15
Fixes: Fix Macro errors and cleanup after rebase
Tjemmmic Sep 24, 2024
a25d108
Fixes: Eigen Event handler fix
Tjemmmic Sep 24, 2024
0bf0dbb
Merge branch 'refs/heads/main' into donovan/eigen-blueprint-test
Tjemmmic Sep 24, 2024
5bcd861
Fixes: Cleanup after merging in Main
Tjemmmic Sep 24, 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
3,747 changes: 3,441 additions & 306 deletions Cargo.lock

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ url = { git = "https://github.com/domenukk/rust-url", branch = "no_std", default
w3f-bls = { version = "0.1.4", default-features = false }
cid = { version = "0.11.1" }

alloy-primitives = "0.7.7"
alloy-json-abi = "0.7.7"
alloy-sol-types = "0.7.7"
alloy-rpc-types = { version = "0.2.1" }
alloy-provider = { version = "0.2.1", default-features = false, features = ["reqwest", "ws"] }
alloy-pubsub = { version = "0.2.1" }
alloy-signer = { version = "0.2.1" }
alloy-signer-local = { version = "0.2.1" }
alloy-network = { version = "0.2.1" }
alloy-contract = { version = "0.2.1" }
alloy-transport = { version = "0.2.1" }
alloy-primitives = "0.8.3"
alloy-json-abi = "0.8.3"
alloy-sol-types = "0.8.3"
alloy-rpc-types = { version = "0.3.6" }
alloy-provider = { version = "0.3.6", default-features = false, features = ["reqwest", "ws"] }
alloy-pubsub = { version = "0.3.6" }
alloy-signer = { version = "0.3.6" }
alloy-signer-local = { version = "0.3.6" }
alloy-network = { version = "0.3.6" }
alloy-contract = { version = "0.3.6" }
alloy-transport = { version = "0.3.6" }

ark-bn254 = "0.4.0"
ark-ec = "0.4.0"
Expand All @@ -168,7 +168,8 @@ secp256k1 = "0.29.1"

# Eigenlayer
# TODO: Remove this branch, point to main once https://github.com/webb-tools/eigensdk-rs/pull/20 is merged
eigensdk-rs = { git = "https://github.com/webb-tools/eigensdk-rs.git", branch = "donovan/maintenance" }
#eigensdk-rs = { git = "https://github.com/webb-tools/eigensdk-rs.git", branch = "donovan/maintenance" }
eigensdk-rs = { path = "../eigensdk-rs" }

# Config for 'cargo dist'
[workspace.metadata.dist]
Expand Down
1 change: 0 additions & 1 deletion blueprint-metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ fn generate_rustdoc() -> Crate {
cmd.arg("--lib");
cmd.args(["--target-dir", &custom_target_dir]);
cmd.arg("--locked");
cmd.args(["--", "--document-hidden-items"]);
cmd.env("RUSTC_BOOTSTRAP", "1");
cmd.stdout(Stdio::piped());
cmd.stderr(Stdio::piped());
Expand Down
1 change: 1 addition & 0 deletions blueprint-test-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ gadget-sdk = { workspace = true }
uuid = { workspace = true, features = ["v4"] }
subxt = { workspace = true, features = ["substrate-compat"] }
color-eyre = { workspace = true }
eigensdk-rs = { workspace = true }
tracing = { workspace = true }

url = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion blueprint-test-utils/src/test_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
32 changes: 32 additions & 0 deletions blueprints/incredible-squaring/blueprint-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"metadata": {
"name": "incredible-squaring-blueprint",
"description": "A Simple Blueprint to demo how blueprints work on Tangle Network",
"author": "Webb Technologies Inc.",
"category": null,
"code_repository": "https://github.com/webb-tools/gadget",
"logo": null,
"website": "https://tangle.tools",
"license": "MIT OR Apache-2.0"
},
"jobs": [],
"registration_hook": "None",
"registration_params": [],
"request_hook": "None",
"request_params": [],
"gadget": {
"Native": {
"sources": [
{
"fetcher": {
"Testing": {
"cargo_package": "incredible-squaring-blueprint",
"cargo_bin": "incredible-squaring-gadget",
"base_path": "./blueprints/incredible-squaring/"
}
}
}
]
}
}
}
175 changes: 90 additions & 85 deletions blueprints/incredible-squaring/src/eigenlayer.rs
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
#![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::ProviderBuilder;
use alloy_provider::Provider;
use alloy_signer::k256::ecdsa::SigningKey;
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 color_eyre::{eyre::eyre, eyre::OptionExt, Result};
use gadget_sdk::job;
use gadget_sdk::{
events_watcher::{
evm::{Config, EventWatcher},
},
keystore::Backend,
network::setup::{start_p2p_network, NetworkConfig},
run::GadgetRunner,
info
use alloy_sol_types::{private::alloy_json_abi::JsonAbi, sol};

use color_eyre::{
eyre::{eyre, OptionExt},
Result,
};
use std::convert::Infallible;
use std::ops::Deref;
use std::sync::OnceLock;
use alloy_signer::k256::elliptic_curve::SecretKey;
use alloy_transport::Transport;
use IncredibleSquaringTaskManager::{
respondToTaskCall, G1Point, G2Point,
NonSignerStakesAndSignature, Task, TaskResponse,

use eigensdk_rs::{
eigen_utils::{
types::{operator_id_from_key_pair, OperatorPubkeys},
*,
},
incredible_squaring_avs::operator::*,
};

use gadget_sdk::{
tangle_subxt::tangle_testnet_runtime::api::{
runtime_types::{sp_core::ecdsa, tangle_primitives::services},
config::GadgetConfiguration,
events_watcher::evm::{Config, EventWatcher},
info, job,
keystore::{sp_core_subxt::Pair as SubxtPair, Backend},
network::{
gossip::GossipHandle,
setup::{start_p2p_network, NetworkConfig},
},
run::GadgetRunner,
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 eigensdk_rs::eigen_utils::types::{operator_id_from_key_pair, OperatorPubkeys};
use eigensdk_rs::eigen_utils::*;
use eigensdk_rs::incredible_squaring_avs::operator::*;

use sp_core::Pair;
use gadget_sdk::config::{
GadgetConfiguration, StdGadgetConfiguration,
};
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;

use IBLSSignatureChecker::NonSignerStakesAndSignature;
use IIncredibleSquaringTaskManager::{Task, TaskResponse};
use IncredibleSquaringTaskManager::respondToTaskCall;
use BN254::{G1Point, G2Point};

// Codegen from ABI file to interact with the contract.
sol!(
Expand All @@ -71,16 +71,12 @@ sol!(
),
)]
pub async fn xsquare_eigen(
// TODO: Add Context
// ctx: &MyContext,
number_to_be_squared: U256,
task_created_block: u32,
quorum_numbers: Bytes,
quorum_threshold_percentage: u32,
) -> Result<respondToTaskCall, Infallible> {
// TODO: Send our task response to Aggregator RPC server
// TODO: OR we use the gossip protocol to send the response to peers
// TODO: Where is by BLS key?

// // 1. Calculate the squared number and save the response
// let my_msg = MyMessage {
Expand Down Expand Up @@ -168,7 +164,7 @@ pub fn convert_event_to_inputs(
impl GadgetRunner for EigenlayerGadgetRunner<parking_lot::RawRwLock> {
type Error = color_eyre::eyre::Report;

fn config(&self) -> &StdGadgetConfiguration {
fn config(&self) -> &GadgetConfiguration<parking_lot::RawRwLock> {
todo!()
}

Expand Down Expand Up @@ -227,15 +223,16 @@ impl GadgetRunner for EigenlayerGadgetRunner<parking_lot::RawRwLock> {
node_api_ip_port_address: "127.0.0.1:9808".to_string(),
eth_rpc_url: http_endpoint.to_string(),
eth_ws_url: ws_endpoint.to_string(),
bls_private_key_store_path: "./keystore/bls".to_string(),
ecdsa_private_key_store_path: "./keystore/ecdsa".to_string(),
incredible_squaring_service_manager_addr: Default::default(),
avs_registry_coordinator_addr: Default::default(),
operator_state_retriever_addr: Default::default(),
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(),
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(),
delegation_manager_addr: Default::default(),
avs_directory_addr: Default::default(),
operator_address: Default::default(),
delegation_manager_addr: "a85233C63b9Ee964Add6F2cffe00Fd84eb32338f".to_string(),
avs_directory_addr: "c5a5C42992dECbae36851359345FE25997F5C42d".to_string(),
operator_address: "f39Fd6e51aad88F6F4ce6aB8827279cffFb92266".to_string(),
enable_metrics: false,
enable_node_api: false,
server_ip_port_address: "127.0.0.1:8673".to_string(),
Expand All @@ -252,15 +249,15 @@ impl GadgetRunner for EigenlayerGadgetRunner<parking_lot::RawRwLock> {
.clone()
.boxed();

let _ws_provider = ProviderBuilder::new()
let ws_provider = ProviderBuilder::new()
.with_recommended_fillers()
.wallet(wallet)
.on_http(self.env.rpc_endpoint.parse()?)
.root()
.clone()
.boxed();

let _operator_info_service = OperatorInfoService::new(
let operator_info_service = OperatorInfoService::new(
types::OperatorInfo {
socket: "0.0.0.0:0".to_string(),
pubkeys: OperatorPubkeys {
Expand All @@ -278,27 +275,27 @@ impl GadgetRunner for EigenlayerGadgetRunner<parking_lot::RawRwLock> {
.await
.map_err(|e| OperatorError::HttpEthClientError(e.to_string()))?;

let _signer = EigenGadgetSigner::new(
let signer = EigenGadgetSigner::new(
PrivateKeySigner::from_signing_key(ecdsa_signing_key),
Some(ChainId::from(chain_id)),
);

// This creates and registers an operator with the given configuration
// let operator = Operator::<NodeConfig, OperatorInfoService>::new_from_config(
// node_config.clone(),
// EigenGadgetProvider {
// provider: http_provider,
// },
// EigenGadgetProvider {
// provider: ws_provider,
// },
// operator_info_service,
// signer,
// )
// .await
// .map_err(|e| eyre!(e))?;

// self.set_operator(operator);
let operator = Operator::<NodeConfig, OperatorInfoService>::new_from_config(
node_config.clone(),
EigenGadgetProvider {
provider: http_provider.clone(),
},
EigenGadgetProvider {
provider: ws_provider.clone(),
},
operator_info_service.clone(),
signer.clone(),
)
.await
.map_err(|e| eyre!(e))?;

self.set_operator(operator);

info!("Registered operator for Eigenlayer");
Ok(())
Expand All @@ -308,7 +305,7 @@ impl GadgetRunner for EigenlayerGadgetRunner<parking_lot::RawRwLock> {
todo!()
}

async fn run(&self) -> Result<()> {
async fn run(&mut self) -> Result<()> {
// Tangle Portion of Run
let _client = self.env.client().await.map_err(|e| eyre!(e))?;
let signer = self.env.first_sr25519_signer().map_err(|e| eyre!(e))?;
Expand Down Expand Up @@ -371,19 +368,27 @@ impl GadgetRunner for EigenlayerGadgetRunner<parking_lot::RawRwLock> {

let _network: GossipHandle =
start_p2p_network(network_config).map_err(|e| eyre!(e.to_string()))?;
// let x_square_eigen = blueprint::XsquareEigenEventHandler {
// ctx: blueprint::MyContext { network, keystore },
// };
//
// let contract: IncredibleSquaringTaskManager::IncredibleSquaringTaskManagerInstance = IncredibleSquaringTaskManager::IncredibleSquaringTaskManagerInstance::new(contract_address, provider);
//
// EventWatcher::run(
// &EigenlayerEventWatcher,
// contract,
// // Add more handler here if we have more functions.
// vec![Box::new(x_square_eigen)],
// )
// .await?;

let x_square_eigen = XsquareEigenEventHandler {};

let operator: Operator<NodeConfig, OperatorInfoService> =
self.operator.clone().ok_or(eyre!("Operator is None"))?;

let instance =
IncredibleSquaringTaskManagerInstanceWrapper::new(IncredibleSquaringTaskManager::new(
operator
.incredible_squaring_contract_manager
.task_manager_addr,
operator
.incredible_squaring_contract_manager
.eth_client_http
.clone(),
));

let event_watcher: EigenlayerEventWatcher<NodeConfig> = EigenlayerEventWatcher::new();
event_watcher
.run(instance, vec![Box::new(x_square_eigen)])
.await?;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion blueprints/incredible-squaring/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use gadget_sdk::job;
use std::convert::Infallible;

//pub mod eigenlayer;
pub mod eigenlayer;

/// Returns x^2 saturating to [`u64::MAX`] if overflow occurs.
#[job(
Expand Down
Loading
Loading