[SQUASHED] Optionally skip RANDAO verif during block production (#3116)

This commit is contained in:
Michael Sproul
2022-03-25 16:30:24 +11:00
parent c5212d0f98
commit eb0324aa6b
7 changed files with 223 additions and 18 deletions

View File

@@ -1155,6 +1155,18 @@ impl BeaconNodeHttpClient {
slot: Slot,
randao_reveal: &SignatureBytes,
graffiti: Option<&Graffiti>,
) -> Result<ForkVersionedResponse<BeaconBlock<T>>, Error> {
self.get_validator_blocks_with_verify_randao(slot, Some(randao_reveal), graffiti, None)
.await
}
/// `GET v2/validator/blocks/{slot}`
pub async fn get_validator_blocks_with_verify_randao<T: EthSpec>(
&self,
slot: Slot,
randao_reveal: Option<&SignatureBytes>,
graffiti: Option<&Graffiti>,
verify_randao: Option<bool>,
) -> Result<ForkVersionedResponse<BeaconBlock<T>>, Error> {
let mut path = self.eth_path(V2)?;
@@ -1164,14 +1176,21 @@ impl BeaconNodeHttpClient {
.push("blocks")
.push(&slot.to_string());
path.query_pairs_mut()
.append_pair("randao_reveal", &randao_reveal.to_string());
if let Some(randao_reveal) = randao_reveal {
path.query_pairs_mut()
.append_pair("randao_reveal", &randao_reveal.to_string());
}
if let Some(graffiti) = graffiti {
path.query_pairs_mut()
.append_pair("graffiti", &graffiti.to_string());
}
if let Some(verify_randao) = verify_randao {
path.query_pairs_mut()
.append_pair("verify_randao", &verify_randao.to_string());
}
self.get(path).await
}

View File

@@ -627,8 +627,14 @@ pub struct ProposerData {
#[derive(Clone, Serialize, Deserialize)]
pub struct ValidatorBlocksQuery {
pub randao_reveal: SignatureBytes,
pub randao_reveal: Option<SignatureBytes>,
pub graffiti: Option<Graffiti>,
#[serde(default = "default_verify_randao")]
pub verify_randao: bool,
}
fn default_verify_randao() -> bool {
true
}
#[derive(Clone, Serialize, Deserialize)]