Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions crates/optimism/trie/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ async fn test_deleted_branch_nodes<S: OpProofsStore>(
) -> Result<(), OpProofsStorageError> {
let path = nibbles_from(vec![1, 2]);
let branch = create_test_branch();
let block_ref = BlockWithParent::new(B256::ZERO, NumHash::new(100, B256::repeat_byte(0x96)));

// Store branch node, then delete it (store None)
storage.store_account_branches(vec![(path, Some(branch.clone()))]).await?;
Expand All @@ -559,7 +560,7 @@ async fn test_deleted_branch_nodes<S: OpProofsStore>(

let mut block_state_diff = BlockStateDiff::default();
block_state_diff.trie_updates.removed_nodes.insert(path);
storage.store_trie_updates(100, block_state_diff).await?;
storage.store_trie_updates(block_ref, block_state_diff).await?;

// Cursor after deletion should not see the node
let mut cursor150 = storage.account_trie_cursor(150)?;
Expand Down Expand Up @@ -1049,7 +1050,10 @@ async fn test_storage_zero_value_deletion<S: OpProofsStore>(
let mut hashed_storage = HashedStorage::default();
hashed_storage.storage.insert(storage_key, U256::ZERO);
block_state_diff.post_state.storages.insert(hashed_address, hashed_storage);
storage.store_trie_updates(100, block_state_diff).await?;

let block_ref: BlockWithParent =
BlockWithParent::new(B256::ZERO, NumHash::new(100, B256::repeat_byte(0x96)));
storage.store_trie_updates(block_ref, block_state_diff).await?;

// Cursor after deletion should NOT see the entry (zero values are skipped)
let mut cursor150 = storage.storage_hashed_cursor(hashed_address, 150)?;
Expand Down Expand Up @@ -1208,7 +1212,8 @@ async fn test_store_trie_updates_with_wiped_storage<S: OpProofsStore>(
use reth_trie::HashedStorage;

let hashed_address = B256::repeat_byte(0x01);
let block_ref = BlockWithParent::new(B256::ZERO, NumHash::new(100, B256::repeat_byte(0x96)));
let block_ref: BlockWithParent =
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Explicit type annotation is unnecessary here as the type can be inferred from the function call. Consider removing : BlockWithParent for cleaner code, as shown in the original code at line 1215.

Suggested change
let block_ref: BlockWithParent =
let block_ref =

Copilot uses AI. Check for mistakes.
BlockWithParent::new(B256::ZERO, NumHash::new(100, B256::repeat_byte(0x96)));

// First, store some storage values at block 50
let storage_slots = vec![
Expand Down Expand Up @@ -1778,7 +1783,7 @@ async fn test_pure_deletions_stored_correctly<S: OpProofsStore>(
};

let block_ref_100 =
BlockWithParent::new(B256::ZERO, NumHash::new(100, B256::repeat_byte(0x97)));
BlockWithParent::new(B256::repeat_byte(0x96), NumHash::new(100, B256::repeat_byte(0x97)));

storage.store_trie_updates(block_ref_100, deletion_diff).await?;

Expand Down Expand Up @@ -1909,7 +1914,7 @@ async fn test_updates_take_precedence_over_removals<S: OpProofsStore>(
};

let block_ref_100 =
BlockWithParent::new(B256::ZERO, NumHash::new(100, B256::repeat_byte(0x97)));
BlockWithParent::new(B256::repeat_byte(0x96), NumHash::new(100, B256::repeat_byte(0x97)));

storage.store_trie_updates(block_ref_100, conflicting_diff).await?;

Expand Down