mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: more clippy fixes
This commit is contained in:
@ -99,7 +99,7 @@ fn system_tx_to_reth_transaction(transaction: &SystemTx, chain_id: u64) -> TxSig
|
|||||||
break spot.to_s();
|
break spot.to_s();
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("Contract not found: {:?} from spot mapping, fetching again...", to);
|
info!("Contract not found: {to:?} from spot mapping, fetching again...");
|
||||||
*EVM_MAP.write().unwrap() = erc20_contract_to_spot_token(chain_id).unwrap();
|
*EVM_MAP.write().unwrap() = erc20_contract_to_spot_token(chain_id).unwrap();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -71,7 +71,7 @@ pub async fn start_pseudo_peer(
|
|||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
Some(event) = tokio_stream::StreamExt::next(&mut network_events) => {
|
Some(event) = tokio_stream::StreamExt::next(&mut network_events) => {
|
||||||
info!("Network event: {:?}", event);
|
info!("Network event: {event:?}");
|
||||||
if matches!(event, NetworkEvent::ActivePeerSession { .. }) && first {
|
if matches!(event, NetworkEvent::ActivePeerSession { .. }) && first {
|
||||||
start_tx.send(()).await?;
|
start_tx.send(()).await?;
|
||||||
first = false;
|
first = false;
|
||||||
|
|||||||
@ -204,10 +204,10 @@ impl<BS: BlockSource> PseudoPeer<BS> {
|
|||||||
let _ = response.send(Ok(BlockBodies(block_bodies)));
|
let _ = response.send(Ok(BlockBodies(block_bodies)));
|
||||||
}
|
}
|
||||||
IncomingEthRequest::GetNodeData { .. } => {
|
IncomingEthRequest::GetNodeData { .. } => {
|
||||||
debug!("GetNodeData request: {:?}", eth_req);
|
debug!("GetNodeData request: {eth_req:?}");
|
||||||
}
|
}
|
||||||
eth_req => {
|
eth_req => {
|
||||||
debug!("New eth protocol request: {:?}", eth_req);
|
debug!("New eth protocol request: {eth_req:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -232,7 +232,7 @@ impl<BS: BlockSource> PseudoPeer<BS> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
panic!("Hash not found: {:?}", hash);
|
panic!("Hash not found: {hash:?}");
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn fallback_to_official_rpc(&self, hash: B256) -> eyre::Result<u64> {
|
async fn fallback_to_official_rpc(&self, hash: B256) -> eyre::Result<u64> {
|
||||||
@ -243,7 +243,7 @@ impl<BS: BlockSource> PseudoPeer<BS> {
|
|||||||
use jsonrpsee::http_client::HttpClientBuilder;
|
use jsonrpsee::http_client::HttpClientBuilder;
|
||||||
use jsonrpsee_core::client::ClientT;
|
use jsonrpsee_core::client::ClientT;
|
||||||
|
|
||||||
debug!("Fallback to official RPC: {:?}", hash);
|
debug!("Fallback to official RPC: {hash:?}");
|
||||||
let client = HttpClientBuilder::default().build("https://rpc.hyperliquid.xyz/evm").unwrap();
|
let client = HttpClientBuilder::default().build("https://rpc.hyperliquid.xyz/evm").unwrap();
|
||||||
let target_block: Block = client.request("eth_getBlockByHash", (hash, false)).await?;
|
let target_block: Block = client.request("eth_getBlockByHash", (hash, false)).await?;
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ impl<BS: BlockSource> PseudoPeer<BS> {
|
|||||||
latest: u64,
|
latest: u64,
|
||||||
) -> eyre::Result<Option<u64>> {
|
) -> eyre::Result<Option<u64>> {
|
||||||
let chunk_size = self.block_source.recommended_chunk_size();
|
let chunk_size = self.block_source.recommended_chunk_size();
|
||||||
debug!("Hash not found, backfilling... {:?}", target_hash);
|
debug!("Hash not found, backfilling... {target_hash:?}");
|
||||||
|
|
||||||
const TRY_OFFICIAL_RPC_THRESHOLD: usize = 20;
|
const TRY_OFFICIAL_RPC_THRESHOLD: usize = 20;
|
||||||
for (iteration, end) in (1..=latest).rev().step_by(chunk_size as usize).enumerate() {
|
for (iteration, end) in (1..=latest).rev().step_by(chunk_size as usize).enumerate() {
|
||||||
@ -293,13 +293,13 @@ impl<BS: BlockSource> PseudoPeer<BS> {
|
|||||||
return Ok(Some(block_number));
|
return Ok(Some(block_number));
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!("Fallback to official RPC failed: {:?}", e);
|
debug!("Fallback to official RPC failed: {e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("Hash not found: {:?}, retrying from the latest block...", target_hash);
|
debug!("Hash not found: {target_hash:?}, retrying from the latest block...");
|
||||||
Ok(None) // Not found
|
Ok(None) // Not found
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ impl<BS: BlockSource> PseudoPeer<BS> {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("Backfilling from {} to {}", start_number, end_number);
|
debug!("Backfilling from {start_number} to {end_number}");
|
||||||
|
|
||||||
// Collect blocks and cache them
|
// Collect blocks and cache them
|
||||||
let blocks = self.collect_blocks(uncached_block_numbers).await;
|
let blocks = self.collect_blocks(uncached_block_numbers).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user