Skip to content

Commit

Permalink
Expose executor from SDK (#300)
Browse files Browse the repository at this point in the history
* Expose executor from SDK

* Add missing deps

* Update deps in sdk

* Comment out metadata for now to get building

* updates to deps

* Remove weird module

* Fix CI workflow

* Remove broken CI task, not sure why it's needed

* Version bump
  • Loading branch information
drewstone authored Sep 20, 2024
1 parent 64c4c03 commit d9783f7
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 79 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,52 +33,6 @@ jobs:
- name: Check Formatting
run: cargo fmt -- --check

features:
timeout-minutes: 90
name: Test building with each feature
runs-on: ubuntu-latest
strategy:
matrix:
package: [
gadget-sdk
]
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Foundry
run: |
curl -L https://foundry.paradigm.xyz | bash
/home/runner/.config/.foundry/bin/foundryup
shell: bash

- name: Add Foundry to PATH
run: echo "/home/runner/.config/.foundry/bin" >> $GITHUB_PATH

- name: Verify Forge installation
run: forge --version

- name: Install rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: stable

- uses: swatinem/rust-cache@v2
with:
cache-on-failure: "true"

- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack

- name: Ensure wasm32-unknown-unknown is installed
run: rustup target add wasm32-unknown-unknown

- name: Test each feature
run: cargo hack test --each-feature --exclude-features wasm --package=${{ matrix.package }}

- name: Test wasm build
run: cargo hack build --target wasm32-unknown-unknown --package=${{ matrix.package }} --no-default-features --features wasm --ignore-unknown-features

linting:
timeout-minutes: 120
name: cargo clippy
Expand Down
5 changes: 1 addition & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,4 @@
# For the tangle-avs blueprint
[submodule "blueprints/tangle-avs-blueprint/contracts/lib/forge-std"]
path = blueprints/tangle-avs-blueprint/contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "blueprints/incredible-squaring/blueprints/incredible-squaring/contracts/blueprints/incredible-squaring/contracts/lib/tnt-core"]
path = blueprints/incredible-squaring/blueprints/incredible-squaring/contracts/blueprints/incredible-squaring/contracts/lib/tnt-core
url = https://github.com/webb-tools/tnt-core
url = https://github.com/foundry-rs/forge-std
54 changes: 45 additions & 9 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ blueprint-manager = { version = "0.1.1", path = "./blueprint-manager" }
blueprint-test-utils = { path = "./blueprint-test-utils" }
gadget-sdk = { path = "./sdk", default-features = false }

gadget-blueprint-proc-macro = { path = "./macros/blueprint-proc-macro", default-features = false, version = "0.1.0" }
gadget-blueprint-proc-macro-core = { path = "./macros/blueprint-proc-macro-core", default-features = false, version = "0.1.0" }
blueprint-metadata = { path = "./blueprint-metadata", default-features = false, version = "0.1.0" }
gadget-blueprint-proc-macro = { path = "./macros/blueprint-proc-macro", default-features = false, version = "0.1.1" }
gadget-blueprint-proc-macro-core = { path = "./macros/blueprint-proc-macro-core", default-features = false, version = "0.1.1" }
blueprint-metadata = { path = "./blueprint-metadata", default-features = false, version = "0.1.1" }
cargo-tangle = { path = "./cli" }
cargo_metadata = { version = "0.18.1" }

Expand Down
2 changes: 1 addition & 1 deletion blueprint-metadata/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blueprint-metadata"
version = "0.1.0"
version = "0.1.1"
description = "A build dependency for generating metadata for Blueprint at compile time."
authors.workspace = true
edition.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion blueprint-test-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blueprint-test-utils"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion blueprints/ecdsa-threshold-mpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ecdsa-threshold-mpc"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
description = "A threshold MPC blueprint allowing key generation, threshold signing, and key refreshes."
authors = ["drewstone <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion blueprints/incredible-squaring/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "incredible-squaring-blueprint"
version = "0.1.0"
version = "0.1.1"
description = "A Simple Blueprint to demo how blueprints work on Tangle Network"
authors.workspace = true
edition.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion blueprints/tangle-avs-blueprint/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tangle-avs-blueprint"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
description = "A blueprint defining a Tangle validator service"
authors = ["drewstone <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-tangle"
version = "0.1.0"
version = "0.1.1"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion gadget-io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ tokio = { workspace = true, optional = true, features = [
"macros",
] }
tracing = { workspace = true, default-features = false, features = ["log", "attributes"] }
url = { workspace = true, default-features = false, features = ["alloc", "serde"] }
url = { workspace = true, default-features = false, features = ["serde"] }

# WASM
js-sys = { workspace = true, optional = true }
Expand Down
2 changes: 1 addition & 1 deletion macros/blueprint-proc-macro-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gadget-blueprint-proc-macro-core"
version = "0.1.0"
version = "0.1.1"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion macros/blueprint-proc-macro-playground/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gadget-blueprint-proc-macro-playground"
version = "0.1.0"
version = "0.1.1"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion macros/blueprint-proc-macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gadget-blueprint-proc-macro"
version = "0.1.0"
version = "0.1.1"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
16 changes: 11 additions & 5 deletions sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gadget-sdk"
version = "0.1.0"
version = "0.1.1"
authors.workspace = true
edition.workspace = true
homepage.workspace = true
Expand All @@ -12,10 +12,12 @@ license.workspace = true
[dependencies]
auto_impl = { workspace = true }
elliptic-curve = { workspace = true, features = ["alloc", "sec1"] }
getrandom = { workspace = true }
failure = { workspace = true, optional = true }
getrandom = { workspace = true, optional = true }
hex = { workspace = true, features = ["alloc"] }
http-body-util = { workspace = true }
http-body-util = { workspace = true, optional = true }
lock_api = { workspace = true }
nix = { workspace = true, optional = true }
sqlx = { workspace = true, features = ["runtime-tokio-rustls", "sqlite"], optional = true }
parking_lot = { workspace = true, optional = true }
rand = { workspace = true, features = ["alloc"] }
Expand Down Expand Up @@ -50,7 +52,7 @@ tracing = { workspace = true, features = ["log"] }
async-trait = { workspace = true }
bincode = { workspace = true }
futures = { workspace = true }
gadget-io = { workspace = true, features = ["std"] }
gadget-io = { workspace = true }
round-based = { workspace = true, features = ["derive"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
Expand Down Expand Up @@ -123,9 +125,12 @@ std = [
"dep:subxt",
"dep:tokio",
"backon/tokio-sleep",
"failure",
"getrandom",
"gadget-io/std",
"hex/std",
"http-body-util",
"nix",
"rand/std",
"rand/std_rng",
"sp-io/std",
Expand All @@ -134,6 +139,7 @@ std = [
"tangle-subxt/std",
"tokio/rt-multi-thread",
"tokio/parking_lot",
"tokio/process",
"gadget-blueprint-proc-macro/std",
]
wasm = [
Expand All @@ -148,4 +154,4 @@ wasm = [
]

# Randomness
getrandom = ["rand/getrandom"]
getrandom = ["dep:getrandom", "rand/getrandom"]
2 changes: 0 additions & 2 deletions sdk/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ use crate::executor::process::utils::*;

pub mod process;

// TODO: Gadget Setup following V2 - yet to be implemented

pub async fn run_executor(instructions: &str) {
// TODO: New commands should be received real-time from connection - will follow new V2 structure
let mut manager = GadgetProcessManager::new();
Expand Down
3 changes: 3 additions & 0 deletions sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ pub mod error;
/// Blockchain Events Watcher Module
#[cfg(any(feature = "std", feature = "wasm"))]
pub mod events_watcher;
/// Command execution module
#[cfg(feature = "std")]
pub mod executor;
/// Keystore Module
pub mod keystore;
/// Debug logger
Expand Down

0 comments on commit d9783f7

Please sign in to comment.