Skip to content

Conversation

@chong-he
Copy link
Member

@chong-he chong-he commented Oct 8, 2025

Issue Addressed

Proposed Changes

Split the function publish_attestations_and_aggregates into publish_attestations and handle_aggregates, so that for attestations, only 1 task is spawned.

Additional Info

Tested with Kurtosis on minimal preset, which has a max_committees_per_slot of 4. The number of times the VC calls the BN for the endpoint /eth/v1/validator/attestation_data is given by the metric: http_api_paths_times_count{path="v1/validator/attestation_data"}

For 100 slots of data:
Before: http_api_paths_times_count{path="v1/validator/attestation_data"} 398
After: http_api_paths_times_count{path="v1/validator/attestation_data"} 100

From the test output, we see that the number of calls to the BN is reduced. On mainnet, the max_committee_per_slot is 64, the VC should only call the BN only once per slot for this endpoint

@chong-he chong-he changed the title attestation committee index Always use committee index 0 when getting attestation data Oct 8, 2025
@chong-he chong-he added the work-in-progress PR is a work-in-progress label Oct 8, 2025
let attestation_data_cache_clone = attestation_data_cache.clone();

let attestation_service = self.clone();
self.inner.executor.spawn_ignoring_error(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use spawn_handle and then await the handle to get the attestation data from inside the future (rather than using the attestation_data_cache RwLock).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case the handle doesn't return the result, it's an error and we probably need to just stop the attestation process for this slot (return Err(..))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the comment, I revised in 0967696

validator = ?duty.pubkey,
duty_slot = %duty.slot,
attestation_slot = %attestation_data.slot,
duty_index = duty.committee_index,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could keep these logs (these won't be 0, because the duty still contains the real committee index).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, revised in 0967696

}

Ok(Some(attestation_data))
drop(attestations_timer);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This drop probably not needed (can just rename the timer to _attestations_timer and it will drop when it goes out of scope, when the function finishes)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put a underscore before the timer and removed this line: 0967696

@michaelsproul michaelsproul added val-client Relates to the validator client binary optimization Something to make Lighthouse run more efficiently. v8.1.0 Post-Fulu release labels Oct 16, 2025
@chong-he chong-he added ready-for-review The code is ready for review and removed work-in-progress PR is a work-in-progress labels Oct 17, 2025
@mergify
Copy link

mergify bot commented Oct 20, 2025

Some required checks have failed. Could you please take a look @chong-he? 🙏

@mergify mergify bot added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Oct 20, 2025
@chong-he chong-he added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

optimization Something to make Lighthouse run more efficiently. ready-for-review The code is ready for review v8.1.0 Post-Fulu release val-client Relates to the validator client binary

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants