Testnet corrections (#1050)

* Correct RPC ping request

* Add attestation verification

* Add discv5 bug fixes

* Reduce gossipsub heartbeat and update metadata

* Handle known chain of advanced peer
This commit is contained in:
Age Manning
2020-04-27 14:18:30 +10:00
committed by GitHub
parent fa8154e3da
commit 500f6b53d1
7 changed files with 176 additions and 141 deletions

View File

@@ -190,10 +190,24 @@ impl<T: BeaconChainTypes> AttestationService<T> {
pub fn should_process_attestation(
&mut self,
_message_id: &MessageId,
_peer_id: &PeerId,
_subnet: &SubnetId,
_attestation: &Attestation<T::EthSpec>,
peer_id: &PeerId,
subnet: &SubnetId,
attestation: &Attestation<T::EthSpec>,
) -> bool {
// verify the attestation is on the correct subnet
let expected_subnet = match attestation.subnet_id(&self.beacon_chain.spec) {
Ok(v) => v,
Err(e) => {
warn!(self.log, "Could not obtain attestation subnet_id"; "error" => format!("{:?}", e));
return false;
}
};
if expected_subnet != *subnet {
warn!(self.log, "Received an attestation on the wrong subnet"; "subnet_received" => format!("{:?}", subnet), "subnet_expected" => format!("{:?}",expected_subnet), "peer_id" => format!("{}", peer_id));
return false;
}
// TODO: Correctly handle validation aggregator checks
true
}