diff --git a/beacon_node/beacon_chain/src/eth1_chain.rs b/beacon_node/beacon_chain/src/eth1_chain.rs index a9819eab1f..6359a5cd93 100644 --- a/beacon_node/beacon_chain/src/eth1_chain.rs +++ b/beacon_node/beacon_chain/src/eth1_chain.rs @@ -205,20 +205,31 @@ impl Eth1ChainBackend for CachingEth1Backend { let blocks = self.core.blocks().read(); - let eth1_data = eth1_data_sets(blocks.iter(), state, prev_eth1_hash, spec) - .map(|(new_eth1_data, all_eth1_data)| { - collect_valid_votes(state, new_eth1_data, all_eth1_data) - }) - .and_then(find_winning_vote) - .unwrap_or_else(|| { + let (new_eth1_data, all_eth1_data) = + if let Some(sets) = eth1_data_sets(blocks.iter(), state, prev_eth1_hash, spec) { + sets + } else { crit!( self.log, - "Unable to cast valid vote for Eth1Data"; - "hint" => "check connection to eth1 node", - "reason" => "no votes", + "Unable to find eth1 data sets"; + "outcome" => "casting random eth1 vote" ); - random_eth1_data() - }); + return Ok(random_eth1_data()); + }; + + let valid_votes = collect_valid_votes(state, new_eth1_data, all_eth1_data); + + let eth1_data = if let Some(eth1_data) = find_winning_vote(valid_votes) { + eth1_data + } else { + crit!( + self.log, + "Unable to find a winning eth1 vote"; + "outcome" => "casting random eth1 vote" + ); + + return Ok(random_eth1_data()); + }; Ok(eth1_data) } diff --git a/beacon_node/eth1/src/service.rs b/beacon_node/eth1/src/service.rs index 8a9be6b896..bf88491103 100644 --- a/beacon_node/eth1/src/service.rs +++ b/beacon_node/eth1/src/service.rs @@ -220,6 +220,8 @@ impl Service { { let log_a = self.log.clone(); let log_b = self.log.clone(); + let inner_1 = self.inner.clone(); + let inner_2 = self.inner.clone(); let deposit_future = self .update_deposit_cache() @@ -229,6 +231,7 @@ impl Service { Ok(DepositCacheUpdateOutcome::Success { logs_imported }) => trace!( log_a, "Updated eth1 deposit cache"; + "cached_deposits" => inner_1.deposit_cache.read().cache.len(), "logs_imported" => logs_imported, ), Err(e) => error!( @@ -252,6 +255,7 @@ impl Service { }) => trace!( log_b, "Updated eth1 block cache"; + "cached_blocks" => inner_2.block_cache.read().len(), "blocks_imported" => blocks_imported, "head_block" => head_block_number, ), diff --git a/beacon_node/rest_api/src/router.rs b/beacon_node/rest_api/src/router.rs index 35bde8eed9..ada832f089 100644 --- a/beacon_node/rest_api/src/router.rs +++ b/beacon_node/rest_api/src/router.rs @@ -154,7 +154,7 @@ pub fn route( // (e.g., a response with a 404 or 500 status). request_result.then(move |result| match result { Ok(response) => { - debug!(local_log, "Request successful: {:?}", path); + debug!(local_log, "HTTP API request successful"; "path" => path); metrics::inc_counter(&metrics::SUCCESS_COUNT); metrics::stop_timer(timer); @@ -163,7 +163,7 @@ pub fn route( Err(e) => { let error_response = e.into(); - debug!(local_log, "Request failure: {:?}", path); + debug!(local_log, "HTTP API request failure"; "path" => path); metrics::stop_timer(timer); Ok(error_response)