Skip to content
Draft
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
249 changes: 207 additions & 42 deletions Cargo.lock

Large diffs are not rendered by default.

37 changes: 20 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,26 @@ ssv_types = { path = "anchor/common/ssv_types" }
subnet_service = { path = "anchor/subnet_service" }
version = { path = "anchor/common/version" }

# Lighthouse latest from unstable (e58ec88fe)
beacon_node_fallback = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
bls = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
eth2 = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
eth2_keystore = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
eth2_network_config = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
health_metrics = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
metrics = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
network_utils = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
slashing_protection = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
slot_clock = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
task_executor = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
types = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
validator_metrics = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
validator_services = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
validator_store = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
workspace_members = { git = "https://github.com/sigp/lighthouse", rev = "e58ec88fe" }
# Lighthouse Gloas builder-API stack head, sigp/lighthouse#9807 (44f442479); re-pin to
# unstable once the #9805-#9807 stack merges
beacon_node_fallback = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
bls = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
builder_store = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
builder_types = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
eth2 = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
eth2_keystore = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
eth2_network_config = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
health_metrics = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
metrics = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
network_utils = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
slashing_protection = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
slot_clock = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
task_executor = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
types = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
validator_metrics = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
validator_services = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
validator_store = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }
workspace_members = { git = "https://github.com/sigp/lighthouse", rev = "44f442479d628ee4dcdcbd53db04791ec368057c" }

alloy = { version = "1.2.1", features = [
"sol-types",
Expand Down
1 change: 1 addition & 0 deletions anchor/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ path = "src/lib.rs"
[dependencies]
anchor_validator_store = { workspace = true }
beacon_node_fallback = { workspace = true }
builder_store = { workspace = true }
clap = { workspace = true }
cli = { workspace = true }
database = { workspace = true }
Expand Down
32 changes: 31 additions & 1 deletion anchor/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use beacon_node_fallback::{
BeaconNodeFallback, CandidateBeaconNode, beacon_head_monitor::HeadEvent,
start_fallback_updater_service,
};
use builder_store::BuilderStore;
use config::Config;
use database::{NetworkDatabase, OwnOperatorId};
use duties_tracker::{duties_tracker::DutiesTracker, voluntary_exit_tracker::VoluntaryExitTracker};
Expand Down Expand Up @@ -58,12 +59,14 @@ use validator_metrics::set_gauge;
use validator_services::{
attestation_service::AttestationServiceBuilder,
block_service::BlockServiceBuilder,
builder_preferences_service::BuilderPreferencesService,
duties_service,
duties_service::{DutiesServiceBuilder, SelectionProofConfig},
latency_service::start_latency_service,
payload_attestation_service::PayloadAttestationService,
preparation_service::PreparationServiceBuilder,
proposer_preferences_service::ProposerPreferencesService,
request_auth_cache::RequestAuthCache,
sync_committee_service::SyncCommitteeService,
};

Expand Down Expand Up @@ -721,12 +724,24 @@ impl Client {
.await?;
}

// `BlockServiceBuilder::build()` requires both a `BuilderStore` and a `RequestAuthCache`
// at the new Lighthouse pin. Both types are Arc-backed, so the clones below share one
// store and one cache between the block service and the builder-preferences service,
// whose per-slot tick is the cache's only `prune()` caller; a second
// `RequestAuthCache::default()` here would leave the block service's cache insert-only.
let configured_builders =
BuilderStore::open_or_create(config.global_config.data_dir.builder_definitions_dir())
.map_err(|e| format!("Unable to open or create builder definitions: {e:?}"))?;
let request_auth_cache = RequestAuthCache::default();

let mut block_service_builder = BlockServiceBuilder::new()
.slot_clock(slot_clock.clone())
.validator_store(validator_store.clone())
.beacon_nodes(beacon_nodes.clone())
.executor(executor.clone())
.chain_spec(spec.clone());
.chain_spec(spec.clone())
.configured_builders(configured_builders.clone())
.request_auth_cache(request_auth_cache.clone());

// If we have proposer nodes, add them to the block service builder.
if proposer_nodes.num_total().await > 0 {
Expand Down Expand Up @@ -858,6 +873,21 @@ impl Client {
)
.start_update_service()
.map_err(|e| format!("Unable to start proposer preferences service: {e}"))?;

// Publishes signed builder preferences ahead of time for known proposal duties
// (current and next epoch) and prunes the shared request-auth cache each slot.
BuilderPreferencesService::new(
duties_service.clone(),
validator_store.clone(),
slot_clock.clone(),
beacon_nodes.clone(),
configured_builders,
request_auth_cache,
executor.clone(),
spec.clone(),
)
.start_update_service()
.map_err(|e| format!("Unable to start builder preferences service: {e}"))?;
}

http_api_shared_state.write().database_state = Some(database.watch());
Expand Down
7 changes: 7 additions & 0 deletions anchor/common/global_config/src/data_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ impl DataDir {
pub fn default_logs_dir(&self) -> PathBuf {
self.path.join("logs")
}

/// Directory holding `builder_definitions.yml`, created on first use by Lighthouse's
/// `BuilderStore`. The datadir root, mirroring Lighthouse's placement of the file directly
/// in its validators dir.
pub fn builder_definitions_dir(&self) -> PathBuf {
self.path.clone()
}
}

impl Display for DataDir {
Expand Down
1 change: 1 addition & 0 deletions anchor/validator_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ authors = ["Sigma Prime <contact@sigmaprime.io>"]
[dependencies]
beacon_node_fallback = { workspace = true }
bls = { workspace = true }
builder_types = { workspace = true }
database = { workspace = true }
eth2 = { workspace = true }
ethereum_ssz = { workspace = true }
Expand Down
Loading
Loading