Skip to content

Commit 2c7310a

Browse files
committed
fix(l1): clippy lint — box large PersistMessage::Block variant, allow too_many_arguments
1 parent 79fbf2e commit 2c7310a

1 file changed

Lines changed: 47 additions & 9 deletions

File tree

crates/storage/store.rs

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@ impl Store {
17131713
// in-flight batches to ~1.
17141714
let (ack_tx, ack_rx) = sync_channel(1);
17151715
self.persist_tx
1716-
.send(PersistMessage::Block(BlockPersist {
1716+
.send(PersistMessage::Block(Box::new(BlockPersist {
17171717
blocks: blocks_with_receipts,
17181718
codes: code_updates,
17191719
parent_state_root,
@@ -1724,7 +1724,7 @@ impl Store {
17241724
block_number: last_block_number,
17251725
block_hash: last_block_hash,
17261726
ack: ack_tx,
1727-
}))
1727+
})))
17281728
.map_err(|e| StoreError::Custom(format!("failed to send block persist: {e}")))?;
17291729
ack_rx
17301730
.recv()
@@ -1916,6 +1916,7 @@ impl Store {
19161916
loop {
19171917
match rx.recv() {
19181918
Ok(PersistMessage::Block(bp)) => {
1919+
let bp = *bp;
19191920
// Stage block data (sole swapper of the buffer; codes
19201921
// are batch-level and attributed to the first block).
19211922
let staged = mutate_block_buffer(&persist_buffer, move |b| {
@@ -3656,7 +3657,7 @@ struct BlockPersist {
36563657
/// [`Store::wait_for_persistence_idle`]: the FIFO worker handles it only after
36573658
/// all earlier `Block` messages are fully processed.
36583659
enum PersistMessage {
3659-
Block(BlockPersist),
3660+
Block(Box<BlockPersist>),
36603661
Ping(std::sync::mpsc::SyncSender<Result<(), StoreError>>),
36613662
/// Graceful-shutdown handshake. Handled only after every earlier `Block`
36623663
/// (FIFO), so it both drains in-flight work and force-flushes the block-data
@@ -3802,6 +3803,7 @@ impl PendingTrieRoots {
38023803
/// Build the trie diff-layer, RCU-swap it into `trie_cache`, then clear the
38033804
/// pending root. Swap MUST precede the clear so a woken reader sees the layer.
38043805
/// On swap failure the root is still cleared so gated readers error, not deadlock.
3806+
#[allow(clippy::too_many_arguments)]
38053807
fn apply_trie_phase1(
38063808
trie_cache: &Arc<RwLock<Arc<TrieLayerCache>>>,
38073809
pending_roots: &PendingTrieRoots,
@@ -4532,7 +4534,13 @@ mod state_history_tests {
45324534
fn journal_entry_written_per_block_in_regular_mode() {
45334535
let backend: Arc<dyn StorageBackend> = Arc::new(InMemoryBackend::open().unwrap());
45344536
let dir = tempfile::tempdir().unwrap();
4535-
let store = Store::from_backend(backend.clone(), dir.path().to_path_buf(), 1, DEFAULT_PERSIST_CHANNEL_CAPACITY).unwrap();
4537+
let store = Store::from_backend(
4538+
backend.clone(),
4539+
dir.path().to_path_buf(),
4540+
1,
4541+
DEFAULT_PERSIST_CHANNEL_CAPACITY,
4542+
)
4543+
.unwrap();
45364544

45374545
let state_root_1 = H256::repeat_byte(0x11);
45384546
let block1 = make_block(1, H256::zero(), state_root_1);
@@ -4603,7 +4611,13 @@ mod state_history_tests {
46034611
fn journal_skipped_in_batch_mode() {
46044612
let backend: Arc<dyn StorageBackend> = Arc::new(InMemoryBackend::open().unwrap());
46054613
let dir = tempfile::tempdir().unwrap();
4606-
let store = Store::from_backend(backend.clone(), dir.path().to_path_buf(), 1, DEFAULT_PERSIST_CHANNEL_CAPACITY).unwrap();
4614+
let store = Store::from_backend(
4615+
backend.clone(),
4616+
dir.path().to_path_buf(),
4617+
1,
4618+
DEFAULT_PERSIST_CHANNEL_CAPACITY,
4619+
)
4620+
.unwrap();
46074621

46084622
let mut prev_hash = H256::zero();
46094623
for n in 1..=5u64 {
@@ -4636,7 +4650,13 @@ mod state_history_tests {
46364650
fn journal_storage_updates_appear_in_storage_diff() {
46374651
let backend: Arc<dyn StorageBackend> = Arc::new(InMemoryBackend::open().unwrap());
46384652
let dir = tempfile::tempdir().unwrap();
4639-
let store = Store::from_backend(backend.clone(), dir.path().to_path_buf(), 1, DEFAULT_PERSIST_CHANNEL_CAPACITY).unwrap();
4653+
let store = Store::from_backend(
4654+
backend.clone(),
4655+
dir.path().to_path_buf(),
4656+
1,
4657+
DEFAULT_PERSIST_CHANNEL_CAPACITY,
4658+
)
4659+
.unwrap();
46404660

46414661
let account_hash_a = H256::repeat_byte(0xa0);
46424662
let account_hash_b = H256::repeat_byte(0xb0);
@@ -4725,7 +4745,13 @@ mod state_history_tests {
47254745
async fn finality_advance_prunes_journal_below_boundary() {
47264746
let backend: Arc<dyn StorageBackend> = Arc::new(InMemoryBackend::open().unwrap());
47274747
let dir = tempfile::tempdir().unwrap();
4728-
let store = Store::from_backend(backend.clone(), dir.path().to_path_buf(), 1, DEFAULT_PERSIST_CHANNEL_CAPACITY).unwrap();
4748+
let store = Store::from_backend(
4749+
backend.clone(),
4750+
dir.path().to_path_buf(),
4751+
1,
4752+
DEFAULT_PERSIST_CHANNEL_CAPACITY,
4753+
)
4754+
.unwrap();
47294755

47304756
seed_journal_entries(&backend, &(1..=10).collect::<Vec<_>>());
47314757
for n in 1..=10 {
@@ -4756,7 +4782,13 @@ mod state_history_tests {
47564782
async fn finality_no_op_does_not_prune() {
47574783
let backend: Arc<dyn StorageBackend> = Arc::new(InMemoryBackend::open().unwrap());
47584784
let dir = tempfile::tempdir().unwrap();
4759-
let store = Store::from_backend(backend.clone(), dir.path().to_path_buf(), 1, DEFAULT_PERSIST_CHANNEL_CAPACITY).unwrap();
4785+
let store = Store::from_backend(
4786+
backend.clone(),
4787+
dir.path().to_path_buf(),
4788+
1,
4789+
DEFAULT_PERSIST_CHANNEL_CAPACITY,
4790+
)
4791+
.unwrap();
47604792

47614793
store
47624794
.forkchoice_update_inner(vec![], 100, H256::zero(), None, Some(5))
@@ -4799,7 +4831,13 @@ mod state_history_tests {
47994831
async fn malformed_finalized_returns_error_not_silent_zero() {
48004832
let backend: Arc<dyn StorageBackend> = Arc::new(InMemoryBackend::open().unwrap());
48014833
let dir = tempfile::tempdir().unwrap();
4802-
let store = Store::from_backend(backend.clone(), dir.path().to_path_buf(), 1, DEFAULT_PERSIST_CHANNEL_CAPACITY).unwrap();
4834+
let store = Store::from_backend(
4835+
backend.clone(),
4836+
dir.path().to_path_buf(),
4837+
1,
4838+
DEFAULT_PERSIST_CHANNEL_CAPACITY,
4839+
)
4840+
.unwrap();
48034841

48044842
// Plant a 4-byte (instead of 8-byte) FinalizedBlockNumber value.
48054843
let mut tx = backend.begin_write().unwrap();

0 commit comments

Comments
 (0)