From d4dd9fae0751b27ab68d9220761ccd786be44abf Mon Sep 17 00:00:00 2001 From: Pawan Dhananjay Date: Mon, 29 Jun 2020 16:33:14 +0530 Subject: [PATCH] Fix BlocksByRootRequest min/max bounds calculation (#1312) --- beacon_node/eth2_libp2p/src/rpc/methods.rs | 2 +- beacon_node/eth2_libp2p/src/rpc/protocol.rs | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/beacon_node/eth2_libp2p/src/rpc/methods.rs b/beacon_node/eth2_libp2p/src/rpc/methods.rs index cae9b15265..8f9bf19e6d 100644 --- a/beacon_node/eth2_libp2p/src/rpc/methods.rs +++ b/beacon_node/eth2_libp2p/src/rpc/methods.rs @@ -188,7 +188,7 @@ pub struct BlocksByRangeRequest { } /// Request a number of beacon block bodies from a peer. -#[derive(Encode, Decode, Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq)] pub struct BlocksByRootRequest { /// The list of beacon block bodies being requested. pub block_roots: VariableList, diff --git a/beacon_node/eth2_libp2p/src/rpc/protocol.rs b/beacon_node/eth2_libp2p/src/rpc/protocol.rs index af16c812a0..58ef95460a 100644 --- a/beacon_node/eth2_libp2p/src/rpc/protocol.rs +++ b/beacon_node/eth2_libp2p/src/rpc/protocol.rs @@ -43,18 +43,16 @@ lazy_static! { } .as_ssz_bytes() .len(); - pub static ref BLOCKS_BY_ROOT_REQUEST_MIN: usize = BlocksByRootRequest { - block_roots: VariableList::::from(Vec::::new()) - } + pub static ref BLOCKS_BY_ROOT_REQUEST_MIN: usize = + VariableList::::from(Vec::::new()) .as_ssz_bytes() .len(); - pub static ref BLOCKS_BY_ROOT_REQUEST_MAX: usize = BlocksByRootRequest { - block_roots: VariableList::::from(vec![ + pub static ref BLOCKS_BY_ROOT_REQUEST_MAX: usize = + VariableList::::from(vec![ Hash256::zero(); MAX_REQUEST_BLOCKS as usize ]) - } .as_ssz_bytes() .len(); }