Skip to content

Commit

Permalink
Add Anchor Processor (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
dknopik authored Dec 9, 2024
1 parent d0f5aba commit 04176ae
Show file tree
Hide file tree
Showing 9 changed files with 570 additions and 2 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

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

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
members = [
"anchor",
"anchor/client",
"anchor/common/version",
"anchor/http_api",
"anchor/http_metrics",
"anchor/qbft",
"anchor/network",
"anchor/common/version"
"anchor/processor",
"anchor/qbft",
]
resolver = "2"

Expand All @@ -21,6 +22,7 @@ http_api = { path = "anchor/http_api" }
http_metrics = { path = "anchor/http_metrics" }
network = { path ="anchor/network"}
version = { path ="anchor/common/version"}
processor = { path = "anchor/processor" }
lighthouse_network = { git = "https://github.com/sigp/lighthouse", branch = "unstable"}
task_executor = { git = "https://github.com/sigp/lighthouse", branch = "unstable", default-features = false, features = [ "tracing", ] }
metrics = { git = "https://github.com/agemanning/lighthouse", branch = "modularize-vc" }
Expand All @@ -38,6 +40,7 @@ either = "1.13.0"
futures = "0.3.30"
tower-http = {version = "0.6", features = ["cors"] }
hyper = "1.4"
num_cpus = "1"
parking_lot = "0.12"
serde = { version = "1.0.208", features = ["derive"] }
strum = { version = "0.24", features = ["derive"] }
Expand Down
1 change: 1 addition & 0 deletions anchor/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ network = { workspace = true }
unused_port = { workspace = true }
tokio = { workspace = true }
parking_lot = { workspace = true }
processor = { workspace = true }
# Local dependencies
fdlimit = "0.3"
ethereum_hashing = "0.7.0"
3 changes: 3 additions & 0 deletions anchor/client/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ pub struct Config {
/// A list of custom certificates that the validator client will additionally use when
/// connecting to an execution node over SSL/TLS.
pub execution_nodes_tls_certs: Option<Vec<PathBuf>>,
/// Configuration for the processor
pub processor: processor::Config,
}

impl Default for Config {
Expand Down Expand Up @@ -74,6 +76,7 @@ impl Default for Config {
network: <_>::default(),
beacon_nodes_tls_certs: None,
execution_nodes_tls_certs: None,
processor: <_>::default(),
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions anchor/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ impl Client {
"Starting the Anchor client"
);

// Start the processor
let _processor_senders = processor::spawn(config.processor, executor.clone());

// Optionally start the metrics server.
let _http_metrics_shared_state = if config.http_metrics.enabled {
let shared_state = Arc::new(RwLock::new(http_metrics::Shared { genesis_time: None }));
Expand Down
18 changes: 18 additions & 0 deletions anchor/processor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "processor"
version = "0.1.0"
authors = ["Sigma Prime <[email protected]"]
edition = { workspace = true }

[dependencies]
tokio = { workspace = true, features = ["sync", "rt", "rt-multi-thread", "macros"] }
tracing = { workspace = true }
task_executor = { workspace = true }
serde = { workspace = true }
num_cpus = { workspace = true }
metrics = { workspace = true }
qbft = { workspace = true }

[dev-dependencies]
async-channel = { workspace = true }
futures = { workspace = true }
Loading

0 comments on commit 04176ae

Please sign in to comment.