Skip to content

Commit

Permalink
fix: cleanup cli commands (#352)
Browse files Browse the repository at this point in the history
Signed-off-by: Jawad Tariq <sjcool420@hotmail.co.uk>
Signed-off-by: Bastian Gruber <foreach@me.com>
Co-authored-by: Jawad Tariq <sjcool420@hotmail.co.uk>
  • Loading branch information
gruberb and JDawg287 authored Nov 14, 2023
1 parent 0d04308 commit d951171
Show file tree
Hide file tree
Showing 62 changed files with 472 additions and 1,298 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/docker_build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:
network:
uses: ./.github/workflows/docker_utils.yml
secrets: inherit
with:
features: "network"

docker_e2e:
runs-on: ubuntu-latest-16-core
Expand Down Expand Up @@ -84,8 +82,7 @@ jobs:
frontend-erc20-e2e:
runs-on: ubuntu-latest
needs: docker
# if: ${{ github.event_name == 'pull_request' }}
if: ${{ false }} # disable for now because of: TP-768
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Set environment
run: |
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/docker_utils.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: template - docker

env:
DEFAULT_FEATURES: tce,sequencer,network,node,subnet
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
AWS_SHARED_CREDENTIALS_FILE: "${{ github.workspace }}/.aws/credentials"
Expand All @@ -19,10 +18,6 @@ on:
required: false
type: string
default: stable
features:
required: false
type: string
default: tce,sequencer,network,node,subnet
outputs:
tags:
description: "Docker tags"
Expand All @@ -32,8 +27,6 @@ jobs:
docker:
name: Build and push docker image to GitHub Container Registry
runs-on: ubuntu-latest-16-core
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -73,17 +66,6 @@ jobs:
aws configure set aws_secret_access_key ${{ env.AWS_SECRET_ACCESS_KEY }} --profile default
aws configure set aws_session_token ${{ env.AWS_SESSION_TOKEN }} --profile default
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch,suffix=${{ inputs.features != env.DEFAULT_FEATURES && format('-{0}', inputs.features) || '' }}
type=ref,event=pr,suffix=${{ inputs.features != env.DEFAULT_FEATURES && format('-{0}', inputs.features) || '' }}
type=semver,suffix=${{ inputs.features != env.DEFAULT_FEATURES && format('-{0}', inputs.features) || '' }},pattern={{version}}
type=semver,suffix=${{ inputs.features != env.DEFAULT_FEATURES && format('-{0}', inputs.features) || '' }},pattern={{major}}.{{minor}}
- name: Push to GitHub Container Registry
uses: docker/build-push-action@v3
with:
Expand All @@ -92,7 +74,6 @@ jobs:
# push only images targeting topos (e.g.: exclude test, lint, etc.)
push: ${{ inputs.target == 'topos' }}
target: ${{ inputs.target }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
secret-files: |
"aws=${{ github.workspace }}/.aws/credentials"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ jobs:
with:
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- run: cargo nextest run cert_delivery --locked --no-default-features -F tce
- run: cargo nextest run cert_delivery --locked --no-default-features
env:
RUST_LOG: topos=warn
2 changes: 1 addition & 1 deletion crates/topos-p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ test-log.workspace = true
env_logger.workspace = true
rstest = { workspace = true, features = ["async-timeout"] }
tracing-subscriber.workspace = true
topos-test-sdk = { path = "../topos-test-sdk/", features = ["tce"] }
topos-test-sdk = { path = "../topos-test-sdk/" }
rand.workspace = true
2 changes: 1 addition & 1 deletion crates/topos-tce-proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ serial_test.workspace = true
byteorder = "1.4.3"
dockertest = "0.3.1"
topos-tce-storage = { path = "../topos-tce-storage" }
topos-test-sdk = { path = "../topos-test-sdk/", features=["tce"] }
topos-test-sdk = { path = "../topos-test-sdk/" }
24 changes: 6 additions & 18 deletions crates/topos-test-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ workspace = true
topos-core = { workspace = true, features = ["uci", "api"] }
topos-crypto = { path = "../topos-crypto/" }
topos-p2p = { path = "../topos-p2p/" }
topos-tce = { path = "../topos-tce/", optional = true }
topos-tce-api = { path = "../topos-tce-api/", optional = true }
topos-tce-broadcast = { path = "../topos-tce-broadcast/", optional = true }
topos-tce-gatekeeper = { path = "../topos-tce-gatekeeper/", optional = true }
topos-tce = { path = "../topos-tce/" }
topos-tce-api = { path = "../topos-tce-api/" }
topos-tce-broadcast = { path = "../topos-tce-broadcast/" }
topos-tce-gatekeeper = { path = "../topos-tce-gatekeeper/" }
topos-tce-storage = { path = "../topos-tce-storage/" }
topos-tce-synchronizer = { path = "../topos-tce-synchronizer/", optional = true }
topos-tce-transport = { path = "../topos-tce-transport/", optional = true }
topos-tce-synchronizer = { path = "../topos-tce-synchronizer/" }
topos-tce-transport = { path = "../topos-tce-transport/" }

hex.workspace = true
ethers.workspace = true
Expand All @@ -42,17 +42,5 @@ tokio.workspace = true
tracing.workspace = true
async-stream.workspace = true

[features]
default = []
tce = [
"topos-core/api",
"topos-tce",
"topos-tce-api",
"topos-tce-broadcast",
"topos-tce-gatekeeper",
"topos-tce-synchronizer",
"topos-tce-transport",
]

[build-dependencies]
tonic-build.workspace = true
1 change: 0 additions & 1 deletion crates/topos-test-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pub mod networking;
pub mod p2p;
pub mod sequencer;
pub mod storage;
#[cfg(feature = "tce")]
pub mod tce;

use std::{collections::HashSet, net::SocketAddr, sync::Mutex};
Expand Down
1 change: 1 addition & 0 deletions crates/topos-wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl SecretManager {
}

pub fn from_aws(_secrets_config: &str) -> Self {
println!("loading from aws-sm");
todo!()
}

Expand Down
18 changes: 6 additions & 12 deletions crates/topos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ edition = "2021"
workspace = true

[dependencies]
topos-tce = { path = "../topos-tce/", optional = true }
topos-tce = { path = "../topos-tce/" }
topos-p2p = { path = "../topos-p2p" }
topos-tce-transport = { path = "../topos-tce-transport", optional = true }
topos-sequencer = { path = "../topos-sequencer", optional = true }
topos-tce-transport = { path = "../topos-tce-transport" }
topos-sequencer = { path = "../topos-sequencer" }
topos-core = { workspace = true, features = ["api"] }
topos-certificate-spammer = { path = "../topos-certificate-spammer", optional = true }
topos-certificate-spammer = { path = "../topos-certificate-spammer" }
topos-tce-broadcast = { path = "../topos-tce-broadcast", optional = true }
topos-wallet = { path = "../topos-wallet" }

Expand Down Expand Up @@ -54,7 +54,7 @@ topos-tce-synchronizer = { path = "../topos-tce-synchronizer" }
topos-tce-gatekeeper = { path = "../topos-tce-gatekeeper" }
topos-tce-api = { path = "../topos-tce-api" }
topos-tce-storage = { path = "../topos-tce-storage" }
topos-test-sdk = { path = "../topos-test-sdk", features = ["tce"] }
topos-test-sdk = { path = "../topos-test-sdk" }
serde.workspace = true
serde_json.workspace = true
test-log.workspace = true
Expand All @@ -68,11 +68,5 @@ rstest = { workspace = true, features = ["async-timeout"] }
tempfile = "3.8.0"

[features]
default = ["tce", "sequencer", "network", "node", "setup", "subnet"]
default = []
broadcast_via_channels = ["default", "topos-tce-broadcast/task-manager-channels"]
tce = ["topos-tce", "topos-tce-transport"]
sequencer = ["topos-sequencer"]
network = ["topos-certificate-spammer"]
node = ["tce", "sequencer"]
setup = []
subnet = []
5 changes: 0 additions & 5 deletions crates/topos/src/components/doctor.rs

This file was deleted.

12 changes: 1 addition & 11 deletions crates/topos/src/components/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
pub(crate) mod doctor;
#[cfg(feature = "network")]
pub(crate) mod network;
#[cfg(feature = "node")]
pub(crate) mod node;
#[cfg(feature = "sequencer")]
pub(crate) mod sequencer;
#[cfg(feature = "setup")]
pub(crate) mod regtest;
pub(crate) mod setup;
#[cfg(feature = "subnet")]
pub(crate) mod subnet;
#[cfg(feature = "tce")]
pub(crate) mod tce;
30 changes: 0 additions & 30 deletions crates/topos/src/components/network/commands.rs

This file was deleted.

12 changes: 11 additions & 1 deletion crates/topos/src/components/node/commands.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
use std::path::PathBuf;

use clap::{Args, Subcommand};
use serde::Serialize;

mod init;
mod status;
mod up;

pub(crate) use init::Init;
pub(crate) use status::Status;
pub(crate) use up::Up;

#[derive(Args, Debug, Serialize)]
pub(crate) struct NodeArgument {
#[clap(short, long, default_value = "http://[::1]:1340")]
pub(crate) node: String,
}

/// Utility to manage your nodes in the Topos network
#[derive(Args, Debug)]
pub(crate) struct NodeCommand {
Expand All @@ -25,10 +34,11 @@ pub(crate) struct NodeCommand {
pub(crate) subcommands: Option<NodeCommands>,
}

#[derive(Subcommand, Debug)]
#[derive(Subcommand, Debug, Serialize)]
pub(crate) enum NodeCommands {
Up(Box<Up>),
Init(Box<Init>),
Status(Status),
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion crates/topos/src/components/node/commands/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use clap::Args;
use serde::Serialize;

#[derive(Args, Debug, Serialize)]
#[command(about = "Setup your node!", trailing_var_arg = true)]
#[command(about = "Setup your node", trailing_var_arg = true)]
#[serde(rename_all = "kebab-case")]
pub struct Init {
/// Name to identify your node
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use super::NodeArgument;
use clap::Args;
use serde::Serialize;

#[derive(Args, Debug)]
#[derive(Args, Debug, Serialize)]
#[command(about = "Get node status")]
pub(crate) struct Status {
#[command(flatten)]
pub(crate) node_args: NodeArgument,
Expand Down
12 changes: 10 additions & 2 deletions crates/topos/src/components/node/commands/up.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use clap::Args;
use serde::Serialize;

#[derive(Args, Debug, Serialize)]
#[command(about = "Spawn your node!")]
#[derive(Args, Clone, Debug, Serialize)]
#[command(about = "Spawn your node")]
#[serde(rename_all = "kebab-case")]
pub struct Up {
/// Name to identify your node
Expand All @@ -18,4 +18,12 @@ pub struct Up {
/// Usable for cases where edge endpoint is available as infura (or similar cloud provider) endpoint
#[arg(long, env = "TOPOS_NO_EDGE_PROCESS", action)]
pub no_edge_process: bool,
/// Socket of the opentelemetry agent endpoint.
/// If not provided open telemetry will not be used
#[arg(long, env = "TOPOS_OTLP_AGENT")]
pub otlp_agent: Option<String>,
/// Otlp service name.
/// If not provided open telemetry will not be used
#[arg(long, env = "TOPOS_OTLP_SERVICE_NAME")]
pub otlp_service_name: Option<String>,
}
Loading

0 comments on commit d951171

Please sign in to comment.