fix(precompile-storage): replace unimplemented! panics with structured errors in SetHandler transient methods#3281
Open
eric-ships wants to merge 1 commit into
Conversation
…s in SetHandler transient methods SetHandler<T> implemented t_read, t_write, and t_delete with unimplemented!(), causing a process panic instead of returning Err. Replace each stub with Err(BasePrecompileError::Fatal(...)) and add a test asserting all three transient methods return Err.
Collaborator
🟡 Heimdall Review Status
|
Contributor
Review SummaryNo issues found. This is a clean, well-motivated change. The replacement of
|
Contributor
✅ base-std fork tests: all 602 passedbase/base is fully in sync with the base-std spec. |
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.
BOP-286
Motivation
SetHandler<T>implemented theHandler<T>transient methods (t_read,t_write,t_delete) withunimplemented!(), causing a process panic if any generic caller invoked them. TheHandler<T>trait returnsResultprecisely so callers can handle unsupported operations without crashing.The practical risk is a node crash rather than a clean revert: a future developer adding a
Setfield to a transient storage struct, or a generic caller iterating over handler methods, would cause an unrecoverable panic at runtime instead of receiving a structured error. Even though transientSetstorage is unlikely by design, the fix is a 3-line change that permanently closes this crash vector. The panic vs.Err(Fatal)distinction matters for operational stability:Fatalsurfaces to revm's frame handler, while a panic kills the process.What changed
Replaced the three
unimplemented!()stubs inSetHandler<T>'sHandlerimpl withErr(BasePrecompileError::Fatal("Set does not support transient storage".into())). Added a test asserting all three methods returnErr.