Skip to content
Open
Changes from 6 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
ea45814
using events api for eager start attestation tasks
hopinheimer Aug 18, 2025
6f20083
merge `origin/unstable` into `hopinheimer/eager-send-attestation`
hopinheimer Aug 18, 2025
46fe220
minor nits
hopinheimer Aug 18, 2025
de7226f
clippy chill vibes
hopinheimer Aug 18, 2025
5f2a101
missed something
hopinheimer Aug 18, 2025
ae16705
linty
hopinheimer Aug 18, 2025
c13d0c3
implemented head monitoring service
hopinheimer Sep 19, 2025
8405f01
Merge branch 'unstable' of github.com:sigp/lighthouse into eager-send…
hopinheimer Sep 19, 2025
65e04fb
merge from feature branch
hopinheimer Sep 19, 2025
a1d36e6
fixing some linting issues
hopinheimer Sep 19, 2025
a489d32
comments and removing unwanted code
hopinheimer Sep 20, 2025
2b974db
clippy change
hopinheimer Sep 20, 2025
5600aef
Merge branch 'unstable' into eager-send-attestation
hopinheimer Oct 15, 2025
b65fc30
same data attestation bug solved
hopinheimer Oct 16, 2025
9024931
Merge branch 'unstable' into eager-send-attestation
hopinheimer Oct 20, 2025
b25703f
fixing dangling conditions and amaking head_monitor_service optional
hopinheimer Oct 20, 2025
e68548b
Merge branch 'eager-send-attestation' of github.com:hopinheimer/light…
hopinheimer Oct 20, 2025
c4d851c
fmt
hopinheimer Oct 20, 2025
daf5b2e
update comment
hopinheimer Oct 20, 2025
c49b8eb
Merge branch 'unstable' into eager-send-attestation
hopinheimer Oct 25, 2025
0e35ee5
massive refact
hopinheimer Oct 28, 2025
29867d2
fixes and linting
hopinheimer Oct 29, 2025
fd43876
remove unused code
hopinheimer Oct 31, 2025
b054a10
changes
hopinheimer Nov 1, 2025
eb057d0
Merge branch 'unstable' into eager-send-attestation
hopinheimer Nov 2, 2025
91e5980
Merge branch 'unstable' into eager-send-attestation
hopinheimer Nov 5, 2025
2e0c78c
Merge branch 'unstable' into eager-send-attestation
hopinheimer Nov 10, 2025
32eed9a
addressing comments
hopinheimer Nov 10, 2025
dac9f00
removing unwanted logs
hopinheimer Nov 11, 2025
bf1471c
fmt
hopinheimer Nov 11, 2025
9794737
Merge branch 'unstable' into eager-send-attestation
hopinheimer Nov 11, 2025
b20ded5
Merge branch 'unstable' into eager-send-attestation
hopinheimer Nov 12, 2025
39b9a58
fixing a unwanted service starting bug
hopinheimer Nov 14, 2025
2e6a8f9
Merge branch 'unstable' into eager-send-attestation
hopinheimer Nov 26, 2025
07d9a12
making the service feature flagged
hopinheimer Nov 26, 2025
a82960b
cleaned up some logic
hopinheimer Nov 26, 2025
6bddeeb
fix
hopinheimer Nov 26, 2025
409d937
updating docs
hopinheimer Nov 26, 2025
0d8160f
addressing comments
hopinheimer Nov 27, 2025
4ea159b
Resolve merge conflicts
eserilev Dec 1, 2025
70e6d18
testsss
hopinheimer Dec 1, 2025
84c8291
fmt
hopinheimer Dec 1, 2025
f174615
Merge branch 'eager-send-attestation' of github.com:hopinheimer/light…
hopinheimer Dec 1, 2025
468fe8a
Merge branch 'unstable' of https://github.com/sigp/lighthouse into ea…
eserilev Dec 1, 2025
bdf62d9
Merge branch 'eager-send-attestation' of https://github.com/hopinheim…
eserilev Dec 3, 2025
94af503
Resolve merge conflicts
eserilev Dec 3, 2025
8b45d57
addressing comments
hopinheimer Dec 17, 2025
ce91eca
Merge branch 'unstable' into eager-send-attestation
hopinheimer Dec 17, 2025
eabbdd4
resolving unstable changes
hopinheimer Dec 17, 2025
dfe2935
clippy
hopinheimer Dec 17, 2025
7b7ab09
update cli docs for default behaviour
hopinheimer Dec 17, 2025
435a93c
Merge branch 'unstable' into eager-send-attestation
eserilev Jan 14, 2026
00962ea
Merge remote-tracking branch 'origin/unstable' into eager-send-attest…
michaelsproul Jan 15, 2026
c2092eb
Small tweaks
michaelsproul Jan 15, 2026
b388efe
Flip flag polarity and make it work
michaelsproul Jan 15, 2026
4bfafc1
Update book
michaelsproul Jan 15, 2026
face04f
Add eth2 events feature
michaelsproul Jan 15, 2026
b30d710
addressing comments
hopinheimer Jan 15, 2026
28dbe33
linting
hopinheimer Jan 15, 2026
8cfa532
Merge branch 'unstable' of github.com:sigp/lighthouse into eager-send…
hopinheimer Jan 16, 2026
516ccd7
fixing unfavorable condition
hopinheimer Jan 19, 2026
3d4dfe0
Merge branch 'unstable' into eager-send-attestation
hopinheimer Jan 19, 2026
4b4d0d1
Merge branch 'unstable' into eager-send-attestation
hopinheimer Jan 21, 2026
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
39 changes: 38 additions & 1 deletion validator_client/validator_services/src/attestation_service.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::duties_service::{DutiesService, DutyAndProof};
use beacon_node_fallback::{ApiTopic, BeaconNodeFallback};
use eth2::types::{EventKind, EventTopic};
use futures::StreamExt;
use futures::future::join_all;
use logging::crit;
use slot_clock::SlotClock;
Expand Down Expand Up @@ -160,7 +162,10 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> AttestationService<S,
let interval_fut = async move {
loop {
if let Some(duration_to_next_slot) = self.slot_clock.duration_to_next_slot() {
sleep(duration_to_next_slot + slot_duration / 3).await;
tokio::select! {
_ = sleep(duration_to_next_slot + slot_duration / 3) => {},
_ = poll_head_event_on_all_beacon_nodes::<T, S::E>(&self.beacon_nodes) => {}
}

if let Err(e) = self.spawn_attestation_tasks(slot_duration) {
crit!(error = e, "Failed to spawn attestation tasks")
Expand Down Expand Up @@ -709,6 +714,38 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> AttestationService<S,
}
}

async fn poll_head_event_on_all_beacon_nodes<T: SlotClock, E: EthSpec>(
beacon_nodes: &Arc<BeaconNodeFallback<T>>,
) -> Result<(), String> {
beacon_nodes
.first_success(|beacon_node| async move {
let mut event_stream = beacon_node
.get_events::<E>(&[EventTopic::Head])
.await
.map_err(|e| format!("Failed to get event stream: {:?}", e))?;

// Poll once for a head event to trigger early attestation processing
if let Some(event_result) = event_stream.next().await {
let event =
event_result.map_err(|e| format!("Head event stream error: {:?}", e))?;
match event {
EventKind::Head(_) => {
trace!("Received head event, triggering early attestation processing");
Ok(())
}
_ => Err("Received non-head event when expecting head event".to_string()),
}
} else {
Err("No head events received".to_string())
}
})
.await
.map_err(|e| {
debug!(error = %e, "Failed to get head events from any beacon node");
e.to_string()
})
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
Loading