Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure codebase for future binaries #6

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Cargo.lock

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

24 changes: 16 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
[package]
name = "anchor"
version = "0.1.0"
[workspace]
# Extra tooling projects will be added.
members = [
"anchor",
"anchor/client",
]
resolver = "2"

[workspace.package]
edition = "2021"
authors = ["Sigma Prime <[email protected]>"]
rust-version = "1.80.0"

[dependencies]
[workspace.dependencies]
client = { path = "anchor/client" }
task_executor = { git = "https://github.com/sigp/lighthouse", branch = "anchor", default-features = false, features = ["tracing"] }
sensitive_url = { git = "https://github.com/sigp/lighthouse", branch = "anchor"}
async-channel = "1.9"
Expand All @@ -20,5 +25,8 @@ tracing = "0.1.40"
git-version = "0.3.9"
target_info = "0.1.0"

[dev-dependencies]
regex = "1.10.6"
[profile.maxperf]
inherits = "release"
lto = "fat"
codegen-units = 1
incremental = false
24 changes: 24 additions & 0 deletions anchor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "anchor"
version = "0.1.0"
edition = { workspace = true }
authors = ["Sigma Prime <[email protected]>"]
rust-version = "1.80.0"

[dependencies]
task_executor = { workspace = true }
sensitive_url = { workspace = true }
async-channel = { workspace = true }
clap = { workspace = true }
dirs = { workspace = true }
ethereum_hashing = { workspace = true }
futures = { workspace = true }
serde = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
git-version = { workspace = true }
target_info = { workspace = true }
client = { workspace = true }

[dev-dependencies]
regex = "1.10.6"
File renamed without changes.
17 changes: 17 additions & 0 deletions anchor/client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "client"
version = "0.1.0"
authors = ["Sigma Prime <[email protected]"]
edition = { workspace = true }

[lib]
name = "client"
path = "src/lib.rs"

[dependencies]
task_executor = { workspace = true }
clap = { workspace = true }
serde = { workspace = true }
sensitive_url = { workspace = true }
dirs = { workspace = true }

File renamed without changes.
5 changes: 4 additions & 1 deletion src/client/mod.rs → anchor/client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// use tracing::{debug, info};
use crate::config::Config;

pub mod config;

use config::Config;
use task_executor::TaskExecutor;

pub struct Client {}
Expand Down
7 changes: 3 additions & 4 deletions src/cli.rs → anchor/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ pub fn cli_app() -> Command {
.styles(get_color_style())
.next_line_help(true)
.term_width(80)
.disable_help_flag(true)
.about(
"Anchor client. Maintained by Sigma Prime",
"Anchor is a rust-based SSV client. Currently under active developement and should not be used for production."
)
.long_version(LONG_VERSION.as_str())
.display_order(0)
Expand All @@ -71,8 +70,8 @@ pub fn cli_app() -> Command {
.value_name("DIR")
.global(true)
.help(
"Used to specify a custom root data directory for lighthouse keys and databases. \
Defaults to $HOME/.lighthouse/{network} where network is the value of the `network` flag \
"Used to specify a custom root data directory for anchor keys and databases. \
Defaults to $HOME/.anchor/{network} where network is the value of the `network` flag \
Note: Users should specify separate custom datadirs for different networks.")
.action(ArgAction::Set)
.display_order(0)
Expand Down
File renamed without changes.
9 changes: 5 additions & 4 deletions src/main.rs → anchor/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use tracing::{error, info};

mod cli;
mod client;
mod config;
mod environment;
mod version;

Expand All @@ -20,8 +18,11 @@ fn main() {
// Obtain the CLI and build the config
let cli = cli::cli_app();
let matches = cli.get_matches();
// Build the config
let config = match config::from_cli(&matches) {

// Currently the only binary is the client. We build the client config, but later this will
// generalise to other sub commands
// Build the client config
let config = match client::config::from_cli(&matches) {
Ok(config) => config,
Err(e) => {
error!(e, "Unable to initialize configuration");
Expand Down
File renamed without changes.