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

chore: cleanup #215

Merged
merged 11 commits into from
Dec 17, 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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI fmt clippy and test
name: CI

on:
pull_request:
Expand Down Expand Up @@ -33,4 +33,4 @@ jobs:
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- run: cargo test --all-features
- run: cargo test --all-features
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Docs to GitHub Pages
name: Docs

on:
push:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
ghcr.io/commit-boost/pbs:latest
cache-from: type=registry,ref=ghcr.io/commit-boost/pbs:buildcache
cache-to: type=registry,ref=ghcr.io/commit-boost/pbs:buildcache,mode=max
file: docker/pbs.Dockerfile
file: provisioning/pbs.Dockerfile

build-and-push-signer-docker:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
ghcr.io/commit-boost/signer:latest
cache-from: type=registry,ref=ghcr.io/commit-boost/signer:buildcache
cache-to: type=registry,ref=ghcr.io/commit-boost/signer:buildcache,mode=max
file: docker/signer.Dockerfile
file: provisioning/signer.Dockerfile

finalize-release:
needs:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ target/
cb.docker-compose.yml
targets.json
.idea/
logs
logs
.vscode/
5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

39 changes: 39 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Contributors Guide

Commit-Boost is community driven and we welcome all contributions.

If you contribute to this repo, your contributions will be made to the project under both [Apache 2.0](/LICENSE-APACHE) and the [MIT](/LICENSE-MIT)
license.

There are fundamentally three ways you can contribute:

1. **By opening an issue:** For example, if you believe that you have uncovered a bug
2. **By adding context:** Providing additional context to existing issues
3. **By resolving issues:** For example by opening a PR

### Contributions Related to Spelling and Grammar

For first-time contributors we will not be accepting PRs that only fix spelling or grammatical errors in documentation, code or
elsewhere.

### Submitting a bug report

If you believe you have found a security issues, please **do not** open a public issue but check out our [Security](/SECURITY.md) policy instead.

If you find a non-security related bug, please file an issue detailing:
- Release version you are using
- Code snippets and/or logs that can help identifying the bug
- Concrete steps to reproduce the bug

### Submitting a feature request
If you have a suggestion for a new feature or an improvement to an existing one, please open a new issue and provide:

- A clear and concise description of the feature you’d like to see implemented.
- An explanation of why this feature would be helpful or what problem it would solve.
- Any relevant examples, mock-ups, or references that can help illustrate your idea.

We value your input and appreciate all suggestions to help make this project better!

### Resolving an issue
We welcome PRs from any community member. Before making a large change, it is usually a good idea to first open an issue describing the change to solicit feedback and guidance.
This will increase the likelihood of the PR getting merged.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ members = [

"tests",
"benches/*",
"examples/*",
"examples/builder_log",
"examples/da_commit",
"examples/status_api",
]
resolver = "2"

Expand Down
66 changes: 10 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Commit-Boost

A new Ethereum validator sidecar focused on standardizing the last mile of communication between validators and third-party protocols.
[![Ci](https://github.com/Commit-Boost/commit-boost-client/actions/workflows/ci.yml/badge.svg)](https://github.com/Commit-Boost/commit-boost-client/actions/workflows/ci.yml)
[![Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://commit-boost.github.io/commit-boost-client/)
[![Release](https://img.shields.io/github/v/release/Commit-Boost/commit-boost-client)](https://github.com/Commit-Boost/commit-boost-client/releases)
[![Chat](https://img.shields.io/endpoint?color=neon&logo=telegram&label=chat&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2F%2BPcs9bykxK3BiMzk5)](https://t.me/+Pcs9bykxK3BiMzk5)
[![X](https://img.shields.io/twitter/follow/Commit_Boost)](https://x.com/Commit_Boost)

[Docs](https://commit-boost.github.io/commit-boost-client/) |
[X (Twitter)](https://x.com/Commit_Boost)
A new Ethereum validator sidecar focused on standardizing the last mile of communication between validators and third-party protocols.

## Overview
Commit-Boost is a modular sidecar that allows Ethereum validators to opt-in to different commitment protocols
Expand All @@ -13,66 +16,17 @@ Commit-Boost is a modular sidecar that allows Ethereum validators to opt-in to d
- Out-of-the-box support for metrics reporting and dashboards to have clear insight into what is happening in your validator
- Plug-in system to add custom modules, e.g. receive a notification on Telegram if a relay fails to deliver a block

For more information on how to run Commit-Boost, check out our [docs](https://commit-boost.github.io/commit-boost-client/get_started/overview).

### For developers
- A modular platform to develop and distribute proposer commitments protocols
- A single API to interact with validators
- Support for hard-forks and new protocol requirements

For more information on how to develop a module on Commit-Boost, check out our [docs](https://commit-boost.github.io/commit-boost-client/category/developing).

### Example

A basic commit module with Commit-Boost.

Add the `commit-boost` crate to your `Cargo.toml`:

```toml
commit-boost = { git = "https://github.com/Commit-Boost/commit-boost-client", rev = "..." }
```

Then in `main.rs`:

```rust
use commit_boost::prelude::*;

#[derive(Debug, TreeHash)]
struct Datagram {
data: u64,
}

#[tokio::main]
async fn main() {
let config = load_commit_module_config::<()>().unwrap();
let pubkeys = config.signer_client.get_pubkeys().await.unwrap().keys;

let pubkey = *pubkeys.consensus.first().unwrap().consensus;

let datagram = Datagram { data: 42 };
let request = SignConsensusRequest::builder(pubkey).with_msg(&datagram);
let signature = config
.signer_client
.request_consensus_signature(&request)
.await
.unwrap();

println!("Data: {datagram:?} - Commitment: {signature}");
}
```

Finally, create a Docker image with your binary, e.g. `my_commit_module`, and add it to the `cb-config.toml` file:

```toml
[[modules]]
id = "MY_MODULE"
docker_image = "my_commit_module"
```

For a more detailed example check out [here](/examples/da_commit) and our docs on how to [setup Commit-Boost](https://commit-boost.github.io/commit-boost-client/get_started/overview) for development.
## Get started
- [Node operators](https://commit-boost.github.io/commit-boost-client/category/get-started)
- [Developers](https://commit-boost.github.io/commit-boost-client/category/developing). Check out also the [examples](/examples)

## Audit
Commit Boost received an audit from [Sigma Prime](https://sigmaprime.io/). Find the report [here](/audit/Sigma_Prime_Commit_Boost_Client_Security_Assessment_Report_v2_0.pdf).
Commit-Boost received an audit from [Sigma Prime](https://sigmaprime.io/). Find the report [here](/audit/Sigma_Prime_Commit_Boost_Client_Security_Assessment_Report_v2_0.pdf).

## Acknowledgements
- [MEV boost](https://github.com/flashbots/mev-boost)
Expand Down
2 changes: 1 addition & 1 deletion benches/pbs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ commit-boost-cli start --docker benches/pbs/bench.docker-compose.yml
```
or regenerate it using `commit-boost-cli init`.

To clean up after then benchmark, run:
To clean up after the benchmark, run:
```bash
commit-boost-cli stop --docker benches/pbs/bench.docker-compose.yml
```
Expand Down
2 changes: 1 addition & 1 deletion bin/cli.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clap::Parser;

/// Main entry point of the Commit Boost CLI
/// Main entry point of the Commit-Boost CLI
#[tokio::main]
async fn main() -> eyre::Result<()> {
color_eyre::install()?;
Expand Down
9 changes: 6 additions & 3 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ validator_pubkeys = [
# Supported registries:
# - Lido: NodeOperatorsRegistry
# OPTIONAL
loader = "./mux_keys.example.json"
loader = "./tests/data/mux_keys.example.json"
# loader = { registry = "lido", node_operator_id = 8 }
timeout_get_header_ms = 900
late_in_slot_time_ms = 1500
Expand Down Expand Up @@ -146,7 +146,7 @@ docker_image = "ghcr.io/commit-boost/signer:latest"
# - ValidatorsDir: load keys from a `keys` and `secrets` file/folder (ERC-2335 style keystores). More details can be found in the docs (https://commit-boost.github.io/commit-boost-client/get_started/configuration/)
[signer.local.loader]
# File: path to the keys file
key_path = "./keys.example.json"
key_path = "./tests/data/keys.example.json"
# ValidatorsDir: format of the keystore (lighthouse, prysm, teku or lodestar)
# format = "lighthouse"
# ValidatorsDir: full path to the keys directory
Expand Down Expand Up @@ -212,10 +212,13 @@ host = "127.0.0.1"
# - /etc/prometheus/targets.json
# ```
# and use the `targets.json` file generated by `commit-boost-cli init`
prometheus_config = "./docker/prometheus.yml"
prometheus_config = "./provisioning/prometheus.yml"
# Whether to start Grafana with built-in dashboards
# OPTIONAL, DEFAULT: true
use_grafana = true
# Path to a folder containing a `dashboards` and `datasources` folder for Grafana.
# OPTIONAL
grafana_path = "./provisioning/grafana"
# Whether to start cadvisor for system monitoring
# OPTIONAL, DEFAULT: true
use_cadvisor = true
Expand Down
46 changes: 27 additions & 19 deletions crates/cli/src/docker_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub async fn handle_docker_init(config_path: String, output_dir: String) -> Resu
let builder_events_port = 30000;
let mut builder_events_modules = Vec::new();

let mut exposed_ports_warn = Vec::new();
let mut warnings = Vec::new();

let mut needs_signer_module = cb_config.pbs.with_signer;

Expand Down Expand Up @@ -269,8 +269,7 @@ pub async fn handle_docker_init(config_path: String, output_dir: String) -> Resu
let host_endpoint =
SocketAddr::from((cb_config.pbs.pbs_config.host, cb_config.pbs.pbs_config.port));
let ports = Ports::Short(vec![format!("{}:{}", host_endpoint, cb_config.pbs.pbs_config.port)]);
exposed_ports_warn
.push(format!("pbs has an exported port on {}", cb_config.pbs.pbs_config.port));
warnings.push(format!("pbs has an exported port on {}", cb_config.pbs.pbs_config.port));

// inside the container expose on 0.0.0.0
let container_endpoint =
Expand Down Expand Up @@ -466,7 +465,7 @@ pub async fn handle_docker_init(config_path: String, output_dir: String) -> Resu

if let Some(metrics_config) = cb_config.metrics {
// prometheus
exposed_ports_warn.push("prometheus has an exported port on 9090".to_string());
warnings.push("prometheus has an exported port on 9090".to_string());

let prom_volume = Volumes::Simple(format!(
"{}:/etc/prometheus/prometheus.yml",
Expand Down Expand Up @@ -503,13 +502,30 @@ pub async fn handle_docker_init(config_path: String, output_dir: String) -> Resu

// grafana
if metrics_config.use_grafana {
exposed_ports_warn.push("grafana has an exported port on 3000".to_string());
exposed_ports_warn.push(
warnings.push("grafana has an exported port on 3000".to_string());
warnings.push(
"Grafana has the default admin password of 'admin'. Login to change it".to_string(),
);

let grafana_data_volume =
Volumes::Simple(format!("{}:/var/lib/grafana", GRAFANA_DATA_VOLUME));
vec![Volumes::Simple(format!("{}:/var/lib/grafana", GRAFANA_DATA_VOLUME))];

let grafana_source_volumes = if let Some(path) = metrics_config.grafana_path {
vec![
Volumes::Simple(format!(
"{}:/etc/grafana/provisioning/dashboards",
path.join("dashboards").display()
)),
Volumes::Simple(format!(
"{}:/etc/grafana/provisioning/datasources",
path.join("datasources").display()
)),
]
} else {
vec![]
};

let grafana_volumes = [grafana_data_volume, grafana_source_volumes].concat();

let grafana_service = Service {
container_name: Some("cb_grafana".to_owned()),
Expand All @@ -518,15 +534,7 @@ pub async fn handle_docker_init(config_path: String, output_dir: String) -> Resu
networks: Networks::Simple(vec![METRICS_NETWORK.to_owned()]),
depends_on: DependsOnOptions::Simple(vec!["cb_prometheus".to_owned()]),
environment: Environment::List(vec!["GF_SECURITY_ADMIN_PASSWORD=admin".to_owned()]),
volumes: vec![
Volumes::Simple(
"./grafana/dashboards:/etc/grafana/provisioning/dashboards".to_owned(),
),
Volumes::Simple(
"./grafana/datasources:/etc/grafana/provisioning/datasources".to_owned(),
),
grafana_data_volume,
],
volumes: grafana_volumes,
// disable verbose grafana logs
logging: Some(LoggingParameters { driver: Some("none".to_owned()), options: None }),
..Service::default()
Expand All @@ -547,7 +555,7 @@ pub async fn handle_docker_init(config_path: String, output_dir: String) -> Resu

// cadvisor
if metrics_config.use_cadvisor {
exposed_ports_warn.push("cadvisor has an exported port on 8080".to_string());
warnings.push("cadvisor has an exported port on 8080".to_string());

services.insert(
"cb_cadvisor".to_owned(),
Expand Down Expand Up @@ -578,9 +586,9 @@ pub async fn handle_docker_init(config_path: String, output_dir: String) -> Resu
let compose_str = serde_yaml::to_string(&compose)?;
let compose_path = Path::new(&output_dir).join(CB_COMPOSE_FILE);
std::fs::write(&compose_path, compose_str)?;
if !exposed_ports_warn.is_empty() {
if !warnings.is_empty() {
println!("\n");
for exposed_port in exposed_ports_warn {
for exposed_port in warnings {
println!("Warning: {}", exposed_port);
}
println!("\n");
Expand Down
4 changes: 3 additions & 1 deletion crates/common/src/config/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::net::Ipv4Addr;
use std::{net::Ipv4Addr, path::PathBuf};

use eyre::Result;
use serde::{Deserialize, Serialize};
Expand All @@ -16,6 +16,8 @@ pub struct MetricsConfig {
/// Whether to start the grafana service
#[serde(default = "default_bool::<true>")]
pub use_grafana: bool,
/// Path to grafana config folder
pub grafana_path: Option<PathBuf>,
/// Whether to start the cadvisor service
#[serde(default = "default_bool::<true>")]
pub use_cadvisor: bool,
Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Chain {
Chain::Sepolia => KnownChain::Sepolia.id(),
Chain::Helder => KnownChain::Helder.id(),
Chain::Custom { .. } => {
unimplemented!("chain id is not supported on custom chains, plase file an issue")
unimplemented!("chain id is not supported on custom chains, please file an issue")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/get_started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Modify the `blockrelay.config` file to add Commit-Boost:
}
```

#### Beacon Node to Commit Boost
#### Beacon Node to Commit-Boost
In this setup, the BN Builder-API endpoint will be pointing to the PBS module (e.g. for Lighthouse you will need the flag `--builder=http://127.0.0.0:18550`).

This will bypass the `blockrelay` entirely so make sure all relays are properly configured in the `[[relays]]` section.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/get_started/running/binary.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Modules need some environment variables to work correctly.

#### Commit modules
- `CB_SIGNER_URL`: required, url to the signer module server.
- `CB_SIGNER_JWT`: required, jwt to use to for signature requests (needs to match what is in `CB_JWTS`).
- `CB_SIGNER_JWT`: required, jwt to use for signature requests (needs to match what is in `CB_JWTS`).

#### Events modules
- `CB_BUILDER_PORT`: required, port to open to receive builder events from the PBS module.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion k8s/README.md → provisioning/k8s/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Commit boost on k8s
# Commit-Boost on k8s

Currently, only the PBS module is supported and it can be used as a
drop-in replacement to mev-boost. To quickly install it, from the
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading