Add graffiti cli flag to the validator client. (#1425)

## Issue Addressed

#1419

## Proposed Changes

Creates a `--graffiti` cli flag in the validator client. If the flag is set, it overrides graffiti in the beacon node. 

## Additional Info
This commit is contained in:
realbigsean
2020-08-11 02:16:29 +00:00
parent 95b55d7170
commit ec84183e05
9 changed files with 125 additions and 21 deletions

View File

@@ -11,8 +11,8 @@ use std::marker::PhantomData;
use std::time::Duration;
use types::{
Attestation, AttestationData, AttesterSlashing, BeaconBlock, BeaconState, CommitteeIndex,
Epoch, EthSpec, Fork, Hash256, ProposerSlashing, PublicKey, PublicKeyBytes, Signature,
SignedAggregateAndProof, SignedBeaconBlock, Slot, SubnetId,
Epoch, EthSpec, Fork, Graffiti, Hash256, ProposerSlashing, PublicKey, PublicKeyBytes,
Signature, SignedAggregateAndProof, SignedBeaconBlock, Slot, SubnetId,
};
use url::Url;
@@ -313,18 +313,21 @@ impl<E: EthSpec> Validator<E> {
&self,
slot: Slot,
randao_reveal: Signature,
graffiti: Option<Graffiti>,
) -> Result<BeaconBlock<E>, Error> {
let client = self.0.clone();
let url = self.url("block")?;
client
.json_get::<BeaconBlock<E>>(
url,
vec![
("slot".into(), format!("{}", slot.as_u64())),
("randao_reveal".into(), as_ssz_hex_string(&randao_reveal)),
],
)
.await
let mut query_pairs = vec![
("slot".into(), format!("{}", slot.as_u64())),
("randao_reveal".into(), as_ssz_hex_string(&randao_reveal)),
];
if let Some(graffiti_bytes) = graffiti {
query_pairs.push(("graffiti".into(), as_ssz_hex_string(&graffiti_bytes)));
}
client.json_get::<BeaconBlock<E>>(url, query_pairs).await
}
/// Subscribes a list of validators to particular slots for attestation production/publication.