V0.11.0 network update (#976)

* Adjust RPC methods to match v0.11.1

* Adds fork handling for gossipsub topics

* Update gossipsub topics to v0.11.0
This commit is contained in:
Age Manning
2020-04-01 17:20:32 +11:00
parent 5eb4c7d682
commit 88cecd6fb8
19 changed files with 247 additions and 226 deletions

View File

@@ -43,7 +43,7 @@ impl<T: EthSpec> SyncNetworkContext<T> {
self.log,
"Sending Status Request";
"peer" => format!("{:?}", peer_id),
"fork_version" => format!("{:?}", status_message.fork_version),
"fork_digest" => format!("{:?}", status_message.fork_digest),
"finalized_root" => format!("{:?}", status_message.finalized_root),
"finalized_epoch" => format!("{:?}", status_message.finalized_epoch),
"head_root" => format!("{}", status_message.head_root),

View File

@@ -9,7 +9,7 @@ use std::collections::hash_map::Entry;
use std::collections::{HashMap, HashSet};
use std::hash::{Hash, Hasher};
use std::ops::Sub;
use types::{EthSpec, Hash256, SignedBeaconBlock, Slot};
use types::{EthSpec, SignedBeaconBlock, Slot};
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct BatchId(pub u64);
@@ -41,8 +41,6 @@ pub struct Batch<T: EthSpec> {
pub start_slot: Slot,
/// The requested end slot of batch, exclusive.
pub end_slot: Slot,
/// The hash of the chain root to requested from the peer.
pub head_root: Hash256,
/// The peer that was originally assigned to the batch.
pub original_peer: PeerId,
/// The peer that is currently assigned to the batch.
@@ -61,18 +59,11 @@ pub struct Batch<T: EthSpec> {
impl<T: EthSpec> Eq for Batch<T> {}
impl<T: EthSpec> Batch<T> {
pub fn new(
id: BatchId,
start_slot: Slot,
end_slot: Slot,
head_root: Hash256,
peer_id: PeerId,
) -> Self {
pub fn new(id: BatchId, start_slot: Slot, end_slot: Slot, peer_id: PeerId) -> Self {
Batch {
id,
start_slot,
end_slot,
head_root,
original_peer: peer_id.clone(),
current_peer: peer_id,
retries: 0,
@@ -84,7 +75,6 @@ impl<T: EthSpec> Batch<T> {
pub fn to_blocks_by_range_request(&self) -> BlocksByRangeRequest {
BlocksByRangeRequest {
head_block_root: self.head_root,
start_slot: self.start_slot.into(),
count: std::cmp::min(BLOCKS_PER_BATCH, self.end_slot.sub(self.start_slot).into()),
step: 1,

View File

@@ -449,7 +449,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
"end_slot" => batch.end_slot,
"id" => *batch.id,
"peer" => format!("{}", batch.current_peer),
"head_root"=> format!("{}", batch.head_root),
"retries" => batch.retries,
"re-processes" => batch.reprocess_retries);
self.send_batch(network, batch);
@@ -578,8 +577,7 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
"start_slot" => batch.start_slot,
"end_slot" => batch.end_slot,
"id" => *batch.id,
"peer" => format!("{:?}", batch.current_peer),
"head_root"=> format!("{}", batch.head_root));
"peer" => format!("{:?}", batch.current_peer));
self.send_batch(network, batch);
ProcessingResult::KeepChain
}
@@ -603,8 +601,7 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
"start_slot" => batch.start_slot,
"end_slot" => batch.end_slot,
"id" => *batch.id,
"peer" => format!("{}", batch.current_peer),
"head_root"=> format!("{}", batch.head_root));
"peer" => format!("{}", batch.current_peer));
// send the batch
self.send_batch(network, batch);
return true;
@@ -675,7 +672,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
batch_id,
batch_start_slot,
batch_end_slot,
self.target_head_root,
peer_id,
))
}