Skip to content

Commit d653aa0

Browse files
committed
just fix
1 parent 1c7d570 commit d653aa0

File tree

9 files changed

+51
-75
lines changed

9 files changed

+51
-75
lines changed

crates/simulator/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ async fn init_dependencies<Node>(
4747
database_url: String,
4848
kafka_brokers: String,
4949
kafka_topic: String,
50-
) -> Result<ListenerDependencies<BundleSimulatorImpl<RethSimulationEngine<Node>, TipsSimulationPublisher>>>
50+
) -> Result<
51+
ListenerDependencies<BundleSimulatorImpl<RethSimulationEngine<Node>, TipsSimulationPublisher>>,
52+
>
5153
where
5254
Node: FullNodeComponents,
5355
<Node as FullNodeComponents>::Evm: ConfigureEvm<NextBlockEnvCtx = OpNextBlockEnvAttributes>,
@@ -128,10 +130,8 @@ where
128130
)
129131
.await?;
130132

131-
let shared_worker_pool = SimulationWorkerPool::new(
132-
Arc::new(dependencies.simulator),
133-
max_concurrent_simulations,
134-
);
133+
let shared_worker_pool =
134+
SimulationWorkerPool::new(Arc::new(dependencies.simulator), max_concurrent_simulations);
135135

136136
let exex_listener = ExExEventListener::new(
137137
exex_ctx,

crates/simulator/tests/bundle_simulator_impl_test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,3 @@ async fn test_bundle_simulator_impl_various_error_types() {
175175
}
176176
}
177177
}
178-

crates/simulator/tests/common/builders.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![allow(dead_code)]
22

33
/// Test data builders for creating complex test scenarios
4-
54
use alloy_primitives::{Address, Bytes, B256, U256};
65
use alloy_rpc_types_mev::EthSendBundle;
76
use std::collections::HashMap;
@@ -51,8 +50,6 @@ impl TestBundleBuilder {
5150
self
5251
}
5352

54-
55-
5653
pub fn build(self) -> EthSendBundle {
5754
EthSendBundle {
5855
txs: self.txs,
@@ -255,7 +252,6 @@ impl ScenarioBuilder {
255252
self
256253
}
257254

258-
259255
pub fn add_simple_bundle(mut self, num_txs: usize) -> Self {
260256
let mut builder = TestBundleBuilder::new().with_block_number(self.block_number);
261257

@@ -279,4 +275,3 @@ impl ScenarioBuilder {
279275
.collect()
280276
}
281277
}
282-

crates/simulator/tests/common/fixtures.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![allow(dead_code)]
22

33
/// Test fixtures and pre-configured test data
4-
54
use alloy_primitives::Bytes;
65
use alloy_rpc_types_mev::EthSendBundle;
76

@@ -63,7 +62,6 @@ pub mod transactions {
6362
0x50, 0x60, 0x70, 0x80,
6463
])
6564
}
66-
6765
}
6866

6967
/// Pre-configured bundles for testing
@@ -89,7 +87,6 @@ pub mod bundles {
8987
.build()
9088
}
9189

92-
9390
/// Large bundle for stress testing
9491
pub fn large_bundle(num_txs: usize) -> EthSendBundle {
9592
let mut builder = TestBundleBuilder::new().with_block_number(blocks::BLOCK_18M);
@@ -101,7 +98,6 @@ pub mod bundles {
10198

10299
builder.build()
103100
}
104-
105101
}
106102

107103
/// Test scenarios combining multiple fixtures
@@ -143,4 +139,3 @@ pub mod scenarios {
143139
}
144140
}
145141
}
146-

crates/simulator/tests/common/mock_bundle_simulator.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ impl MockBundleSimulator {
1919
pub fn new(engine: MockSimulationEngine, publisher: MockSimulationPublisher) -> Self {
2020
Self { engine, publisher }
2121
}
22-
23-
2422
}
2523

2624
#[async_trait]
@@ -56,4 +54,3 @@ impl BundleSimulator for MockBundleSimulator {
5654
Ok(())
5755
}
5856
}
59-

crates/simulator/tests/common/mocks.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![allow(dead_code)]
22

33
/// Reusable mock implementations for testing
4-
54
use alloy_primitives::{Address, U256};
65
use async_trait::async_trait;
76
use std::collections::HashMap;
@@ -44,7 +43,6 @@ impl MockSimulationEngine {
4443
self
4544
}
4645

47-
4846
pub fn simulation_count(&self) -> usize {
4947
self.simulations.lock().unwrap().len()
5048
}
@@ -129,7 +127,6 @@ impl MockSimulationPublisher {
129127
pub fn published_count(&self) -> usize {
130128
self.published.lock().unwrap().len()
131129
}
132-
133130
}
134131

135132
#[async_trait]

crates/simulator/tests/common/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![allow(dead_code)]
22

33
/// Common test utilities and infrastructure for simulator testing
4-
54
pub mod builders;
65
pub mod fixtures;
76
pub mod mock_bundle_simulator;
@@ -13,7 +12,6 @@ use std::collections::HashMap;
1312
use tips_simulator::types::{SimulationRequest, SimulationResult};
1413
use uuid::Uuid;
1514

16-
1715
/// Helper to create a simple test bundle
1816
pub fn create_test_bundle(num_txs: usize, block_number: u64) -> EthSendBundle {
1917
let mut txs = Vec::new();
@@ -83,7 +81,4 @@ pub mod assertions {
8381
"Successful simulation should not have error"
8482
);
8583
}
86-
87-
8884
}
89-

crates/simulator/tests/publisher_test.rs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/// Unit tests for the SimulationPublisher implementation
22
mod common;
33

4-
use common::builders::*;
54
use alloy_primitives::{Address, B256, U256};
5+
use common::builders::*;
66
use std::collections::HashMap;
77

88
// These tests focus on the logic that can be tested without requiring
@@ -12,16 +12,16 @@ use std::collections::HashMap;
1212
async fn test_state_diff_conversion_logic() {
1313
// Test the state diff conversion logic that TipsSimulationPublisher uses
1414
let mut original_state_diff = HashMap::new();
15-
15+
1616
// Create test data with multiple accounts and storage slots
1717
for i in 0..3 {
1818
let addr = Address::random();
1919
let mut storage = HashMap::new();
20-
20+
2121
for j in 0..5 {
2222
storage.insert(U256::from(i * 10 + j), U256::from((i + 1) * 100 + j));
2323
}
24-
24+
2525
original_state_diff.insert(addr, storage);
2626
}
2727

@@ -39,12 +39,12 @@ async fn test_state_diff_conversion_logic() {
3939

4040
// Verify conversion
4141
assert_eq!(converted.len(), original_state_diff.len());
42-
42+
4343
for (address, original_storage) in &original_state_diff {
4444
assert!(converted.contains_key(address));
4545
let converted_storage = &converted[address];
4646
assert_eq!(converted_storage.len(), original_storage.len());
47-
47+
4848
for (key, value) in original_storage {
4949
let key_bytes = key.to_be_bytes::<32>();
5050
let storage_key = B256::from(key_bytes);
@@ -53,21 +53,20 @@ async fn test_state_diff_conversion_logic() {
5353
}
5454
}
5555

56-
5756
#[test]
5857
fn test_large_state_diff_handling() {
5958
// Test handling of large state diffs
6059
let mut large_state_diff = HashMap::new();
61-
60+
6261
// Create a large state diff with many accounts and storage slots
6362
for i in 0..100 {
6463
let addr = Address::random();
6564
let mut storage = HashMap::new();
66-
65+
6766
for j in 0..50 {
6867
storage.insert(U256::from(i * 1000 + j), U256::from(j * 12345));
6968
}
70-
69+
7170
large_state_diff.insert(addr, storage);
7271
}
7372

@@ -90,8 +89,6 @@ fn test_large_state_diff_handling() {
9089
}
9190
}
9291

93-
94-
9592
#[test]
9693
fn test_execution_time_bounds() {
9794
// Test execution time edge cases
@@ -106,26 +103,28 @@ fn test_execution_time_bounds() {
106103
let result = SimulationResultBuilder::successful()
107104
.with_execution_time_us(execution_time)
108105
.build();
109-
110-
assert_eq!(result.execution_time_us, execution_time, "Failed for: {}", description);
106+
107+
assert_eq!(
108+
result.execution_time_us, execution_time,
109+
"Failed for: {}",
110+
description
111+
);
111112
}
112113
}
113114

114-
115-
116115
#[test]
117116
fn test_multiple_addresses_same_storage() {
118117
// Test multiple addresses with the same storage patterns
119118
let addresses = vec![Address::random(), Address::random(), Address::random()];
120119
let mut state_diff = HashMap::new();
121-
120+
122121
for addr in &addresses {
123122
let mut storage = HashMap::new();
124123
storage.insert(U256::from(1), U256::from(100));
125124
storage.insert(U256::from(2), U256::from(200));
126125
state_diff.insert(*addr, storage);
127126
}
128-
127+
129128
// Convert
130129
let mut converted = HashMap::new();
131130
for (address, storage) in &state_diff {
@@ -137,7 +136,7 @@ fn test_multiple_addresses_same_storage() {
137136
}
138137
converted.insert(*address, storage_map);
139138
}
140-
139+
141140
assert_eq!(converted.len(), 3);
142141
for addr in &addresses {
143142
assert!(converted.contains_key(addr));

0 commit comments

Comments
 (0)