Skip to content

Commit a4aaa32

Browse files
committed
Remove more HTTP client code
1 parent 8a7a341 commit a4aaa32

3 files changed

Lines changed: 3 additions & 110 deletions

File tree

beacon_node/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ pub fn get_config<E: EthSpec>(
471471

472472
info!(
473473
deploy_block = eth2_network_config.deposit_contract_deploy_block,
474-
address = &format!("{:?}", spec.deposit_contract_address),
474+
address = ?spec.deposit_contract_address,
475475
"Deposit contract"
476476
);
477477

common/eth2/src/lib.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,18 +1682,6 @@ impl BeaconNodeHttpClient {
16821682
Ok(())
16831683
}
16841684

1685-
/// `GET beacon/deposit_snapshot`
1686-
pub async fn get_deposit_snapshot(&self) -> Result<Option<types::DepositTreeSnapshot>, Error> {
1687-
let mut path = self.eth_path(V1)?;
1688-
path.path_segments_mut()
1689-
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
1690-
.push("beacon")
1691-
.push("deposit_snapshot");
1692-
self.get_opt_with_timeout::<GenericResponse<_>, _>(path, self.timeouts.get_deposit_snapshot)
1693-
.await
1694-
.map(|opt| opt.map(|r| r.data))
1695-
}
1696-
16971685
/// `POST beacon/rewards/sync_committee`
16981686
pub async fn post_beacon_rewards_sync_committee(
16991687
&self,

common/eth2/src/lighthouse.rs

Lines changed: 2 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ pub mod sync_state;
77

88
use crate::{
99
lighthouse::sync_state::SyncState,
10-
types::{
11-
AdminPeer, DepositTreeSnapshot, Epoch, FinalizedExecutionBlock, GenericResponse,
12-
ValidatorId,
13-
},
14-
BeaconNodeHttpClient, DepositData, Error, Eth1Data, Hash256, Slot,
10+
types::{AdminPeer, Epoch, GenericResponse, ValidatorId},
11+
BeaconNodeHttpClient, DepositData, Error, Hash256, Slot,
1512
};
1613
use proto_array::core::ProtoArray;
1714
use serde::{Deserialize, Serialize};
@@ -159,18 +156,6 @@ pub struct ProcessHealth {
159156
pub pid_process_seconds_total: u64,
160157
}
161158

162-
/// Indicates how up-to-date the Eth1 caches are.
163-
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
164-
pub struct Eth1SyncStatusData {
165-
pub head_block_number: Option<u64>,
166-
pub head_block_timestamp: Option<u64>,
167-
pub latest_cached_block_number: Option<u64>,
168-
pub latest_cached_block_timestamp: Option<u64>,
169-
pub voting_target_timestamp: u64,
170-
pub eth1_node_sync_status_percentage: f64,
171-
pub lighthouse_is_cached_and_ready: bool,
172-
}
173-
174159
/// A fully parsed eth1 deposit contract log.
175160
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode)]
176161
pub struct DepositLog {
@@ -183,41 +168,6 @@ pub struct DepositLog {
183168
pub signature_is_valid: bool,
184169
}
185170

186-
/// A block of the eth1 chain.
187-
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode)]
188-
pub struct Eth1Block {
189-
pub hash: Hash256,
190-
pub timestamp: u64,
191-
pub number: u64,
192-
#[ssz(with = "four_byte_option_hash256")]
193-
pub deposit_root: Option<Hash256>,
194-
#[ssz(with = "four_byte_option_u64")]
195-
pub deposit_count: Option<u64>,
196-
}
197-
198-
impl Eth1Block {
199-
pub fn eth1_data(self) -> Option<Eth1Data> {
200-
Some(Eth1Data {
201-
deposit_root: self.deposit_root?,
202-
deposit_count: self.deposit_count?,
203-
block_hash: self.hash,
204-
})
205-
}
206-
}
207-
208-
impl From<Eth1Block> for FinalizedExecutionBlock {
209-
fn from(eth1_block: Eth1Block) -> Self {
210-
Self {
211-
deposit_count: eth1_block.deposit_count.unwrap_or(0),
212-
deposit_root: eth1_block
213-
.deposit_root
214-
.unwrap_or_else(|| DepositTreeSnapshot::default().deposit_root),
215-
block_hash: eth1_block.hash,
216-
block_height: eth1_block.number,
217-
}
218-
}
219-
}
220-
221171
impl BeaconNodeHttpClient {
222172
/// `GET lighthouse/health`
223173
pub async fn get_lighthouse_health(&self) -> Result<GenericResponse<Health>, Error> {
@@ -298,51 +248,6 @@ impl BeaconNodeHttpClient {
298248
self.get(path).await
299249
}
300250

301-
/// `GET lighthouse/eth1/syncing`
302-
pub async fn get_lighthouse_eth1_syncing(
303-
&self,
304-
) -> Result<GenericResponse<Eth1SyncStatusData>, Error> {
305-
let mut path = self.server.full.clone();
306-
307-
path.path_segments_mut()
308-
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
309-
.push("lighthouse")
310-
.push("eth1")
311-
.push("syncing");
312-
313-
self.get(path).await
314-
}
315-
316-
/// `GET lighthouse/eth1/block_cache`
317-
pub async fn get_lighthouse_eth1_block_cache(
318-
&self,
319-
) -> Result<GenericResponse<Vec<Eth1Block>>, Error> {
320-
let mut path = self.server.full.clone();
321-
322-
path.path_segments_mut()
323-
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
324-
.push("lighthouse")
325-
.push("eth1")
326-
.push("block_cache");
327-
328-
self.get(path).await
329-
}
330-
331-
/// `GET lighthouse/eth1/deposit_cache`
332-
pub async fn get_lighthouse_eth1_deposit_cache(
333-
&self,
334-
) -> Result<GenericResponse<Vec<DepositLog>>, Error> {
335-
let mut path = self.server.full.clone();
336-
337-
path.path_segments_mut()
338-
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
339-
.push("lighthouse")
340-
.push("eth1")
341-
.push("deposit_cache");
342-
343-
self.get(path).await
344-
}
345-
346251
/// `POST lighthouse/database/reconstruct`
347252
pub async fn post_lighthouse_database_reconstruct(&self) -> Result<String, Error> {
348253
let mut path = self.server.full.clone();

0 commit comments

Comments
 (0)