Skip to content

Commit

Permalink
feat: symbiotic initial integration (#411)
Browse files Browse the repository at this point in the history
* feat: begin symbiotic integration

* fix: impl eigen register in config

* feat: impl symb and fix other registrations/requires registration

* fix: fmt

* feat: update runners, separate configs, add Symbiotic contracts, not working

* feat: use blueprint runner in eigen test, still not working

* feat: fix test and insert test keys at setup time

* fix: remove unused runner

* fix: fix

* fix: clippy

* fix: add default blueprint ids

* fix: remove need to import packages for macro

* fix: fix test

* fix: reorg and attempt to fix CI

* fix: fixes

* fix: fmt

* fix: services context

* fix: fixes

* fix: fix path

* Update sdk/src/runners/jobs.rs

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

* fix: symbiotic build

* fix: fix naming

* fix: fix naming

* fix: fix var in macro

* fix: symbiotic contracts

* fix: fixes

* fix: fixes

---------

Co-authored-by: Alex <[email protected]>
  • Loading branch information
drewstone and Serial-ATA authored Oct 29, 2024
1 parent 4719718 commit 81e1f0e
Show file tree
Hide file tree
Showing 61 changed files with 3,091 additions and 1,558 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
blueprint-manager,
gadget-context-derive,
gadget-blueprint-proc-macro,
gadget-blueprint-proc-macro-playground,
gadget-blueprint-proc-macro-playground
]
steps:
- name: checkout code
Expand Down
8 changes: 7 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@
[submodule "blueprints/ecdsa-threshold-mpc/contracts/lib/tnt-core"]
path = blueprints/ecdsa-threshold-mpc/contracts/lib/tnt-core
url = https://github.com/tangle-network/tnt-core
branch = main
branch = main
[submodule "blueprints/incredible-squaring-symbiotic/contracts/lib/forge-std"]
path = blueprints/incredible-squaring-symbiotic/contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "blueprints/incredible-squaring-symbiotic/contracts/lib/core"]
path = blueprints/incredible-squaring-symbiotic/contracts/lib/core
url = https://github.com/symbioticfi/core
56 changes: 56 additions & 0 deletions Cargo.lock

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

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

incredible-squaring-blueprint = { path = "./blueprints/incredible-squaring", default-features = false, version = "0.1.1" }
incredible-squaring-blueprint-eigenlayer = { path = "./blueprints/incredible-squaring-eigenlayer", default-features = false, version = "0.1.1" }
incredible-squaring-blueprint-symbiotic = { path = "./blueprints/incredible-squaring-symbiotic", 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.3" }
gadget-blueprint-proc-macro-core = { path = "./macros/blueprint-proc-macro-core", default-features = false, version = "0.1.5" }
Expand Down Expand Up @@ -178,6 +181,9 @@ secp256k1 = "0.29.1"
eigensdk = { version = "0.1.0", features = ["full", "utils", "types"] }
testcontainers = { version = "0.20.1" }

# Symbiotic
symbiotic-rs = { version = "0.1.0" }

# Config for 'cargo dist'
[workspace.metadata.dist]
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
Expand Down
2 changes: 1 addition & 1 deletion blueprint-manager/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct BlueprintManagerConfig {
/// The directory in which all gadgets will store their data
#[arg(long, short = 'd', default_value = "./data")]
pub data_dir: PathBuf,
/// The verbosity level, can be used multiple times
/// The verbosity level, can be used multiple times to increase verbosity
#[arg(long, short = 'v', action = clap::ArgAction::Count)]
pub verbose: u8,
/// Whether to use pretty logging
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 @@ -38,6 +38,7 @@ alloy-contract = { workspace = true }
alloy-rpc-types-eth = { workspace = true }
alloy-node-bindings = { workspace = true }
thiserror = { workspace = true }
lazy_static = { workspace = true }

eigensdk = { workspace = true }
testcontainers = { workspace = true }
Expand Down
113 changes: 113 additions & 0 deletions blueprint-test-utils/src/eigenlayer_test_env.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
use alloy_primitives::{address, Address};
use alloy_provider::Provider;
use gadget_sdk::info;
use gadget_sdk::{
config::protocol::EigenlayerContractAddresses, events_watcher::evm::get_provider_http,
};

use crate::helpers::get_receipt;

alloy_sol_types::sol!(
#[allow(missing_docs)]
#[sol(rpc)]
#[derive(Debug)]
IncredibleSquaringTaskManager,
"./../blueprints/incredible-squaring-eigenlayer/contracts/out/IncredibleSquaringTaskManager.sol/IncredibleSquaringTaskManager.json"
);

alloy_sol_types::sol!(
#[allow(missing_docs)]
#[sol(rpc)]
#[derive(Debug)]
PauserRegistry,
"./../blueprints/incredible-squaring-eigenlayer/contracts/out/IPauserRegistry.sol/IPauserRegistry.json"
);

alloy_sol_types::sol!(
#[allow(missing_docs, clippy::too_many_arguments)]
#[sol(rpc)]
#[derive(Debug)]
RegistryCoordinator,
"./../blueprints/incredible-squaring-eigenlayer/contracts/out/RegistryCoordinator.sol/RegistryCoordinator.json"
);

pub struct EigenlayerTestEnvironment {
pub http_endpoint: String,
pub ws_endpoint: String,
pub accounts: Vec<Address>,
pub eigenlayer_contract_addresses: EigenlayerContractAddresses,
pub pauser_registry_address: Address,
}

pub async fn setup_eigenlayer_test_environment(
http_endpoint: &str,
ws_endpoint: &str,
) -> EigenlayerTestEnvironment {
let provider = get_provider_http(http_endpoint);

let accounts = provider.get_accounts().await.unwrap();

let registry_coordinator_address = address!("c3e53f4d16ae77db1c982e75a937b9f60fe63690");
std::env::set_var(
"REGISTRY_COORDINATOR_ADDR",
registry_coordinator_address.to_string(),
);
let operator_state_retriever_address = address!("1613beb3b2c4f22ee086b2b38c1476a3ce7f78e8");
std::env::set_var(
"OPERATOR_STATE_RETRIEVER_ADDR",
operator_state_retriever_address.to_string(),
);
let delegation_manager_address = address!("dc64a140aa3e981100a9beca4e685f962f0cf6c9");
std::env::set_var(
"DELEGATION_MANAGER_ADDR",
delegation_manager_address.to_string(),
);
let strategy_manager_address = address!("5fc8d32690cc91d4c39d9d3abcbd16989f875707");
std::env::set_var(
"STRATEGY_MANAGER_ADDR",
strategy_manager_address.to_string(),
);
let erc20_mock_address = address!("7969c5ed335650692bc04293b07f5bf2e7a673c0");
std::env::set_var("ERC20_MOCK_ADDR", erc20_mock_address.to_string());

let pauser_registry = PauserRegistry::deploy(provider.clone()).await.unwrap();
let pauser_registry_address = *pauser_registry.address();

let registry_coordinator =
RegistryCoordinator::new(registry_coordinator_address, provider.clone());

let operator_set_params = RegistryCoordinator::OperatorSetParam {
maxOperatorCount: 10,
kickBIPsOfOperatorStake: 100,
kickBIPsOfTotalStake: 1000,
};
let strategy_params = RegistryCoordinator::StrategyParams {
strategy: erc20_mock_address,
multiplier: 1,
};

info!("Creating Quorum");
let _receipt = get_receipt(registry_coordinator.createQuorum(
operator_set_params,
0,
vec![strategy_params],
))
.await
.unwrap();

info!("Setup Eigenlayer test environment");

EigenlayerTestEnvironment {
http_endpoint: http_endpoint.to_string(),
ws_endpoint: ws_endpoint.to_string(),
accounts,
eigenlayer_contract_addresses: EigenlayerContractAddresses {
registry_coordinator_address,
operator_state_retriever_address,
delegation_manager_address,
strategy_manager_address,
avs_directory_address: Default::default(),
},
pauser_registry_address,
}
}
Loading

0 comments on commit 81e1f0e

Please sign in to comment.