Skip to content

Commit db9f8a8

Browse files
committed
Merge branch 'main' into unified-binary
2 parents a62086f + 23098c4 commit db9f8a8

34 files changed

Lines changed: 1006 additions & 129 deletions

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,11 @@ targets.json
1616
.idea/
1717
logs
1818
.vscode/
19+
20+
# Nix
21+
.direnv/
22+
.devenv/
23+
devenv.*
24+
devenv.lock
25+
.devenv.flake.nix
26+
.envrc

Cargo.lock

Lines changed: 106 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ lazy_static = "1.5.0"
5151
lh_eth2 = { package = "eth2", git = "https://github.com/sigp/lighthouse", tag = "v8.0.0-rc.0" }
5252
lh_eth2_keystore = { package = "eth2_keystore", git = "https://github.com/sigp/lighthouse", tag = "v8.0.0-rc.0" }
5353
lh_types = { package = "types", git = "https://github.com/sigp/lighthouse", tag = "v8.0.0-rc.0" }
54+
notify = "8.2.0"
5455
parking_lot = "0.12.3"
5556
pbkdf2 = "0.12.2"
5657
prometheus = "0.14.0"

bin/commit-boost.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ async fn main() -> Result<()> {
6767
/// Run the PBS service
6868
async fn run_pbs_service() -> Result<()> {
6969
let _guard = initialize_tracing_log(PBS_SERVICE_NAME, LogsSettings::from_env_config()?);
70-
let pbs_config = load_pbs_config().await?;
70+
let (pbs_config, config_path) = load_pbs_config(None).await?;
7171

7272
PbsService::init_metrics(pbs_config.chain)?;
73-
let state = PbsState::new(pbs_config);
73+
let state = PbsState::new(pbs_config, config_path);
7474
let server = PbsService::run::<_, DefaultBuilderApi>(state);
7575

7676
tokio::select! {
@@ -112,3 +112,19 @@ async fn run_init(config_path: PathBuf, output_path: PathBuf) -> Result<()> {
112112
print_logo();
113113
handle_docker_init(config_path, output_path).await
114114
}
115+
116+
#[cfg(test)]
117+
mod tests {
118+
use super::*;
119+
120+
#[test]
121+
fn version_has_v_prefix() {
122+
assert!(VERSION.starts_with('v'), "VERSION should start with 'v', got: {VERSION}");
123+
}
124+
125+
#[test]
126+
fn parse_init_subcommand() {
127+
Cli::try_parse_from(["commit-boost", "init", "--config", "/tmp/config.toml"])
128+
.expect("should parse init subcommand");
129+
}
130+
}

config.example.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@ extra_validation_enabled = false
5555
# Execution Layer RPC url to use for extra validation
5656
# OPTIONAL
5757
# rpc_url = "https://ethereum-holesky-rpc.publicnode.com"
58-
# URL of the SSV API server to use, if you have a mux that targets an SSV node operator
59-
# OPTIONAL, DEFAULT: "https://api.ssv.network/api/v4"
60-
# ssv_api_url = "https://api.ssv.network/api/v4"
58+
# URL of your local SSV node API endpoint, if you have a mux that targets an SSV node operator
59+
# OPTIONAL, DEFAULT: "http://localhost:16000/v1/"
60+
# ssv_node_api_url = "http://localhost:16000/v1/"
61+
# URL of the public SSV API server, if you have a mux that targets an SSV node operator. This is used as
62+
# a fallback if the user's own SSV node is not reachable.
63+
# OPTIONAL, DEFAULT: "https://api.ssv.network/api/v4/"
64+
# ssv_public_api_url = "https://api.ssv.network/api/v4/"
6165
# Timeout for any HTTP requests sent from the PBS module to other services, in seconds
6266
# OPTIONAL, DEFAULT: 10
6367
http_timeout_seconds = 10

crates/common/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ lazy_static.workspace = true
3030
lh_eth2.workspace = true
3131
lh_eth2_keystore.workspace = true
3232
lh_types.workspace = true
33+
notify.workspace = true
3334
pbkdf2.workspace = true
3435
rand.workspace = true
3536
rayon.workspace = true

crates/common/src/config/log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub struct LogsSettings {
1616

1717
impl LogsSettings {
1818
pub fn from_env_config() -> Result<Self> {
19-
let mut config = CommitBoostConfig::from_env_path()?;
19+
let (mut config, _) = CommitBoostConfig::from_env_path()?;
2020

2121
// Override log dir path if env var is set
2222
if let Some(log_dir) = load_optional_env_var(LOGS_DIR_ENV) {

crates/common/src/config/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ impl CommitBoostConfig {
5656
}
5757

5858
pub fn from_file(path: &PathBuf) -> Result<Self> {
59-
let config: Self = load_from_file(path)?;
59+
let (config, _): (Self, _) = load_from_file(path)?;
6060
Ok(config)
6161
}
6262

6363
// When loading the config from the environment, it's important that every path
6464
// is replaced with the correct value if the config is loaded inside a container
65-
pub fn from_env_path() -> Result<Self> {
66-
let helper_config: HelperConfig = load_file_from_env(CONFIG_ENV)?;
65+
pub fn from_env_path() -> Result<(Self, PathBuf)> {
66+
let (helper_config, config_path): (HelperConfig, PathBuf) = load_file_from_env(CONFIG_ENV)?;
6767

6868
let chain = match helper_config.chain {
6969
ChainLoader::Path { path, genesis_time_secs } => {
@@ -109,13 +109,13 @@ impl CommitBoostConfig {
109109
logs: helper_config.logs,
110110
};
111111

112-
Ok(config)
112+
Ok((config, config_path))
113113
}
114114

115115
/// Returns the path to the chain spec file if any
116116
pub fn chain_spec_file(path: &PathBuf) -> Option<PathBuf> {
117117
match load_from_file::<_, ChainConfig>(path) {
118-
Ok(config) => {
118+
Ok((config, _)) => {
119119
if let ChainLoader::Path { path, genesis_time_secs: _ } = config.chain {
120120
Some(path)
121121
} else {

crates/common/src/config/module.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn load_commit_module_config<T: DeserializeOwned>() -> Result<StartCommitMod
8282
}
8383

8484
// load module config including the extra data (if any)
85-
let cb_config: StubConfig<T> = load_file_from_env(CONFIG_ENV)?;
85+
let (cb_config, _): (StubConfig<T>, _) = load_file_from_env(CONFIG_ENV)?;
8686

8787
// find all matching modules config
8888
let matches: Vec<ThisModuleConfig<T>> = cb_config
@@ -148,7 +148,7 @@ pub fn load_builder_module_config<T: DeserializeOwned>() -> eyre::Result<StartBu
148148
}
149149

150150
// load module config including the extra data (if any)
151-
let cb_config: StubConfig<T> = load_file_from_env(CONFIG_ENV)?;
151+
let (cb_config, _): (StubConfig<T>, _) = load_file_from_env(CONFIG_ENV)?;
152152

153153
// find all matching modules config
154154
let matches: Vec<ThisModuleConfig<T>> = cb_config

0 commit comments

Comments
 (0)