Skip to content

Commit

Permalink
Leverage blueprint in incredible squaring aggregator (#365)
Browse files Browse the repository at this point in the history
* feat: add eigenlayer context

* merge: combine context and proc macro tests

* fix: removing unused code and fixing test

* fix: move static vars to the lib

* fix: move static vars to the lib

* chore: debug

* fix: lint and fmt to keep things clean

* chore: add logging for debugging

* fix: identified issue

* fix: start on proc macro for abi grabbing

* fix: compiles and deploys tasks, event listener not firing

* chore: separate event listener files out

* fix: spelling and blocks to mine

* fix: more logging

* chore: remove logs, evm event listener is broke

* fix: remove one loop from event listening flow, polling seems to work, event catching not

* Fix: Got back to original signing bug

* Fix: Fixed address change - back to signature invalid revert

* Fix: Correctly pulls task index from events

* fix: use EL convert to g1/g2 point

* feat: use aggregator and separate out from the blueprint job

* fix: updates using aggregator

* fix: solve registry error in aggregator

* fix: prevent duplicates

* fix: got test working

* fix: fmt and clippy cleanup

* feat: added test in eigen IS blueprint, cleaned up testing code for it

* feat: convert aggregator process_new_jobs to blueprint

* Use incredible squaring aggregator (#364)

* chore: bump rustdoc-types (#348)

Also pin to the latest nightly

* fix: load substrate signer from env correctly (#349)

* fix: add `data_dir` back to `GadgetConfiguration` (#350)

It was (mistakenly?) removed in #333. Went ahead and added a default path for blueprint manager as well.

* Multi job runner + SDK main macro (#346)

* feat: use aggregator and separate out from the blueprint job

* fix: uncomment generate_json (#358)

* fix: updates using aggregator

* fix: solve registry error in aggregator

* fix: prevent duplicates

* fix: got test working

* fix: fmt and clippy cleanup

* feat(cli): support custom repo and path sources (#360)

* feat: added test in eigen IS blueprint, cleaned up testing code for it

* Event Workflows (phase 1: Custom listeners) (#359)

* Add wrapper types + trait structure to enforce structure for event flows

* Decoupling/refactor and ensure integration test passes

* periodic web poller working and further refactor of macro code

* Everything compiling, integration test passes

* fix(sdk)!: downgrade substrate dependencies for now

It's currently impossible to use some APIs downstream, since they expose `sp_core` (v0.34.0) types instead of the `sdk::keystore::sp_core_subxt` (v0.31.0) types. Cargo will refuse to build blueprints using them. I just got rid of the `sdk::keystore::sp_core_subxt` hack and downgraded all of the dependencies necessary (I think).

This won't be an issue once #318 is taken care of.

* feat(sdk): re-export `libp2p`

---------

Co-authored-by: Alex <[email protected]>
Co-authored-by: Thomas Braun <[email protected]>
Co-authored-by: Tjemmmic <[email protected]>

* fix: merge fix-el branch

* feat: use aggregator blueprint

* fix: remappings out of date

* fix: remove eigenlayer-middleware from tangle blueprint git modules

* chore: close handles once test completes, rpc server still not shutting down

* fix: remove broken invalid test cases

* fix: proc macro doc fixes to avoid more maintenance

* chore: merge main

* fix: move helpers to separate file

* fix: moving helpers along w/ eigenlayer context

* fix: get both blueprints running

* fix: expose addresses better

* feat: test exits successfully and all pieces work seamlessly

* fix: add helper

* fix: clippy and fmt

* fix: context derive test

* fix: context derive test

---------

Co-authored-by: Tjemmmic <[email protected]>
Co-authored-by: Alex <[email protected]>
Co-authored-by: Thomas Braun <[email protected]>
  • Loading branch information
4 people authored Oct 25, 2024
1 parent c4934f3 commit 5c887fc
Show file tree
Hide file tree
Showing 37 changed files with 1,529 additions and 1,173 deletions.
56 changes: 5 additions & 51 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ members = [
"blueprint-metadata",
"blueprints/incredible-squaring",
"blueprints/incredible-squaring-eigenlayer",
"blueprints/incredible-squaring-eigenlayer/aggregator",
"blueprints/periodic-web-poller",
"cli",
"gadget-io",
Expand Down Expand Up @@ -49,7 +48,6 @@ blueprint-test-utils = { path = "./blueprint-test-utils" }
gadget-sdk = { path = "./sdk", default-features = false, version = "0.2.2" }

incredible-squaring-blueprint-eigenlayer = { path = "./blueprints/incredible-squaring-eigenlayer", default-features = false, version = "0.1.1" }
incredible-squaring-aggregator = { path = "./blueprints/incredible-squaring-eigenlayer/aggregator", default-features = false, version = "0.1.1" }
periodic-web-poller-blueprint = { path = "./blueprints/periodic-web-poller", default-features = false, version = "0.1.1" }
gadget-blueprint-proc-macro = { path = "./macros/blueprint-proc-macro", default-features = false, version = "0.2.2" }
gadget-blueprint-proc-macro-core = { path = "./macros/blueprint-proc-macro-core", default-features = false, version = "0.1.4" }
Expand Down
3 changes: 2 additions & 1 deletion blueprint-manager/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ pub async fn run_blueprint_manager<F: SendFuture<'static, ()>>(
let sub_account_id = tangle_key.account_id().clone();

let tangle_client =
TangleRuntimeClient::from_url(gadget_config.url.as_str(), sub_account_id.clone()).await?;
TangleRuntimeClient::from_url(gadget_config.ws_rpc_url.as_str(), sub_account_id.clone())
.await?;
let services_client = ServicesClient::new(tangle_client.client());
let mut active_gadgets = HashMap::new();

Expand Down
48 changes: 0 additions & 48 deletions blueprint-manager/src/sdk/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use crate::config::BlueprintManagerConfig;
use crate::protocols::resolver::NativeGithubMetadata;
use gadget_io::GadgetConfig;
use gadget_sdk::config::Protocol;
use gadget_sdk::{info, warn};
use sha2::Digest;
use std::path::Path;
Expand Down Expand Up @@ -38,51 +35,6 @@ pub fn bounded_string_to_string(string: BoundedString) -> Result<String, FromUtf
String::from_utf8(bytes.clone())
}

pub fn generate_process_arguments(
gadget_config: &GadgetConfig,
opt: &BlueprintManagerConfig,
blueprint_id: u64,
service_id: u64,
protocol: Protocol,
) -> color_eyre::Result<Vec<String>> {
let mut arguments = vec![];
arguments.push("run".to_string());

if opt.test_mode {
arguments.push("--test-mode=true".to_string());
}

for bootnode in &gadget_config.bootnodes {
arguments.push(format!("--bootnodes={}", bootnode));
}

arguments.extend([
format!("--bind-addr={}", gadget_config.bind_addr),
format!("--bind-port={}", gadget_config.bind_port),
format!("--url={}", gadget_config.url),
format!("--keystore-uri={}", gadget_config.keystore_uri),
format!("--chain={}", gadget_config.chain),
format!("--verbose={}", opt.verbose),
format!("--pretty={}", opt.pretty),
format!("--blueprint-id={}", blueprint_id),
format!("--service-id={}", service_id),
format!("--protocol={}", protocol),
format!(
"--log-id=Blueprint-{blueprint_id}-Service-{service_id}-{}",
opt.instance_id.clone().unwrap_or_else(|| format!(
"{}-{}",
gadget_config.bind_addr, gadget_config.bind_port
))
),
]);

if let Some(keystore_password) = &gadget_config.keystore_password {
arguments.push(format!("--keystore-password={}", keystore_password));
}

Ok(arguments)
}

pub fn hash_bytes_to_hex<T: AsRef<[u8]>>(input: T) -> String {
let mut hasher = sha2::Sha256::default();
hasher.update(input);
Expand Down
12 changes: 10 additions & 2 deletions blueprint-manager/src/sources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ pub async fn handle<'a>(

// Add required env vars for all child processes/gadgets
let mut env_vars = vec![
("RPC_URL".to_string(), gadget_config.url.to_string()),
(
"HTTP_RPC_URL".to_string(),
gadget_config.http_rpc_url.to_string(),
),
(
"WS_RPC_URL".to_string(),
gadget_config.ws_rpc_url.to_string(),
),
(
"KEYSTORE_URI".to_string(),
blueprint_manager_opts.keystore_uri.clone(),
Expand Down Expand Up @@ -141,7 +148,8 @@ pub fn generate_process_arguments(
arguments.extend([
format!("--bind-addr={}", gadget_config.bind_addr),
format!("--bind-port={}", gadget_config.bind_port),
format!("--url={}", gadget_config.url),
format!("--http-rpc-url={}", gadget_config.http_rpc_url),
format!("--ws-rpc-url={}", gadget_config.ws_rpc_url),
format!("--keystore-uri={}", gadget_config.keystore_uri),
format!("--chain={}", gadget_config.chain),
format!("--verbose={}", opt.verbose),
Expand Down
4 changes: 1 addition & 3 deletions blueprint-test-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ alloy-sol-types = { workspace = true }
alloy-contract = { workspace = true }
alloy-rpc-types-eth = { workspace = true }
alloy-node-bindings = { workspace = true }

incredible-squaring-aggregator = { workspace = true }

thiserror = { workspace = true }

eigensdk = { workspace = true }
testcontainers = { workspace = true }
Expand Down
Loading

0 comments on commit 5c887fc

Please sign in to comment.