fix(l1): return error instead of panic in TrieWrapper::put_batch#6887
Open
reflecttypefor wants to merge 1 commit into
Open
fix(l1): return error instead of panic in TrieWrapper::put_batch#6887reflecttypefor wants to merge 1 commit into
reflecttypefor wants to merge 1 commit into
Conversation
Signed-off-by: reflecttypefor <reflecttypefor@outlook.com>
ElFantasma
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
TrieWrapper::put_batch currently calls unimplemented!(), which panics at runtime if ever invoked. Since TrieWrapper is a read-only view over the trie layer cache, this method should never be called — but a panic is still an unnecessarily harsh failure mode. Returning a recoverable error is more defensive and consistent with other read-only TrieDB implementations in the codebase.
Description
Replace unimplemented!("This function should not be called") with Err(TrieError::DbError(anyhow::anyhow!("TrieWrapper is read-only; put_batch should not be called"))), following the same pattern used by BackendTrieDBLocked::put_batch in crates/storage/trie.rs.
This is a one-line behavioral change with no impact on the happy path — the function was never meant to succeed.
Checklist
STORE_SCHEMA_VERSION(crates/storage/lib.rs) if the PR includes breaking changes to theStorerequiring a re-sync.Closes #issue_number