Skip to content

Commit ac4bbb1

Browse files
committed
fixup clippy and fmt
1 parent dd4b377 commit ac4bbb1

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl BuilderConfig {
259259
}
260260

261261
/// Loads the Signet system constants for Pecorino.
262-
pub fn load_pecorino_constants(&self) -> SignetSystemConstants {
262+
pub const fn load_pecorino_constants(&self) -> SignetSystemConstants {
263263
let host = HostConfig::new(
264264
self.host_chain_id,
265265
149984,

src/tasks/block.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl BlockBuilder {
8181
mut bundle_receiver: mpsc::UnboundedReceiver<Bundle>,
8282
cache: SimCache,
8383
) -> JoinHandle<()> {
84-
let jh = tokio::spawn(async move {
84+
tokio::spawn(async move {
8585
loop {
8686
select! {
8787
maybe_tx = tx_receiver.recv() => {
@@ -96,8 +96,7 @@ impl BlockBuilder {
9696
}
9797
}
9898
}
99-
});
100-
jh
99+
})
101100
}
102101

103102
/// Spawns the block building task.
@@ -107,7 +106,7 @@ impl BlockBuilder {
107106
cache: SimCache,
108107
submit_sender: mpsc::UnboundedSender<BuiltBlock>,
109108
) -> JoinHandle<()> {
110-
let jh = tokio::spawn(async move {
109+
tokio::spawn(async move {
111110
loop {
112111
let sim_cache = cache.clone();
113112

@@ -126,8 +125,7 @@ impl BlockBuilder {
126125
}
127126
}
128127
}
129-
});
130-
jh
128+
})
131129
}
132130

133131
/// Returns the instant at which simulation must stop.

tests/block_builder_test.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ mod tests {
1717
};
1818
use tokio::{sync::mpsc::unbounded_channel, time::timeout};
1919

20+
/// Tests a single block build.
2021
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
2122
async fn test_handle_build() {
2223
setup_logging();
@@ -100,12 +101,12 @@ mod tests {
100101
let builder = Arc::new(BlockBuilder::new(&config, ru_provider.clone(), slot_calculator));
101102

102103
// Create a sim cache and start filling it with items
103-
let _ =
104-
builder.clone().spawn_cache_handler(tx_receiver, bundle_receiver, sim_cache.clone());
104+
builder.clone().spawn_cache_handler(tx_receiver, bundle_receiver, sim_cache.clone());
105105

106106
// Finally, Kick off the block builder task.
107-
let _ = builder.clone().spawn_builder_task(constants, sim_cache.clone(), block_sender);
107+
builder.clone().spawn_builder_task(constants, sim_cache.clone(), block_sender);
108108

109+
// Feed in transactions to the tx_sender and wait for the block to be simulated
109110
let tx_1 = new_signed_tx(&test_key_0, 0, U256::from(1_f64), 11_000).unwrap();
110111
let tx_2 = new_signed_tx(&test_key_1, 0, U256::from(2_f64), 10_000).unwrap();
111112
tx_sender.send(tx_1).unwrap();
@@ -114,8 +115,9 @@ mod tests {
114115
// Wait for a block with timeout
115116
let result = timeout(Duration::from_secs(5), block_receiver.recv()).await;
116117
assert!(result.is_ok(), "Did not receive block within 5 seconds");
118+
119+
// Assert on the block
117120
let block = result.unwrap();
118-
dbg!(&block);
119121
assert!(block.is_some(), "Block channel closed without receiving a block");
120122
assert!(block.unwrap().tx_count() == 2); // TODO: Why is this failing? I'm seeing EVM errors but haven't tracked them down yet.
121123
}

0 commit comments

Comments
 (0)