From afba1505e9e68e778d0aab348ce8bb1898f51804 Mon Sep 17 00:00:00 2001 From: Drew Stone Date: Tue, 5 Nov 2024 16:52:20 +0700 Subject: [PATCH 1/2] chore: remove duplicated blueprints --- .gitmodules | 9 +- blueprints/ecdsa-threshold-mpc/.gitignore | 30 --- blueprints/ecdsa-threshold-mpc/Cargo.toml | 43 ---- blueprints/ecdsa-threshold-mpc/LICENSE | 24 -- blueprints/ecdsa-threshold-mpc/README.md | 13 -- blueprints/ecdsa-threshold-mpc/build.rs | 4 - .../ecdsa-threshold-mpc/contracts/.gitignore | 14 -- .../ecdsa-threshold-mpc/contracts/README.md | 66 ------ .../contracts/remappings.txt | 10 - .../contracts/src/HelloBlueprint.sol | 95 -------- blueprints/ecdsa-threshold-mpc/foundry.toml | 10 - .../ecdsa-threshold-mpc/rust-toolchain.toml | 5 - .../ecdsa-threshold-mpc/src/jobs/keygen.rs | 122 ----------- .../ecdsa-threshold-mpc/src/jobs/mod.rs | 19 -- .../ecdsa-threshold-mpc/src/jobs/refresh.rs | 14 -- .../ecdsa-threshold-mpc/src/jobs/sign.rs | 14 -- blueprints/ecdsa-threshold-mpc/src/main.rs | 62 ------ .../ecdsa-threshold-mpc/src/mpc/keygen.rs | 206 ------------------ blueprints/ecdsa-threshold-mpc/src/mpc/mod.rs | 36 --- .../ecdsa-threshold-mpc/src/mpc/refresh.rs | 1 - .../ecdsa-threshold-mpc/src/mpc/sign.rs | 1 - blueprints/ecdsa-threshold-mpc/taplo.toml | 4 - blueprints/tangle-raw/Cargo.toml | 22 -- blueprints/tangle-raw/build.rs | 5 - blueprints/tangle-raw/src/lib.rs | 24 -- blueprints/tangle-raw/src/main.rs | 37 ---- 26 files changed, 1 insertion(+), 889 deletions(-) delete mode 100644 blueprints/ecdsa-threshold-mpc/.gitignore delete mode 100644 blueprints/ecdsa-threshold-mpc/Cargo.toml delete mode 100644 blueprints/ecdsa-threshold-mpc/LICENSE delete mode 100644 blueprints/ecdsa-threshold-mpc/README.md delete mode 100644 blueprints/ecdsa-threshold-mpc/build.rs delete mode 100644 blueprints/ecdsa-threshold-mpc/contracts/.gitignore delete mode 100644 blueprints/ecdsa-threshold-mpc/contracts/README.md delete mode 100644 blueprints/ecdsa-threshold-mpc/contracts/remappings.txt delete mode 100644 blueprints/ecdsa-threshold-mpc/contracts/src/HelloBlueprint.sol delete mode 100644 blueprints/ecdsa-threshold-mpc/foundry.toml delete mode 100644 blueprints/ecdsa-threshold-mpc/rust-toolchain.toml delete mode 100644 blueprints/ecdsa-threshold-mpc/src/jobs/keygen.rs delete mode 100644 blueprints/ecdsa-threshold-mpc/src/jobs/mod.rs delete mode 100644 blueprints/ecdsa-threshold-mpc/src/jobs/refresh.rs delete mode 100644 blueprints/ecdsa-threshold-mpc/src/jobs/sign.rs delete mode 100644 blueprints/ecdsa-threshold-mpc/src/main.rs delete mode 100644 blueprints/ecdsa-threshold-mpc/src/mpc/keygen.rs delete mode 100644 blueprints/ecdsa-threshold-mpc/src/mpc/mod.rs delete mode 100644 blueprints/ecdsa-threshold-mpc/src/mpc/refresh.rs delete mode 100644 blueprints/ecdsa-threshold-mpc/src/mpc/sign.rs delete mode 100644 blueprints/ecdsa-threshold-mpc/taplo.toml delete mode 100644 blueprints/tangle-raw/Cargo.toml delete mode 100644 blueprints/tangle-raw/build.rs delete mode 100644 blueprints/tangle-raw/src/lib.rs delete mode 100644 blueprints/tangle-raw/src/main.rs diff --git a/.gitmodules b/.gitmodules index e085e360..5b891f05 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,14 +14,7 @@ path = blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std url = https://github.com/foundry-rs/forge-std -# For the ecdsa-threshold-mpc blueprint -[submodule "blueprints/ecdsa-threshold-mpc/contracts/lib/forge-std"] - path = blueprints/ecdsa-threshold-mpc/contracts/lib/forge-std - url = https://github.com/foundry-rs/forge-std -[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 +# For the incredible-squaring-symbiotic blueprint [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 diff --git a/blueprints/ecdsa-threshold-mpc/.gitignore b/blueprints/ecdsa-threshold-mpc/.gitignore deleted file mode 100644 index c046cc39..00000000 --- a/blueprints/ecdsa-threshold-mpc/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -# Generated by Cargo -target/ - -# These are backup files generated by rustfmt -**/*.rs.bk - -# MSVC Windows builds of rustc generate these, which store debugging information -*.pdb - -.idea -.vscode -.zed - -.direnv -.DS_Store -# Solc Compiler files -cache/ -out/ - -# Ignores development broadcast logs -!/broadcast -/broadcast/*/31337/ -/broadcast/**/dry-run/ - -# Docs -docs/ - -# Dotenv file -.env -blueprint.lock diff --git a/blueprints/ecdsa-threshold-mpc/Cargo.toml b/blueprints/ecdsa-threshold-mpc/Cargo.toml deleted file mode 100644 index 71e27f7b..00000000 --- a/blueprints/ecdsa-threshold-mpc/Cargo.toml +++ /dev/null @@ -1,43 +0,0 @@ -[package] -name = "ecdsa-threshold-mpc" -version = "0.1.1" -edition = "2021" -description = "A threshold MPC blueprint allowing key generation, threshold signing, and key refreshes." -authors = ["drewstone "] -license = "Unlicense" -homepage = "https://tangle.tools" -repository = "https://github.com/tangle-network/ecdsa-threshold-mpc" -readme = "README.md" -categories = ["cryptography", "cryptography::cryptocurrencies"] -keywords = ["tangle", "blueprint", "avs"] -rust-version = "1.81" -publish = false - -[dependencies] -thiserror = { workspace = true } -futures = { workspace = true } -rand = { workspace = true, features = ["alloc"] } -gadget-sdk = { workspace = true, features = ["std"] } - -color-eyre = { workspace = true } -tokio = { workspace = true, default-features = false, features = ["full"] } -tracing-subscriber = { workspace = true, features = ["parking_lot", "env-filter"] } -serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true } -sp-core = { workspace = true, features = ["std"] } -itertools = { workspace = true } - -cggmp21 = { version = "0.4", features = ["curve-stark", "curve-secp256k1", "curve-secp256r1"] } -key-share = { version = "0.4", default-features = false } - -generic-ec = { version = "0.4.1", default-features = false } -round-based = { version = "0.3", default-features = false } -digest = { version = "0.10", default-features = false } -sha2 = { version = "0.10", default-features = false } - -[build-dependencies] -blueprint-metadata = "0.1" - -[features] -default = ["std"] -std = [] diff --git a/blueprints/ecdsa-threshold-mpc/LICENSE b/blueprints/ecdsa-threshold-mpc/LICENSE deleted file mode 100644 index fdddb29a..00000000 --- a/blueprints/ecdsa-threshold-mpc/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to diff --git a/blueprints/ecdsa-threshold-mpc/README.md b/blueprints/ecdsa-threshold-mpc/README.md deleted file mode 100644 index 4e03f048..00000000 --- a/blueprints/ecdsa-threshold-mpc/README.md +++ /dev/null @@ -1,13 +0,0 @@ -## ECDSA Threshold MPC Blueprint - -_Note: This Blueprint is under active development._ - -A Blueprint for running a ECDSA threshold MPC protocol on the Tangle Network. - -## Building the Blueprint - -- To build the blueprint, just run the following command: - -```bash -cargo build -p ecdsa-threshold-mpc -``` diff --git a/blueprints/ecdsa-threshold-mpc/build.rs b/blueprints/ecdsa-threshold-mpc/build.rs deleted file mode 100644 index c77402e1..00000000 --- a/blueprints/ecdsa-threshold-mpc/build.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("cargo:rerun-if-changed=src/main.rs"); - blueprint_metadata::generate_json(); -} diff --git a/blueprints/ecdsa-threshold-mpc/contracts/.gitignore b/blueprints/ecdsa-threshold-mpc/contracts/.gitignore deleted file mode 100644 index 85198aaa..00000000 --- a/blueprints/ecdsa-threshold-mpc/contracts/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -# Compiler files -cache/ -out/ - -# Ignores development broadcast logs -!/broadcast -/broadcast/*/31337/ -/broadcast/**/dry-run/ - -# Docs -docs/ - -# Dotenv file -.env diff --git a/blueprints/ecdsa-threshold-mpc/contracts/README.md b/blueprints/ecdsa-threshold-mpc/contracts/README.md deleted file mode 100644 index 9265b455..00000000 --- a/blueprints/ecdsa-threshold-mpc/contracts/README.md +++ /dev/null @@ -1,66 +0,0 @@ -## Foundry - -**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** - -Foundry consists of: - -- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). -- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. -- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. -- **Chisel**: Fast, utilitarian, and verbose solidity REPL. - -## Documentation - -https://book.getfoundry.sh/ - -## Usage - -### Build - -```shell -$ forge build -``` - -### Test - -```shell -$ forge test -``` - -### Format - -```shell -$ forge fmt -``` - -### Gas Snapshots - -```shell -$ forge snapshot -``` - -### Anvil - -```shell -$ anvil -``` - -### Deploy - -```shell -$ forge script script/Counter.s.sol:CounterScript --rpc-url --private-key -``` - -### Cast - -```shell -$ cast -``` - -### Help - -```shell -$ forge --help -$ anvil --help -$ cast --help -``` diff --git a/blueprints/ecdsa-threshold-mpc/contracts/remappings.txt b/blueprints/ecdsa-threshold-mpc/contracts/remappings.txt deleted file mode 100644 index d4921f78..00000000 --- a/blueprints/ecdsa-threshold-mpc/contracts/remappings.txt +++ /dev/null @@ -1,10 +0,0 @@ -@uniswap/v3-core/=lib/tnt-core/lib/uniswap-v3-core/contracts/ -clones/=lib/tnt-core/lib/clones-with-immutable-args/src/ -forge-std/=lib/forge-std/src/ -forge-test/=lib/tnt-core/lib/prb-test/src/ -math/=lib/tnt-core/lib/prb-math/src/ -openzeppelin-contracts-upgradeable/=lib/tnt-core/lib/openzeppelin-contracts-upgradeable/contracts/ -openzeppelin-contracts/=lib/tnt-core/lib/openzeppelin-contracts/contracts/ -solmate/=lib/tnt-core/lib/solmate/src/ -test/=lib/tnt-core/test/ -tnt-core/=lib/tnt-core/src/ \ No newline at end of file diff --git a/blueprints/ecdsa-threshold-mpc/contracts/src/HelloBlueprint.sol b/blueprints/ecdsa-threshold-mpc/contracts/src/HelloBlueprint.sol deleted file mode 100644 index c159a3c0..00000000 --- a/blueprints/ecdsa-threshold-mpc/contracts/src/HelloBlueprint.sol +++ /dev/null @@ -1,95 +0,0 @@ -// SPDX-License-Identifier: UNLICENSE -pragma solidity >=0.8.13; - -import "tnt-core/BlueprintServiceManager.sol"; - -/** - * @title HelloBlueprint - * @dev This contract is an example of a service blueprint that provides a single service. - */ -contract HelloBlueprint is BlueprintServiceManager { - /** - * @dev Hook for service operator registration. Called when a service operator - * attempts to register with the blueprint. - * @param operator The operator's details. - * @param _registrationInputs Inputs required for registration. - */ - function onRegister(bytes calldata operator, bytes calldata _registrationInputs) - public - payable - override - onlyFromRootChain - { - // Do something with the operator's details - } - - /** - * @dev Hook for service instance requests. Called when a user requests a service - * instance from the blueprint. - * @param serviceId The ID of the requested service. - * @param operators The operators involved in the service. - * @param _requestInputs Inputs required for the service request. - */ - function onRequest(uint64 serviceId, bytes[] calldata operators, bytes calldata _requestInputs) - public - payable - override - onlyFromRootChain - { - // Do something with the service request - } - - /** - * @dev Hook for handling job call results. Called when operators send the result - * of a job execution. - * @param serviceId The ID of the service related to the job. - * @param job The job identifier. - * @param _jobCallId The unique ID for the job call. - * @param participant The participant (operator) sending the result. - * @param _inputs Inputs used for the job execution. - * @param _outputs Outputs resulting from the job execution. - */ - function onJobCallResult( - uint64 serviceId, - uint8 job, - uint64 _jobCallId, - bytes calldata participant, - bytes calldata _inputs, - bytes calldata _outputs - ) public virtual override onlyFromRootChain { - // Do something with the job call result - } - - /** - * @dev Verifies the result of a job call. This function is used to validate the - * outputs of a job execution against the expected results. - * @param serviceId The ID of the service related to the job. - * @param job The job identifier. - * @param jobCallId The unique ID for the job call. - * @param participant The participant (operator) whose result is being verified. - * @param inputs Inputs used for the job execution. - * @param outputs Outputs resulting from the job execution. - * @return bool Returns true if the job call result is verified successfully, - * otherwise false. - */ - function verifyJobCallResult( - uint64 serviceId, - uint8 job, - uint64 jobCallId, - bytes calldata participant, - bytes calldata inputs, - bytes calldata outputs - ) public view virtual override onlyFromRootChain returns (bool) { - // Verify the job call result here - return true; - } - - /** - * @dev Converts a public key to an operator address. - * @param publicKey The public key to convert. - * @return address The operator address. - */ - function operatorAddressFromPublicKey(bytes calldata publicKey) internal pure returns (address) { - return address(uint160(uint256(keccak256(publicKey)))); - } -} diff --git a/blueprints/ecdsa-threshold-mpc/foundry.toml b/blueprints/ecdsa-threshold-mpc/foundry.toml deleted file mode 100644 index 26bed054..00000000 --- a/blueprints/ecdsa-threshold-mpc/foundry.toml +++ /dev/null @@ -1,10 +0,0 @@ -[profile.default] -src = "contracts/src" -test = "contracts/test" -out = "contracts/out" -script = "contracts/script" -cache_path = "contracts/cache" -broadcast = "contracts/broadcast" -libs = ["contracts/lib"] - -# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options diff --git a/blueprints/ecdsa-threshold-mpc/rust-toolchain.toml b/blueprints/ecdsa-threshold-mpc/rust-toolchain.toml deleted file mode 100644 index 288fa153..00000000 --- a/blueprints/ecdsa-threshold-mpc/rust-toolchain.toml +++ /dev/null @@ -1,5 +0,0 @@ -[toolchain] -channel = "stable" -components = ["rustfmt", "clippy", "rust-src"] -targets = ["wasm32-unknown-unknown"] -profile = "minimal" diff --git a/blueprints/ecdsa-threshold-mpc/src/jobs/keygen.rs b/blueprints/ecdsa-threshold-mpc/src/jobs/keygen.rs deleted file mode 100644 index 77710c48..00000000 --- a/blueprints/ecdsa-threshold-mpc/src/jobs/keygen.rs +++ /dev/null @@ -1,122 +0,0 @@ -use cggmp21::{ - progress::PerfProfiler, - supported_curves::{Secp256k1, Secp256r1, Stark}, -}; -use gadget_sdk::{ - self as sdk, - network::{channels::UserID, IdentifierInfo, ProtocolMessage}, -}; -use generic_ec::Curve; -use rand::SeedableRng; -use sdk::tangle_subxt::subxt::ext::futures::future::try_join_all; -use sp_core::{ecdsa, keccak_256}; -use std::sync::Arc; -use std::{collections::HashMap, convert::Infallible, fmt::format}; -use tokio::spawn; - -use color_eyre::Result; - -use crate::mpc::{keygen::run_full_keygen_protocol, DefaultCryptoHasher, DefaultSecurityLevel}; - -use super::Context; - -/// The execution of these jobs represent a service instance with specific operators. -/// -/// Things that are appealing to provide the developer are: -/// - For networked protocols we need a unique identifier for protocol execution. Each job/task should have a unique identifier. -/// If multiple messaging protocols are created in a single task, they should have unique identifiers. This should be clearly -/// provided/exposed to the developer using our SDK. The variable names should likely indicate uniqueness. -#[sdk::job( - id = 0, - params(curve, t, num_keys, hd_wallet), - - verifier(evm = "HelloBlueprint") -)] -pub async fn keygen( - ctx: Context, - curve: u8, - t: u16, - num_keys: u16, - hd_wallet: bool, -) -> Result { - // TODO: How to grab the specific operators? What index am I? - let n = 3 * (t + 1); - let i = 0; - // TODO: Constructing mapping from user IDs to ecdsa keys? - let mapping: HashMap = HashMap::new(); - // TODO: How to get my ecdsa key? - let my_ecdsa_key = ecdsa::Public::from_raw([0u8; 33]); - // TODO: How to grab api / task / job specific onchain metadata? - // TODO: How to get restake information about this instance? - // TODO: How to get the service ID? - let service_id = 1u64; - let (session_id, block_id, task_id, retry_id) = - (Some(0u64), Some(0u64), Some(0u64), Some(0u64)); - let identifier_info: IdentifierInfo = IdentifierInfo { - session_id, - block_id, - task_id, - retry_id, - }; - let rng = rand::rngs::StdRng::from_entropy(); - // TODO: How to get the raw job bytes? - let job_id_bytes = vec![0u8; 32]; - let mix = keccak_256(b"cggmp21-keygen"); - let eid_bytes = [&job_id_bytes[..], &mix[..]].concat(); - let eid = cggmp21::ExecutionId::new(&eid_bytes); - let mix = keccak_256(b"cggmp21-keygen-aux"); - let aux_eid_bytes = [&job_id_bytes[..], &mix[..]].concat(); - let aux_eid = cggmp21::ExecutionId::new(&aux_eid_bytes); - let tracer = PerfProfiler::new(); - - let id = service_id.to_string(); - let _span = tracing::info_span!("cggmp21-keygen", id = id).entered(); - - // TODO: What is the protocol message channel? Can I get it from the network? - let (_dummy_sender, protocol_message_channel) = - futures::channel::mpsc::unbounded::(); - let mut handles = Vec::new(); - macro_rules! run_keygen_for_curve { - ($curve:ty) => { - for _ in 0..num_keys { - let handle = spawn(async move { - run_full_keygen_protocol::< - $curve, - DefaultSecurityLevel, - DefaultCryptoHasher, - _, - _, - >( - protocol_message_channel, - identifier_info, - Arc::new(mapping), - my_ecdsa_key, - ctx.network, - tracer, - eid, - aux_eid, - i, - n, - t, - hd_wallet, - rng, - &job_id_bytes[..], - ) - .await - }); - handles.push(handle); - } - }; - } - - match curve { - 0 => run_keygen_for_curve!(Secp256k1), - 1 => run_keygen_for_curve!(Secp256r1), - 2 => run_keygen_for_curve!(Stark), - _ => panic!("Invalid curve"), - } - - let results = try_join_all(handles).await?; - - Ok("Hello World!".to_string()) -} diff --git a/blueprints/ecdsa-threshold-mpc/src/jobs/mod.rs b/blueprints/ecdsa-threshold-mpc/src/jobs/mod.rs deleted file mode 100644 index c6de6928..00000000 --- a/blueprints/ecdsa-threshold-mpc/src/jobs/mod.rs +++ /dev/null @@ -1,19 +0,0 @@ -use gadget_sdk::network::gossip::GossipHandle; - -pub mod keygen; -pub mod refresh; -pub mod sign; - -pub use keygen::*; -pub use refresh::*; -pub use sign::*; - -#[derive(Clone)] -pub struct Context { - pub network: GossipHandle, -} - -impl Context { - // TODO: Get my index in the network (deterministically) - // TODO: Get the mapping of all peers to their keys -} diff --git a/blueprints/ecdsa-threshold-mpc/src/jobs/refresh.rs b/blueprints/ecdsa-threshold-mpc/src/jobs/refresh.rs deleted file mode 100644 index 3e158e57..00000000 --- a/blueprints/ecdsa-threshold-mpc/src/jobs/refresh.rs +++ /dev/null @@ -1,14 +0,0 @@ -use gadget_sdk as sdk; -use std::convert::Infallible; - -use color_eyre::Result; - -#[sdk::job( - id = 2, - params(keygen_id, new_parties, t), - - verifier(evm = "HelloBlueprint") -)] -pub fn refresh(keygen_id: u32, new_parties: Vec, t: u16) -> Result { - Ok("Hello World!".to_string()) -} diff --git a/blueprints/ecdsa-threshold-mpc/src/jobs/sign.rs b/blueprints/ecdsa-threshold-mpc/src/jobs/sign.rs deleted file mode 100644 index c6230b6b..00000000 --- a/blueprints/ecdsa-threshold-mpc/src/jobs/sign.rs +++ /dev/null @@ -1,14 +0,0 @@ -use gadget_sdk as sdk; -use std::convert::Infallible; - -use color_eyre::Result; - -#[sdk::job( - id = 1, - params(msgs, is_prehashed), - - verifier(evm = "HelloBlueprint") -)] -pub fn sign(msgs: Vec, is_prehashed: bool) -> Result { - Ok("Hello World!".to_string()) -} diff --git a/blueprints/ecdsa-threshold-mpc/src/main.rs b/blueprints/ecdsa-threshold-mpc/src/main.rs deleted file mode 100644 index 63d6e2db..00000000 --- a/blueprints/ecdsa-threshold-mpc/src/main.rs +++ /dev/null @@ -1,62 +0,0 @@ -use gadget_sdk as sdk; -use std::convert::Infallible; - -use color_eyre::{eyre::OptionExt, Result}; -use sdk::{ - events_watcher::tangle::TangleEventsWatcher, keystore::backend::GenericKeyStore, - keystore::Backend, tangle_subxt::*, -}; - -pub mod jobs; -pub mod mpc; - -#[tokio::main] -async fn main() -> Result<()> { - color_eyre::install()?; - - // Initialize the logger - let env_filter = tracing_subscriber::EnvFilter::from_default_env(); - tracing_subscriber::fmt() - .compact() - .with_target(true) - .with_env_filter(env_filter) - .init(); - - // Initialize the environment - let env = sdk::config::load(None)?; - let keystore = env.keystore()?; - let signer = env.first_signer()?; - let client: TangleClient = - subxt::OnlineClient::from_url(&env.http_rpc_endpoint).await?; - - // // Create the event handler from the job - // let keygen_job = KeygenEventHandler { - // service_id: env.service_id, - // signer, - // }; - - // let signing_job = SigningEventHandler { - // service_id: env.service_id, - // signer, - // }; - - // let key_refresh_job = KeyRefreshEventHandler { - // service_id: env.service_id, - // signer, - // }; - - // tracing::info!("Starting the event watcher ..."); - - // SubstrateEventWatcher::run( - // &TangleEventsWatcher, - // client, - // // Add more handler here if we have more functions. - // vec![ - // Box::new(keygen_job), - // Box::new(signing_job), - // Box::new(key_refresh_job), - // ], - // ) - // .await?; - Ok(()) -} diff --git a/blueprints/ecdsa-threshold-mpc/src/mpc/keygen.rs b/blueprints/ecdsa-threshold-mpc/src/mpc/keygen.rs deleted file mode 100644 index 0a39dfbe..00000000 --- a/blueprints/ecdsa-threshold-mpc/src/mpc/keygen.rs +++ /dev/null @@ -1,206 +0,0 @@ -use cggmp21::generic_ec::Curve; -use cggmp21::key_refresh::msg::aux_only; -use cggmp21::key_refresh::AuxInfoGenerationBuilder; -use cggmp21::key_share::DirtyKeyShare; -use cggmp21::key_share::Validate; -use cggmp21::keygen::msg::threshold::Msg; -use cggmp21::keygen::KeygenBuilder; -use cggmp21::progress::PerfProfiler; -use cggmp21::security_level::SecurityLevel; -use cggmp21::supported_curves::{Secp256k1, Secp256r1, Stark}; -use cggmp21::KeyShare; -use cggmp21::PregeneratedPrimes; -use digest::typenum::U32; -use digest::Digest; -use gadget_sdk::network::channels::create_job_manager_to_async_protocol_channel_split_io; -use gadget_sdk::network::channels::UserID; -use gadget_sdk::network::deserialize; -use gadget_sdk::network::serialize; -use gadget_sdk::network::IdentifierInfo; -use gadget_sdk::network::Network; -use gadget_sdk::network::ProtocolMessage; -use gadget_sdk::store::KeyValueStoreBackend; -use gadget_sdk::{debug, trace}; -use itertools::Itertools; -use rand::rngs::{OsRng, StdRng}; -use rand::{CryptoRng, RngCore, SeedableRng}; -use round_based::{Delivery, Incoming, MpcParty, Outgoing}; -use serde::Serialize; -use sp_core::keccak_256; -use sp_core::{ecdsa, Pair}; -use std::collections::{BTreeMap, HashMap}; -use std::sync::Arc; -use tokio::sync::mpsc::UnboundedReceiver; - -use crate::mpc::{DefaultCryptoHasher, DefaultSecurityLevel}; - -use super::Error; - -#[allow(clippy::too_many_arguments)] -pub async fn run_and_serialize_keygen< - 'r, - E: Curve, - S: SecurityLevel, - H: Digest + Clone + Send + 'static, - D, - R, ->( - tracer: &mut PerfProfiler, - eid: cggmp21::ExecutionId<'r>, - i: u16, - n: u16, - t: u16, - hd_wallet: bool, - party: MpcParty, D>, - mut rng: R, -) -> Result, Error> -where - D: Delivery>, - R: RngCore + CryptoRng, -{ - let builder = KeygenBuilder::::new(eid, i, n); - let incomplete_key_share = builder - .set_progress_tracer(tracer) - .set_threshold(t) - .hd_wallet(hd_wallet) - .start(&mut rng, party) - .await?; - debug!("Finished AsyncProtocol - Keygen"); - serialize(&incomplete_key_share).map_err(Into::into) -} - -#[allow(clippy::too_many_arguments)] -pub async fn run_and_serialize_keyrefresh< - 'r, - E: Curve, - S: SecurityLevel, - H: Digest + Clone + Send + 'static, - D, ->( - incomplete_key_share: Vec, - pregenerated_primes: PregeneratedPrimes, - tracer: &mut PerfProfiler, - aux_eid: cggmp21::ExecutionId<'r>, - i: u16, - n: u16, - party: MpcParty, D>, - mut rng: StdRng, -) -> Result<(Vec, Vec), Error> -where - D: Delivery>, -{ - let incomplete_key_share: cggmp21::key_share::Valid< - cggmp21::key_share::DirtyIncompleteKeyShare, - > = deserialize(&incomplete_key_share)?; - - let aux_info_builder = - AuxInfoGenerationBuilder::::new_aux_gen(aux_eid, i, n, pregenerated_primes); - - let aux_info = aux_info_builder - .set_progress_tracer(tracer) - .start(&mut rng, party) - .await?; - let perf_report = tracer.get_report()?; - trace!("Aux info protocol report: {perf_report}"); - debug!("Finished AsyncProtocol - Aux Info"); - - let key_share: KeyShare = DirtyKeyShare { - core: incomplete_key_share.into_inner(), - aux: aux_info.into_inner(), - } - .validate() - .map_err(|e| Error::ValidateError(e.to_string()))?; - // Serialize the key share and the public key - serialize(&key_share) - .map(|ks| (ks, key_share.shared_public_key.to_bytes(true).to_vec())) - .map_err(Into::into) -} - -async fn pregenerate_primes( - tracer: &PerfProfiler, - job_id_bytes: &[u8], -) -> Result<(PerfProfiler, PregeneratedPrimes), Error> { - let perf_report = tracer.get_report()?; - trace!("Incomplete Keygen protocol report: {perf_report}"); - debug!("Finished AsyncProtocol - Incomplete Keygen"); - let tracer = PerfProfiler::new(); - - let pregenerated_primes_key = - keccak_256(&[&b"dfns-cggmp21-keygen-primes"[..], job_id_bytes].concat()); - let now = tokio::time::Instant::now(); - let pregenerated_primes = tokio::task::spawn_blocking(|| { - let mut rng = OsRng; - cggmp21::PregeneratedPrimes::::generate(&mut rng) - }) - .await?; - - let elapsed = now.elapsed(); - debug!("Pregenerated primes took {elapsed:?}"); - - Ok((tracer, pregenerated_primes)) -} - -#[allow(clippy::too_many_arguments)] -pub async fn run_full_keygen_protocol< - 'a, - E: Curve, - S: SecurityLevel, - H: Digest + Clone + Send + 'static, - KBE: KeyValueStoreBackend, - N: Network, ->( - protocol_message_channel: UnboundedReceiver, - identifier_info: IdentifierInfo, - mapping: Arc>, - my_role_id: ecdsa::Public, - network: N, - mut tracer: PerfProfiler, - eid: cggmp21::ExecutionId<'a>, - aux_eid: cggmp21::ExecutionId<'a>, - i: u16, - n: u16, - t: u16, - hd_wallet: bool, - rng: StdRng, - job_id_bytes: &[u8], -) -> Result<(Vec, Vec), Error> { - let (tx0, rx0, tx1, rx1) = create_job_manager_to_async_protocol_channel_split_io( - protocol_message_channel, - identifier_info, - mapping, - my_role_id, - network, - i, - ); - let delivery = (rx0, tx0); - let party = MpcParty::, _, _>::connected(delivery); - let incomplete_key_share = run_and_serialize_keygen::( - &mut tracer, - eid, - i, - n, - t, - hd_wallet, - party, - rng.clone(), - ) - .await?; - let (mut tracer, pregenerated_primes) = - pregenerate_primes::(&tracer, job_id_bytes).await?; - - let delivery = (rx1, tx1); - let party = MpcParty::, _, _>::connected(delivery); - let (key_share, serialized_public_key) = run_and_serialize_keyrefresh::( - incomplete_key_share, - pregenerated_primes, - &mut tracer, - aux_eid, - i, - n, - party, - rng, - ) - .await?; - - Ok((key_share, serialized_public_key)) -} diff --git a/blueprints/ecdsa-threshold-mpc/src/mpc/mod.rs b/blueprints/ecdsa-threshold-mpc/src/mpc/mod.rs deleted file mode 100644 index 59b67f03..00000000 --- a/blueprints/ecdsa-threshold-mpc/src/mpc/mod.rs +++ /dev/null @@ -1,36 +0,0 @@ -use std::collections::HashMap; - -use cggmp21::security_level::SecurityLevel128; -use cggmp21::{key_share::InvalidKeyShare, progress::ProfileError, security_level::SecurityLevel}; -use generic_ec::Curve; -use sha2::Sha256; -use sp_core::ecdsa; - -pub mod keygen; -pub mod refresh; -pub mod sign; - -pub type DefaultSecurityLevel = SecurityLevel128; -pub type DefaultCryptoHasher = Sha256; - -#[derive(thiserror::Error, Debug)] -pub enum Error { - #[error("IO error")] - Cggmp21IoError(String), - #[error("SDK error")] - SdkError(#[from] gadget_sdk::Error), - #[error("Serialization error")] - SerializationError(#[from] serde_json::Error), - #[error("Keygen error")] - KeygenError(#[from] cggmp21::keygen::KeygenError), - #[error("Sign error")] - SignError(#[from] cggmp21::signing::SigningError), - #[error("Key refresh error")] - KeyRefreshError(#[from] cggmp21::key_refresh::KeyRefreshError), - #[error("Invalid key share")] - ValidateError(String), - #[error("Tokio join error")] - JoinError(#[from] tokio::task::JoinError), - #[error("Tracer profile error")] - TracerProfileError(#[from] cggmp21::progress::ProfileError), -} diff --git a/blueprints/ecdsa-threshold-mpc/src/mpc/refresh.rs b/blueprints/ecdsa-threshold-mpc/src/mpc/refresh.rs deleted file mode 100644 index 8b137891..00000000 --- a/blueprints/ecdsa-threshold-mpc/src/mpc/refresh.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/blueprints/ecdsa-threshold-mpc/src/mpc/sign.rs b/blueprints/ecdsa-threshold-mpc/src/mpc/sign.rs deleted file mode 100644 index 8b137891..00000000 --- a/blueprints/ecdsa-threshold-mpc/src/mpc/sign.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/blueprints/ecdsa-threshold-mpc/taplo.toml b/blueprints/ecdsa-threshold-mpc/taplo.toml deleted file mode 100644 index 3b9f0df9..00000000 --- a/blueprints/ecdsa-threshold-mpc/taplo.toml +++ /dev/null @@ -1,4 +0,0 @@ -[formatting] -align_entries = false -array_auto_expand = true -column_width = 120 diff --git a/blueprints/tangle-raw/Cargo.toml b/blueprints/tangle-raw/Cargo.toml deleted file mode 100644 index 6cbb694e..00000000 --- a/blueprints/tangle-raw/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "tangle-raw-blueprint" -version = "0.1.1" -description = "A Simple Blueprint to demo how to listen to raw events from Tangle" -authors.workspace = true -edition.workspace = true -license.workspace = true -homepage.workspace = true -repository.workspace = true -publish = false - -[dependencies] -gadget-sdk = { workspace = true, features = ["std"] } -color-eyre = { workspace = true } -tracing = { workspace = true } - -[build-dependencies] -blueprint-metadata = { workspace = true } - -[features] -default = ["std"] -std = [] \ No newline at end of file diff --git a/blueprints/tangle-raw/build.rs b/blueprints/tangle-raw/build.rs deleted file mode 100644 index acb638b3..00000000 --- a/blueprints/tangle-raw/build.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - println!("cargo:rerun-if-changed=src/lib.rs"); - println!("cargo:rerun-if-changed=src/main.rs"); - blueprint_metadata::generate_json(); -} diff --git a/blueprints/tangle-raw/src/lib.rs b/blueprints/tangle-raw/src/lib.rs deleted file mode 100644 index 1ee1ee64..00000000 --- a/blueprints/tangle-raw/src/lib.rs +++ /dev/null @@ -1,24 +0,0 @@ -use gadget_sdk::event_listener::tangle::{TangleEvent, TangleEventListener}; -use gadget_sdk::job; -use gadget_sdk::tangle_subxt::tangle_testnet_runtime::api; - -#[derive(Clone)] -pub struct MyContext; - -#[job( - id = 0, - event_listener( - listener = TangleEventListener, - ), -)] -pub fn raw(event: TangleEvent, context: MyContext) -> Result { - if let Some(balance_transfer) = event - .evt - .as_event::() - .ok() - .flatten() - { - gadget_sdk::info!("Found a balance transfer: {balance_transfer:?}"); - } - Ok(0) -} diff --git a/blueprints/tangle-raw/src/main.rs b/blueprints/tangle-raw/src/main.rs deleted file mode 100644 index 85869285..00000000 --- a/blueprints/tangle-raw/src/main.rs +++ /dev/null @@ -1,37 +0,0 @@ -use color_eyre::{eyre::eyre, Result}; -use gadget_sdk::config::protocol::TangleInstanceSettings; -use gadget_sdk::info; -use gadget_sdk::runners::tangle::TangleConfig; -use gadget_sdk::runners::BlueprintRunner; -use gadget_sdk::tangle_subxt::subxt::tx::Signer; -use tangle_raw_blueprint as blueprint; - -#[gadget_sdk::main(env)] -async fn main() { - let client = env.client().await.map_err(|e| eyre!(e))?; - let signer = env.first_sr25519_signer().map_err(|e| eyre!(e))?; - let tangle_config = TangleConfig { - price_targets: Default::default(), - }; - - info!("Starting the event watcher for {} ...", signer.account_id()); - - let tangle_settings = env.protocol_specific.tangle()?; - let TangleInstanceSettings { service_id, .. } = tangle_settings; - - let x_square = blueprint::RawEventHandler { - service_id: *service_id, - context: blueprint::MyContext, - client, - signer, - }; - - info!("~~~ Executing the incredible squaring blueprint ~~~"); - BlueprintRunner::new(tangle_config, env) - .job(x_square) - .run() - .await?; - - info!("Exiting..."); - Ok(()) -} From a361fea8fee15006e707dfc0101c5a50224bfc7f Mon Sep 17 00:00:00 2001 From: Drew Stone Date: Tue, 5 Nov 2024 16:53:37 +0700 Subject: [PATCH 2/2] chore: mv blueprints to examples --- .gitmodules | 24 +++++++++---------- .../contracts/lib/forge-std | 1 - .../contracts/lib/tnt-core | 1 - .../incredible-squaring-eigenlayer/.gitignore | 0 .../incredible-squaring-eigenlayer/Cargo.toml | 0 .../incredible-squaring-eigenlayer/README.md | 0 .../incredible-squaring-eigenlayer/build.rs | 0 .../contracts/.gitignore | 0 .../contracts/foundry.toml | 0 .../contracts/lib/eigenlayer-middleware | 0 .../contracts/lib/forge-std | 0 .../contracts/remappings.txt | 0 .../contracts/src/ERC20Mock.sol | 0 .../src/IIncredibleSquaringTaskManager.sol | 0 .../src/IncredibleSquaringServiceManager.sol | 0 .../src/IncredibleSquaringTaskManager.sol | 0 .../src/constants.rs | 0 .../src/contexts/aggregator.rs | 0 .../src/contexts/client.rs | 0 .../src/contexts/mod.rs | 0 .../src/contexts/x_square.rs | 0 .../src/jobs/compute_x_square.rs | 0 .../src/jobs/initialize_task.rs | 0 .../src/jobs/mod.rs | 0 .../incredible-squaring-eigenlayer/src/lib.rs | 0 .../src/main.rs | 0 .../incredible-squaring-symbiotic/.gitignore | 0 .../incredible-squaring-symbiotic/Cargo.toml | 0 .../incredible-squaring-symbiotic/README.md | 0 .../incredible-squaring-symbiotic/build.rs | 0 .../contracts/.gitignore | 0 .../contracts/foundry.toml | 0 .../contracts/lib/core | 0 .../contracts/lib/forge-std | 0 .../contracts/remappings.txt | 0 .../src/IIncredibleSquaringTaskManager.sol | 0 .../src/IncredibleSquaringTaskManager.sol | 0 .../contracts/src/SimpleKeyRegistry32.sol | 0 .../contracts/src/SimpleMiddleware.sol | 0 .../src/libraries/MapWithTimeData.sol | 0 .../incredible-squaring-symbiotic/src/lib.rs | 0 .../incredible-squaring-symbiotic/src/main.rs | 0 .../incredible-squaring/.gitignore | 0 .../incredible-squaring/Cargo.toml | 0 .../incredible-squaring/README.md | 0 .../incredible-squaring/build.rs | 0 .../incredible-squaring/contracts/.gitignore | 0 .../contracts/foundry.toml | 0 .../contracts/remappings.txt | 0 .../src/IncredibleSquaringBlueprint.sol | 0 .../src/IncredibleSquaringInstance.sol | 0 .../incredible-squaring/deploy.ts | 0 .../incredible-squaring/package.json | 0 .../incredible-squaring/src/lib.rs | 0 .../incredible-squaring/src/main.rs | 0 .../incredible-squaring/tsconfig.json | 0 .../incredible-squaring/yarn.lock | 0 .../periodic-web-poller/Cargo.toml | 0 .../periodic-web-poller/build.rs | 0 .../periodic-web-poller/src/lib.rs | 0 .../periodic-web-poller/src/main.rs | 0 .../tangle-raw-event-listener/Cargo.toml | 0 .../tangle-raw-event-listener/build.rs | 0 .../tangle-raw-event-listener/src/lib.rs | 0 .../tangle-raw-event-listener/src/main.rs | 0 65 files changed, 12 insertions(+), 14 deletions(-) delete mode 160000 blueprints/incredible-squaring/contracts/lib/forge-std delete mode 160000 blueprints/incredible-squaring/contracts/lib/tnt-core rename {blueprints => examples}/incredible-squaring-eigenlayer/.gitignore (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/Cargo.toml (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/README.md (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/build.rs (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/contracts/.gitignore (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/contracts/foundry.toml (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/contracts/lib/eigenlayer-middleware (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/contracts/lib/forge-std (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/contracts/remappings.txt (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/contracts/src/ERC20Mock.sol (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/contracts/src/IIncredibleSquaringTaskManager.sol (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/contracts/src/IncredibleSquaringServiceManager.sol (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/contracts/src/IncredibleSquaringTaskManager.sol (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/src/constants.rs (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/src/contexts/aggregator.rs (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/src/contexts/client.rs (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/src/contexts/mod.rs (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/src/contexts/x_square.rs (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/src/jobs/compute_x_square.rs (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/src/jobs/initialize_task.rs (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/src/jobs/mod.rs (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/src/lib.rs (100%) rename {blueprints => examples}/incredible-squaring-eigenlayer/src/main.rs (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/.gitignore (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/Cargo.toml (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/README.md (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/build.rs (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/contracts/.gitignore (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/contracts/foundry.toml (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/contracts/lib/core (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/contracts/lib/forge-std (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/contracts/remappings.txt (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/contracts/src/IIncredibleSquaringTaskManager.sol (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/contracts/src/IncredibleSquaringTaskManager.sol (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/contracts/src/SimpleKeyRegistry32.sol (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/contracts/src/SimpleMiddleware.sol (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/contracts/src/libraries/MapWithTimeData.sol (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/src/lib.rs (100%) rename {blueprints => examples}/incredible-squaring-symbiotic/src/main.rs (100%) rename {blueprints => examples}/incredible-squaring/.gitignore (100%) rename {blueprints => examples}/incredible-squaring/Cargo.toml (100%) rename {blueprints => examples}/incredible-squaring/README.md (100%) rename {blueprints => examples}/incredible-squaring/build.rs (100%) rename {blueprints => examples}/incredible-squaring/contracts/.gitignore (100%) rename {blueprints => examples}/incredible-squaring/contracts/foundry.toml (100%) rename {blueprints => examples}/incredible-squaring/contracts/remappings.txt (100%) rename {blueprints => examples}/incredible-squaring/contracts/src/IncredibleSquaringBlueprint.sol (100%) rename {blueprints => examples}/incredible-squaring/contracts/src/IncredibleSquaringInstance.sol (100%) rename {blueprints => examples}/incredible-squaring/deploy.ts (100%) rename {blueprints => examples}/incredible-squaring/package.json (100%) rename {blueprints => examples}/incredible-squaring/src/lib.rs (100%) rename {blueprints => examples}/incredible-squaring/src/main.rs (100%) rename {blueprints => examples}/incredible-squaring/tsconfig.json (100%) rename {blueprints => examples}/incredible-squaring/yarn.lock (100%) rename {blueprints => examples}/periodic-web-poller/Cargo.toml (100%) rename {blueprints => examples}/periodic-web-poller/build.rs (100%) rename {blueprints => examples}/periodic-web-poller/src/lib.rs (100%) rename {blueprints => examples}/periodic-web-poller/src/main.rs (100%) rename {blueprints => examples}/tangle-raw-event-listener/Cargo.toml (100%) rename {blueprints => examples}/tangle-raw-event-listener/build.rs (100%) rename {blueprints => examples}/tangle-raw-event-listener/src/lib.rs (100%) rename {blueprints => examples}/tangle-raw-event-listener/src/main.rs (100%) diff --git a/.gitmodules b/.gitmodules index 5b891f05..a0cefd61 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,23 +1,23 @@ # For the incredible-squaring blueprint -[submodule "blueprints/incredible-squaring/contracts/lib/forge-std"] - path = blueprints/incredible-squaring/contracts/lib/forge-std +[submodule "examples/incredible-squaring/contracts/lib/forge-std"] + path = examples/incredible-squaring/contracts/lib/forge-std url = https://github.com/foundry-rs/forge-std -[submodule "blueprints/incredible-squaring/contracts/lib/tnt-core"] - path = blueprints/incredible-squaring/contracts/lib/tnt-core +[submodule "examples/incredible-squaring/contracts/lib/tnt-core"] + path = examples/incredible-squaring/contracts/lib/tnt-core url = https://github.com/tangle-network/tnt-core # For the incredible-squaring-eigenlayer blueprint -[submodule "blueprints/incredible-squaring-eigenlayer/contracts/lib/eigenlayer-middleware"] - path = blueprints/incredible-squaring-eigenlayer/contracts/lib/eigenlayer-middleware +[submodule "examples/incredible-squaring-eigenlayer/contracts/lib/eigenlayer-middleware"] + path = examples/incredible-squaring-eigenlayer/contracts/lib/eigenlayer-middleware url = https://github.com/Layr-Labs/eigenlayer-middleware -[submodule "blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std"] - path = blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std +[submodule "examples/incredible-squaring-eigenlayer/contracts/lib/forge-std"] + path = examples/incredible-squaring-eigenlayer/contracts/lib/forge-std url = https://github.com/foundry-rs/forge-std # For the incredible-squaring-symbiotic blueprint -[submodule "blueprints/incredible-squaring-symbiotic/contracts/lib/forge-std"] - path = blueprints/incredible-squaring-symbiotic/contracts/lib/forge-std +[submodule "examples/incredible-squaring-symbiotic/contracts/lib/forge-std"] + path = examples/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 +[submodule "examples/incredible-squaring-symbiotic/contracts/lib/core"] + path = examples/incredible-squaring-symbiotic/contracts/lib/core url = https://github.com/symbioticfi/core diff --git a/blueprints/incredible-squaring/contracts/lib/forge-std b/blueprints/incredible-squaring/contracts/lib/forge-std deleted file mode 160000 index 035de35f..00000000 --- a/blueprints/incredible-squaring/contracts/lib/forge-std +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 035de35f5e366c8d6ed142aec4ccb57fe2dd87d4 diff --git a/blueprints/incredible-squaring/contracts/lib/tnt-core b/blueprints/incredible-squaring/contracts/lib/tnt-core deleted file mode 160000 index c1fa9c7c..00000000 --- a/blueprints/incredible-squaring/contracts/lib/tnt-core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c1fa9c7c3c5891aab9bd25002a434d93c54942cd diff --git a/blueprints/incredible-squaring-eigenlayer/.gitignore b/examples/incredible-squaring-eigenlayer/.gitignore similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/.gitignore rename to examples/incredible-squaring-eigenlayer/.gitignore diff --git a/blueprints/incredible-squaring-eigenlayer/Cargo.toml b/examples/incredible-squaring-eigenlayer/Cargo.toml similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/Cargo.toml rename to examples/incredible-squaring-eigenlayer/Cargo.toml diff --git a/blueprints/incredible-squaring-eigenlayer/README.md b/examples/incredible-squaring-eigenlayer/README.md similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/README.md rename to examples/incredible-squaring-eigenlayer/README.md diff --git a/blueprints/incredible-squaring-eigenlayer/build.rs b/examples/incredible-squaring-eigenlayer/build.rs similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/build.rs rename to examples/incredible-squaring-eigenlayer/build.rs diff --git a/blueprints/incredible-squaring-eigenlayer/contracts/.gitignore b/examples/incredible-squaring-eigenlayer/contracts/.gitignore similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/contracts/.gitignore rename to examples/incredible-squaring-eigenlayer/contracts/.gitignore diff --git a/blueprints/incredible-squaring-eigenlayer/contracts/foundry.toml b/examples/incredible-squaring-eigenlayer/contracts/foundry.toml similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/contracts/foundry.toml rename to examples/incredible-squaring-eigenlayer/contracts/foundry.toml diff --git a/blueprints/incredible-squaring-eigenlayer/contracts/lib/eigenlayer-middleware b/examples/incredible-squaring-eigenlayer/contracts/lib/eigenlayer-middleware similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/contracts/lib/eigenlayer-middleware rename to examples/incredible-squaring-eigenlayer/contracts/lib/eigenlayer-middleware diff --git a/blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std b/examples/incredible-squaring-eigenlayer/contracts/lib/forge-std similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std rename to examples/incredible-squaring-eigenlayer/contracts/lib/forge-std diff --git a/blueprints/incredible-squaring-eigenlayer/contracts/remappings.txt b/examples/incredible-squaring-eigenlayer/contracts/remappings.txt similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/contracts/remappings.txt rename to examples/incredible-squaring-eigenlayer/contracts/remappings.txt diff --git a/blueprints/incredible-squaring-eigenlayer/contracts/src/ERC20Mock.sol b/examples/incredible-squaring-eigenlayer/contracts/src/ERC20Mock.sol similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/contracts/src/ERC20Mock.sol rename to examples/incredible-squaring-eigenlayer/contracts/src/ERC20Mock.sol diff --git a/blueprints/incredible-squaring-eigenlayer/contracts/src/IIncredibleSquaringTaskManager.sol b/examples/incredible-squaring-eigenlayer/contracts/src/IIncredibleSquaringTaskManager.sol similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/contracts/src/IIncredibleSquaringTaskManager.sol rename to examples/incredible-squaring-eigenlayer/contracts/src/IIncredibleSquaringTaskManager.sol diff --git a/blueprints/incredible-squaring-eigenlayer/contracts/src/IncredibleSquaringServiceManager.sol b/examples/incredible-squaring-eigenlayer/contracts/src/IncredibleSquaringServiceManager.sol similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/contracts/src/IncredibleSquaringServiceManager.sol rename to examples/incredible-squaring-eigenlayer/contracts/src/IncredibleSquaringServiceManager.sol diff --git a/blueprints/incredible-squaring-eigenlayer/contracts/src/IncredibleSquaringTaskManager.sol b/examples/incredible-squaring-eigenlayer/contracts/src/IncredibleSquaringTaskManager.sol similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/contracts/src/IncredibleSquaringTaskManager.sol rename to examples/incredible-squaring-eigenlayer/contracts/src/IncredibleSquaringTaskManager.sol diff --git a/blueprints/incredible-squaring-eigenlayer/src/constants.rs b/examples/incredible-squaring-eigenlayer/src/constants.rs similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/src/constants.rs rename to examples/incredible-squaring-eigenlayer/src/constants.rs diff --git a/blueprints/incredible-squaring-eigenlayer/src/contexts/aggregator.rs b/examples/incredible-squaring-eigenlayer/src/contexts/aggregator.rs similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/src/contexts/aggregator.rs rename to examples/incredible-squaring-eigenlayer/src/contexts/aggregator.rs diff --git a/blueprints/incredible-squaring-eigenlayer/src/contexts/client.rs b/examples/incredible-squaring-eigenlayer/src/contexts/client.rs similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/src/contexts/client.rs rename to examples/incredible-squaring-eigenlayer/src/contexts/client.rs diff --git a/blueprints/incredible-squaring-eigenlayer/src/contexts/mod.rs b/examples/incredible-squaring-eigenlayer/src/contexts/mod.rs similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/src/contexts/mod.rs rename to examples/incredible-squaring-eigenlayer/src/contexts/mod.rs diff --git a/blueprints/incredible-squaring-eigenlayer/src/contexts/x_square.rs b/examples/incredible-squaring-eigenlayer/src/contexts/x_square.rs similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/src/contexts/x_square.rs rename to examples/incredible-squaring-eigenlayer/src/contexts/x_square.rs diff --git a/blueprints/incredible-squaring-eigenlayer/src/jobs/compute_x_square.rs b/examples/incredible-squaring-eigenlayer/src/jobs/compute_x_square.rs similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/src/jobs/compute_x_square.rs rename to examples/incredible-squaring-eigenlayer/src/jobs/compute_x_square.rs diff --git a/blueprints/incredible-squaring-eigenlayer/src/jobs/initialize_task.rs b/examples/incredible-squaring-eigenlayer/src/jobs/initialize_task.rs similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/src/jobs/initialize_task.rs rename to examples/incredible-squaring-eigenlayer/src/jobs/initialize_task.rs diff --git a/blueprints/incredible-squaring-eigenlayer/src/jobs/mod.rs b/examples/incredible-squaring-eigenlayer/src/jobs/mod.rs similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/src/jobs/mod.rs rename to examples/incredible-squaring-eigenlayer/src/jobs/mod.rs diff --git a/blueprints/incredible-squaring-eigenlayer/src/lib.rs b/examples/incredible-squaring-eigenlayer/src/lib.rs similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/src/lib.rs rename to examples/incredible-squaring-eigenlayer/src/lib.rs diff --git a/blueprints/incredible-squaring-eigenlayer/src/main.rs b/examples/incredible-squaring-eigenlayer/src/main.rs similarity index 100% rename from blueprints/incredible-squaring-eigenlayer/src/main.rs rename to examples/incredible-squaring-eigenlayer/src/main.rs diff --git a/blueprints/incredible-squaring-symbiotic/.gitignore b/examples/incredible-squaring-symbiotic/.gitignore similarity index 100% rename from blueprints/incredible-squaring-symbiotic/.gitignore rename to examples/incredible-squaring-symbiotic/.gitignore diff --git a/blueprints/incredible-squaring-symbiotic/Cargo.toml b/examples/incredible-squaring-symbiotic/Cargo.toml similarity index 100% rename from blueprints/incredible-squaring-symbiotic/Cargo.toml rename to examples/incredible-squaring-symbiotic/Cargo.toml diff --git a/blueprints/incredible-squaring-symbiotic/README.md b/examples/incredible-squaring-symbiotic/README.md similarity index 100% rename from blueprints/incredible-squaring-symbiotic/README.md rename to examples/incredible-squaring-symbiotic/README.md diff --git a/blueprints/incredible-squaring-symbiotic/build.rs b/examples/incredible-squaring-symbiotic/build.rs similarity index 100% rename from blueprints/incredible-squaring-symbiotic/build.rs rename to examples/incredible-squaring-symbiotic/build.rs diff --git a/blueprints/incredible-squaring-symbiotic/contracts/.gitignore b/examples/incredible-squaring-symbiotic/contracts/.gitignore similarity index 100% rename from blueprints/incredible-squaring-symbiotic/contracts/.gitignore rename to examples/incredible-squaring-symbiotic/contracts/.gitignore diff --git a/blueprints/incredible-squaring-symbiotic/contracts/foundry.toml b/examples/incredible-squaring-symbiotic/contracts/foundry.toml similarity index 100% rename from blueprints/incredible-squaring-symbiotic/contracts/foundry.toml rename to examples/incredible-squaring-symbiotic/contracts/foundry.toml diff --git a/blueprints/incredible-squaring-symbiotic/contracts/lib/core b/examples/incredible-squaring-symbiotic/contracts/lib/core similarity index 100% rename from blueprints/incredible-squaring-symbiotic/contracts/lib/core rename to examples/incredible-squaring-symbiotic/contracts/lib/core diff --git a/blueprints/incredible-squaring-symbiotic/contracts/lib/forge-std b/examples/incredible-squaring-symbiotic/contracts/lib/forge-std similarity index 100% rename from blueprints/incredible-squaring-symbiotic/contracts/lib/forge-std rename to examples/incredible-squaring-symbiotic/contracts/lib/forge-std diff --git a/blueprints/incredible-squaring-symbiotic/contracts/remappings.txt b/examples/incredible-squaring-symbiotic/contracts/remappings.txt similarity index 100% rename from blueprints/incredible-squaring-symbiotic/contracts/remappings.txt rename to examples/incredible-squaring-symbiotic/contracts/remappings.txt diff --git a/blueprints/incredible-squaring-symbiotic/contracts/src/IIncredibleSquaringTaskManager.sol b/examples/incredible-squaring-symbiotic/contracts/src/IIncredibleSquaringTaskManager.sol similarity index 100% rename from blueprints/incredible-squaring-symbiotic/contracts/src/IIncredibleSquaringTaskManager.sol rename to examples/incredible-squaring-symbiotic/contracts/src/IIncredibleSquaringTaskManager.sol diff --git a/blueprints/incredible-squaring-symbiotic/contracts/src/IncredibleSquaringTaskManager.sol b/examples/incredible-squaring-symbiotic/contracts/src/IncredibleSquaringTaskManager.sol similarity index 100% rename from blueprints/incredible-squaring-symbiotic/contracts/src/IncredibleSquaringTaskManager.sol rename to examples/incredible-squaring-symbiotic/contracts/src/IncredibleSquaringTaskManager.sol diff --git a/blueprints/incredible-squaring-symbiotic/contracts/src/SimpleKeyRegistry32.sol b/examples/incredible-squaring-symbiotic/contracts/src/SimpleKeyRegistry32.sol similarity index 100% rename from blueprints/incredible-squaring-symbiotic/contracts/src/SimpleKeyRegistry32.sol rename to examples/incredible-squaring-symbiotic/contracts/src/SimpleKeyRegistry32.sol diff --git a/blueprints/incredible-squaring-symbiotic/contracts/src/SimpleMiddleware.sol b/examples/incredible-squaring-symbiotic/contracts/src/SimpleMiddleware.sol similarity index 100% rename from blueprints/incredible-squaring-symbiotic/contracts/src/SimpleMiddleware.sol rename to examples/incredible-squaring-symbiotic/contracts/src/SimpleMiddleware.sol diff --git a/blueprints/incredible-squaring-symbiotic/contracts/src/libraries/MapWithTimeData.sol b/examples/incredible-squaring-symbiotic/contracts/src/libraries/MapWithTimeData.sol similarity index 100% rename from blueprints/incredible-squaring-symbiotic/contracts/src/libraries/MapWithTimeData.sol rename to examples/incredible-squaring-symbiotic/contracts/src/libraries/MapWithTimeData.sol diff --git a/blueprints/incredible-squaring-symbiotic/src/lib.rs b/examples/incredible-squaring-symbiotic/src/lib.rs similarity index 100% rename from blueprints/incredible-squaring-symbiotic/src/lib.rs rename to examples/incredible-squaring-symbiotic/src/lib.rs diff --git a/blueprints/incredible-squaring-symbiotic/src/main.rs b/examples/incredible-squaring-symbiotic/src/main.rs similarity index 100% rename from blueprints/incredible-squaring-symbiotic/src/main.rs rename to examples/incredible-squaring-symbiotic/src/main.rs diff --git a/blueprints/incredible-squaring/.gitignore b/examples/incredible-squaring/.gitignore similarity index 100% rename from blueprints/incredible-squaring/.gitignore rename to examples/incredible-squaring/.gitignore diff --git a/blueprints/incredible-squaring/Cargo.toml b/examples/incredible-squaring/Cargo.toml similarity index 100% rename from blueprints/incredible-squaring/Cargo.toml rename to examples/incredible-squaring/Cargo.toml diff --git a/blueprints/incredible-squaring/README.md b/examples/incredible-squaring/README.md similarity index 100% rename from blueprints/incredible-squaring/README.md rename to examples/incredible-squaring/README.md diff --git a/blueprints/incredible-squaring/build.rs b/examples/incredible-squaring/build.rs similarity index 100% rename from blueprints/incredible-squaring/build.rs rename to examples/incredible-squaring/build.rs diff --git a/blueprints/incredible-squaring/contracts/.gitignore b/examples/incredible-squaring/contracts/.gitignore similarity index 100% rename from blueprints/incredible-squaring/contracts/.gitignore rename to examples/incredible-squaring/contracts/.gitignore diff --git a/blueprints/incredible-squaring/contracts/foundry.toml b/examples/incredible-squaring/contracts/foundry.toml similarity index 100% rename from blueprints/incredible-squaring/contracts/foundry.toml rename to examples/incredible-squaring/contracts/foundry.toml diff --git a/blueprints/incredible-squaring/contracts/remappings.txt b/examples/incredible-squaring/contracts/remappings.txt similarity index 100% rename from blueprints/incredible-squaring/contracts/remappings.txt rename to examples/incredible-squaring/contracts/remappings.txt diff --git a/blueprints/incredible-squaring/contracts/src/IncredibleSquaringBlueprint.sol b/examples/incredible-squaring/contracts/src/IncredibleSquaringBlueprint.sol similarity index 100% rename from blueprints/incredible-squaring/contracts/src/IncredibleSquaringBlueprint.sol rename to examples/incredible-squaring/contracts/src/IncredibleSquaringBlueprint.sol diff --git a/blueprints/incredible-squaring/contracts/src/IncredibleSquaringInstance.sol b/examples/incredible-squaring/contracts/src/IncredibleSquaringInstance.sol similarity index 100% rename from blueprints/incredible-squaring/contracts/src/IncredibleSquaringInstance.sol rename to examples/incredible-squaring/contracts/src/IncredibleSquaringInstance.sol diff --git a/blueprints/incredible-squaring/deploy.ts b/examples/incredible-squaring/deploy.ts similarity index 100% rename from blueprints/incredible-squaring/deploy.ts rename to examples/incredible-squaring/deploy.ts diff --git a/blueprints/incredible-squaring/package.json b/examples/incredible-squaring/package.json similarity index 100% rename from blueprints/incredible-squaring/package.json rename to examples/incredible-squaring/package.json diff --git a/blueprints/incredible-squaring/src/lib.rs b/examples/incredible-squaring/src/lib.rs similarity index 100% rename from blueprints/incredible-squaring/src/lib.rs rename to examples/incredible-squaring/src/lib.rs diff --git a/blueprints/incredible-squaring/src/main.rs b/examples/incredible-squaring/src/main.rs similarity index 100% rename from blueprints/incredible-squaring/src/main.rs rename to examples/incredible-squaring/src/main.rs diff --git a/blueprints/incredible-squaring/tsconfig.json b/examples/incredible-squaring/tsconfig.json similarity index 100% rename from blueprints/incredible-squaring/tsconfig.json rename to examples/incredible-squaring/tsconfig.json diff --git a/blueprints/incredible-squaring/yarn.lock b/examples/incredible-squaring/yarn.lock similarity index 100% rename from blueprints/incredible-squaring/yarn.lock rename to examples/incredible-squaring/yarn.lock diff --git a/blueprints/periodic-web-poller/Cargo.toml b/examples/periodic-web-poller/Cargo.toml similarity index 100% rename from blueprints/periodic-web-poller/Cargo.toml rename to examples/periodic-web-poller/Cargo.toml diff --git a/blueprints/periodic-web-poller/build.rs b/examples/periodic-web-poller/build.rs similarity index 100% rename from blueprints/periodic-web-poller/build.rs rename to examples/periodic-web-poller/build.rs diff --git a/blueprints/periodic-web-poller/src/lib.rs b/examples/periodic-web-poller/src/lib.rs similarity index 100% rename from blueprints/periodic-web-poller/src/lib.rs rename to examples/periodic-web-poller/src/lib.rs diff --git a/blueprints/periodic-web-poller/src/main.rs b/examples/periodic-web-poller/src/main.rs similarity index 100% rename from blueprints/periodic-web-poller/src/main.rs rename to examples/periodic-web-poller/src/main.rs diff --git a/blueprints/tangle-raw-event-listener/Cargo.toml b/examples/tangle-raw-event-listener/Cargo.toml similarity index 100% rename from blueprints/tangle-raw-event-listener/Cargo.toml rename to examples/tangle-raw-event-listener/Cargo.toml diff --git a/blueprints/tangle-raw-event-listener/build.rs b/examples/tangle-raw-event-listener/build.rs similarity index 100% rename from blueprints/tangle-raw-event-listener/build.rs rename to examples/tangle-raw-event-listener/build.rs diff --git a/blueprints/tangle-raw-event-listener/src/lib.rs b/examples/tangle-raw-event-listener/src/lib.rs similarity index 100% rename from blueprints/tangle-raw-event-listener/src/lib.rs rename to examples/tangle-raw-event-listener/src/lib.rs diff --git a/blueprints/tangle-raw-event-listener/src/main.rs b/examples/tangle-raw-event-listener/src/main.rs similarity index 100% rename from blueprints/tangle-raw-event-listener/src/main.rs rename to examples/tangle-raw-event-listener/src/main.rs