feat(l1): drop unwraps storage - #3002
Conversation
Lines of code reportTotal lines added: Detailed view |
There was a problem hiding this comment.
I added comments in most of the functions that could be refactored using the transpose method, but the following are other functions where this could be done.
- In
crates/storage/store_db/libmdbx.rs:set_canonical_block.get_payload.get_pending_block.get_latest_valid_ancestor;
- In
crates/storage/store_db/redb.rs:get_block_hash_by_block_number.get_block_header.get_block_body_by_hash.get_block_header_by_hash.get_pending_block.get_account_code.get_receipt.get_canonical_block_hash.get_payload.get_latest_valid_ancestor.
The same goes for the use of expect to help replace the use of unwraps. Using the motivation for removing the unwraps as context, it is the same to use expect in its place. I left some comments, but not in the following functions:
- In
crates/storage/store_db/libmdbx.rs:add_transaction_locations.read_account_snapshot.
- In
crates/storage/store_db/redb.rs:get_transaction_location.take_storage_heal_paths.read_account_snapshot.
EDIT: Having read the issue, as we are allowing the use of expect for unrecoverable errors, let's add a comment saying so above the line of code that has an expect explaining in detail why the error is unrecoverable.
fmoletta
left a comment
There was a problem hiding this comment.
The InMemory Store variant is mostly used for local testing. I think it is overkill to modify all these trait methods just to guard the rare lock error on the in memory variant. Maybe we should just use expect and let it crash.
This is just my opinion, I would like to know what the rest of the team thinks about this
I understand the appeal of using |
**Motivation** Dissallow unwraps on l1. **Description** This pr drops unwraps on crate storage. Test's unwraps remain. Resolves partially lambdaclass#2879.
Motivation
Dissallow unwraps on l1.
Description
This pr drops unwraps on crate storage. Test's unwraps remain. Resolves partially #2879.