Refuse to sign sync committee messages when head is optimistic (#3191)

## Issue Addressed

Resolves #3151 

## Proposed Changes

When fetching duties for sync committee contributions, check the value of `execution_optimistic` of the head block from the BN and refuse to sign any sync committee messages `if execution_optimistic == true`.

## Additional Info
- Is backwards compatible with older BNs
- Finding a way to add test coverage for this would be prudent. Open to suggestions.
This commit is contained in:
Mac L
2022-07-27 00:51:05 +00:00
parent d316305411
commit 44fae52cd7
4 changed files with 70 additions and 8 deletions

View File

@@ -2324,6 +2324,12 @@ pub fn serve<T: BeaconChainTypes>(
blocking_json_task(move || {
chain
.get_aggregated_sync_committee_contribution(&sync_committee_data)
.map_err(|e| {
warp_utils::reject::custom_bad_request(format!(
"unable to fetch sync contribution: {:?}",
e
))
})?
.map(api_types::GenericResponse::from)
.ok_or_else(|| {
warp_utils::reject::custom_not_found(