Skip to content

Commit 04176ae

Browse files
authored
Add Anchor Processor (sigp#57)
1 parent d0f5aba commit 04176ae

File tree

9 files changed

+570
-2
lines changed

9 files changed

+570
-2
lines changed

Cargo.lock

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
members = [
44
"anchor",
55
"anchor/client",
6+
"anchor/common/version",
67
"anchor/http_api",
78
"anchor/http_metrics",
8-
"anchor/qbft",
99
"anchor/network",
10-
"anchor/common/version"
10+
"anchor/processor",
11+
"anchor/qbft",
1112
]
1213
resolver = "2"
1314

@@ -21,6 +22,7 @@ http_api = { path = "anchor/http_api" }
2122
http_metrics = { path = "anchor/http_metrics" }
2223
network = { path ="anchor/network"}
2324
version = { path ="anchor/common/version"}
25+
processor = { path = "anchor/processor" }
2426
lighthouse_network = { git = "https://github.com/sigp/lighthouse", branch = "unstable"}
2527
task_executor = { git = "https://github.com/sigp/lighthouse", branch = "unstable", default-features = false, features = [ "tracing", ] }
2628
metrics = { git = "https://github.com/agemanning/lighthouse", branch = "modularize-vc" }
@@ -38,6 +40,7 @@ either = "1.13.0"
3840
futures = "0.3.30"
3941
tower-http = {version = "0.6", features = ["cors"] }
4042
hyper = "1.4"
43+
num_cpus = "1"
4144
parking_lot = "0.12"
4245
serde = { version = "1.0.208", features = ["derive"] }
4346
strum = { version = "0.24", features = ["derive"] }

anchor/client/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ network = { workspace = true }
2424
unused_port = { workspace = true }
2525
tokio = { workspace = true }
2626
parking_lot = { workspace = true }
27+
processor = { workspace = true }
2728
# Local dependencies
2829
fdlimit = "0.3"
2930
ethereum_hashing = "0.7.0"

anchor/client/src/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ pub struct Config {
4646
/// A list of custom certificates that the validator client will additionally use when
4747
/// connecting to an execution node over SSL/TLS.
4848
pub execution_nodes_tls_certs: Option<Vec<PathBuf>>,
49+
/// Configuration for the processor
50+
pub processor: processor::Config,
4951
}
5052

5153
impl Default for Config {
@@ -74,6 +76,7 @@ impl Default for Config {
7476
network: <_>::default(),
7577
beacon_nodes_tls_certs: None,
7678
execution_nodes_tls_certs: None,
79+
processor: <_>::default(),
7780
}
7881
}
7982
}

anchor/client/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ impl Client {
4242
"Starting the Anchor client"
4343
);
4444

45+
// Start the processor
46+
let _processor_senders = processor::spawn(config.processor, executor.clone());
47+
4548
// Optionally start the metrics server.
4649
let _http_metrics_shared_state = if config.http_metrics.enabled {
4750
let shared_state = Arc::new(RwLock::new(http_metrics::Shared { genesis_time: None }));

anchor/processor/Cargo.toml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
name = "processor"
3+
version = "0.1.0"
4+
authors = ["Sigma Prime <[email protected]"]
5+
edition = { workspace = true }
6+
7+
[dependencies]
8+
tokio = { workspace = true, features = ["sync", "rt", "rt-multi-thread", "macros"] }
9+
tracing = { workspace = true }
10+
task_executor = { workspace = true }
11+
serde = { workspace = true }
12+
num_cpus = { workspace = true }
13+
metrics = { workspace = true }
14+
qbft = { workspace = true }
15+
16+
[dev-dependencies]
17+
async-channel = { workspace = true }
18+
futures = { workspace = true }

0 commit comments

Comments
 (0)