Skip to content

Commit fa5ec8c

Browse files
committed
Fix clippy warnings and apply nightly fmt
- Add missing doc comments for bundle state clone metrics - Remove unused crate dependencies (alloy-sol-types, op-alloy-consensus, revm) - Fix collapsible_if lint in flashblock_trie_cache.rs - Add Debug derive to MeteringApiImpl - Export MeterBundleOutput from public API
1 parent 8e88f61 commit fa5ec8c

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/flashblocks/src/metrics.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ pub struct Metrics {
5757
#[metric(describe = "Total number of WebSocket reconnection attempts")]
5858
pub reconnect_attempts: Counter,
5959

60+
/// Time taken to clone bundle state.
6061
#[metric(describe = "Time taken to clone bundle state")]
6162
pub bundle_state_clone_duration: Histogram,
6263

64+
/// Size of bundle state being cloned (number of accounts).
6365
#[metric(describe = "Size of bundle state being cloned (number of accounts)")]
6466
pub bundle_state_clone_size: Histogram,
6567
}

crates/rpc/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ alloy-consensus.workspace = true
3535
alloy-eips.workspace = true
3636
alloy-rpc-types.workspace = true
3737
alloy-rpc-types-eth.workspace = true
38-
alloy-sol-types.workspace = true
3938

4039
# op-alloy
41-
op-alloy-consensus.workspace = true
4240
op-alloy-rpc-types.workspace = true
4341
op-alloy-network.workspace = true
4442

@@ -47,7 +45,6 @@ tokio.workspace = true
4745
tokio-stream.workspace = true
4846

4947
# revm
50-
revm.workspace = true
5148
revm-database.workspace = true
5249

5350
# rpc

crates/rpc/src/base/flashblock_trie_cache.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ use crate::FlashblocksState;
1616
/// each bundle's state root time reflects only its own I/O cost.
1717
#[derive(Debug, Clone)]
1818
pub struct FlashblockTrieData {
19+
/// The trie updates from computing the state root.
1920
pub trie_updates: TrieUpdates,
21+
/// The hashed post state used for state root computation.
2022
pub hashed_state: HashedPostState,
2123
}
2224

@@ -61,10 +63,11 @@ impl FlashblockTrieCache {
6163
canonical_state_provider: &dyn StateProvider,
6264
) -> EyreResult<FlashblockTrieData> {
6365
let cached_entry = self.cache.load();
64-
if let Some(cached) = cached_entry.as_ref() {
65-
if cached.block_hash == block_hash && cached.flashblock_index == flashblock_index {
66-
return Ok(cached.trie_data.clone());
67-
}
66+
if let Some(cached) = cached_entry.as_ref()
67+
&& cached.block_hash == block_hash
68+
&& cached.flashblock_index == flashblock_index
69+
{
70+
return Ok(cached.trie_data.clone());
6871
}
6972

7073
let hashed_state =

crates/rpc/src/base/meter_rpc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ use tracing::{error, info};
1313

1414
use crate::{FlashblockTrieCache, MeteringApiServer, meter_bundle};
1515

16-
/// Implementation of the metering RPC API
16+
/// Implementation of the metering RPC API.
17+
#[derive(Debug)]
1718
pub struct MeteringApiImpl<Provider, FB> {
1819
provider: Provider,
1920
flashblocks_state: Arc<FB>,

crates/rpc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub use tips_core::types::{Bundle, MeterBundleResponse, TransactionResult};
99
mod base;
1010
pub use base::{
1111
flashblock_trie_cache::{FlashblockTrieCache, FlashblockTrieData},
12-
meter::{FlashblocksState, meter_bundle},
12+
meter::{FlashblocksState, MeterBundleOutput, meter_bundle},
1313
meter_rpc::MeteringApiImpl,
1414
pubsub::{EthPubSub, EthPubSubApiServer},
1515
traits::{MeteringApiServer, TransactionStatusApiServer},

crates/runner/src/extensions/rpc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ impl BaseNodeExtension for BaseRpcExtension {
7474
// Metering API requires flashblocks state to access pending blocks for bundle simulation
7575
if metering_enabled {
7676
info!(message = "Starting Metering RPC");
77-
let metering_api =
78-
MeteringApiImpl::new(ctx.provider().clone(), fb.clone());
77+
let metering_api = MeteringApiImpl::new(ctx.provider().clone(), fb.clone());
7978
ctx.modules.merge_configured(metering_api.into_rpc())?;
8079
}
8180

0 commit comments

Comments
 (0)