Implement skip_randao_verification and blinded block rewards API (#3540)

## Issue Addressed

https://github.com/ethereum/beacon-APIs/pull/222

## Proposed Changes

Update Lighthouse's randao verification API to match the `beacon-APIs` spec. We implemented the API before spec stabilisation, and it changed slightly in the course of review.

Rather than a flag `verify_randao` taking a boolean value, the new API uses a `skip_randao_verification` flag which takes no argument. The new spec also requires the randao reveal to be present and equal to the point-at-infinity when `skip_randao_verification` is set.

I've also updated the `POST /lighthouse/analysis/block_rewards` API to take blinded blocks as input, as the execution payload is irrelevant and we may want to assess blocks produced by builders.

## Additional Info

This is technically a breaking change, but seeing as I suspect I'm the only one using these parameters/APIs, I think we're OK to include this in a patch release.
This commit is contained in:
Michael Sproul
2022-09-19 07:58:48 +00:00
parent ca42ef2e5a
commit f2ac0738d8
8 changed files with 116 additions and 145 deletions

View File

@@ -80,6 +80,18 @@ where
self.point.is_none()
}
/// Initialize self to the point-at-infinity.
///
/// In general `AggregateSignature::infinity` should be used in favour of this function.
pub fn infinity() -> Result<Self, Error> {
Self::deserialize(&INFINITY_SIGNATURE)
}
/// Returns `true` if `self` is equal to the point at infinity.
pub fn is_infinity(&self) -> bool {
self.is_infinity
}
/// Returns a reference to the underlying BLS point.
pub(crate) fn point(&self) -> Option<&Sig> {
self.point.as_ref()