Skip to content

Commit

Permalink
touchups
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Dec 24, 2024
1 parent 7894c0d commit d3e56dd
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions crates/rpc/rpc-eth-types/src/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ where
CacheAction::GetBlockWithSenders { block_hash, response_tx } => {
if let Some(block) = this.full_block_cache.get(&block_hash).cloned() {
let _ = response_tx.send(Ok(Some(block)));
continue;
continue
}

// block is not in the cache, request it if this is the first consumer
Expand Down Expand Up @@ -427,7 +427,7 @@ where
// check if block is cached
if let Some(receipts) = this.receipts_cache.get(&block_hash).cloned() {
let _ = response_tx.send(Ok(Some(receipts)));
continue;
continue
}

// block is not in the cache, request it if this is the first consumer
Expand All @@ -452,7 +452,7 @@ where
// check if the header is cached
if let Some(header) = this.headers_cache.get(&block_hash).cloned() {
let _ = response_tx.send(Ok(header));
continue;
continue
}

// header is not in the cache, request it if this is the first
Expand Down
8 changes: 4 additions & 4 deletions crates/rpc/rpc-eth-types/src/fee_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl FeeHistoryCache {
if entries.len() == 0 {
self.inner.upper_bound.store(0, SeqCst);
self.inner.lower_bound.store(0, SeqCst);
return;
return
}

let upper_bound = *entries.last_entry().expect("Contains at least one entry").key();
Expand Down Expand Up @@ -152,7 +152,7 @@ impl FeeHistoryCache {
.collect::<Vec<_>>();

if result.is_empty() {
return None;
return None
}

Some(result)
Expand Down Expand Up @@ -245,7 +245,7 @@ pub async fn fee_history_cache_new_blocks_task<St, Provider, N>(
event = events.next() => {
let Some(event) = event else {
// the stream ended, we are done
break;
break
};

let committed = event.committed();
Expand Down Expand Up @@ -314,7 +314,7 @@ where
// Empty blocks should return in a zero row
if transactions.is_empty() {
rewards_in_block.push(0);
continue;
continue
}

let threshold = (gas_used as f64 * percentile / 100.) as u64;
Expand Down
10 changes: 5 additions & 5 deletions crates/rpc/rpc-eth-types/src/gas_oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ where

// if we have stored a last price, then we check whether or not it was for the same head
if inner.last_price.block_hash == header.hash() {
return Ok(inner.last_price.price);
return Ok(inner.last_price.price)
}

// if all responses are empty, then we can return a maximum of 2*check_block blocks' worth
Expand Down Expand Up @@ -177,7 +177,7 @@ where

// break when we have enough populated blocks
if populated_blocks >= self.oracle_config.blocks {
break;
break
}

current_hash = parent_hash;
Expand Down Expand Up @@ -247,14 +247,14 @@ where
// ignore transactions with a tip under the configured threshold
if let Some(ignore_under) = self.ignore_price {
if effective_tip < Some(ignore_under) {
continue;
continue
}
}

// check if the sender was the coinbase, if so, ignore
if let Some(sender) = tx.recover_signer() {
if sender == block.beneficiary() {
continue;
continue
}
}

Expand All @@ -264,7 +264,7 @@ where

// we have enough entries
if prices.len() >= limit {
break;
break
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-types/src/id_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn to_quantity(val: u128) -> SubscriptionId<'static> {
let non_zero = b.iter().take_while(|b| **b == 0).count();
let b = &b[non_zero..];
if b.is_empty() {
return SubscriptionId::Str("0x0".into());
return SubscriptionId::Str("0x0".into())
}

let mut id = String::with_capacity(2 * b.len() + 2);
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-types/src/logs_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub fn log_matches_filter(
!params.filter_address(&log.address) ||
!params.filter_topics(log.topics()))
{
return false;
return false
}
true
}
Expand Down
6 changes: 3 additions & 3 deletions crates/rpc/rpc-eth-types/src/revm_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ impl CallFees {
max_fee < block_base_fee
{
// `base_fee_per_gas` is greater than the `max_fee_per_gas`
return Err(RpcInvalidTransactionError::FeeCapTooLow.into());
return Err(RpcInvalidTransactionError::FeeCapTooLow.into())
}
if max_fee < max_priority_fee_per_gas {
return Err(
// `max_priority_fee_per_gas` is greater than the `max_fee_per_gas`
RpcInvalidTransactionError::TipAboveFeeCap.into(),
);
)
}
// ref <https://github.com/ethereum/go-ethereum/blob/0dd173a727dd2d2409b8e401b22e85d20c25b71f/internal/ethapi/transaction_args.go#L446-L446>
Ok(min(
Expand Down Expand Up @@ -179,7 +179,7 @@ impl CallFees {
// Ensure blob_hashes are present
if !has_blob_hashes {
// Blob transaction but no blob hashes
return Err(RpcInvalidTransactionError::BlobTransactionMissingBlobHashes.into());
return Err(RpcInvalidTransactionError::BlobTransactionMissingBlobHashes.into())
}

Ok(Self {
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-types/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::future::Future;
/// See [`alloy_eips::eip2718::Decodable2718::decode_2718`]
pub fn recover_raw_transaction<T: SignedTransaction>(mut data: &[u8]) -> EthResult<RecoveredTx<T>> {
if data.is_empty() {
return Err(EthApiError::EmptyRawTransactionData);
return Err(EthApiError::EmptyRawTransactionData)
}

let transaction =
Expand Down

0 comments on commit d3e56dd

Please sign in to comment.