Update /rewards endpoints to match spec (#8967)

I believe one of our rewards endpoints is slightly out of spec. We do not return the `finalized` status for `post_beacon_rewards_attestations`.
Additionally, the `eth2` client doesn't expect the correct wrapper types for some other endpoints.


  - Update `post_beacon_rewards_attestations` server implementation to match spec.
- Update all three client functions in `eth2` to the correct wrapper type.
- Add missing tests for `http_api` to detect any regressions.


Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
Mac L
2026-03-16 07:53:22 +03:00
committed by GitHub
parent 6ca610d918
commit 4eecca6da7
3 changed files with 124 additions and 12 deletions

View File

@@ -1801,8 +1801,16 @@ pub fn serve<T: BeaconChainTypes>(
let execution_optimistic =
chain.is_optimistic_or_invalid_head().unwrap_or_default();
Ok(api_types::GenericResponse::from(attestation_rewards))
.map(|resp| resp.add_execution_optimistic(execution_optimistic))
let finalized = epoch + 2
<= chain
.canonical_head
.cached_head()
.finalized_checkpoint()
.epoch;
Ok(api_types::GenericResponse::from(attestation_rewards)).map(|resp| {
resp.add_execution_optimistic_finalized(execution_optimistic, finalized)
})
})
},
);