Skip to content

Commit

Permalink
fix(cargo-tangle): CLI bugs (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
shekohex authored Oct 25, 2024
1 parent 27e774c commit 2111dc9
Show file tree
Hide file tree
Showing 25 changed files with 242 additions and 252 deletions.
105 changes: 7 additions & 98 deletions Cargo.lock

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

6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ members = [
"macros/playground",
"macros/context-derive",
]
exclude = [
"tangle-test-utils",
"example",
]
exclude = ["tangle-test-utils", "example"]

[workspace.package]
authors = ["Webb Technologies Inc."]
Expand Down Expand Up @@ -123,7 +120,6 @@ serde = { version = "1.0.208", default-features = false }
serde_json = "1.0"
sha2 = "0.10.8"
sqlx = "=0.7.3"
structopt = "0.3.26"
syn = "2.0.75"
sysinfo = "0.31.2"
thiserror = { version = "1.0.64", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion blueprint-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ path = "src/main.rs"
sp-core = { workspace = true }
gadget-io = { workspace = true }
gadget-sdk = { workspace = true, default-features = true }
clap = { workspace = true, features = ["derive", "wrap_help"] }
color-eyre = { workspace = true, features = ["tracing-error", "color-spantrace", "issue-url"] }
serde = { workspace = true }
structopt = { workspace = true }
tangle-subxt = { workspace = true }
toml = { workspace = true }
hex = { workspace = true }
Expand Down
22 changes: 11 additions & 11 deletions blueprint-manager/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
use clap::Parser;
use std::path::PathBuf;
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
#[structopt(
#[derive(Debug, Parser)]
#[command(
name = "Blueprint Manager",
about = "An program executor that connects to the Tangle network and runs protocols dynamically on the fly"
)]
pub struct BlueprintManagerConfig {
/// The path to the gadget configuration file
#[structopt(parse(from_os_str), short = "s", long)]
#[arg(short = 's', long)]
pub gadget_config: Option<PathBuf>,
/// The path to the keystore
#[structopt(short = "k", long)]
#[arg(short = 'k', long)]
pub keystore_uri: String,
/// The directory in which all gadgets will store their data
#[structopt(long, short = "d", parse(from_os_str), default_value = "./data")]
#[arg(long, short = 'd', default_value = "./data")]
pub data_dir: PathBuf,
/// The verbosity level, can be used multiple times
#[structopt(long, short = "v", parse(from_occurrences))]
pub verbose: i32,
#[arg(long, short = 'v', action = clap::ArgAction::Count)]
pub verbose: u8,
/// Whether to use pretty logging
#[structopt(long)]
#[arg(long)]
pub pretty: bool,
/// An optional unique string identifier for the blueprint manager to differentiate between multiple
/// running instances of a BlueprintManager (mostly for debugging purposes)
#[structopt(long, short = "id")]
#[arg(long, alias = "id")]
pub instance_id: Option<String>,
#[structopt(long, short = "t")]
#[arg(long, short = 't')]
pub test_mode: bool,
}
4 changes: 2 additions & 2 deletions blueprint-manager/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use blueprint_manager::config::BlueprintManagerConfig;
use blueprint_manager::run_blueprint_manager;
use blueprint_manager::sdk;
use blueprint_manager::sdk::utils::msg_to_error;
use clap::Parser;
use gadget_io::GadgetConfig;
use sdk::entry;
use structopt::StructOpt;

#[tokio::main]
#[allow(clippy::needless_return)]
async fn main() -> color_eyre::Result<()> {
color_eyre::install()?;
let mut blueprint_manager_config = BlueprintManagerConfig::from_args();
let mut blueprint_manager_config = BlueprintManagerConfig::parse();

blueprint_manager_config.data_dir = std::path::absolute(&blueprint_manager_config.data_dir)?;

Expand Down
2 changes: 1 addition & 1 deletion blueprint-manager/src/sdk/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<'a, F: Send + Future<Output = T> + 'a, T> SendFuture<'a, T> for F {}

/// Sets up the logger for the blueprint manager, based on the verbosity level passed in.
pub fn setup_blueprint_manager_logger(
verbose: i32,
verbose: u8,
pretty: bool,
filter: &str,
) -> color_eyre::Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion blueprint-test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub struct PerTestNodeInput<T> {
bind_ip: IpAddr,
bind_port: u16,
bootnodes: Vec<Multiaddr>,
verbose: i32,
verbose: u8,
pretty: bool,
#[allow(dead_code)]
extra_input: T,
Expand Down
2 changes: 1 addition & 1 deletion blueprints/incredible-squaring-eigenlayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ark-ec = { workspace = true }
parking_lot = { workspace = true }
libp2p = { workspace = true }
ed25519-zebra = { workspace = true, features = ["pkcs8", "default", "der", "std", "serde", "pem"] }
structopt = { workspace = true }
clap = { workspace = true, features = ["derive", "wrap_help"] }
hex = { workspace = true }
k256 = { workspace = true }
reqwest = { workspace = true }
Expand Down
Submodule forge-std updated 4 files
+193 −0 CONTRIBUTING.md
+16 −0 README.md
+73 −8 src/Vm.sol
+2 −2 test/Vm.t.sol
4 changes: 2 additions & 2 deletions blueprints/incredible-squaring-eigenlayer/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ use eigensdk::client_elcontracts::writer::ELChainWriter;
use eigensdk::crypto_bls::BlsKeyPair;
use eigensdk::logging::get_test_logger;
use eigensdk::types::operator::Operator;
use gadget_sdk::clap::Parser;
use gadget_sdk::events_watcher::InitializableEventHandler;
use gadget_sdk::info;
use gadget_sdk::run::GadgetRunner;
use gadget_sdk::structopt::StructOpt;
use gadget_sdk::{
config::{ContextConfig, GadgetConfiguration},
events_watcher::evm::DefaultNodeConfig,
Expand Down Expand Up @@ -211,7 +211,7 @@ impl GadgetRunner for EigenlayerGadgetRunner<parking_lot::RawRwLock> {

pub async fn execute_runner() -> Result<()> {
gadget_sdk::logging::setup_log();
let config = ContextConfig::from_args();
let config = ContextConfig::parse();
let env = gadget_sdk::config::load(config).expect("Failed to load environment");
let mut runner = Box::new(EigenlayerGadgetRunner::new(env.clone()).await);

Expand Down
Loading

0 comments on commit 2111dc9

Please sign in to comment.