Skip to content

Commit

Permalink
chore: rm redundant ( (paradigmxyz#10112)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Aug 5, 2024
1 parent 029d8ce commit 6008deb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions crates/engine/tree/src/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ where
// If the receiver errors then senders have disconnected, so the loop should then end.
while let Ok(action) = self.incoming.recv() {
match action {
PersistenceAction::RemoveBlocksAbove((new_tip_num, sender)) => {
PersistenceAction::RemoveBlocksAbove(new_tip_num, sender) => {
let provider_rw = self.provider.provider_rw()?;
let sf_provider = self.provider.static_file_provider();

Expand All @@ -71,7 +71,7 @@ where
// we ignore the error because the caller may or may not care about the result
let _ = sender.send(());
}
PersistenceAction::SaveBlocks((blocks, sender)) => {
PersistenceAction::SaveBlocks(blocks, sender) => {
let Some(last_block) = blocks.last() else {
let _ = sender.send(None);
continue
Expand All @@ -89,13 +89,13 @@ where
// we ignore the error because the caller may or may not care about the result
let _ = sender.send(Some(last_block_hash));
}
PersistenceAction::PruneBefore((block_num, sender)) => {
PersistenceAction::PruneBefore(block_num, sender) => {
let res = self.prune_before(block_num)?;

// we ignore the error because the caller may or may not care about the result
let _ = sender.send(res);
}
PersistenceAction::WriteTransactions((block, sender)) => {
PersistenceAction::WriteTransactions(block, sender) => {
unimplemented!()
// let (block_num, td) =
// self.write_transactions(block).expect("todo: handle errors");
Expand Down Expand Up @@ -130,24 +130,24 @@ pub enum PersistenceAction {
///
/// First, header, transaction, and receipt-related data should be written to static files.
/// Then the execution history-related data will be written to the database.
SaveBlocks((Vec<ExecutedBlock>, oneshot::Sender<Option<B256>>)),
SaveBlocks(Vec<ExecutedBlock>, oneshot::Sender<Option<B256>>),

/// The given block has been added to the canonical chain, its transactions and headers will be
/// persisted for durability.
///
/// This will first append the header and transactions to static files, then update the
/// checkpoints for headers and block bodies in the database.
WriteTransactions((Arc<SealedBlock>, oneshot::Sender<()>)),
WriteTransactions(Arc<SealedBlock>, oneshot::Sender<()>),

/// Removes block data above the given block number from the database.
///
/// This will first update checkpoints from the database, then remove actual block data from
/// static files.
RemoveBlocksAbove((u64, oneshot::Sender<()>)),
RemoveBlocksAbove(u64, oneshot::Sender<()>),

/// Prune associated block data before the given block number, according to already-configured
/// prune modes.
PruneBefore((u64, oneshot::Sender<PrunerOutput>)),
PruneBefore(u64, oneshot::Sender<PrunerOutput>),
}

/// A handle to the persistence service
Expand Down Expand Up @@ -206,7 +206,7 @@ impl PersistenceHandle {
blocks: Vec<ExecutedBlock>,
tx: oneshot::Sender<Option<B256>>,
) -> Result<(), SendError<PersistenceAction>> {
self.send_action(PersistenceAction::SaveBlocks((blocks, tx)))
self.send_action(PersistenceAction::SaveBlocks(blocks, tx))
}

/// Tells the persistence service to remove blocks above a certain block number. The removed
Expand All @@ -218,7 +218,7 @@ impl PersistenceHandle {
block_num: u64,
tx: oneshot::Sender<()>,
) -> Result<(), SendError<PersistenceAction>> {
self.send_action(PersistenceAction::RemoveBlocksAbove((block_num, tx)))
self.send_action(PersistenceAction::RemoveBlocksAbove(block_num, tx))
}

/// Tells the persistence service to remove block data before the given hash, according to the
Expand All @@ -230,7 +230,7 @@ impl PersistenceHandle {
block_num: u64,
tx: oneshot::Sender<PrunerOutput>,
) -> Result<(), SendError<PersistenceAction>> {
self.send_action(PersistenceAction::PruneBefore((block_num, tx)))
self.send_action(PersistenceAction::PruneBefore(block_num, tx))
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,7 @@ mod tests {

let received_action =
test_harness.action_rx.recv().expect("Failed to receive save blocks action");
if let PersistenceAction::SaveBlocks((saved_blocks, _)) = received_action {
if let PersistenceAction::SaveBlocks(saved_blocks, _) = received_action {
// only blocks.len() - tree_config.persistence_threshold() will be
// persisted
let expected_persist_len = blocks.len() - tree_config.persistence_threshold() as usize;
Expand Down

0 comments on commit 6008deb

Please sign in to comment.