From 42d7ebfef13a3d95ffbb45b43a2da98151e2ace7 Mon Sep 17 00:00:00 2001 From: shekohex Date: Tue, 5 Nov 2024 14:21:51 +0200 Subject: [PATCH] chore: Update blueprint metadata (#26) Co-authored-by: drewstone --- .gitmodules | 3 - Cargo.lock | 198 +++++++++++++++++++++++++++++++++------- Cargo.toml | 8 +- contracts/lib/forge-std | 1 - contracts/lib/tnt-core | 2 +- flake.lock | 18 ++-- src/lib.rs | 2 +- src/main.rs | 22 ++--- 8 files changed, 189 insertions(+), 65 deletions(-) delete mode 160000 contracts/lib/forge-std diff --git a/.gitmodules b/.gitmodules index 2d09745..3c37741 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "contracts/lib/forge-std"] - path = contracts/lib/forge-std - url = https://github.com/foundry-rs/forge-std [submodule "contracts/lib/tnt-core"] path = contracts/lib/tnt-core url = https://github.com/tangle-network/tnt-core diff --git a/Cargo.lock b/Cargo.lock index 5fbc17b..c93843e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -611,6 +611,55 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstream" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +dependencies = [ + "anstyle", + "windows-sys 0.59.0", +] + [[package]] name = "anyhow" version = "1.0.91" @@ -1664,9 +1713,9 @@ dependencies = [ [[package]] name = "blueprint-metadata" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1e0a945a0830663b038415a202c7afda8119feb762c1b0e95ffe75f2c316aca" +checksum = "4f8754ff7a709cf0643f82093fff582192a36afe3b075cde8e752ad9e39d35ed" dependencies = [ "cargo_metadata", "fs2", @@ -1997,6 +2046,47 @@ dependencies = [ "vec_map", ] +[[package]] +name = "clap" +version = "4.5.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim 0.11.1", + "terminal_size", +] + +[[package]] +name = "clap_derive" +version = "4.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + [[package]] name = "cmake" version = "0.1.51" @@ -2085,6 +2175,12 @@ dependencies = [ "tracing-error", ] +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + [[package]] name = "combine" version = "4.6.7" @@ -3662,6 +3758,20 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "example" +version = "0.1.0" +dependencies = [ + "async-trait", + "blueprint-metadata", + "color-eyre", + "gadget-sdk", + "structopt", + "tokio", + "tracing", + "tracing-subscriber 0.3.18", +] + [[package]] name = "expander" version = "2.2.1" @@ -3819,20 +3929,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" -[[package]] -name = "foo" -version = "0.1.0" -dependencies = [ - "async-trait", - "blueprint-metadata", - "color-eyre", - "gadget-sdk", - "structopt", - "tokio", - "tracing", - "tracing-subscriber 0.3.18", -] - [[package]] name = "foreign-types" version = "0.3.2" @@ -4094,9 +4190,9 @@ dependencies = [ [[package]] name = "gadget-blueprint-proc-macro" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d897b55547a26ef706294d7ffafb17f4010560b65090873db496c4edda5ece" +checksum = "ca275170fab969cca0a2635d32bfd88e7657918e8cfe5c9527ff2966c6387268" dependencies = [ "gadget-blueprint-proc-macro-core", "indexmap 2.6.0", @@ -4109,9 +4205,9 @@ dependencies = [ [[package]] name = "gadget-blueprint-proc-macro-core" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29208d31dc75687c8665ec60a033c4542e69eded7c643ff92f96ceeb608b291c" +checksum = "788b9e5ef537eea236c14f1a450ee92f7039b241d048f97470e8e8fb5be0319a" dependencies = [ "cid", "ethereum-types", @@ -4120,9 +4216,9 @@ dependencies = [ [[package]] name = "gadget-context-derive" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8d2eeaef345c28de2ce1f3f4a17a3c7a2f23767af559f5654b0bf003d89431e" +checksum = "c2f15fa82798ae66fec9bea17791a5f37f200ed9803158b08180fd6ba85737c1" dependencies = [ "proc-macro2", "quote", @@ -4131,11 +4227,12 @@ dependencies = [ [[package]] name = "gadget-io" -version = "0.0.3" +version = "0.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70887be31a7cbbbecd3a125b972b2718ab4e7ab8e4ee2ae6a1c69134b62153ba" +checksum = "8ff8d951c0776ee79a2594634f49f9f6b6006eff55ed7c61b033c84b33f4f839" dependencies = [ "cfg-if", + "clap 4.5.20", "hex", "multiaddr", "parity-scale-codec", @@ -4145,7 +4242,6 @@ dependencies = [ "sp-application-crypto", "sp-core", "sp-keystore", - "structopt", "thiserror", "tokio", "tracing", @@ -4154,9 +4250,9 @@ dependencies = [ [[package]] name = "gadget-sdk" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "055ce5d17fdc5f3d829ba57c55c7a1f644e241317841987473ee989502f50b4e" +checksum = "1f8c097510e2e3af9d6a248bebc3416bb3efdcb67748afa57a68b8c1bc1662e4" dependencies = [ "alloy-contract", "alloy-network", @@ -4167,6 +4263,7 @@ dependencies = [ "alloy-signer-local", "alloy-sol-types", "alloy-transport", + "alloy-transport-http", "ark-bn254", "ark-ec", "ark-ff 0.4.2", @@ -4175,6 +4272,8 @@ dependencies = [ "auto_impl", "backon", "bincode", + "bollard", + "clap 4.5.20", "ed25519-zebra 4.0.3", "eigensdk", "elliptic-curve", @@ -4189,7 +4288,9 @@ dependencies = [ "http-body-util", "hyper 1.5.0", "hyper-util", + "itertools 0.13.0", "k256", + "lazy_static", "libp2p", "lock_api", "log", @@ -4205,10 +4306,10 @@ dependencies = [ "sp-core", "sp-io", "sqlx", - "structopt", "subxt", "subxt-core", "subxt-signer", + "symbiotic-rs", "sysinfo", "tangle-subxt", "thiserror", @@ -5069,6 +5170,12 @@ version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.10.5" @@ -5440,7 +5547,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -10041,7 +10148,7 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" dependencies = [ - "clap", + "clap 2.34.0", "lazy_static", "structopt-derive", ] @@ -10273,6 +10380,17 @@ dependencies = [ "zip", ] +[[package]] +name = "symbiotic-rs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02f31217207638b7cba9751cedb9ddb612478423d7bf8700091cf1f9970bbc5f" +dependencies = [ + "alloy-contract", + "alloy-sol-types", + "serde", +] + [[package]] name = "syn" version = "1.0.109" @@ -10403,9 +10521,9 @@ dependencies = [ [[package]] name = "tangle-subxt" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20bf7f8d29cfdb72ea840a6d58d9191b3573dc0309f1b94eee25848498f89c1a" +checksum = "5fd92b3c29823ab4db09ed7030222dbcdf94d5edbb384b5fca4eb76f646ead9c" dependencies = [ "parity-scale-codec", "scale-info", @@ -10460,6 +10578,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" +dependencies = [ + "rustix 0.38.37", + "windows-sys 0.59.0", +] + [[package]] name = "testcontainers" version = "0.20.1" @@ -11160,6 +11288,12 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" version = "0.8.2" diff --git a/Cargo.toml b/Cargo.toml index e6dcf86..5e15163 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ tracing = "0.1" async-trait = "0.1" color-eyre = "0.6" structopt = "0.3.26" -tokio = { version = "1.41", default-features = false, features = ["full"] } +tokio = { version = "^1", default-features = false, features = ["full"] } tracing-subscriber = { version = "0.3", features = ["parking_lot", "env-filter"] } [features] @@ -25,12 +25,12 @@ default = ["std"] std = ["gadget-sdk/std"] [dependencies.gadget-sdk] -version = "0.2.2" +version = "0.3.0" default-features = false features = ["getrandom"] [build-dependencies] -blueprint-metadata = "0.1.5" +blueprint-metadata = "0.1.6" [lib] path = "src/lib.rs" @@ -40,7 +40,7 @@ name = "{{project-name}}" path = "src/main.rs" [package.metadata.blueprint] -manager = { evm = "HelloBlueprint" } +manager = { Evm = "HelloBlueprint" } [[package.metadata.gadget.Native.sources]] owner = "{{gh-username}}" diff --git a/contracts/lib/forge-std b/contracts/lib/forge-std deleted file mode 160000 index 1de6eec..0000000 --- a/contracts/lib/forge-std +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1de6eecf821de7fe2c908cc48d3ab3dced20717f diff --git a/contracts/lib/tnt-core b/contracts/lib/tnt-core index c1fa9c7..37f34c5 160000 --- a/contracts/lib/tnt-core +++ b/contracts/lib/tnt-core @@ -1 +1 @@ -Subproject commit c1fa9c7c3c5891aab9bd25002a434d93c54942cd +Subproject commit 37f34c54a063259a44547df63b82a79c852807d9 diff --git a/flake.lock b/flake.lock index a29ecdc..75e7986 100644 --- a/flake.lock +++ b/flake.lock @@ -28,11 +28,11 @@ ] }, "locked": { - "lastModified": 1728119511, - "narHash": "sha256-kJHt+BoDTc9aYXnmy7X+kQto9cT77lDKHAYp5FyY4OY=", + "lastModified": 1730625090, + "narHash": "sha256-lWfkkj+GEUM0UqYLD2Rx3zzILTL3xdmGJKGR4fwONpA=", "owner": "shazow", "repo": "foundry.nix", - "rev": "c45f6bc1f2110b1d209e116be203648a06a02f80", + "rev": "1c6a742bcbfd55a80de0e1f967a60174716a1560", "type": "github" }, "original": { @@ -44,11 +44,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729690727, - "narHash": "sha256-kpkyedYvqiVvMhHaDaIPqD0tUgT+reMMRjrjnlZ1aQo=", + "lastModified": 1730768919, + "narHash": "sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "be79af5ec63facf6c7709094db72b253c34e1ac2", + "rev": "a04d33c0c3f1a59a2c1cb0c6e34cd24500e5a1dc", "type": "github" }, "original": { @@ -73,11 +73,11 @@ ] }, "locked": { - "lastModified": 1729736953, - "narHash": "sha256-Rb6JUop7NRklg0uzcre+A+Ebrn/ZiQPkm4QdKg6/3pw=", + "lastModified": 1730773675, + "narHash": "sha256-pULo7GryzLkqGveWvnNWVz1Kk6EJqvq+HQeSkwvr7DA=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "29b1275740d9283467b8117499ec8cbb35250584", + "rev": "e19e9d54fac1e53f73411ebe22d19f946b1ba0bd", "type": "github" }, "original": { diff --git a/src/lib.rs b/src/lib.rs index 6132642..d26cf13 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,7 +19,7 @@ pub struct ServiceContext { params(who), result(_), event_listener( - listener = TangleEventListener::, + listener = TangleEventListener::, pre_processor = services_pre_processor, post_processor = services_post_processor, ), diff --git a/src/main.rs b/src/main.rs index 1bc3268..32028d7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,20 +1,20 @@ use color_eyre::Result; use {{project-name | snake_case}} as blueprint; use gadget_sdk as sdk; -use gadget_sdk::job_runner::MultiJobRunner; +use gadget_sdk::runners::tangle::TangleConfig; +use gadget_sdk::runners::BlueprintRunner; use sdk::tangle_subxt::*; #[sdk::main(env)] async fn main() -> Result<()> { - init_logger(); let signer = env.first_sr25519_signer()?; - let client = subxt::OnlineClient::from_url(&env.rpc_endpoint).await?; + let client = subxt::OnlineClient::from_url(&env.ws_rpc_endpoint).await?; if env.should_run_registration() { todo!(); } - let service_id = env.service_id.expect("should exist"); + let service_id = env.service_id().expect("should exist"); // Create your service context // Here you can pass any configuration or context that your service needs. @@ -31,17 +31,11 @@ async fn main() -> Result<()> { }; tracing::info!("Starting the event watcher ..."); - MultiJobRunner::new(env).job(say_hello_job).run().await?; + BlueprintRunner::new(TangleConfig::default(), env) + .job(say_hello_job) + .run() + .await?; tracing::info!("Exiting..."); Ok(()) } - -fn init_logger() { - let env_filter = tracing_subscriber::EnvFilter::from_default_env(); - tracing_subscriber::fmt() - .compact() - .with_target(true) - .with_env_filter(env_filter) - .init(); -}