Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unrelated SAFETY tags on comments #6726

Merged
merged 5 commits into from Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/reth/src/commands/db/tui.rs
Expand Up @@ -321,7 +321,7 @@ where
MouseEventKind::ScrollUp => app.previous(),
// TODO: This click event can be triggered outside of the list widget.
MouseEventKind::Down(_) => {
// SAFETY: The pointer to the app's state will always be valid for
// NOTE: The pointer to the app's state will always be valid for
allnil marked this conversation as resolved.
Show resolved Hide resolved
// reads here, and the source is larger than the destination.
//
// This is technically unsafe, but because the alignment requirements
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/transaction/eip4844.rs
Expand Up @@ -169,7 +169,7 @@ impl TxEip4844 {
/// Returns the total gas for all blobs in this transaction.
#[inline]
pub fn blob_gas(&self) -> u64 {
// SAFETY: we don't expect u64::MAX / DATA_GAS_PER_BLOB hashes in a single transaction
// NOTE: we don't expect u64::MAX / DATA_GAS_PER_BLOB hashes in a single transaction
self.blob_versioned_hashes.len() as u64 * DATA_GAS_PER_BLOB
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/api/fees.rs
Expand Up @@ -103,7 +103,7 @@ where
//
// Treat a request for 1 block as a request for `newest_block..=newest_block`,
// otherwise `newest_block - 2
// SAFETY: We ensured that block count is capped
// NOTE: We ensured that block count is capped
let start_block = end_block_plus - block_count;

// Collect base fees, gas usage ratios and (optionally) reward percentile data
Expand Down
4 changes: 2 additions & 2 deletions crates/storage/provider/src/providers/database/provider.rs
Expand Up @@ -604,7 +604,7 @@ impl<TX: DbTxMut + DbTx> DatabaseProvider<TX> {
self.get_or_take::<tables::TxSenders, TAKE>(first_transaction..=last_transaction)?;

// Recover senders manually if not found in db
// SAFETY: Transactions are always guaranteed to be in the database whereas
// NOTE: Transactions are always guaranteed to be in the database whereas
// senders might be pruned.
if senders.len() != transactions.len() {
senders.reserve(transactions.len() - senders.len());
Expand Down Expand Up @@ -1555,7 +1555,7 @@ impl<TX: DbTx> TransactionsProvider for DatabaseProvider<TX> {
if let Some(block_body) = self.block_body_indices(block_number)? {
// the index of the tx in the block is the offset:
// len([start..tx_id])
// SAFETY: `transaction_id` is always `>=` the block's first
// NOTE: `transaction_id` is always `>=` the block's first
// index
let index = transaction_id - block_body.first_tx_num();

Expand Down
7 changes: 3 additions & 4 deletions crates/transaction-pool/src/pool/parked.rs
Expand Up @@ -186,10 +186,9 @@ impl<T: ParkedOrd> ParkedPool<T> {

let mut removed = Vec::new();

while limit.is_exceeded(self.len(), self.size()) && !self.last_sender_transaction.is_empty()
{
// SAFETY: This will not panic due to `!addresses.is_empty()`
let sender_id = self.last_sender_transaction.last().expect("no empty").sender_id;
while limit.is_exceeded(self.len(), self.size()) && !sender_ids.is_empty() {
// NOTE: This will not panic due to `!addresses.is_empty()`
let sender_id = sender_ids.pop().unwrap().sender_id;
let list = self.get_txs_by_sender(sender_id);

// Drop transactions from this sender until the pool is under limits
Expand Down
2 changes: 1 addition & 1 deletion crates/transaction-pool/src/pool/txpool.rs
Expand Up @@ -1550,7 +1550,7 @@ impl<T: PoolTransaction> AllTransactions<T> {
// the new transaction is the next one
false
} else {
// SAFETY: the transaction was added above so the _inclusive_ descendants iterator
// the transaction was added above so the _inclusive_ descendants iterator
DaniPopes marked this conversation as resolved.
Show resolved Hide resolved
// returns at least 1 tx.
let (id, tx) = descendants.peek().expect("Includes >= 1; qed.");
if id.nonce < inserted_tx_id.nonce {
Expand Down