Progress towards validator signing attestations.

- Added a 'beacon_attester' RPC endpoint, so the BeaconNode can supply attestation data.
 - Renamed 'attestation_data' to just 'attestation' throughout (except where it is actually just the data structure).
This commit is contained in:
Luke Anderson
2019-03-25 18:32:27 +11:00
parent 2f49289c28
commit 4cdeb6abe5
8 changed files with 87 additions and 26 deletions

View File

@@ -94,7 +94,7 @@ impl<T: SlotClock, U: BeaconNode, V: DutiesReader, W: Signer> Attester<T, U, V,
}
fn produce_attestation(&mut self, slot: Slot, shard: u64) -> Result<PollOutcome, Error> {
let attestation_data = match self.beacon_node.produce_attestation_data(slot, shard)? {
let attestation_data = match self.beacon_node.produce_attestation(slot, shard)? {
Some(attestation_data) => attestation_data,
None => return Ok(PollOutcome::BeaconNodeUnableToProduceAttestation(slot)),
};
@@ -120,7 +120,7 @@ impl<T: SlotClock, U: BeaconNode, V: DutiesReader, W: Signer> Attester<T, U, V,
};
self.beacon_node
.publish_attestation_data(free_attestation)?;
.publish_attestation(free_attestation)?;
Ok(PollOutcome::AttestationProduced(slot))
}

View File

@@ -26,7 +26,7 @@ impl SimulatedBeaconNode {
}
impl BeaconNode for SimulatedBeaconNode {
fn produce_attestation_data(&self, slot: Slot, shard: u64) -> ProduceResult {
fn produce_attestation(&self, slot: Slot, shard: u64) -> ProduceResult {
*self.produce_input.write().unwrap() = Some((slot, shard));
match *self.produce_result.read().unwrap() {
Some(ref r) => r.clone(),
@@ -34,7 +34,7 @@ impl BeaconNode for SimulatedBeaconNode {
}
}
fn publish_attestation_data(&self, free_attestation: FreeAttestation) -> PublishResult {
fn publish_attestation(&self, free_attestation: FreeAttestation) -> PublishResult {
*self.publish_input.write().unwrap() = Some(free_attestation.clone());
match *self.publish_result.read().unwrap() {
Some(ref r) => r.clone(),

View File

@@ -14,13 +14,13 @@ pub enum PublishOutcome {
/// Defines the methods required to produce and publish blocks on a Beacon Node.
pub trait BeaconNode: Send + Sync {
fn produce_attestation_data(
fn produce_attestation(
&self,
slot: Slot,
shard: u64,
) -> Result<Option<AttestationData>, BeaconNodeError>;
fn publish_attestation_data(
fn publish_attestation(
&self,
free_attestation: FreeAttestation,
) -> Result<PublishOutcome, BeaconNodeError>;