From ee199bb5db2683602f686db1b6b88ee5f5daeaf9 Mon Sep 17 00:00:00 2001 From: rakita Date: Fri, 12 Jan 2024 12:38:41 +0100 Subject: [PATCH] fmt: run nightly-2023-10-15 and remove semicolons (#6035) --- .../commands/debug_cmd/in_memory_merkle.rs | 2 +- bin/reth/src/commands/debug_cmd/merkle.rs | 6 +- crates/blockchain-tree/src/blockchain_tree.rs | 2 +- crates/consensus/beacon/src/engine/mod.rs | 88 +++++++++---------- .../consensus/beacon/src/engine/test_utils.rs | 4 +- crates/net/eth-wire/src/test_utils.rs | 2 +- crates/net/network/src/manager.rs | 6 +- crates/net/network/src/swarm.rs | 22 ++--- crates/net/network/tests/it/multiplex.rs | 16 ++-- crates/payload/validator/src/lib.rs | 2 +- crates/primitives/src/block.rs | 2 +- crates/primitives/src/header.rs | 4 +- crates/primitives/src/receipt.rs | 6 +- crates/revm/src/optimism/processor.rs | 6 +- crates/revm/src/processor.rs | 16 ++-- crates/rpc/rpc/src/eth/api/pending_block.rs | 2 +- crates/stages/src/pipeline/mod.rs | 14 +-- crates/stages/src/stages/execution.rs | 10 +-- crates/stages/src/stages/hashing_account.rs | 6 +- crates/storage/codecs/src/lib.rs | 8 +- .../storage/db/src/implementation/mdbx/mod.rs | 2 +- .../provider/src/providers/database/mod.rs | 2 +- .../src/providers/database/provider.rs | 46 +++++----- .../src/providers/snapshot/manager.rs | 2 +- .../provider/src/test_utils/executor.rs | 4 +- crates/transaction-pool/src/pool/txpool.rs | 46 +++++----- testing/ef-tests/src/cases/blockchain_test.rs | 2 +- 27 files changed, 161 insertions(+), 167 deletions(-) diff --git a/bin/reth/src/commands/debug_cmd/in_memory_merkle.rs b/bin/reth/src/commands/debug_cmd/in_memory_merkle.rs index b15b71b1a..32c208e64 100644 --- a/bin/reth/src/commands/debug_cmd/in_memory_merkle.rs +++ b/bin/reth/src/commands/debug_cmd/in_memory_merkle.rs @@ -190,7 +190,7 @@ impl Command { if in_memory_state_root == block.state_root { info!(target: "reth::cli", state_root = ?in_memory_state_root, "Computed in-memory state root matches"); - return Ok(()); + return Ok(()) } let provider_rw = factory.provider_rw()?; diff --git a/bin/reth/src/commands/debug_cmd/merkle.rs b/bin/reth/src/commands/debug_cmd/merkle.rs index ac2f6c771..ee575830a 100644 --- a/bin/reth/src/commands/debug_cmd/merkle.rs +++ b/bin/reth/src/commands/debug_cmd/merkle.rs @@ -178,7 +178,7 @@ impl Command { Ok(senders) => senders, Err(err) => { warn!(target: "reth::cli", "Error sealing block with senders: {err:?}. Skipping..."); - continue; + continue } }; provider_rw.insert_block(sealed_block, None)?; @@ -278,7 +278,7 @@ impl Command { let clean_result = merkle_stage.execute(&provider_rw, clean_input); assert!(clean_result.is_ok(), "Clean state root calculation failed"); if clean_result.unwrap().done { - break; + break } } @@ -344,7 +344,7 @@ impl Command { clean.1.nibbles.len() > self.skip_node_depth.unwrap_or_default() { first_mismatched_storage = Some((incremental, clean)); - break; + break } } (Some(incremental), None) => { diff --git a/crates/blockchain-tree/src/blockchain_tree.rs b/crates/blockchain-tree/src/blockchain_tree.rs index 8f460a04b..10fefc611 100644 --- a/crates/blockchain-tree/src/blockchain_tree.rs +++ b/crates/blockchain-tree/src/blockchain_tree.rs @@ -1189,7 +1189,7 @@ impl BlockchainTree { block_number: tip.number, block_hash: tip.hash, }, - )))); + )))) } self.metrics.trie_updates_insert_recomputed.increment(1); trie_updates diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 5f55814c6..fe759d3cb 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -339,21 +339,21 @@ where ) -> RethResult { trace!(target: "consensus::engine", ?state, "Received new forkchoice state update"); if state.head_block_hash.is_zero() { - return Ok(OnForkChoiceUpdated::invalid_state()); + return Ok(OnForkChoiceUpdated::invalid_state()) } // check if the new head hash is connected to any ancestor that we previously marked as // invalid let lowest_buffered_ancestor_fcu = self.lowest_buffered_ancestor_or(state.head_block_hash); if let Some(status) = self.check_invalid_ancestor(lowest_buffered_ancestor_fcu) { - return Ok(OnForkChoiceUpdated::with_invalid(status)); + return Ok(OnForkChoiceUpdated::with_invalid(status)) } if self.sync.is_pipeline_active() { // We can only process new forkchoice updates if the pipeline is idle, since it requires // exclusive access to the database trace!(target: "consensus::engine", "Pipeline is syncing, skipping forkchoice update"); - return Ok(OnForkChoiceUpdated::syncing()); + return Ok(OnForkChoiceUpdated::syncing()) } if let Some(hook) = self.hooks.active_db_write_hook() { @@ -365,7 +365,7 @@ where "Hook is in progress, skipping forkchoice update. \ This may affect the performance of your node as a validator." ); - return Ok(OnForkChoiceUpdated::syncing()); + return Ok(OnForkChoiceUpdated::syncing()) } let start = Instant::now(); @@ -434,7 +434,7 @@ where // attributes if let Some(invalid_fcu_response) = self.ensure_consistent_state(state)? { trace!(target: "consensus::engine", ?state, head=?state.head_block_hash, "Forkchoice state is inconsistent, returning invalid response"); - return Ok(invalid_fcu_response); + return Ok(invalid_fcu_response) } // the CL requested to build a new payload on top of this new VALID head @@ -445,7 +445,7 @@ where ); trace!(target: "consensus::engine", status = ?payload_response, ?state, "Returning forkchoice status"); - return Ok(payload_response); + return Ok(payload_response) } PayloadStatus::new(PayloadStatusEnum::Valid, Some(state.head_block_hash)) @@ -454,7 +454,7 @@ where if let RethError::Canonical(ref err) = error { if err.is_fatal() { tracing::error!(target: "consensus::engine", ?err, "Encountered fatal error"); - return Err(error); + return Err(error) } } @@ -466,7 +466,7 @@ where self.ensure_consistent_state_with_status(state, &status)? { trace!(target: "consensus::engine", ?status, ?state, "Forkchoice state is inconsistent, returning invalid response"); - return Ok(invalid_fcu_response); + return Ok(invalid_fcu_response) } trace!(target: "consensus::engine", ?status, ?state, "Returning forkchoice status"); @@ -494,11 +494,11 @@ where // FCU resulted in a fatal error from which we can't recover let err = err.clone(); let _ = tx.send(Err(error)); - return OnForkchoiceUpdateOutcome::Fatal(err); + return OnForkchoiceUpdateOutcome::Fatal(err) } } let _ = tx.send(Err(error)); - return OnForkchoiceUpdateOutcome::Processed; + return OnForkchoiceUpdateOutcome::Processed } }; @@ -523,7 +523,7 @@ where if self.sync.has_reached_max_block(tip_number) { // Terminate the sync early if it's reached the maximum user // configured block. - return OnForkchoiceUpdateOutcome::ReachedMaxBlock; + return OnForkchoiceUpdateOutcome::ReachedMaxBlock } } ForkchoiceStatus::Syncing => { @@ -574,7 +574,7 @@ where inconsistent_stage_checkpoint = stage_checkpoint, "Pipeline sync progress is inconsistent" ); - return Ok(self.blockchain.block_hash(first_stage_checkpoint)?); + return Ok(self.blockchain.block_hash(first_stage_checkpoint)?) } } @@ -650,7 +650,7 @@ where Ok(None) => { // we don't have the block yet and the distance exceeds the allowed // threshold - return Some(state.finalized_block_hash); + return Some(state.finalized_block_hash) } Ok(Some(_)) => { // we're fully synced to the finalized block @@ -691,7 +691,7 @@ where ) -> Option { // check pre merge block error if insert_err.map(|err| err.is_block_pre_merge()).unwrap_or_default() { - return Some(B256::ZERO); + return Some(B256::ZERO) } // If this is sent from new payload then the parent hash could be in a side chain, and is @@ -706,7 +706,7 @@ where // we need to check if the parent block is the last POW block, if so then the payload is // the first POS. The engine API spec mandates a zero hash to be returned: if !parent_header.is_zero_difficulty() { - return Some(B256::ZERO); + return Some(B256::ZERO) } // parent is canonical POS block @@ -818,7 +818,7 @@ where // we likely do not have the finalized or safe blocks, and would return an incorrect // INVALID status instead. if status.is_valid() { - return self.ensure_consistent_state(state); + return self.ensure_consistent_state(state) } Ok(None) @@ -844,7 +844,7 @@ where if !state.finalized_block_hash.is_zero() && !self.blockchain.is_canonical(state.finalized_block_hash)? { - return Ok(Some(OnForkChoiceUpdated::invalid_state())); + return Ok(Some(OnForkChoiceUpdated::invalid_state())) } // Finalized block is consistent, so update it in the canon chain tracker. @@ -858,7 +858,7 @@ where if !state.safe_block_hash.is_zero() && !self.blockchain.is_canonical(state.safe_block_hash)? { - return Ok(Some(OnForkChoiceUpdated::invalid_state())); + return Ok(Some(OnForkChoiceUpdated::invalid_state())) } // Safe block is consistent, so update it in the canon chain tracker. @@ -919,7 +919,7 @@ where if !safe_block_hash.is_zero() { if self.blockchain.safe_block_hash()? == Some(safe_block_hash) { // nothing to update - return Ok(()); + return Ok(()) } let safe = @@ -939,7 +939,7 @@ where if !finalized_block_hash.is_zero() { if self.blockchain.finalized_block_hash()? == Some(finalized_block_hash) { // nothing to update - return Ok(()); + return Ok(()) } let finalized = self @@ -973,7 +973,7 @@ where if let Some(invalid_ancestor) = self.check_invalid_ancestor(state.head_block_hash) { warn!(target: "consensus::engine", ?error, ?state, ?invalid_ancestor, head=?state.head_block_hash, "Failed to canonicalize the head hash, head is also considered invalid"); debug!(target: "consensus::engine", head=?state.head_block_hash, current_error=?error, "Head was previously marked as invalid"); - return invalid_ancestor; + return invalid_ancestor } match &error { @@ -984,7 +984,7 @@ where return PayloadStatus::from_status(PayloadStatusEnum::Invalid { validation_error: error.to_string(), }) - .with_latest_valid_hash(B256::ZERO); + .with_latest_valid_hash(B256::ZERO) } RethError::Canonical(CanonicalError::BlockchainTree( BlockchainTreeError::BlockHashNotFoundInChain { .. }, @@ -1086,7 +1086,7 @@ where if let Some(status) = self.check_invalid_ancestor_with_head(lowest_buffered_ancestor, block.hash) { - return Ok(status); + return Ok(status) } let res = if self.sync.is_pipeline_idle() { @@ -1192,7 +1192,7 @@ where // begin a payload build process. In such an event, the forkchoiceState update MUST NOT // be rolled back. if attrs.timestamp() <= head.timestamp { - return OnForkChoiceUpdated::invalid_payload_attributes(); + return OnForkChoiceUpdated::invalid_payload_attributes() } // 8. Client software MUST begin a payload build process building on top of @@ -1278,7 +1278,7 @@ where if let Some(status) = self.check_invalid_ancestor_with_head(block.parent_hash, block.hash) { - return Ok(status); + return Ok(status) } // not known to be invalid, but we don't know anything else @@ -1377,7 +1377,7 @@ where // check if the block's parent is already marked as invalid if self.check_invalid_ancestor_with_head(block.parent_hash, block.hash).is_some() { // can skip this invalid block - return; + return } match self @@ -1443,7 +1443,7 @@ where // threshold self.sync.set_pipeline_sync_target(target); // we can exit early here because the pipeline will take care of syncing - return; + return } // continue downloading the missing parent @@ -1546,7 +1546,7 @@ where } EngineSyncEvent::PipelineTaskDropped => { error!(target: "consensus::engine", "Failed to receive spawned pipeline"); - return Some(Err(BeaconConsensusEngineError::PipelineChannelClosed)); + return Some(Err(BeaconConsensusEngineError::PipelineChannelClosed)) } EngineSyncEvent::PipelineFinished { result, reached_max_block } => { return self.on_pipeline_finished(result, reached_max_block) @@ -1576,7 +1576,7 @@ where if reached_max_block { // Terminate the sync early if it's reached the maximum user // configured block. - return Some(Ok(())); + return Some(Ok(())) } if let ControlFlow::Unwind { bad_block, .. } = ctrl { @@ -1584,7 +1584,7 @@ where // update the `invalid_headers` cache with the new invalid headers self.invalid_headers.insert(*bad_block); - return None; + return None } // update the canon chain if continuous is enabled @@ -1602,7 +1602,7 @@ where }, Err(error) => { error!(target: "consensus::engine", ?error, "Error getting canonical header for continuous sync"); - return Some(Err(RethError::Provider(error).into())); + return Some(Err(RethError::Provider(error).into())) } }; self.blockchain.set_canonical_head(max_header); @@ -1614,7 +1614,7 @@ where // This is only possible if the node was run with `debug.tip` // argument and without CL. warn!(target: "consensus::engine", "No fork choice state available"); - return None; + return None } }; @@ -1684,7 +1684,7 @@ where } Err(error) => { error!(target: "consensus::engine", ?error, "Error restoring blockchain tree state"); - return Some(Err(error.into())); + return Some(Err(error.into())) } }; } @@ -1718,7 +1718,7 @@ where self.blockchain.connect_buffered_blocks_to_canonical_hashes() { error!(target: "consensus::engine", ?error, "Error connecting buffered blocks to canonical hashes on hook result"); - return Err(error.into()); + return Err(error.into()) } } } @@ -1772,7 +1772,7 @@ where }, )? { this.on_hook_result(result)?; - continue; + continue } // Process one incoming message from the CL. We don't drain the messages right away, @@ -1787,11 +1787,11 @@ where OnForkchoiceUpdateOutcome::Processed => {} OnForkchoiceUpdateOutcome::ReachedMaxBlock => { // reached the max block, we can terminate the future - return Poll::Ready(Ok(())); + return Poll::Ready(Ok(())) } OnForkchoiceUpdateOutcome::Fatal(err) => { // fatal error, we can terminate the future - return Poll::Ready(Err(RethError::Execution(err).into())); + return Poll::Ready(Err(RethError::Execution(err).into())) } } } @@ -1807,23 +1807,23 @@ where this.listeners.push_listener(tx); } } - continue; + continue } // Both running hook with db write access and engine messages are pending, // proceed to other polls - break; + break } // process sync events if any match this.sync.poll(cx) { Poll::Ready(sync_event) => { if let Some(res) = this.on_sync_event(sync_event) { - return Poll::Ready(res); + return Poll::Ready(res) } // this could have taken a while, so we start the next cycle to handle any new // engine messages - continue 'main; + continue 'main } Poll::Pending => { // no more sync events to process @@ -1851,13 +1851,13 @@ where // ensure we're polling until pending while also checking for new engine // messages before polling the next hook - continue 'main; + continue 'main } } // incoming engine messages and sync events are drained, so we can yield back // control - return Poll::Pending; + return Poll::Pending } } } @@ -1971,7 +1971,7 @@ mod tests { result, Err(BeaconConsensusEngineError::Pipeline(n)) if matches!(*n.as_ref(), PipelineError::Stage(StageError::ChannelClosed)) ); - break; + break } Err(TryRecvError::Empty) => { let _ = env diff --git a/crates/consensus/beacon/src/engine/test_utils.rs b/crates/consensus/beacon/src/engine/test_utils.rs index 3efa1dbb3..35d34dfe0 100644 --- a/crates/consensus/beacon/src/engine/test_utils.rs +++ b/crates/consensus/beacon/src/engine/test_utils.rs @@ -90,7 +90,7 @@ impl TestEnv { loop { let result = self.send_new_payload(payload.clone(), cancun_fields.clone()).await?; if !result.is_syncing() { - return Ok(result); + return Ok(result) } } } @@ -111,7 +111,7 @@ impl TestEnv { loop { let result = self.engine_handle.fork_choice_updated(state, None).await?; if !result.is_syncing() { - return Ok(result); + return Ok(result) } } } diff --git a/crates/net/eth-wire/src/test_utils.rs b/crates/net/eth-wire/src/test_utils.rs index ceaa8206c..b9f9591a1 100644 --- a/crates/net/eth-wire/src/test_utils.rs +++ b/crates/net/eth-wire/src/test_utils.rs @@ -137,7 +137,7 @@ pub mod proto { /// Decodes a `TestProtoMessage` from the given message buffer. pub fn decode_message(buf: &mut &[u8]) -> Option { if buf.is_empty() { - return None; + return None } let id = buf[0]; buf.advance(1); diff --git a/crates/net/network/src/manager.rs b/crates/net/network/src/manager.rs index 456b542e3..5cf397714 100644 --- a/crates/net/network/src/manager.rs +++ b/crates/net/network/src/manager.rs @@ -524,7 +524,7 @@ where if self.handle.mode().is_stake() { // See [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#devp2p) warn!(target: "net", "Peer performed block propagation, but it is not supported in proof of stake (EIP-3675)"); - return; + return } let msg = NewBlockMessage { hash, block: Arc::new(block) }; self.swarm.state_mut().announce_new_block(msg); @@ -647,7 +647,7 @@ where // This is only possible if the channel was deliberately closed since we always // have an instance of `NetworkHandle` error!("Network message channel closed."); - return Poll::Ready(()); + return Poll::Ready(()) } Poll::Ready(Some(msg)) => this.on_handle_message(msg), }; @@ -918,7 +918,7 @@ where if budget == 0 { // make sure we're woken up again cx.waker().wake_by_ref(); - break; + break } } diff --git a/crates/net/network/src/swarm.rs b/crates/net/network/src/swarm.rs index 690a37b4b..3a9fc5a4f 100644 --- a/crates/net/network/src/swarm.rs +++ b/crates/net/network/src/swarm.rs @@ -192,7 +192,7 @@ where ListenerEvent::Incoming { stream, remote_addr } => { // Reject incoming connection if node is shutting down. if self.is_shutting_down() { - return None; + return None } // ensure we can handle an incoming connection from this address if let Err(err) = @@ -210,13 +210,13 @@ where ); } } - return None; + return None } match self.sessions.on_incoming(stream, remote_addr) { Ok(session_id) => { trace!(target: "net", ?remote_addr, "Incoming connection"); - return Some(SwarmEvent::IncomingTcpConnection { session_id, remote_addr }); + return Some(SwarmEvent::IncomingTcpConnection { session_id, remote_addr }) } Err(err) => { trace!(target: "net", ?err, "Incoming connection rejected, capacity already reached."); @@ -235,7 +235,7 @@ where match event { StateAction::Connect { remote_addr, peer_id } => { self.dial_outbound(remote_addr, peer_id); - return Some(SwarmEvent::OutgoingTcpConnection { remote_addr, peer_id }); + return Some(SwarmEvent::OutgoingTcpConnection { remote_addr, peer_id }) } StateAction::Disconnect { peer_id, reason } => { self.sessions.disconnect(peer_id, reason); @@ -253,7 +253,7 @@ where StateAction::DiscoveredNode { peer_id, socket_addr, fork_id } => { // Don't try to connect to peer if node is shutting down if self.is_shutting_down() { - return None; + return None } // Insert peer only if no fork id or a valid fork id if fork_id.map_or_else(|| true, |f| self.sessions.is_valid_fork_id(f)) { @@ -302,7 +302,7 @@ where loop { while let Poll::Ready(action) = this.state.poll(cx) { if let Some(event) = this.on_state_action(action) { - return Poll::Ready(Some(event)); + return Poll::Ready(Some(event)) } } @@ -311,9 +311,9 @@ where Poll::Pending => {} Poll::Ready(event) => { if let Some(event) = this.on_session_event(event) { - return Poll::Ready(Some(event)); + return Poll::Ready(Some(event)) } - continue; + continue } } @@ -322,13 +322,13 @@ where Poll::Pending => {} Poll::Ready(event) => { if let Some(event) = this.on_connection(event) { - return Poll::Ready(Some(event)); + return Poll::Ready(Some(event)) } - continue; + continue } } - return Poll::Pending; + return Poll::Pending } } } diff --git a/crates/net/network/tests/it/multiplex.rs b/crates/net/network/tests/it/multiplex.rs index 1e61efb4d..aac55a982 100644 --- a/crates/net/network/tests/it/multiplex.rs +++ b/crates/net/network/tests/it/multiplex.rs @@ -114,7 +114,7 @@ mod proto { /// Decodes a `TestProtoMessage` from the given message buffer. pub fn decode_message(buf: &mut &[u8]) -> Option { if buf.is_empty() { - return None; + return None } let id = buf[0]; buf.advance(1); @@ -238,7 +238,7 @@ impl Stream for PingPongProtoConnection { fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { let this = self.get_mut(); if let Some(initial_ping) = this.initial_ping.take() { - return Poll::Ready(Some(initial_ping.encoded())); + return Poll::Ready(Some(initial_ping.encoded())) } loop { @@ -250,21 +250,19 @@ impl Stream for PingPongProtoConnection { } } } - let Some(msg) = ready!(this.conn.poll_next_unpin(cx)) else { - return Poll::Ready(None); - }; + let Some(msg) = ready!(this.conn.poll_next_unpin(cx)) else { return Poll::Ready(None) }; let Some(msg) = PingPongProtoMessage::decode_message(&mut &msg[..]) else { - return Poll::Ready(None); + return Poll::Ready(None) }; match msg.message { PingPongProtoMessageKind::Ping => { - return Poll::Ready(Some(PingPongProtoMessage::pong().encoded())); + return Poll::Ready(Some(PingPongProtoMessage::pong().encoded())) } PingPongProtoMessageKind::Pong => {} PingPongProtoMessageKind::PingMessage(msg) => { - return Poll::Ready(Some(PingPongProtoMessage::pong_message(msg).encoded())); + return Poll::Ready(Some(PingPongProtoMessage::pong_message(msg).encoded())) } PingPongProtoMessageKind::PongMessage(msg) => { if let Some(sender) = this.pending_pong.take() { @@ -274,7 +272,7 @@ impl Stream for PingPongProtoConnection { } } - return Poll::Pending; + return Poll::Pending } } } diff --git a/crates/payload/validator/src/lib.rs b/crates/payload/validator/src/lib.rs index 89840c032..7f617b09c 100644 --- a/crates/payload/validator/src/lib.rs +++ b/crates/payload/validator/src/lib.rs @@ -109,7 +109,7 @@ impl ExecutionPayloadValidator { if !cancun_active && block.has_blob_transactions() { // cancun not active but blob transactions present - return Err(PayloadError::PreCancunBlockWithBlobTransactions); + return Err(PayloadError::PreCancunBlockWithBlobTransactions) } // Ensure the hash included in the payload matches the block hash diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs index d597b269b..5e5bc6038 100644 --- a/crates/primitives/src/block.rs +++ b/crates/primitives/src/block.rs @@ -89,7 +89,7 @@ impl Block { let Some(senders) = TransactionSigned::recover_signers_unchecked(&self.body, self.body.len()) else { - return Err(self); + return Err(self) }; senders }; diff --git a/crates/primitives/src/header.rs b/crates/primitives/src/header.rs index 00099dff9..2190fc27b 100644 --- a/crates/primitives/src/header.rs +++ b/crates/primitives/src/header.rs @@ -146,7 +146,7 @@ impl Header { /// Returns an error if the extradata size is larger than 100 KB. pub fn ensure_extradata_valid(&self) -> Result<(), HeaderError> { if self.extra_data.len() > 100 * 1024 { - return Err(HeaderError::LargeExtraData); + return Err(HeaderError::LargeExtraData) } Ok(()) } @@ -158,7 +158,7 @@ impl Header { /// Returns an error if the block difficulty exceeds 80 bits. pub fn ensure_difficulty_valid(&self) -> Result<(), HeaderError> { if self.difficulty.bit_len() > 80 { - return Err(HeaderError::LargeDifficulty); + return Err(HeaderError::LargeDifficulty) } Ok(()) } diff --git a/crates/primitives/src/receipt.rs b/crates/primitives/src/receipt.rs index 5bf07391e..f7c27771f 100644 --- a/crates/primitives/src/receipt.rs +++ b/crates/primitives/src/receipt.rs @@ -120,15 +120,13 @@ impl Receipts { /// Retrieves gas spent by transactions as a vector of tuples (transaction index, gas used). pub fn gas_spent_by_tx(&self) -> Result, PruneSegmentError> { - let Some(block_r) = self.last() else { - return Ok(vec![]); - }; + let Some(block_r) = self.last() else { return Ok(vec![]) }; let mut out = Vec::with_capacity(block_r.len()); for (id, tx_r) in block_r.iter().enumerate() { if let Some(receipt) = tx_r.as_ref() { out.push((id as u64, receipt.cumulative_gas_used)); } else { - return Err(PruneSegmentError::ReceiptsPruned); + return Err(PruneSegmentError::ReceiptsPruned) } } Ok(out) diff --git a/crates/revm/src/optimism/processor.rs b/crates/revm/src/optimism/processor.rs index 5b33ad162..40ff62f66 100644 --- a/crates/revm/src/optimism/processor.rs +++ b/crates/revm/src/optimism/processor.rs @@ -43,7 +43,7 @@ impl<'a> BlockExecutor for EVMProcessor<'a> { block.timestamp, ) { debug!(target: "evm", ?error, ?receipts, "receipts verification failed"); - return Err(error); + return Err(error) }; self.stats.receipt_root_duration += time.elapsed(); } @@ -60,7 +60,7 @@ impl<'a> BlockExecutor for EVMProcessor<'a> { // perf: do not execute empty blocks if block.body.is_empty() { - return Ok((Vec::new(), 0)); + return Ok((Vec::new(), 0)) } let is_regolith = @@ -91,7 +91,7 @@ impl<'a> BlockExecutor for EVMProcessor<'a> { transaction_gas_limit: transaction.gas_limit(), block_available_gas, } - .into()); + .into()) } // Cache the depositor account prior to the state transition for the deposit nonce. diff --git a/crates/revm/src/processor.rs b/crates/revm/src/processor.rs index 594327da7..f9290d866 100644 --- a/crates/revm/src/processor.rs +++ b/crates/revm/src/processor.rs @@ -277,7 +277,7 @@ impl<'a> EVMProcessor<'a> { gas: GotExpected { got: cumulative_gas_used, expected: block.gas_used }, gas_spent_by_tx: receipts.gas_spent_by_tx()?, } - .into()); + .into()) } let time = Instant::now(); self.apply_post_execution_state_change(block, total_difficulty)?; @@ -336,7 +336,7 @@ impl<'a> EVMProcessor<'a> { self.prune_modes.receipts.map_or(false, |mode| mode.should_prune(block_number, tip)) { receipts.clear(); - return Ok(()); + return Ok(()) } // All receipts from the last 128 blocks are required for blockchain tree, even with @@ -344,7 +344,7 @@ impl<'a> EVMProcessor<'a> { let prunable_receipts = PruneMode::Distance(MINIMUM_PRUNING_DISTANCE).should_prune(block_number, tip); if !prunable_receipts { - return Ok(()); + return Ok(()) } let contract_log_pruner = self.prune_modes.receipts_log_filter.group_by_block(tip, None)?; @@ -402,7 +402,7 @@ impl<'a> BlockExecutor for EVMProcessor<'a> { verify_receipt(block.header.receipts_root, block.header.logs_bloom, receipts.iter()) { debug!(target: "evm", ?error, ?receipts, "receipts verification failed"); - return Err(error); + return Err(error) }; self.stats.receipt_root_duration += time.elapsed(); } @@ -419,7 +419,7 @@ impl<'a> BlockExecutor for EVMProcessor<'a> { // perf: do not execute empty blocks if block.body.is_empty() { - return Ok((Vec::new(), 0)); + return Ok((Vec::new(), 0)) } let mut cumulative_gas_used = 0; @@ -434,7 +434,7 @@ impl<'a> BlockExecutor for EVMProcessor<'a> { transaction_gas_limit: transaction.gas_limit(), block_available_gas, } - .into()); + .into()) } // Execute transaction. let ResultAndState { result, state } = self.transact(transaction, *sender)?; @@ -517,7 +517,7 @@ pub fn verify_receipt<'a>( return Err(BlockValidationError::ReceiptRootDiff( GotExpected { got: receipts_root, expected: expected_receipts_root }.into(), ) - .into()); + .into()) } // Create header log bloom. @@ -526,7 +526,7 @@ pub fn verify_receipt<'a>( return Err(BlockValidationError::BloomLogDiff( GotExpected { got: logs_bloom, expected: expected_logs_bloom }.into(), ) - .into()); + .into()) } Ok(()) diff --git a/crates/rpc/rpc/src/eth/api/pending_block.rs b/crates/rpc/rpc/src/eth/api/pending_block.rs index 8ab260dc6..917a205d4 100644 --- a/crates/rpc/rpc/src/eth/api/pending_block.rs +++ b/crates/rpc/rpc/src/eth/api/pending_block.rs @@ -106,7 +106,7 @@ impl PendingBlockEnv { // them as invalid here which removes all dependent transactions from the iterator // before we can continue best_txs.mark_invalid(&pool_tx); - continue; + continue } // convert tx to a signed transaction diff --git a/crates/stages/src/pipeline/mod.rs b/crates/stages/src/pipeline/mod.rs index 2d416db5c..66de426df 100644 --- a/crates/stages/src/pipeline/mod.rs +++ b/crates/stages/src/pipeline/mod.rs @@ -161,7 +161,7 @@ where max_block = ?self.max_block, "Terminating pipeline." ); - return Ok(()); + return Ok(()) } } } @@ -197,7 +197,7 @@ where ControlFlow::Continue { block_number } => self.progress.update(block_number), ControlFlow::Unwind { target, bad_block } => { self.unwind(target, Some(bad_block.number))?; - return Ok(ControlFlow::Unwind { target, bad_block }); + return Ok(ControlFlow::Unwind { target, bad_block }) } } @@ -240,7 +240,7 @@ where "Unwind point too far for stage" ); self.listeners.notify(PipelineEvent::Skipped { stage_id }); - continue; + continue } debug!( @@ -285,7 +285,7 @@ where } Err(err) => { self.listeners.notify(PipelineEvent::Error { stage_id }); - return Err(PipelineError::Stage(StageError::Fatal(Box::new(err)))); + return Err(PipelineError::Stage(StageError::Fatal(Box::new(err)))) } } } @@ -325,7 +325,7 @@ where // We reached the maximum block, so we skip the stage return Ok(ControlFlow::NoProgress { block_number: prev_checkpoint.map(|progress| progress.block_number), - }); + }) } let exec_input = ExecInput { target, checkpoint: prev_checkpoint }; @@ -380,7 +380,7 @@ where ControlFlow::Continue { block_number } } else { ControlFlow::NoProgress { block_number: Some(block_number) } - }); + }) } } Err(err) => { @@ -389,7 +389,7 @@ where if let Some(ctrl) = on_stage_error(&self.provider_factory, stage_id, prev_checkpoint, err)? { - return Ok(ctrl); + return Ok(ctrl) } } } diff --git a/crates/stages/src/stages/execution.rs b/crates/stages/src/stages/execution.rs index 66429515e..5d7134ba0 100644 --- a/crates/stages/src/stages/execution.rs +++ b/crates/stages/src/stages/execution.rs @@ -114,7 +114,7 @@ impl ExecutionStage { input: ExecInput, ) -> Result { if input.target_reached() { - return Ok(ExecOutput::done(input.checkpoint())); + return Ok(ExecOutput::done(input.checkpoint())) } let start_block = input.next_block(); @@ -183,7 +183,7 @@ impl ExecutionStage { bundle_size_hint, cumulative_gas, ) { - break; + break } } let time = Instant::now(); @@ -360,7 +360,7 @@ impl Stage for ExecutionStage { if range.is_empty() { return Ok(UnwindOutput { checkpoint: input.checkpoint.with_block_number(input.unwind_to), - }); + }) } // get all batches for account change @@ -403,7 +403,7 @@ impl Stage for ExecutionStage { let mut rev_storage_changeset_walker = storage_changeset.walk_back(None)?; while let Some((key, _)) = rev_storage_changeset_walker.next().transpose()? { if key.block_number() < *range.start() { - break; + break } // delete all changesets rev_storage_changeset_walker.delete_current()?; @@ -423,7 +423,7 @@ impl Stage for ExecutionStage { while let Some(Ok((tx_number, receipt))) = reverse_walker.next() { if tx_number < first_tx_num { - break; + break } reverse_walker.delete_current()?; diff --git a/crates/stages/src/stages/hashing_account.rs b/crates/stages/src/stages/hashing_account.rs index ffe5acdb9..323fd1c1b 100644 --- a/crates/stages/src/stages/hashing_account.rs +++ b/crates/stages/src/stages/hashing_account.rs @@ -138,7 +138,7 @@ impl Stage for AccountHashingStage { input: ExecInput, ) -> Result { if input.target_reached() { - return Ok(ExecOutput::done(input.checkpoint())); + return Ok(ExecOutput::done(input.checkpoint())) } let (from_block, to_block) = input.next_block_range().into_inner(); @@ -238,7 +238,7 @@ impl Stage for AccountHashingStage { }, ); - return Ok(ExecOutput { checkpoint, done: false }); + return Ok(ExecOutput { checkpoint, done: false }) } } else { // Aggregate all transition changesets and make a list of accounts that have been @@ -549,7 +549,7 @@ mod tests { let start_block = input.next_block(); let end_block = output.checkpoint.block_number; if start_block > end_block { - return Ok(()); + return Ok(()) } } self.check_hashed_accounts() diff --git a/crates/storage/codecs/src/lib.rs b/crates/storage/codecs/src/lib.rs index 8725204fa..cdd4bc048 100644 --- a/crates/storage/codecs/src/lib.rs +++ b/crates/storage/codecs/src/lib.rs @@ -178,9 +178,7 @@ where where B: bytes::BufMut + AsMut<[u8]>, { - let Some(element) = self else { - return 0; - }; + let Some(element) = self else { return 0 }; // We don't know the length of the element until we compact it. let mut tmp = Vec::with_capacity(64); @@ -248,7 +246,7 @@ impl Compact for U256 { #[inline] fn from_compact(mut buf: &[u8], len: usize) -> (Self, &[u8]) { if len == 0 { - return (U256::ZERO, buf); + return (U256::ZERO, buf) } let mut arr = [0; 32]; @@ -358,7 +356,7 @@ fn decode_varuint(buf: &[u8]) -> (usize, &[u8]) { let byte = buf[i]; value |= usize::from(byte & 0x7F) << (i * 7); if byte < 0x80 { - return (value, &buf[i + 1..]); + return (value, &buf[i + 1..]) } } diff --git a/crates/storage/db/src/implementation/mdbx/mod.rs b/crates/storage/db/src/implementation/mdbx/mod.rs index 9ff8742f8..303af45c4 100644 --- a/crates/storage/db/src/implementation/mdbx/mod.rs +++ b/crates/storage/db/src/implementation/mdbx/mod.rs @@ -272,7 +272,7 @@ impl DatabaseEnv { LogLevel::Extra => 7, }); } else { - return Err(DatabaseError::LogLevelUnavailable(log_level)); + return Err(DatabaseError::LogLevelUnavailable(log_level)) } } diff --git a/crates/storage/provider/src/providers/database/mod.rs b/crates/storage/provider/src/providers/database/mod.rs index 30c6e5081..a21059b4d 100644 --- a/crates/storage/provider/src/providers/database/mod.rs +++ b/crates/storage/provider/src/providers/database/mod.rs @@ -144,7 +144,7 @@ impl ProviderFactory { if block_number == provider.best_block_number().unwrap_or_default() && block_number == provider.last_block_number().unwrap_or_default() { - return Ok(Box::new(LatestStateProvider::new(provider.into_tx()))); + return Ok(Box::new(LatestStateProvider::new(provider.into_tx()))) } // +1 as the changeset that we want is the one that was applied after this block. diff --git a/crates/storage/provider/src/providers/database/provider.rs b/crates/storage/provider/src/providers/database/provider.rs index 6532ea6fd..54d657be7 100644 --- a/crates/storage/provider/src/providers/database/provider.rs +++ b/crates/storage/provider/src/providers/database/provider.rs @@ -189,7 +189,7 @@ where while let Some((sharded_key, list)) = item { // If the shard does not belong to the key, break. if !shard_belongs_to_key(&sharded_key) { - break; + break } cursor.delete_current()?; @@ -198,12 +198,12 @@ where let first = list.iter(0).next().expect("List can't be empty"); if first >= block_number as usize { item = cursor.prev()?; - continue; + continue } else if block_number <= sharded_key.as_ref().highest_block_number { // Filter out all elements greater than block number. - return Ok(list.iter(0).take_while(|i| *i < block_number as usize).collect::>()); + return Ok(list.iter(0).take_while(|i| *i < block_number as usize).collect::>()) } else { - return Ok(list.iter(0).collect::>()); + return Ok(list.iter(0).collect::>()) } } @@ -332,7 +332,7 @@ impl DatabaseProvider { if snapshot_upper_bound .map_or(false, |snapshot_upper_bound| snapshot_upper_bound >= number) { - return fetch_from_snapshot(provider); + return fetch_from_snapshot(provider) } } fetch_from_database() @@ -393,7 +393,7 @@ impl DatabaseProvider { range: RangeInclusive, ) -> ProviderResult { if range.is_empty() { - return Ok(BundleStateWithReceipts::default()); + return Ok(BundleStateWithReceipts::default()) } let start_block_number = *range.start(); @@ -571,7 +571,7 @@ impl DatabaseProvider { let block_bodies = self.get_or_take::(range)?; if block_bodies.is_empty() { - return Ok(Vec::new()); + return Ok(Vec::new()) } // Compute the first and last tx ID in the range @@ -580,7 +580,7 @@ impl DatabaseProvider { // If this is the case then all of the blocks in the range are empty if last_transaction < first_transaction { - return Ok(block_bodies.into_iter().map(|(n, _)| (n, Vec::new())).collect()); + return Ok(block_bodies.into_iter().map(|(n, _)| (n, Vec::new())).collect()) } // Get transactions and senders @@ -709,7 +709,7 @@ impl DatabaseProvider { let block_headers = self.get_or_take::(range.clone())?; if block_headers.is_empty() { - return Ok(Vec::new()); + return Ok(Vec::new()) } let block_header_hashes = @@ -815,7 +815,7 @@ impl DatabaseProvider { while let Some(Ok((entry_key, _))) = reverse_walker.next() { if selector(entry_key.clone()) <= key { - break; + break } reverse_walker.delete_current()?; deleted += 1; @@ -862,7 +862,7 @@ impl DatabaseProvider { } if deleted == limit { - break; + break } } } @@ -893,7 +893,7 @@ impl DatabaseProvider { } if deleted == limit { - break; + break } } } @@ -913,7 +913,7 @@ impl DatabaseProvider { // delete old shard so new one can be inserted. self.tx.delete::(shard_key, None)?; let list = list.iter(0).map(|i| i as u64).collect::>(); - return Ok(list); + return Ok(list) } Ok(Vec::new()) } @@ -1110,7 +1110,7 @@ impl HeaderProvider for DatabaseProvider { if let Some(td) = self.chain_spec.final_paris_total_difficulty(number) { // if this block is higher than the final paris(merge) block, return the final paris // difficulty - return Ok(Some(td)); + return Ok(Some(td)) } self.get_with_snapshot( @@ -1259,7 +1259,7 @@ impl BlockReader for DatabaseProvider { None => return Ok(None), }; - return Ok(Some(Block { header, body: transactions, ommers, withdrawals })); + return Ok(Some(Block { header, body: transactions, ommers, withdrawals })) } } @@ -1283,11 +1283,11 @@ impl BlockReader for DatabaseProvider { // If the Paris (Merge) hardfork block is known and block is after it, return empty // ommers. if self.chain_spec.final_paris_total_difficulty(number).is_some() { - return Ok(Some(Vec::new())); + return Ok(Some(Vec::new())) } let ommers = self.tx.get::(number)?.map(|o| o.ommers); - return Ok(ommers); + return Ok(ommers) } Ok(None) @@ -1360,7 +1360,7 @@ impl BlockReader for DatabaseProvider { fn block_range(&self, range: RangeInclusive) -> ProviderResult> { if range.is_empty() { - return Ok(Vec::new()); + return Ok(Vec::new()) } let len = range.end().saturating_sub(*range.start()) as usize; @@ -1558,7 +1558,7 @@ impl TransactionsProvider for DatabaseProvider { excess_blob_gas: header.excess_blob_gas, }; - return Ok(Some((transaction, meta))); + return Ok(Some((transaction, meta))) } } } @@ -1706,7 +1706,7 @@ impl WithdrawalsProvider for DatabaseProvider { .get::(number) .map(|w| w.map(|w| w.withdrawals))? .unwrap_or_default(); - return Ok(Some(withdrawals)); + return Ok(Some(withdrawals)) } } Ok(None) @@ -2098,7 +2098,7 @@ impl HashingWriter for DatabaseProvider { root: GotExpected { got: state_root, expected: expected_state_root }, block_number: *range.end(), block_hash: end_block_hash, - }))); + }))) } trie_updates.flush(&self.tx)?; } @@ -2294,7 +2294,7 @@ impl BlockExecutionWriter for DatabaseProvider { root: GotExpected { got: new_state_root, expected: parent_state_root }, block_number: parent_number, block_hash: parent_hash, - }))); + }))) } trie_updates.flush(&self.tx)?; } @@ -2463,7 +2463,7 @@ impl BlockWriter for DatabaseProvider { ) -> ProviderResult<()> { if blocks.is_empty() { debug!(target: "providers::db", "Attempted to append empty block range"); - return Ok(()); + return Ok(()) } let first_number = blocks.first().unwrap().number; diff --git a/crates/storage/provider/src/providers/snapshot/manager.rs b/crates/storage/provider/src/providers/snapshot/manager.rs index 5485e94eb..5ed22ecf2 100644 --- a/crates/storage/provider/src/providers/snapshot/manager.rs +++ b/crates/storage/provider/src/providers/snapshot/manager.rs @@ -347,7 +347,7 @@ impl SnapshotProvider { break 'outer } result.push(res); - break 'inner; + break 'inner } None => { provider = get_provider(number)?; diff --git a/crates/storage/provider/src/test_utils/executor.rs b/crates/storage/provider/src/test_utils/executor.rs index b0fb2dd47..ef66ff9b5 100644 --- a/crates/storage/provider/src/test_utils/executor.rs +++ b/crates/storage/provider/src/test_utils/executor.rs @@ -17,7 +17,7 @@ impl BlockExecutor for TestExecutor { _total_difficulty: U256, ) -> Result<(), BlockExecutionError> { if self.0.is_none() { - return Err(BlockExecutionError::UnavailableForTest); + return Err(BlockExecutionError::UnavailableForTest) } Ok(()) } @@ -28,7 +28,7 @@ impl BlockExecutor for TestExecutor { _total_difficulty: U256, ) -> Result<(), BlockExecutionError> { if self.0.is_none() { - return Err(BlockExecutionError::UnavailableForTest); + return Err(BlockExecutionError::UnavailableForTest) } Ok(()) } diff --git a/crates/transaction-pool/src/pool/txpool.rs b/crates/transaction-pool/src/pool/txpool.rs index f664dc763..bdae83826 100644 --- a/crates/transaction-pool/src/pool/txpool.rs +++ b/crates/transaction-pool/src/pool/txpool.rs @@ -491,7 +491,7 @@ impl TxPool { on_chain_nonce: u64, ) -> PoolResult> { if self.contains(tx.hash()) { - return Err(PoolError::new(*tx.hash(), PoolErrorKind::AlreadyImported)); + return Err(PoolError::new(*tx.hash(), PoolErrorKind::AlreadyImported)) } // Update sender info with balance and nonce @@ -719,7 +719,7 @@ impl TxPool { } id = descendant; } else { - return; + return } } } @@ -945,7 +945,7 @@ impl AllTransactions { let count = entry.get_mut(); if *count == 1 { entry.remove(); - return; + return } *count -= 1; } @@ -1005,7 +1005,7 @@ impl AllTransactions { ($iter:ident) => { 'this: while let Some((peek, _)) = iter.peek() { if peek.sender != id.sender { - break 'this; + break 'this } iter.next(); } @@ -1024,7 +1024,7 @@ impl AllTransactions { current: tx.subpool, destination: Destination::Discard, }); - continue 'transactions; + continue 'transactions } let ancestor = TransactionId::ancestor(id.nonce, info.state_nonce, id.sender); @@ -1047,7 +1047,7 @@ impl AllTransactions { // If there's a nonce gap, we can shortcircuit, because there's nothing to update yet. if tx.state.has_nonce_gap() { next_sender!(iter); - continue 'transactions; + continue 'transactions } // Since this is the first transaction of the sender, it has no parked ancestors @@ -1067,13 +1067,13 @@ impl AllTransactions { while let Some((peek, ref mut tx)) = iter.peek_mut() { if peek.sender != id.sender { // Found the next sender - continue 'transactions; + continue 'transactions } // can short circuit if tx.state.has_nonce_gap() { next_sender!(iter); - continue 'transactions; + continue 'transactions } // update cumulative cost @@ -1235,7 +1235,7 @@ impl AllTransactions { fn contains_conflicting_transaction(&self, tx: &ValidPoolTransaction) -> bool { let mut iter = self.txs_iter(tx.transaction_id.sender); if let Some((_, existing)) = iter.next() { - return tx.tx_type_conflicts_with(&existing.transaction); + return tx.tx_type_conflicts_with(&existing.transaction) } // no existing transaction for this sender false @@ -1259,7 +1259,7 @@ impl AllTransactions { if current_txs >= self.max_account_slots { return Err(InsertErr::ExceededSenderTransactionsCapacity { transaction: Arc::new(transaction), - }); + }) } } if transaction.gas_limit() > self.block_gas_limit { @@ -1267,12 +1267,12 @@ impl AllTransactions { block_gas_limit: self.block_gas_limit, tx_gas_limit: transaction.gas_limit(), transaction: Arc::new(transaction), - }); + }) } if self.contains_conflicting_transaction(&transaction) { // blob vs non blob transactions are mutually exclusive for the same sender - return Err(InsertErr::TxTypeConflict { transaction: Arc::new(transaction) }); + return Err(InsertErr::TxTypeConflict { transaction: Arc::new(transaction) }) } Ok(transaction) @@ -1292,12 +1292,12 @@ impl AllTransactions { if let Some(ancestor) = ancestor { let Some(ancestor_tx) = self.txs.get(&ancestor) else { // ancestor tx is missing, so we can't insert the new blob - return Err(InsertErr::BlobTxHasNonceGap { transaction: Arc::new(new_blob_tx) }); + return Err(InsertErr::BlobTxHasNonceGap { transaction: Arc::new(new_blob_tx) }) }; if ancestor_tx.state.has_nonce_gap() { // the ancestor transaction already has a nonce gap, so we can't insert the new // blob - return Err(InsertErr::BlobTxHasNonceGap { transaction: Arc::new(new_blob_tx) }); + return Err(InsertErr::BlobTxHasNonceGap { transaction: Arc::new(new_blob_tx) }) } // the max cost executing this transaction requires @@ -1306,7 +1306,7 @@ impl AllTransactions { // check if the new blob would go into overdraft if cumulative_cost > on_chain_balance { // the transaction would go into overdraft - return Err(InsertErr::Overdraft { transaction: Arc::new(new_blob_tx) }); + return Err(InsertErr::Overdraft { transaction: Arc::new(new_blob_tx) }) } // ensure that a replacement would not shift already propagated blob transactions into @@ -1323,14 +1323,14 @@ impl AllTransactions { cumulative_cost += tx.transaction.cost(); if tx.transaction.is_eip4844() && cumulative_cost > on_chain_balance { // the transaction would shift - return Err(InsertErr::Overdraft { transaction: Arc::new(new_blob_tx) }); + return Err(InsertErr::Overdraft { transaction: Arc::new(new_blob_tx) }) } } } } } else if new_blob_tx.cost() > on_chain_balance { // the transaction would go into overdraft - return Err(InsertErr::Overdraft { transaction: Arc::new(new_blob_tx) }); + return Err(InsertErr::Overdraft { transaction: Arc::new(new_blob_tx) }) } Ok(new_blob_tx) @@ -1350,7 +1350,7 @@ impl AllTransactions { if maybe_replacement.max_fee_per_gas() <= existing_transaction.max_fee_per_gas() * price_bump_multiplier { - return true; + return true } let existing_max_priority_fee_per_gas = @@ -1363,7 +1363,7 @@ impl AllTransactions { existing_max_priority_fee_per_gas != 0 && replacement_max_priority_fee_per_gas != 0 { - return true; + return true } // check max blob fee per gas @@ -1376,7 +1376,7 @@ impl AllTransactions { if replacement_max_blob_fee_per_gas <= existing_max_blob_fee_per_gas * price_bump_multiplier { - return true; + return true } } @@ -1468,7 +1468,7 @@ impl AllTransactions { let fee_cap = transaction.max_fee_per_gas(); if fee_cap < self.minimal_protocol_basefee as u128 { - return Err(InsertErr::FeeCapBelowMinimumProtocolFeeCap { transaction, fee_cap }); + return Err(InsertErr::FeeCapBelowMinimumProtocolFeeCap { transaction, fee_cap }) } if fee_cap >= self.pending_fees.base_fee as u128 { state.insert(TxState::ENOUGH_FEE_CAP_BLOCK); @@ -1502,7 +1502,7 @@ impl AllTransactions { return Err(InsertErr::Underpriced { transaction: pool_tx.transaction, existing: *entry.get().transaction.hash(), - }); + }) } let new_hash = *pool_tx.transaction.hash(); let new_transaction = pool_tx.transaction.clone(); @@ -1545,7 +1545,7 @@ impl AllTransactions { // If there's a nonce gap, we can shortcircuit if next_nonce != id.nonce { - break; + break } // close the nonce gap diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 2494afeff..3ff4ebbab 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -59,7 +59,7 @@ impl Case for BlockchainTestCase { fn run(&self) -> Result<(), Error> { // If the test is marked for skipping, return a Skipped error immediately. if self.skip { - return Err(Error::Skipped); + return Err(Error::Skipped) } // Iterate through test cases, filtering by the network type to exclude specific forks.